fix: complete HWPOD native Web readiness

This commit is contained in:
root
2026-07-21 09:07:04 +02:00
parent 6449bbd648
commit 41326a283b
@@ -33,7 +33,15 @@ function healthPlugin(): Plugin { return { name: "hwpod-native-health", configur
function nativeRuntimeConfigPlugin(serialized: string | undefined): Plugin {
const config = parseWorkbenchNativeRuntimeConfig(requiredString(serialized, "HWPOD_WEB_RUNTIME_CONFIG"));
const inlineJson = JSON.stringify(config).replace(/</gu, "\\u003c");
return { name: "hwpod-native-runtime-config", transformIndexHtml() { return [{ tag: "script", injectTo: "head-prepend", children: `window.HWLAB_CLOUD_WEB_CONFIG=${inlineJson};` }]; } };
return {
name: "hwpod-native-runtime-config",
configureServer(server) { server.middlewares.use((request, response, next) => {
if (request.url !== "/v1/web-performance" || request.method !== "POST") return next();
response.writeHead(204, { "cache-control": "no-store" });
response.end();
}); },
transformIndexHtml() { return [{ tag: "script", injectTo: "head-prepend", children: `window.HWLAB_CLOUD_WEB_CONFIG=${inlineJson};` }]; },
};
}
function nativeSessionPlugin(serialized: string | undefined): Plugin {
const profile = parseHwpodNativeAccessProfile(serialized);