From 0da63dc2968807fe73c326a7a265ce0b80acf16e Mon Sep 17 00:00:00 2001 From: BomberFish Date: Fri, 11 Oct 2024 18:07:08 -0400 Subject: [PATCH] minor error screen changes --- src/worker/error.ts | 266 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 224 insertions(+), 42 deletions(-) diff --git a/src/worker/error.ts b/src/worker/error.ts index 81405b1..dddf830 100644 --- a/src/worker/error.ts +++ b/src/worker/error.ts @@ -1,6 +1,6 @@ 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 = ` + // turn script into a data URI so we don"t have to escape any HTML values + const script = ` errorTrace.value = ${JSON.stringify(trace)}; fetchedURL.textContent = ${JSON.stringify(fetchedURL)}; for (const node of document.querySelectorAll("#hostname")) node.textContent = ${JSON.stringify(location.hostname)}; @@ -8,54 +8,236 @@ export function errorTemplate(trace: string, fetchedURL: string) { version.textContent = ${JSON.stringify(VERSION)}; `; - return ` - - + return ` + + Scramjet - - -

Error processing your request

-
-

Failed to load

-

Internal Server Error

- -

Try:

- -

If you"re the administrator of , try:

- - -
-

Scramjet v

+ + +
+
+

Uh oh!

+

There was an error loading

+ + +
+ +
+

Try:

+
    +
  • Checking your internet connection
  • +
  • Verifying you entered the correct address
  • +
  • Clearing the site data
  • +
  • Contacting 's administrator
  • +
  • Verify the server isn't censored
  • +
+

If you're the administrator of , try:

+
    +
  • Restarting your server
  • +
  • Updating Scramjet
  • +
  • Troubleshooting the error on the GitHub repository
  • +
+
+
+
+ +
+

Scramjet v

+ - - + + + `; } export function renderError(err: unknown, fetchedURL: string) { - const headers = { - "content-type": "text/html", - }; - if (crossOriginIsolated) { - headers["Cross-Origin-Embedder-Policy"] = "require-corp"; - } + const headers = { + "content-type": "text/html", + }; + if (crossOriginIsolated) { + headers["Cross-Origin-Embedder-Policy"] = "require-corp"; + } - return new Response(errorTemplate(String(err), fetchedURL), { - status: 500, - headers: headers, - }); + return new Response(errorTemplate(String(err), fetchedURL), { + status: 500, + headers: headers, + }); }