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.

feat(settings): render the changelog as records in a scroll area, not injected markdown

Rahmane9ea2a298f48
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index ca25e3f1..66421f0f 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -8,6 +8,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Added**
+- `settings` render the changelog as records in a scroll area, not injected markdown
- `update` a Check again row, so a release that lands while the panel is open is visible
- `files` long-press opens the context menu, so Preview is reachable on a phone
- `update` tell the running build from the checkout, so a pending rebuild is visible
diff --git a/frontend/slices/os-settings/components/changelog-view.tsx b/frontend/slices/os-settings/components/changelog-view.tsx
new file mode 100644
index 00000000..399d40c7
--- /dev/null
+++ b/frontend/slices/os-settings/components/changelog-view.tsx
@@ -0,0 +1,59 @@
+"use client";
+
+import { ScrollArea } from "@/components/ui/scroll-area";
+import { cn } from "@/lib/utils";
+import type { ChangelogDay } from "../lib/changelog";
+
+// The changelog as a LIST, in the same idiom as the rest of Settings: an uppercase
+// muted caption per day (the SettingsSection title treatment), a group label, a
+// mono scope chip, then the subject. Theme tokens only — no hex, nothing that
+// stops tracking the active preset.
+//
+// It scrolls INSIDE a bounded box rather than growing the pane. Six days of
+// history is ~60 rows: without a bound it pushed everything below it out of reach
+// and made the About pane's own scrollbar the only way back.
+
+const DAY_LABEL = "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground";
+
+export function ChangelogView({ days, className }: { days: ChangelogDay[]; className?: string }) {
+ if (!days.length) return null;
+ return (
+ <ScrollArea className={cn("max-h-64 rounded-lg border bg-background/40", className)}>
+ <div className="space-y-3 p-3">
+ {days.map((day) => (
+ <section key={day.date} className="space-y-1.5">
+ {/* Sticky so the date stays legible while its own entries scroll past;
+ the blur matches the shell's other floating chrome. */}
+ <h4 className={cn(DAY_LABEL, "sticky -top-3 -mx-3 bg-background/85 px-3 py-1 backdrop-blur")}>
+ {day.date}
+ </h4>
+ {day.groups.map((group) => (
+ <div key={group.label} className="space-y-1">
+ <div className="text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70">
+ {group.label}
+ </div>
+ <ul className="space-y-1">
+ {group.entries.map((entry, i) => (
+ <li key={`${entry.scope}-${i}`} className="flex gap-1.5 text-xs leading-snug">
+ <span aria-hidden className="select-none text-muted-foreground/50">
+ •
+ </span>
+ <span className="min-w-0">
+ {entry.scope && (
+ <span className="mr-1 rounded bg-secondary px-1 font-mono text-[10px] text-muted-foreground">
+ {entry.scope}
+ </span>
+ )}
+ <span className="break-words text-foreground/90">{entry.text}</span>
+ </span>
+ </li>
+ ))}
+ </ul>
+ </div>
+ ))}
+ </section>
+ ))}
+ </div>
+ </ScrollArea>
+ );
+}
diff --git a/frontend/slices/os-settings/components/update-notes.tsx b/frontend/slices/os-settings/components/update-notes.tsx
index 87a1de44..1d7322d6 100644
--- a/frontend/slices/os-settings/components/update-notes.tsx
+++ b/frontend/slices/os-settings/components/update-notes.tsx
@@ -1,19 +1,33 @@
"use client";
-import { useEffect, useState } from "react";
+import { useEffect, useMemo, useState } from "react";
import { GitCommitHorizontal } from "lucide-react";
-import { FormDrawer, mdToHtml } from "@/features/os-shell";
+import { ScrollArea } from "@/components/ui/scroll-area";
+import { FormDrawer } from "@/features/os-shell";
import type { UpdateCommit } from "@/lib/host/self-update";
+import { parseChangelog } from "../lib/changelog";
+import { ChangelogView } from "./changelog-view";
// The docs behind the update button: what is ABOUT to land, then what already has.
//
// Two different sources on purpose. The incoming list comes from the update check
// (`git log HEAD..origin/main`) because docs/CHANGELOG.md in this checkout is, by
// definition, the OLD one — it is generated at ship time and arrives WITH the update
-// it would describe. The shipped list is that file, the same one "What's new" shows.
+// it would describe. The shipped list is that file, rendered by the same component
+// "What's new" uses, so the drawer and the panel below it cannot look like two
+// different products.
const REPO = "https://github.com/rahmanef63/mso";
+const DOCS: [string, string][] = [
+ ["README — what MSO is, and the security model", `${REPO}#readme`],
+ ["Full changelog", `${REPO}/blob/main/docs/CHANGELOG.md`],
+ ["Progress log — why each change happened", `${REPO}/blob/main/docs/PROGRESS.md`],
+ ["CLI reference", `${REPO}/blob/main/docs/CLI.md`],
+];
+
+const CAPTION = "text-[11px] font-semibold uppercase tracking-wide text-muted-foreground";
+
export function UpdateNotes({ commits }: { commits: UpdateCommit[] }) {
const [shipped, setShipped] = useState<string | null>(null);
@@ -21,63 +35,65 @@ export function UpdateNotes({ commits }: { commits: UpdateCommit[] }) {
let alive = true;
fetch("/api/changelog", { cache: "no-store" })
.then((r) => (r.ok ? r.json() : null))
- .then((d: { markdown?: string } | null) => alive && setShipped(d?.markdown?.slice(0, 12_000) ?? ""))
+ .then((d: { markdown?: string } | null) => alive && setShipped(d?.markdown ?? ""))
.catch(() => alive && setShipped(""));
return () => {
alive = false;
};
}, []);
+ const days = useMemo(() => (shipped ? parseChangelog(shipped) : []), [shipped]);
+
return (
<FormDrawer.Body className="space-y-4">
{commits.length > 0 && (
<section className="space-y-1.5">
- <h3 className="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">Incoming</h3>
- <ul className="space-y-1.5">
- {commits.map((c) => (
- <li key={c.sha} className="flex gap-2 text-xs">
- <GitCommitHorizontal className="mt-0.5 size-3.5 shrink-0 text-muted-foreground" />
- <span className="min-w-0">
- <span className="break-words text-foreground">{c.subject}</span>{" "}
- <span className="whitespace-nowrap font-mono text-[10px] text-muted-foreground">
- {c.sha} · {c.date}
+ <h3 className={CAPTION}>Incoming</h3>
+ {/* Bounded + scrolling like the shipped list below it: `git log
+ HEAD..origin/main` is 25 commits at the cap, and an un-bounded list
+ pushes the docs links off the end of the drawer. */}
+ <ScrollArea className="max-h-44 rounded-lg border bg-background/40">
+ <ul className="space-y-1.5 p-3">
+ {commits.map((c) => (
+ <li key={c.sha} className="flex gap-2 text-xs">
+ <GitCommitHorizontal className="mt-0.5 size-3.5 shrink-0 text-muted-foreground" />
+ <span className="min-w-0">
+ <span className="break-words text-foreground">{c.subject}</span>{" "}
+ <span className="whitespace-nowrap font-mono text-[10px] text-muted-foreground">
+ {c.sha} · {c.date}
+ </span>
</span>
- </span>
- </li>
- ))}
- </ul>
+ </li>
+ ))}
+ </ul>
+ </ScrollArea>
</section>
)}
<section className="space-y-1.5">
- <h3 className="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">
- {commits.length > 0 ? "Already shipped here" : "Shipped"}
- </h3>
+ <h3 className={CAPTION}>{commits.length > 0 ? "Already shipped here" : "Shipped"}</h3>
{shipped === null ? (
<p className="text-xs text-muted-foreground">Loading…</p>
- ) : shipped ? (
- <div
- className="space-y-1 text-xs leading-relaxed [&_code]:rounded [&_code]:bg-secondary [&_code]:px-1 [&_code]:font-mono [&_h2]:pt-2 [&_h2]:text-[11px] [&_h2]:font-semibold [&_h2]:text-muted-foreground [&_strong]:font-semibold [&_strong]:text-foreground"
- dangerouslySetInnerHTML={{ __html: mdToHtml(shipped) }}
- />
+ ) : days.length ? (
+ <ChangelogView days={days} />
) : (
<p className="text-xs text-muted-foreground">No changelog in this checkout yet.</p>
)}
</section>
<section className="space-y-1 border-t pt-3 text-xs">
- <h3 className="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">Docs</h3>
+ <h3 className={CAPTION}>Docs</h3>
{/* Real links, so ⌘-click and long-press-share behave. The repo is public;
everything here is already in the commit history it points at. */}
- <ul className="space-y-1">
- {[
- ["README — what MSO is, and the security model", `${REPO}#readme`],
- ["Full changelog", `${REPO}/blob/main/docs/CHANGELOG.md`],
- ["Progress log — why each change happened", `${REPO}/blob/main/docs/PROGRESS.md`],
- ["CLI reference", `${REPO}/blob/main/docs/CLI.md`],
- ].map(([label, href]) => (
+ <ul className="space-y-1 pt-1">
+ {DOCS.map(([label, href]) => (
<li key={href}>
- <a href={href} target="_blank" rel="noreferrer" className="text-info underline-offset-2 hover:underline">
+ <a
+ href={href}
+ target="_blank"
+ rel="noreferrer"
+ className="text-info underline-offset-2 hover:underline [@media(pointer:coarse)]:inline-block [@media(pointer:coarse)]:py-1.5"
+ >
{label}
</a>
</li>
diff --git a/frontend/slices/os-settings/components/update-section.tsx b/frontend/slices/os-settings/components/update-section.tsx
index 99609ffa..8940273c 100644
--- a/frontend/slices/os-settings/components/update-section.tsx
+++ b/frontend/slices/os-settings/components/update-section.tsx
@@ -3,6 +3,7 @@
import { useCallback, useEffect, useState } from "react";
import { ArrowDownToLine, BookOpen, CheckCircle2, RefreshCw, Search } from "lucide-react";
import { Button } from "@/components/ui/button";
+import { ScrollArea } from "@/components/ui/scroll-area";
import { FormDrawer } from "@/features/os-shell";
import { SettingsSection, SettingsActionRow, SettingsBlock } from "@/features/shell-settings";
import { IS_DEMO } from "@/lib/demo";
@@ -152,9 +153,14 @@ export function UpdateSection() {
<p className="text-[11px] text-destructive-text">The update stopped before deploying. The running build was left untouched — see the log.</p>
)}
{running && (
- <pre className="max-h-48 overflow-auto rounded-md bg-secondary/60 p-2 text-[10px] leading-relaxed whitespace-pre-wrap break-words">
- {info?.log?.trim() || "starting…"}
- </pre>
+ // Same ScrollArea as everything else in Settings, so the updater's
+ // transcript scrolls in the panel's own idiom instead of a raw browser
+ // scrollbar in the middle of a card.
+ <ScrollArea className="max-h-48 rounded-md bg-secondary/60">
+ <pre className="p-2 text-[10px] leading-relaxed whitespace-pre-wrap break-words">
+ {info?.log?.trim() || "starting…"}
+ </pre>
+ </ScrollArea>
)}
{finished === "ok" && !running && (
<Button type="button" size="sm" className="w-full [@media(pointer:coarse)]:min-h-[44px]" onClick={() => window.location.reload()}>
diff --git a/frontend/slices/os-settings/components/whats-new.tsx b/frontend/slices/os-settings/components/whats-new.tsx
index ec8e0db9..0bf2bdfb 100644
--- a/frontend/slices/os-settings/components/whats-new.tsx
+++ b/frontend/slices/os-settings/components/whats-new.tsx
@@ -1,11 +1,11 @@
"use client";
-import { useEffect, useState } from "react";
+import { useEffect, useMemo, useState } from "react";
import { Sparkles } from "lucide-react";
-import { Button } from "@/components/ui/button";
import { SettingsSection } from "@/features/shell-settings";
-import { mdToHtml } from "@/features/os-shell";
import { IS_DEMO } from "@/lib/demo";
+import { parseChangelog } from "../lib/changelog";
+import { ChangelogView } from "./changelog-view";
// "What's new", from docs/CHANGELOG.md — which is generated from git subjects, so
// it cannot drift from what actually shipped.
@@ -13,23 +13,14 @@ import { IS_DEMO } from "@/lib/demo";
// This exists because a change that only lands in a terminal is a change the owner
// has to go looking for. The deploy already ships the file; this puts it where they
// already are.
-
-const COLLAPSED_DAYS = 2;
-
-/** Split on the `## YYYY-MM-DD` day headings the generator emits. */
-function days(md: string): { date: string; body: string }[] {
- return md
- .split(/^## (?=\d{4}-\d{2}-\d{2})/m)
- .slice(1)
- .map((chunk) => {
- const nl = chunk.indexOf("\n");
- return { date: chunk.slice(0, nl).trim(), body: chunk.slice(nl + 1).trim() };
- });
-}
+//
+// Parsed and rendered as records (see lib/changelog.ts). It used to run the raw
+// file through the markdown helper and inject the result — which printed the
+// generator's own "do not edit" preamble at the reader, and stretched the About
+// pane by however many days had shipped. It is a bounded, scrolling list now.
export function WhatsNew() {
const [md, setMd] = useState<string | null>(null);
- const [all, setAll] = useState(false);
useEffect(() => {
if (IS_DEMO) return;
@@ -43,41 +34,20 @@ export function WhatsNew() {
};
}, []);
+ const days = useMemo(() => (md ? parseChangelog(md) : []), [md]);
+
// Nothing to show is not a failure state — a fresh checkout has no generated
// changelog, and an empty card would just be noise in Settings.
- if (!md) return null;
- const entries = days(md);
- if (!entries.length) return null;
- const shown = all ? entries : entries.slice(0, COLLAPSED_DAYS);
+ if (!md || !days.length) return null;
return (
<SettingsSection
icon={<Sparkles />}
title="What's new"
+ bare
footnote="Generated from the commit history of this deployment — it cannot drift from what shipped."
>
- <div className="space-y-3">
- {shown.map((d) => (
- <div key={d.date}>
- <div className="pb-1 text-xs font-semibold text-muted-foreground">{d.date}</div>
- <div
- className="space-y-0.5 text-xs leading-relaxed [&_code]:rounded [&_code]:bg-secondary [&_code]:px-1 [&_code]:font-mono [&_strong]:font-semibold [&_strong]:text-foreground"
- dangerouslySetInnerHTML={{ __html: mdToHtml(d.body) }}
- />
- </div>
- ))}
- {entries.length > COLLAPSED_DAYS && (
- <Button
- type="button"
- variant="secondary"
- size="sm"
- className="w-full [@media(pointer:coarse)]:min-h-[44px]"
- onClick={() => setAll((v) => !v)}
- >
- {all ? "Show less" : `Show all ${entries.length} days`}
- </Button>
- )}
- </div>
+ <ChangelogView days={days} />
</SettingsSection>
);
}
diff --git a/frontend/slices/os-settings/lib/changelog.test.ts b/frontend/slices/os-settings/lib/changelog.test.ts
new file mode 100644
index 00000000..0ef846df
--- /dev/null
+++ b/frontend/slices/os-settings/lib/changelog.test.ts
@@ -0,0 +1,60 @@
+// The generated changelog is what Settings → About shows as "What's new", so what
+// this parser drops, the owner never sees. These pin the two things that were
+// actually wrong when it was rendered as markdown: the developer preamble reached
+// the reader, and the `scope` chip was just more prose.
+import { describe, expect, it } from "vitest";
+import { parseChangelog } from "./changelog";
+
+const FILE = `# Changelog
+
+**Generated — do not edit.** \`node scripts/gen-changelog.mjs\`, run by \`bun run ship\`.
+Newest first. \`docs/PROGRESS.md\` is the source of truth for *why* a change was made.
+
+## 2026-08-17
+
+**Added**
+
+- \`update\` a Check again row, so a release that lands while the panel is open is visible
+- \`files\` long-press opens the context menu
+
+**Fixed**
+
+- \`deps\` pin nanoid >=3.3.18
+
+## 2026-08-11
+
+**Docs**
+
+- an entry with no scope at all
+`;
+
+describe("parseChangelog", () => {
+ const days = parseChangelog(FILE);
+
+ it("keeps the file's own preamble out of the reader's way", () => {
+ expect(days.map((d) => d.date)).toEqual(["2026-08-17", "2026-08-11"]);
+ const text = JSON.stringify(days);
+ expect(text).not.toMatch(/do not edit/i);
+ expect(text).not.toMatch(/gen-changelog/);
+ });
+
+ it("splits scope from subject, so the chip can be a chip", () => {
+ const added = days[0].groups.find((g) => g.label === "Added");
+ expect(added?.entries[0]).toEqual({
+ scope: "update",
+ text: "a Check again row, so a release that lands while the panel is open is visible",
+ });
+ expect(added?.entries).toHaveLength(2);
+ expect(days[0].groups.find((g) => g.label === "Fixed")?.entries[0].scope).toBe("deps");
+ });
+
+ it("keeps an unscoped entry rather than dropping it", () => {
+ expect(days[1].groups[0].entries[0]).toEqual({ scope: "", text: "an entry with no scope at all" });
+ });
+
+ it("returns nothing for a checkout that never generated one", () => {
+ expect(parseChangelog("")).toEqual([]);
+ // A file with the preamble and no days is not an error — it is a fresh repo.
+ expect(parseChangelog("# Changelog\n\n**Generated — do not edit.**\n")).toEqual([]);
+ });
+});
diff --git a/frontend/slices/os-settings/lib/changelog.ts b/frontend/slices/os-settings/lib/changelog.ts
new file mode 100644
index 00000000..dcd59ecd
--- /dev/null
+++ b/frontend/slices/os-settings/lib/changelog.ts
@@ -0,0 +1,79 @@
+// docs/CHANGELOG.md → structure, so Settings can RENDER it instead of dumping it.
+//
+// The file is generated by scripts/gen-changelog.mjs, so its shape is fixed and
+// parsing it is honest rather than fragile:
+//
+// ## 2026-08-17 → a day
+// **Fixed** → a group inside that day
+// - `scope` subject → an entry, scope optional
+//
+// It was previously fed to the generic markdown→HTML helper and injected with
+// dangerouslySetInnerHTML. That rendered the developer preamble ("Generated — do
+// not edit", the path of the script) to a person who wanted to know what changed,
+// turned every entry into a `<br/>`-joined line with no hierarchy, and put an HTML
+// injection path where structured data would do. None of that is markdown's fault:
+// this is a list of records, and it should be typed like one.
+
+export interface ChangelogEntry {
+ /** The conventional-commit scope, when the subject had one. */
+ scope: string;
+ text: string;
+}
+export interface ChangelogGroup {
+ /** "Added", "Fixed", "Docs" … — the generator's own section label. */
+ label: string;
+ entries: ChangelogEntry[];
+}
+export interface ChangelogDay {
+ date: string;
+ groups: ChangelogGroup[];
+}
+
+const DAY = /^##\s+(\d{4}-\d{2}-\d{2})\s*$/;
+const GROUP = /^\*\*(.+?)\*\*\s*$/;
+const ENTRY = /^[-*]\s+(.*)$/;
+/** A leading `scope` chip, exactly as the generator emits it. */
+const SCOPE = /^`([^`]+)`\s*(.*)$/;
+
+export function parseChangelog(markdown: string): ChangelogDay[] {
+ const days: ChangelogDay[] = [];
+ let day: ChangelogDay | null = null;
+ let group: ChangelogGroup | null = null;
+
+ for (const raw of markdown.split(/\r?\n/)) {
+ const line = raw.trim();
+ const dayMatch = DAY.exec(line);
+ if (dayMatch) {
+ // Everything before the first day heading is the file's own preamble, which
+ // is addressed to whoever maintains the generator — never to the reader.
+ day = { date: dayMatch[1], groups: [] };
+ days.push(day);
+ group = null;
+ continue;
+ }
+ if (!day) continue;
+
+ const groupMatch = GROUP.exec(line);
+ if (groupMatch) {
+ group = { label: groupMatch[1], entries: [] };
+ day.groups.push(group);
+ continue;
+ }
+
+ const entryMatch = ENTRY.exec(line);
+ if (!entryMatch) continue;
+ // An entry before any group heading still belongs to the day; give it a home
+ // rather than dropping it, because a dropped line is invisible in the UI.
+ if (!group) {
+ group = { label: "Changed", entries: [] };
+ day.groups.push(group);
+ }
+ const scoped = SCOPE.exec(entryMatch[1].trim());
+ group.entries.push(
+ scoped ? { scope: scoped[1], text: scoped[2].trim() } : { scope: "", text: entryMatch[1].trim() },
+ );
+ }
+
+ // A day whose entries were all preamble noise would render as an empty header.
+ return days.filter((d) => d.groups.some((g) => g.entries.length > 0));
+}