MCPcopy Create free account
hub / github.com/MarsWang42/Awel / getCreationModeHtml

Function getCreationModeHtml

packages/cli/src/proxy.ts:13–24  ·  view source on GitHub ↗

* Reads the dashboard index.html and injects the creation mode flag. * Returns the modified HTML or null if the file doesn't exist.

()

Source from the content-addressed store, hash-verified

11 * Returns the modified HTML or null if the file doesn't exist.
12 */
13function getCreationModeHtml(): string | null {
14 const indexPath = join(__dirname, '../dashboard/index.html');
15 if (!existsSync(indexPath)) return null;
16 let html = readFileSync(indexPath, 'utf-8');
17 const creationScript = `<script>window.__AWEL_CREATION_MODE__=true</script>`;
18 if (html.includes('</head>')) {
19 html = html.replace('</head>', `${creationScript}</head>`);
20 } else {
21 html = creationScript + html;
22 }
23 return html;
24}
25
26/**
27 * Creates proxy middleware that forwards requests to the target app

Callers 1

createProxyMiddlewareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected