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

@ -9,7 +9,7 @@
<a href="https://www.npmjs.com/package/@mercuryworkshop/scramjet"><img src="https://img.shields.io/npm/v/@mercuryworkshop/scramjet.svg?maxAge=3600" alt="npm version" /></a> <a href="https://www.npmjs.com/package/@mercuryworkshop/scramjet"><img src="https://img.shields.io/npm/v/@mercuryworkshop/scramjet.svg?maxAge=3600" alt="npm version" /></a>
Scramjet is an experimental inteception based web proxy that aims to be the successor to Ultraviolet. It is designed with security, developer friendlyness, and performance in mind. Scramjet strives to have a clean, organized codebase to improve maintainability. Scramjet is made to evade internet censorship and arbitrary bypass web browser restrictions. Scramjet is an experimental inteception based web proxy that aims to be the successor to Ultraviolet. It is designed with security, developer friendlyness, and performance in mind. Scramjet strives to have a clean, organized codebase to improve maintainability. Scramjet is made to evade internet censorship and bypass arbitrary web browser restrictions.
## Supported Sites ## Supported Sites

View file

@ -1,5 +1,4 @@
import { ScramjetConfig } from "../types"; import { ScramjetConfig } from "../types";
import { Codec } from "../codecs";
import { ScramjetFrame } from "./frame"; import { ScramjetFrame } from "./frame";
import { $scramjet, loadCodecs } from "../scramjet"; 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 { rewriteJs } from "./shared/rewriters/js";
import { rewriteHeaders } from "./shared/rewriters/headers"; import { rewriteHeaders } from "./shared/rewriters/headers";
import { rewriteWorkers } from "./shared/rewriters/worker"; import { rewriteWorkers } from "./shared/rewriters/worker";
import type { Codec } from "./codecs";
import { BareClient, BareMuxConnection } from "@mercuryworkshop/bare-mux"; import { BareClient, BareMuxConnection } from "@mercuryworkshop/bare-mux";
import { parseDomain } from "parse-domain"; import { parseDomain } from "parse-domain";
import { ScramjetHeaders } from "./shared/headers"; import { ScramjetHeaders } from "./shared/headers";
@ -94,6 +93,10 @@ declare global {
encode: (url: string) => string; encode: (url: string) => string;
decode: (url: string) => string; decode: (url: string) => string;
}; };
version: {
version: string;
build: string;
};
}; };
COOKIE: string; COOKIE: string;
WASM: string; WASM: string;

View file

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