fix: custom logo not showing in sidebar and silent upload failures

The desktop sidebar never rendered the custom logo because only mobile
views used the customLogo state. Added a logo section at the top of
the desktop sidebar that displays the custom logo (or the default
OtterLogo when none is set).

The upload handler used raw fetch() without checking response.ok, so
HTTP 4xx errors (e.g. file too large) were silently ignored and the UI
falsely reported success. Now checks response status and surfaces the
server error message.

Closes #125
This commit is contained in:
SnapOtter
2026-05-05 21:45:51 +08:00
parent f856c26fcb
commit d46510138f
4 changed files with 138 additions and 1 deletions
@@ -387,11 +387,16 @@ function SystemSection() {
const formData = new FormData();
formData.append("file", file);
try {
await fetch("/api/v1/settings/logo", {
const res = await fetch("/api/v1/settings/logo", {
method: "POST",
headers: formatHeaders(),
body: formData,
});
if (!res.ok) {
const body = await res.json().catch(() => null);
setSaveMsg(body?.error || "Failed to upload logo.");
return;
}
setSettings((prev) => ({ ...prev, customLogo: "true" }));
} catch {
setSaveMsg("Failed to upload logo.");