46 lines
1.3 KiB
HTML
46 lines
1.3 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<script type="module">
|
|
const host = "https://localhost:2233"
|
|
|
|
globalThis["__DEBUG_PROXY__"] = true
|
|
|
|
fetch(`${host}`)
|
|
.then((res) => res.text())
|
|
.then((html) => {
|
|
const parser = new DOMParser()
|
|
const doc = parser.parseFromString(html, "text/html")
|
|
document.head.innerHTML = doc.head.innerHTML
|
|
document.body.innerHTML = doc.body.innerHTML
|
|
|
|
const scripts = doc.querySelectorAll("script")
|
|
scripts.forEach((script) => {
|
|
const $script = document.createElement("script")
|
|
if (!script.innerHTML) return
|
|
$script.innerHTML = script.innerHTML
|
|
|
|
$script.type = "module"
|
|
|
|
$script.crossOrigin = script.crossOrigin
|
|
|
|
document.body.appendChild($script)
|
|
})
|
|
|
|
const srcScripts = doc.querySelectorAll("script[src]")
|
|
srcScripts.forEach((script) => {
|
|
fetch(`${script.src}`)
|
|
.then((res) => res.text())
|
|
.then((text) => {
|
|
const $script = document.createElement("script")
|
|
$script.innerHTML = text
|
|
$script.type = "module"
|
|
document.body.appendChild($script)
|
|
})
|
|
})
|
|
})
|
|
</script>
|
|
</head>
|
|
<body></body>
|
|
</html>
|