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.

782 B
Raw Blame
import { sessionAppForHost, shellAppSession, shellAppTarget, shellAppUpstreamHeaders } from "./session";

/** The shared server socket relay rechecks this authority before every delivery. */
export async function shellAppSocketPolicy(request: Request) {
  const app = await sessionAppForHost(request.headers.get("host") ?? "");
  const url = new URL(request.url);
  if (!app || request.headers.get("origin") !== app.origin || url.pathname.startsWith("/__mso_") ||
      url.pathname.startsWith("/_next")) return null;
  const session = await shellAppSession(request, app);
  if (!session?.device_id) return null;
  return { identity: session.device_id, target: shellAppTarget(app, url).toString(),
    headers: Object.fromEntries(shellAppUpstreamHeaders(request.headers, app)) };
}