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.

fix(shell, gates): restore the artwork reveal rule, and make the instance guard actually read files (#171)

Abdurrahman Fakhrulb7e84e256854
diff --git a/app/globals.css b/app/globals.css
index c7f87bbb..9fd682ff 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -331,9 +331,9 @@ body {
[data-shell="windows"] .shell-artwork-default,
[data-shell="android"] .shell-artwork-default { display: none; }
[data-shell="macos"] .shell-artwork-macos,
-[data-shell="ios"] .shell-artwork-macos { display: block; }
+[data-shell="ios"] .shell-artwork-macos { display: block; content-visibility: visible; }
[data-shell="windows"] .shell-artwork-windows,
-[data-shell="android"] .shell-artwork-windows { display: block; }
+[data-shell="android"] .shell-artwork-windows { display: block; content-visibility: visible; }
/* ── iOS component parity (scoped to the iOS surface ONLY) ─────────────────
Shared primitives (Switch, Segmented) carry accent-tinted states that suit
diff --git a/app/shell-artwork-visibility.test.ts b/app/shell-artwork-visibility.test.ts
new file mode 100644
index 00000000..046d38ee
--- /dev/null
+++ b/app/shell-artwork-visibility.test.ts
@@ -0,0 +1,55 @@
+import fs from "node:fs";
+import path from "node:path";
+import { describe, expect, it } from "vitest";
+
+// The shell renders three artwork variants per app and lets CSS pick one. That only works
+// if the rule that reveals a variant also UNDOES the rule that hides the others: `display`
+// and `content-visibility` are independent properties, so setting `display: block` alone
+// leaves the winner with `content-visibility: hidden` and the icon paints nothing.
+//
+// That exact bug shipped: the reveal rules said only `display: block`, so macOS, iOS,
+// Windows and Android app icons were blank. No test caught it because no test reads CSS
+// cascade intent. This one does, at the level the bug actually lived.
+
+const css = fs.readFileSync(path.join(process.cwd(), "app/globals.css"), "utf8");
+const flat = css.replace(/\s+/g, " ");
+
+/** Body of every rule whose selector list contains `selector`. */
+function ruleBodies(selector: string): string[] {
+ const bodies: string[] = [];
+ for (const match of flat.matchAll(/([^{}]+)\{([^{}]*)\}/g)) {
+ const selectors = match[1].split(",").map((s) => s.trim());
+ if (selectors.includes(selector)) bodies.push(match[2]);
+ }
+ return bodies;
+}
+
+describe("shell artwork variant visibility", () => {
+ it("hides the non-matching variants in layout and paint", () => {
+ // The hide rule lists both selectors together:
+ // .shell-artwork-macos, .shell-artwork-windows { display: none; content-visibility: hidden }
+ const bodies = flat
+ .match(/([^{}]*shell-artwork-macos[^{}]*)\{([^{}]*)\}/g) ?? [];
+ const hides = bodies.filter((rule) => /display:\s*none/.test(rule));
+ expect(hides.length, "a rule must hide the non-matching variants").toBeGreaterThan(0);
+ expect(
+ hides.some((rule) => /content-visibility:\s*hidden/.test(rule)),
+ "the hide rule must also drop the variant out of paint",
+ ).toBe(true);
+ });
+
+ it.each([
+ '[data-shell="macos"] .shell-artwork-macos',
+ '[data-shell="ios"] .shell-artwork-macos',
+ '[data-shell="windows"] .shell-artwork-windows',
+ '[data-shell="android"] .shell-artwork-windows',
+ ])("%s reveals its variant completely", (selector) => {
+ const bodies = ruleBodies(selector).filter((b) => b.includes("display: block"));
+ expect(bodies.length, `${selector} must set display: block`).toBeGreaterThan(0);
+ // The regression: display alone leaves the winner invisible.
+ expect(
+ bodies.some((b) => b.includes("content-visibility: visible")),
+ `${selector} must also restore content-visibility, or the icon renders blank`,
+ ).toBe(true);
+ });
+});
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 7e49d7ed..1ba3b678 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -13,6 +13,7 @@ this is the *what*, and it is what Settings → Account → About shows as “Wh
**Fixed**
+- `shell, gates` restore the artwork reveal rule, and make the instance guard actually read files
- `install` make bun install compile node-pty without a global node-gyp
- `api` restore the models provider name the route extraction dropped (#169)
- `api` restore the models provider name the route extraction dropped (#168)
diff --git a/scripts/check-instance-literals.mjs b/scripts/check-instance-literals.mjs
index 35874cbb..0d1c2ec2 100644
--- a/scripts/check-instance-literals.mjs
+++ b/scripts/check-instance-literals.mjs
@@ -1,4 +1,5 @@
import { execFileSync } from "node:child_process";
+import { readFileSync } from "node:fs";
// Keep operator-instance identities out of the portable/public repository. Build
// these strings from fragments so the guard does not exempt itself by accident.
@@ -14,7 +15,10 @@ const candidates = execFileSync("git", ["ls-files", "--cached", "--others", "--e
const hits = [];
for (const file of candidates) {
let text;
- try { text = await Bun.file(file).text(); } catch { continue; }
+ // `Bun.file` made this guard silently inspect zero files under Node: the ReferenceError
+ // was swallowed by the catch, so `gates-12.sh` reported "passed" while reading nothing.
+ // `readFileSync` works under both runtimes, and a genuinely unreadable file still skips.
+ try { text = readFileSync(file, "utf8"); } catch { continue; }
const literals = /^(app|lib|frontend|components)\//.test(file) && !file.includes(".test.") ? [...forbidden, ["rahmanef", "com"].join(".")] : forbidden;
for (const literal of literals) if (text.toLowerCase().includes(literal.toLowerCase())) hits.push(`${file}: ${literal}`);
}