From 83257b48707a447084723be50d11f7c229f5d209 Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Fri, 10 Nov 2023 20:18:32 -0500 Subject: [PATCH] Handle trailing slashes for API routes and such as well --- src/realms/api/router.ts | 3 +++ src/realms/twitter/router.ts | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/realms/api/router.ts b/src/realms/api/router.ts index b613b86..104c56c 100644 --- a/src/realms/api/router.ts +++ b/src/realms/api/router.ts @@ -8,9 +8,12 @@ export const api = new Hono(); /* Current v1 API endpoints. Currently, these still go through the Twitter embed requests. API v2+ won't do this. */ api.get('/status/:id/:language?', statusRequest); +api.get('/status/:id/:language?/', statusRequest); api.get('/:handle/status/:id/:language?', statusRequest); +api.get('/:handle/status/:id/:language?/', statusRequest); api.get('/robots.txt', async c => c.text(Strings.ROBOTS_TXT_API)); api.get('/:handle', profileRequest); +api.get('/:handle/', profileRequest); api.get('/', async c => c.redirect(Constants.API_DOCS_URL, 302)); \ No newline at end of file diff --git a/src/realms/twitter/router.ts b/src/realms/twitter/router.ts index abac5d8..e399293 100644 --- a/src/realms/twitter/router.ts +++ b/src/realms/twitter/router.ts @@ -55,6 +55,7 @@ twitter.get( tweetRequest ); +twitter.get('/version/', versionRoute); twitter.get('/version', versionRoute); twitter.get('/set_base_redirect', setRedirectRequest); twitter.get('/owoembed', oembed); @@ -64,6 +65,7 @@ twitter.get('/robots.txt', async c => c.text(Strings.ROBOTS_TXT)); twitter.get('/i/events/:id', genericTwitterRedirect); twitter.get('/hashtag/:hashtag', genericTwitterRedirect); +twitter.get('/:handle/', _profileRequest); twitter.get('/:handle', _profileRequest); twitter.all('*', async c => c.redirect(Constants.REDIRECT_URL, 302));