Skip to content

armgit / mso

Public Imported from GitHub
0

Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.

refactor(quicklinks): owner's links become owner's data, repo keeps a neutral fallback

Rahman8e8afc4d4409
diff --git a/frontend/slices/docs/docs.test.ts b/frontend/slices/docs/docs.test.ts
index 8ceecc0c..8ef57b71 100644
--- a/frontend/slices/docs/docs.test.ts
+++ b/frontend/slices/docs/docs.test.ts
@@ -36,19 +36,32 @@ describe("docs app", () => {
});
});
-describe("quicklinks defaults", () => {
- it("are the owner's accounts, not the project's docs", async () => {
- // The four GitHub file URLs that used to seed here now live in the Docs app.
- // A shortcut rail that ships the project's own documentation is a second,
- // worse copy of Docs — and leaves the owner nowhere to put their own links.
- const src = await import("node:fs").then((fs) =>
- fs.readFileSync(new URL("../../../lib/quicklinks/store.tsx", import.meta.url), "utf8"),
- );
- const defaults = src.slice(src.indexOf("const DEFAULTS"), src.indexOf("type Ctx"));
- expect(defaults).not.toContain("/blob/main/");
- expect(defaults).not.toContain("github.com/rahmanef63/mso");
- for (const host of ["github.com", "linkedin.com", "instagram.com"]) {
- expect(defaults).toContain(host);
+describe("quicklinks fallback", () => {
+ // Quicklinks are the instance owner's own shortcuts, so they live in that
+ // owner's data (~/.mso/prefs.json). What stays in the repo is only what renders
+ // when there is no owner data — and it must be true for ANY installer, because
+ // this repo is public and the README invites strangers to run it.
+ const defaults = (() => {
+ const src = read("../../../lib/quicklinks/store.tsx");
+ return src.slice(src.indexOf("const DEFAULTS"), src.indexOf("type Ctx"));
+ })();
+
+ it("ships nobody's personal accounts", () => {
+ // A real account here would seed every stranger's install with it.
+ for (const host of ["linkedin.com", "instagram.com", "x.com", "tiktok.com", "youtube.com"]) {
+ expect(defaults).not.toContain(host);
}
+ // ...and no profile URL of the maintainer's either.
+ expect(defaults).not.toMatch(/github\.com\/[A-Za-z0-9-]+\s*"/);
+ });
+
+ it("is not a second copy of the docs", () => {
+ // Four GitHub file URLs used to seed here; they belong in the Docs app.
+ expect(defaults).not.toContain("/blob/main/");
+ });
+
+ it("still renders something, so an empty rail reads as empty and not broken", () => {
+ expect(defaults.match(/url:/g)?.length).toBe(1);
+ expect(defaults).toContain("https://github.com/rahmanef63/mso");
});
});
diff --git a/lib/quicklinks/store.tsx b/lib/quicklinks/store.tsx
index 08fc60c1..30836117 100644
--- a/lib/quicklinks/store.tsx
+++ b/lib/quicklinks/store.tsx
@@ -20,23 +20,22 @@ export type Quicklink = { id: string; title: string; url: string };
const KEY = "mso:quicklinks";
-// Seed for a fresh visitor (localStorage/server-synced edits win once present).
+// STATIC FALLBACK — not the owner's links, and deliberately not personal.
//
-// These are the INSTANCE OWNER'S links, not the project's. They used to be four
-// GitHub file URLs, which made a personal shortcut rail into a second, worse copy
-// of the docs — those moved to the Docs app (`@/features/docs`), which is where a
-// visitor looking for documentation actually goes.
+// Quicklinks are whoever-owns-this-instance's own shortcuts, so they belong in
+// that owner's DATA (`~/.mso/prefs.json`, synced through /api/prefs), not in a
+// repo other people install. Hardcoding real accounts here shipped the
+// maintainer's Instagram to every stranger's install; hardcoding the project's
+// own docs (what was here before that) made a personal shortcut rail into a
+// second, worse copy of the Docs app.
//
-// ⚠️ If you installed MSO on your own server, change these — they are the
-// maintainer's accounts, not yours. They are all that is here so the list is one
-// edit, and nothing else in the codebase reads them.
+// So this is only what renders when there is no owner data to render: a fresh
+// install, a signed-out visitor (whose /api/prefs GET 401s), or a prefs file that
+// is missing or corrupt. One project-neutral link — enough that the rail is
+// visibly a rail rather than looking broken, and true for anyone who installs MSO.
+// Everything else the owner adds in Settings → Quicklink.
const DEFAULTS: Quicklink[] = [
- { id: "gh", title: "GitHub", url: "https://github.com/rahmanef63" },
- { id: "li", title: "LinkedIn", url: "https://www.linkedin.com/in/rahmanfakhrul" },
- { id: "ig", title: "Instagram", url: "https://www.instagram.com/rahmanef_" },
- { id: "x", title: "X", url: "https://x.com/rahmanef" },
- { id: "yt", title: "YouTube", url: "https://www.youtube.com/@rahmanef" },
- { id: "tt", title: "TikTok", url: "https://www.tiktok.com/@rahmanef" },
+ { id: "mso", title: "MSO on GitHub", url: "https://github.com/rahmanef63/mso" },
];
type Ctx = {