MCPcopy
hub / github.com/opentrace/opentrace / detectInitialMode

Function detectInitialMode

ui/src/OpenTraceApp.tsx:41–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

39type StoreMode = 'local' | `server:${string}`;
40
41function detectInitialMode(): StoreMode {
42 try {
43 const serverUrl = new URLSearchParams(window.location.search).get('server');
44 if (serverUrl) {
45 new URL(serverUrl); // validate
46 return `server:${serverUrl}`;
47 }
48 } catch {
49 /* invalid URL or SSR / non-browser */
50 }
51 return 'local';
52}
53
54function createStoreForMode(mode: StoreMode): GraphStore {
55 if (mode.startsWith('server:')) {

Callers

nothing calls this directly

Calls 1

getMethod · 0.65

Tested by

no test coverage detected