fix: complete HWPOD native Web readiness
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user