MCPcopy Create free account
hub / github.com/block/buzz / deriveWorkspaceName

Function deriveWorkspaceName

desktop/src/features/workspaces/workspaceStorage.ts:88–110  ·  view source on GitHub ↗
(relayUrl: string)

Source from the content-addressed store, hash-verified

86}
87
88export function deriveWorkspaceName(relayUrl: string): string {
89 try {
90 const url = new URL(
91 relayUrl.replace("ws://", "http://").replace("wss://", "https://"),
92 );
93 const host = url.hostname;
94 if (host === "localhost" || host === "127.0.0.1") {
95 return "Local Dev";
96 }
97 const parts = host.split(".");
98 // Detect staging environments (e.g. buzz-oss.stage.blox.sqprod.co)
99 if (parts.some((p) => p === "stage" || p === "staging")) {
100 return "Buzz (staging)";
101 }
102 // Use the first subdomain segment or the domain itself
103 if (parts.length >= 2) {
104 return parts[0] === "relay" ? parts[1] : parts[0];
105 }
106 return host;
107 } catch {
108 return "Workspace";
109 }
110}
111
112export function initFirstWorkspace(
113 relayUrl: string,

Callers 3

AddWorkspaceDialogFunction · 0.90
listenForDeepLinksFunction · 0.90
initFirstWorkspaceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected