chore: code cleanup

This commit is contained in:
Percs 2024-10-13 16:21:57 -05:00
parent 473c756f60
commit 52e419f44e
4 changed files with 9 additions and 5 deletions

View file

@ -1,5 +1,4 @@
import { ScramjetConfig } from "../types";
import { Codec } from "../codecs";
import { ScramjetFrame } from "./frame";
import { $scramjet, loadCodecs } from "../scramjet";

5
src/types.d.ts vendored
View file

@ -15,7 +15,6 @@ import {
import { rewriteJs } from "./shared/rewriters/js";
import { rewriteHeaders } from "./shared/rewriters/headers";
import { rewriteWorkers } from "./shared/rewriters/worker";
import type { Codec } from "./codecs";
import { BareClient, BareMuxConnection } from "@mercuryworkshop/bare-mux";
import { parseDomain } from "parse-domain";
import { ScramjetHeaders } from "./shared/headers";
@ -94,6 +93,10 @@ declare global {
encode: (url: string) => string;
decode: (url: string) => string;
};
version: {
version: string;
build: string;
};
};
COOKIE: string;
WASM: string;

View file

@ -1,3 +1,5 @@
import { $scramjet } from "../scramjet";
export function errorTemplate(trace: string, fetchedURL: string) {
// turn script into a data URI so we don"t have to escape any HTML values
const script = `
@ -5,8 +7,8 @@ export function errorTemplate(trace: string, fetchedURL: string) {
fetchedURL.textContent = ${JSON.stringify(fetchedURL)};
for (const node of document.querySelectorAll("#hostname")) node.textContent = ${JSON.stringify(location.hostname)};
reload.addEventListener("click", () => location.reload());
version.textContent = ${JSON.stringify(VERSION)};
build.textContent = ${JSON.stringify(COMMITHASH)};
version.textContent = ${JSON.stringify($scramjet.version.version)};
build.textContent = ${JSON.stringify($scramjet.version.build)};
`;
return `<!DOCTYPE html>