Make username optional and loosen routing requirements

This commit is contained in:
dangered wolf 2023-11-12 00:53:25 -05:00
parent 026a1f50d6
commit 62d2a54438
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58

View file

@ -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
);