Files
Folo/apps/renderer/__debug_proxy.html
T
2024-11-18 21:36:38 +08:00

42 lines
1.2 KiB
HTML

<!doctype html>
<html>
<head>
<script type="module">
const searchParams = new URLSearchParams(window.location.search)
const debugHost = searchParams.get("debug-host")
const resetSessionStorage = () => {
sessionStorage.removeItem("debug-host")
}
const resetParams = searchParams.delete("debug-host")
if (resetParams) {
resetSessionStorage()
}
const debugHostInSessionStorage = sessionStorage.getItem("debug-host")
const host = debugHost || debugHostInSessionStorage || "https://localhost:2233"
if (debugHost) {
sessionStorage.setItem("debug-host", debugHost)
}
const createRefreshRuntimeScript = `
import RefreshRuntime from "${host}/@react-refresh";
RefreshRuntime.injectIntoGlobalHook(window);
window.$RefreshReg$ = () => {};
window.$RefreshSig$ = () => (type) => type;
window.__vite_plugin_react_preamble_installed__ = true;
`
const $script = document.createElement("script")
$script.innerHTML = createRefreshRuntimeScript
$script.type = "module"
document.head.appendChild($script)
</script>
<title>Debug Proxy</title>
<script type="module" src="./__debug_proxy.ts"></script>
</head>
<body></body>
</html>