const scramjet = new ScramjetController({ files: { wasm: "/scram/scramjet.wasm.js", worker: "/scram/scramjet.worker.js", client: "/scram/scramjet.client.js", shared: "/scram/scramjet.shared.js", sync: "/scram/scramjet.sync.js", }, siteFlags: { "https://discord.com/.*": { naiiveRewriter: true, }, }, }); scramjet.init("./sw.js"); const connection = new BareMux.BareMuxConnection("/baremux/worker.js"); const flex = css` display: flex; `; const col = css` flex-direction: column; `; const store = $store( { url: "https://google.com", wispurl: _CONFIG?.wispurl || (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/", bareurl: _CONFIG?.bareurl || (location.protocol === "https:" ? "https" : "http") + "://" + location.host + "/bare/", proxy: "", }, { ident: "settings", backing: "localstorage", autosave: "auto" } ); connection.setTransport("/epoxy/index.mjs", [{ wisp: store.wispurl }]); function Config() { this.css = ` .cfg * { margin: 2px; } .buttons button { border: 1px solid #4c8bf5; background-color: #313131; border-radius: 0.75em; color: #fff; padding: 0.45em; } .cfg input { border: none; background-color: #313131; border-radius: 0.75em; color: #fff; outline: none; padding: 0.45em; } .input_row input { flex-grow: 1; } .centered { justify-content: center; align-items: center; } `; return html` `; } function App() { this.urlencoded = ""; this.css = ` width: 100%; height: 100%; color: #e0def4; display: flex; flex-direction: column; padding: 0.5em; padding-top: 0; box-sizing: border-box; a { color: #e0def4; } input, button { font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif; } .version { } h1 { font-family: "Inter Tight", "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif; margin-bottom: 0; } iframe { background-color: #fff; border: none; border-radius: 0.3em; flex: 1; width: 100%; } input.bar { font-family: "Inter"; padding: 0.1em; padding-left: 0.3em; border: none; outline: none; color: #fff; height: 1.5em; border-radius: 0.3em; flex: 1; background-color: #121212; border: 1px solid #313131; } .input_row > label { font-size: 0.7rem; color: gray; } p { margin: 0; margin-top: 0.2em; } .nav { padding-top: 0.3em; padding-bottom: 0.3em; gap: 0.3em; } spacer { margin-left: 10em; } .nav button { color: #fff; outline: none; border: none; border-radius: 0.30em; background-color: #121212; border: 1px solid #313131; } `; this.url = store.url; const frame = scramjet.createFrame(); frame.addEventListener("urlchange", (e) => { if (!e.url) return; this.url = e.url; }); frame.frame.addEventListener("load", () => { let url = frame.frame.contentWindow.location.href; if (!url) return; if (url === "about:blank") return; this.url = $scramjet.codec.decode( url.substring((location.href + "/scramjet").length) ); }); const handleSubmit = () => { this.url = this.url.trim(); // frame.go(this.url) if (!this.url.startsWith("http")) { this.url = "https://" + this.url; } return frame.go(this.url); }; const cfg = h(Config); document.body.appendChild(cfg); return html`
scramjet ${$scramjet.version.version} ${$scramjet.version.build}