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(integrations): move the inlined assets out, back under the 220-line ratchet

Abdurrahman Fakhrulefe5ecc592f3
diff --git a/lib/infra/connection-ui-assets.ts b/lib/infra/connection-ui-assets.ts
new file mode 100644
index 00000000..68e73028
--- /dev/null
+++ b/lib/infra/connection-ui-assets.ts
@@ -0,0 +1,17 @@
+// Static assets the connection manager script needs inline.
+//
+// Kept out of connection-ui.ts so that file stays under the 220-line architecture ratchet, and
+// because these are build-time string preparation, not UI logic.
+import { MSO_LOGO_SVG } from "@/lib/presentation/logo";
+import { PROVIDER_ICON_PATHS } from "./provider-icons";
+
+/** The brand mark with its own labelling removed: it is decorative here, since the product name
+ * already appears as text right next to it. */
+export const MSO_BRAND_ICON_SVG = MSO_LOGO_SVG.replace(/\s*role="img"/, "")
+ .replace(/\s*aria-label="[^"]*"/, "")
+ .replace("<svg", '<svg aria-hidden="true"');
+
+/** The preamble that ships both constants into the browser script. */
+export const CONNECTION_MANAGER_ASSETS =
+ `const PROVIDER_ICON_PATHS=${JSON.stringify(PROVIDER_ICON_PATHS)};` +
+ `const MSO_LOGO_SVG=${JSON.stringify(MSO_BRAND_ICON_SVG)};`;
diff --git a/lib/infra/connection-ui.ts b/lib/infra/connection-ui.ts
index 9f06ed70..fb32de56 100644
--- a/lib/infra/connection-ui.ts
+++ b/lib/infra/connection-ui.ts
@@ -1,15 +1,9 @@
import { GOOGLE_CONNECTION_UI_SCRIPT } from "./google-connection-ui";
import { PROJECT_MCP_UI_SCRIPT } from "./project-mcp-ui";
export { CONNECTION_MANAGER_STYLE } from "./connection-ui-style";
-import { PROVIDER_ICON_PATHS } from "./provider-icons";
-import { MSO_LOGO_SVG } from "@/lib/presentation/logo";
+import { CONNECTION_MANAGER_ASSETS } from "./connection-ui-assets";
-const MSO_BRAND_ICON_SVG = MSO_LOGO_SVG
- .replace(/\s*role="img"/, "")
- .replace(/\s*aria-label="[^"]*"/, "")
- .replace("<svg", '<svg aria-hidden="true"');
-
-export const CONNECTION_MANAGER_SCRIPT=GOOGLE_CONNECTION_UI_SCRIPT+PROJECT_MCP_UI_SCRIPT+`const PROVIDER_ICON_PATHS=${JSON.stringify(PROVIDER_ICON_PATHS)};const MSO_LOGO_SVG=${JSON.stringify(MSO_BRAND_ICON_SVG)};`+String.raw`
+export const CONNECTION_MANAGER_SCRIPT=GOOGLE_CONNECTION_UI_SCRIPT+PROJECT_MCP_UI_SCRIPT+CONNECTION_MANAGER_ASSETS+String.raw`
function mountConnectionManager(root,catalog,bridge,initial={}){
let disposed=false,sequence=0,snapshot=initial.snapshot||{users:[],connections:[],bindings:[]},user=initial.user||snapshot.user||null,provider=catalog.find(p=>p.id===initial.provider)||catalog.find(p=>p.id==="github")||catalog[0];
let detail,status,container,sidebarPanel,sidebarBackdrop,sidebarToggle,content,ro,navButtons=[],navMode=["variables","ai-providers"].includes(initial.section)?initial.section:"provider",sidebarOpen=false;