From 62d2a544381ce463109561266563e161e39d5341 Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Sun, 12 Nov 2023 00:53:25 -0500 Subject: [PATCH] Make username optional and loosen routing requirements --- src/realms/twitter/router.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/realms/twitter/router.ts b/src/realms/twitter/router.ts index 8bc2543..f84a287 100644 --- a/src/realms/twitter/router.ts +++ b/src/realms/twitter/router.ts @@ -30,28 +30,30 @@ export const getBaseRedirectUrl = (c: Context) => { const tweetRequest = async (c: Context) => await statusRequest(c); const _profileRequest = async (c: Context) => await profileRequest(c); +twitter.get('/:endpoint{status(es)?}/:id{.+}/:language{[a-z]+}?', tweetRequest); +twitter.get('/:endpoint{status(es)?}/:id{.+}/', tweetRequest); twitter.get('/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:language{[a-z]+}?', tweetRequest); twitter.get('/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/', tweetRequest); -twitter.get('/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/status/:id{.+}/:language{[a-z]+}?', tweetRequest); -twitter.get('/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/status/:id{.+}/', tweetRequest); +twitter.get('/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:language{[a-z]+}?', tweetRequest); +twitter.get('/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/', tweetRequest); twitter.get( - '/:handle{[0-9a-zA-Z_]+}/status/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/', + '/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/', tweetRequest ); twitter.get( - '/:handle{[0-9a-zA-Z_]+}/status/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language{[a-z]+}?', + '/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language{[a-z]+}?', tweetRequest ); twitter.get( - '/:handle{[0-9a-zA-Z_]+}/status/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/', + '/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/', tweetRequest ); twitter.get( - '/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/status/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language{[a-z]+}?', + '/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language{[a-z]+}?', tweetRequest ); twitter.get( - '/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/status/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/', + '/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/', tweetRequest );