INNER CODE UNIT · TypeScript

previewWsMatch

im4codes/imcodes · server/src/index.ts:376

    const previewWsMatch = url.pathname.match(/^\/api\/server\/([^/]+)\/local-web\/([^/]+)(\/.*)?$/);
    if (previewWsMatch) {
      await handlePreviewWsUpgrade(previewWsMatch[1]!, previewWsMatch[2]!, previewWsMatch[3] ?? '/', req, socket, head, url, wss, env);
      return;
    }

    const match = url.pathname.match(/^\/api\/server\/([^/]+)\/ws$/);
    const remoteDesktopServerId = url.pathname === REMOTE_DESKTOP_SIGNALING_PATH
      ? url.searchParams.get(REMOTE_DESKTOP_SERVER_ID_QUERY)
      : null;
    if (!match && !remoteDesktopServerId) { socket.destroy(); return; }

    const serverId = remoteDesktopServerId ?? match![1]!;
    const hasBrowserTicket = url.searchParams.has('ticket');

    // The query-routed remote desktop signaling endpoint is browser-only.
    // Daemons retain the established path-bound endpoint and authentication.
    if (remoteDesktopServerId && !hasBrowserTicket) {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…