diff --git a/src/index.html b/src/index.html new file mode 100644 index 0000000..9982cef --- /dev/null +++ b/src/index.html @@ -0,0 +1,153 @@ + + + + + + + HTML Preview — Refined GitHub + + + + +
+ +
+

Refined GitHub HTML Preview

+

Replace github.com in any HTML file's URL with this site's domain to render it, sandboxed.

+ +
+ github.com URL + + + becomes + +
+
+ + + + diff --git a/src/main.ts b/src/main.ts index 568beb5..e07adfb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,5 @@ import Shell from "./shell.html" with { type: "text" }; +import Index from "./index.html" with { type: "text" }; const ShellPattern = new URLPattern({ pathname: "/:user/:repo/raw/:path(.+)", @@ -13,9 +14,9 @@ export default { const { pathname } = new URL(url); if (pathname === "/") { - return Response.redirect( - "https://github.com/refined-github/html-preview", - ); + return new Response(Index, { + headers: { "content-type": "text/html; charset=utf-8" }, + }); } if (ShellPattern.test(url)) {