diff --git a/apps/git/20260228-000000/index.tsx b/apps/git/20260228-000000/index.tsx index 89cdd01..8e0b688 100644 --- a/apps/git/20260228-000000/index.tsx +++ b/apps/git/20260228-000000/index.tsx @@ -11,7 +11,7 @@ const DATA_DIR = process.env.DATA_DIR! const TOES_URL = process.env.TOES_URL! const MAX_VERSIONS = 5 -const REPOS_DIR = join(DATA_DIR, 'repos') +const REPOS_DIR = resolve(DATA_DIR, 'repos') const VALID_NAME = /^[a-zA-Z0-9_-]+$/ const app = new Hype({ prettyHTML: false, layout: false }) @@ -412,8 +412,8 @@ app.get('/styles.css', c => c.text(baseStyles + stylesToCSS(), 200, { 'Content-Type': 'text/css; charset=utf-8' }), ) -// GET /:repo.git/info/refs?service=git-upload-pack|git-receive-pack -app.get('/:repo{.+\\.git}/info/refs', async c => { +// GET /:repo[.git]/info/refs?service=git-upload-pack|git-receive-pack +app.on('GET', ['/:repo{.+\\.git}/info/refs', '/:repo/info/refs'], async c => { const repoParam = c.req.param('repo').replace(/\.git$/, '') const service = c.req.query('service') @@ -438,8 +438,8 @@ app.get('/:repo{.+\\.git}/info/refs', async c => { return res ?? c.text('Repository not found', 404) }) -// POST /:repo.git/git-upload-pack -app.post('/:repo{.+\\.git}/git-upload-pack', async c => { +// POST /:repo[.git]/git-upload-pack +app.on('POST', ['/:repo{.+\\.git}/git-upload-pack', '/:repo/git-upload-pack'], async c => { const repoParam = c.req.param('repo').replace(/\.git$/, '') if (!validRepoName(repoParam)) { @@ -454,8 +454,8 @@ app.post('/:repo{.+\\.git}/git-upload-pack', async c => { return gitRpc(repoParam, 'git-upload-pack', c.req.raw.body) }) -// POST /:repo.git/git-receive-pack -app.post('/:repo{.+\\.git}/git-receive-pack', async c => { +// POST /:repo[.git]/git-receive-pack +app.on('POST', ['/:repo{.+\\.git}/git-receive-pack', '/:repo/git-receive-pack'], async c => { const repoParam = c.req.param('repo').replace(/\.git$/, '') if (!validRepoName(repoParam)) {