Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: fix assets cache

johnnyjoygha80fe19ee178
diff --git a/web/public/full-logo.webp b/web/src/assets/full-logo.webp
similarity index 100%
rename from web/public/full-logo.webp
rename to web/src/assets/full-logo.webp
diff --git a/web/src/components/MemosLogo.tsx b/web/src/components/MemosLogo.tsx
index bf8a07a4f..ab0b13a23 100644
--- a/web/src/components/MemosLogo.tsx
+++ b/web/src/components/MemosLogo.tsx
@@ -1,3 +1,4 @@
+import fullLogoUrl from "@/assets/full-logo.webp?no-inline";
import { useInstance } from "@/contexts/InstanceContext";
import { cn } from "@/lib/utils";
import UserAvatar from "./UserAvatar";
@@ -23,7 +24,7 @@ function MemosLogo(props: Props) {
const scale = COMPACT_SCALE[size];
const { generalSetting: instanceGeneralSetting } = useInstance();
const title = instanceGeneralSetting.customProfile?.title || "Memos";
- const avatarUrl = instanceGeneralSetting.customProfile?.logoUrl || "/full-logo.webp";
+ const avatarUrl = instanceGeneralSetting.customProfile?.logoUrl || fullLogoUrl;
return (
<div className={cn("relative min-w-0 h-auto", props.className)}>
diff --git a/web/tests/memos-logo.test.tsx b/web/tests/memos-logo.test.tsx
new file mode 100644
index 000000000..9b5b74838
--- /dev/null
+++ b/web/tests/memos-logo.test.tsx
@@ -0,0 +1,33 @@
+import { render, screen } from "@testing-library/react";
+import { beforeEach, describe, expect, it, vi } from "vitest";
+import fullLogoUrl from "@/assets/full-logo.webp?no-inline";
+import MemosLogo from "@/components/MemosLogo";
+
+const mockInstance = {
+ generalSetting: {} as { customProfile?: { title?: string; logoUrl?: string } },
+};
+
+vi.mock("@/contexts/InstanceContext", () => ({
+ useInstance: () => mockInstance,
+}));
+
+describe("<MemosLogo>", () => {
+ beforeEach(() => {
+ mockInstance.generalSetting = {};
+ });
+
+ it("uses the bundled logo when the instance has no custom logo", () => {
+ const { container } = render(<MemosLogo />);
+
+ expect(container.querySelector("img")).toHaveAttribute("src", fullLogoUrl);
+ expect(screen.getByText("Memos")).toBeInTheDocument();
+ });
+
+ it("uses custom instance branding when configured", () => {
+ mockInstance.generalSetting = { customProfile: { title: "Team Notes", logoUrl: "/custom-logo.png" } };
+ const { container } = render(<MemosLogo />);
+
+ expect(container.querySelector("img")).toHaveAttribute("src", "/custom-logo.png");
+ expect(screen.getByText("Team Notes")).toBeInTheDocument();
+ });
+});