From 61f935b7a27d3293c64cb7029d90e407487c4f15 Mon Sep 17 00:00:00 2001 From: fregante Date: Mon, 10 Aug 2026 14:57:25 +0800 Subject: [PATCH 1/2] Add homepage --- src/index.html | 153 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 src/index.html 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.

+ + +
+ + + + From c284e7c780f12dcdf1dc569248f153c824acb8ed Mon Sep 17 00:00:00 2001 From: fregante Date: Mon, 10 Aug 2026 15:00:03 +0800 Subject: [PATCH 2/2] Use it --- src/main.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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)) {