From 7132094f28ca2dc08c32f207ade9c63a28952115 Mon Sep 17 00:00:00 2001 From: Joe Mou Date: Sun, 25 Jan 2026 16:27:48 -0500 Subject: Repository page with info --- src/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/index.ts') diff --git a/src/index.ts b/src/index.ts index fcd0069..393c5ec 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,7 +4,7 @@ import { Eta } from "eta"; import { Hono } from "hono"; import * as path from "node:path"; import * as url from "node:url"; -import { getGitHubBlob, getGitHubTree } from "./scraper.js"; +import { getGitHubBlob, getGitHubRepo, getGitHubTree } from "./scraper.js"; const __dirname = path.dirname(url.fileURLToPath(import.meta.url)); @@ -13,6 +13,12 @@ const eta = new Eta({ views: path.join(__dirname, "..", "views") }); app.use("/static/*", serveStatic({ root: path.join(__dirname, "..") })); +app.get("/:owner/:repo", async (c) => { + const { owner, repo } = c.req.param(); + const data = await getGitHubRepo(owner, repo); + return c.html(await eta.renderAsync("repo.eta", data)); +}); + app.get("/:owner/:repo/tree/:branch/:path{.*}?", async (c) => { const { owner, repo, branch, path = "" } = c.req.param(); const data = await getGitHubTree(owner, repo, branch, path); -- cgit v1.3.1