diff options
| author | Joe Mou <dev@mou.fo> | 2026-01-26 13:03:55 -0500 |
|---|---|---|
| committer | Joe Mou <dev@mou.fo> | 2026-01-26 13:10:03 -0500 |
| commit | 3bd800782f5affdcab01a6fd04ce0018a502c0a3 (patch) | |
| tree | 98cd6d8f9b0b419dc9bb5493052c3f062bcf586b /cgithub | |
| parent | 37aa28f1465cfdd26a58c6dd5b752141ea876cde (diff) | |
Raw route that just redirects to GitHub
Diffstat (limited to 'cgithub')
| -rw-r--r-- | cgithub/src/index.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/cgithub/src/index.ts b/cgithub/src/index.ts index 43d4cfa..15d464a 100644 --- a/cgithub/src/index.ts +++ b/cgithub/src/index.ts @@ -35,6 +35,12 @@ app.get("/:owner/:repo/blob/:branch/:path{.*}", async (c) => { return c.html(await eta.renderAsync("blob.eta", data)); }); +app.get("/:owner/:repo/raw/:branch/:path{.*}", async (c) => { + const { owner, repo, branch, path } = c.req.param(); + c.header("Referrer-Policy", "no-referrer"); + return c.redirect(`https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${path}`); +}); + if (process.env.LISTEN_FDS === "1") { const server = createAdaptorServer(app); // Listen on SD_LISTEN_FDS_START. |
