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.

test: target accessible launchers and clarify delegated sign-in

Rahmanfd9d51ff576e
diff --git a/frontend/slices/auth/components/auth-gate.tsx b/frontend/slices/auth/components/auth-gate.tsx
index a92fec59..3ae8bf6f 100644
--- a/frontend/slices/auth/components/auth-gate.tsx
+++ b/frontend/slices/auth/components/auth-gate.tsx
@@ -9,11 +9,11 @@ import { SessionModeBanner } from "./session-mode-banner";
import { useSession } from "../lib/use-session";
// The shell is PUBLIC: anyone can open it and browse on mock data — no sign-in
-// wall. Sign-in is admin-only and unlocks live host access (files/terminal/
+// wall. Sign-in unlocks device-role-gated live host access (files/terminal/
// monitor); every /api host route enforces the session server-side, so a
-// signed-out visitor is confined to mock (see lib/os-api). Sign-in lives inside
-// the shell (Settings → Server). This gate now only shows a brief splash while
-// the session resolves (avoids a mock→live flash for the owner) + the DEMO badge.
+// signed-out visitor is confined to mock (see lib/os-api). Sign-in is available directly at /login and
+// inside Settings → Server. This gate resolves the session before showing the
+// shell and keeps its actual mock/live mode visible.
export function AuthGate({ children }: { children: ReactNode }) {
if (IS_DEMO) {
return (
diff --git a/frontend/slices/auth/components/login-screen.tsx b/frontend/slices/auth/components/login-screen.tsx
index 54f25d57..39947169 100644
--- a/frontend/slices/auth/components/login-screen.tsx
+++ b/frontend/slices/auth/components/login-screen.tsx
@@ -13,7 +13,7 @@ import { MsoMark } from "@/components/shared/mso-mark";
// "pending": show the device id to paste to an approver. No cookie until an
// approved device promotes it. POSTs /api/auth/login (signed-cookie session).
// `LoginCard` is the reusable content (used full-screen by LoginScreen and as a
-// modal by the Settings → Server sign-in). Admin-only: the public shell runs on
+// modal by the Settings → Server sign-in). Device-role-gated: the public shell runs on
// mock data with no sign-in; this gates access to the real server (live mode).
export function LoginCard({ onAuthed }: { onAuthed: () => void }) {
const [password, setPassword] = useState("");
diff --git a/lib/infra/setup-browser.ts b/lib/infra/setup-browser.ts
index 29472e7c..1515e637 100644
--- a/lib/infra/setup-browser.ts
+++ b/lib/infra/setup-browser.ts
@@ -11,7 +11,7 @@ export const INTEGRATION_BROWSER_SCRIPT=String.raw`
}
async function loadManager(){
cleanup();authController?.abort();authController=new AbortController();
- let owner=false;try{const auth=await json("/api/auth/me",{signal:authController.signal});owner=auth.role==="owner"}catch{}
+ let owner=false,authenticated=false,role=null;try{const auth=await json("/api/auth/me",{signal:authController.signal});owner=auth.role==="owner";authenticated=auth.authenticated===true;role=auth.role}catch{}
const bridge={headingLevel:1,remember:s=>state=s,openLink:url=>window.open(url,"_blank","noopener,noreferrer")};
if(owner){
bridge.openTransfer=openTransfer;
@@ -21,7 +21,8 @@ export const INTEGRATION_BROWSER_SCRIPT=String.raw`
}
if(owner&&wantsTransfer){openTransfer();return}
cleanup=mountConnectionManager(root,INTEGRATIONS_CATALOG,bridge,state);
- if(!owner){const link=integrationNode("a","Sign in to MSO as Owner");link.href="/login?returnTo=%2Fintegrations";link.className="primary integration-signin";link.target="_blank";link.rel="noopener noreferrer";root.prepend(link);const refresh=()=>{if(document.visibilityState!=="hidden")void loadManager()};document.addEventListener("visibilitychange",refresh,{signal:authController.signal});window.addEventListener("focus",refresh,{signal:authController.signal});}
+ if(!owner&&authenticated)root.prepend(integrationNode("p","This device has "+role+" access. An Owner must approve Owner access before it can manage integrations."));
+ if(!owner&&!authenticated){const link=integrationNode("a","Sign in to MSO as Owner");link.href="/login?returnTo=%2Fintegrations";link.className="primary integration-signin";link.target="_blank";link.rel="noopener noreferrer";root.prepend(link);const refresh=()=>{if(document.visibilityState!=="hidden")void loadManager()};document.addEventListener("visibilitychange",refresh,{signal:authController.signal});window.addEventListener("focus",refresh,{signal:authController.signal});}
}
window.addEventListener("pagehide",()=>{cleanup();authController?.abort()},{once:true});
let token=location.hash.slice(1);history.replaceState(null,"",location.pathname);
diff --git a/scripts/check-contrast.mjs b/scripts/check-contrast.mjs
index 98693032..2e3d9ba5 100644
--- a/scripts/check-contrast.mjs
+++ b/scripts/check-contrast.mjs
@@ -2,7 +2,7 @@
// Passive WCAG AA contrast audit. Scans app/globals.css :root + [data-theme="dark"]
// AND every tweakcn preset under lib/appearance/presets/registry-data.json.
// Computes contrast for the 4 key foreground/background pairs in each preset.
-// Exits 0 always — informational only. Parses hex / rgb[a] / oklch.
+// Fails on palette regressions. Parses hex / rgb[a] / oklch.
import { readFileSync } from "node:fs";
import { dirname, join, resolve as pathResolve } from "node:path";
import { fileURLToPath } from "node:url";
diff --git a/scripts/e2e/release.mjs b/scripts/e2e/release.mjs
index 14a9ec4d..eed4759e 100644
--- a/scripts/e2e/release.mjs
+++ b/scripts/e2e/release.mjs
@@ -30,7 +30,8 @@ try {
await page.goto(fixture.base);
await expect(page.getByLabel("Server connection mode")).toContainText("Mock data only");
// Real launcher click, not only deep-link route mounting.
- const settings = page.locator('a[href="/settings"]:visible').first();
+ const settingsName = /^(System )?Settings(?: \(running\))?$/;
+ const settings = page.getByRole("link", { name: settingsName }).or(page.getByRole("button", { name: settingsName })).first();
await expect(settings).toBeVisible();
await settings.click();
await expect(page).toHaveURL(/\/settings/);