mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-06 19:10:54 +01:00
Patch quirky paths for translation (#435 regression)
This commit is contained in:
parent
d682b07fa5
commit
e1c3d7d544
3 changed files with 45 additions and 15 deletions
|
@ -194,6 +194,8 @@ export const handleStatus = async (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log('translation', tweet.translation)
|
||||||
|
|
||||||
/* This Tweet has a translation attached to it, so we'll render it. */
|
/* This Tweet has a translation attached to it, so we'll render it. */
|
||||||
if (tweet.translation) {
|
if (tweet.translation) {
|
||||||
const { translation } = tweet;
|
const { translation } = tweet;
|
||||||
|
|
|
@ -29,40 +29,69 @@ export const getBaseRedirectUrl = (c: Context) => {
|
||||||
/* Workaround for some dumb maybe-build time issue where statusRequest isn't ready or something because none of these trigger*/
|
/* Workaround for some dumb maybe-build time issue where statusRequest isn't ready or something because none of these trigger*/
|
||||||
const tweetRequest = async (c: Context) => await statusRequest(c);
|
const tweetRequest = async (c: Context) => await statusRequest(c);
|
||||||
const _profileRequest = async (c: Context) => await profileRequest(c);
|
const _profileRequest = async (c: Context) => await profileRequest(c);
|
||||||
|
/* How can hono not handle trailing slashes? This is so stupid,
|
||||||
|
|
||||||
twitter.get('/:endpoint{status(es)?}/:id{.+}/:language{[a-z]+}?', tweetRequest);
|
serious TODO: Figure out how to make this not stupid. */
|
||||||
twitter.get('/:endpoint{status(es)?}/:id{.+}/', tweetRequest);
|
twitter.get('/:endpoint{status(es)?}/:id', tweetRequest);
|
||||||
|
twitter.get('/:endpoint{status(es)?}/:id/', tweetRequest);
|
||||||
|
twitter.get('/:endpoint{status(es)?}/:id/:language/', tweetRequest);
|
||||||
|
twitter.get('/:endpoint{status(es)?}/:id/:language', tweetRequest);
|
||||||
twitter.get(
|
twitter.get(
|
||||||
'/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:language{[a-z]+}?',
|
'/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/:language',
|
||||||
tweetRequest
|
|
||||||
);
|
|
||||||
twitter.get('/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/', tweetRequest);
|
|
||||||
twitter.get(
|
|
||||||
'/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:language{[a-z]+}?',
|
|
||||||
tweetRequest
|
tweetRequest
|
||||||
);
|
);
|
||||||
twitter.get(
|
twitter.get(
|
||||||
'/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/',
|
'/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/:language/',
|
||||||
|
tweetRequest
|
||||||
|
);
|
||||||
|
twitter.get('/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id', tweetRequest);
|
||||||
|
twitter.get('/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/', tweetRequest);
|
||||||
|
twitter.get(
|
||||||
|
'/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/:language',
|
||||||
tweetRequest
|
tweetRequest
|
||||||
);
|
);
|
||||||
twitter.get(
|
twitter.get(
|
||||||
'/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/',
|
'/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/:language/',
|
||||||
tweetRequest
|
tweetRequest
|
||||||
);
|
);
|
||||||
twitter.get(
|
twitter.get(
|
||||||
'/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language{[a-z]+}?',
|
'/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id',
|
||||||
tweetRequest
|
tweetRequest
|
||||||
);
|
);
|
||||||
twitter.get(
|
twitter.get(
|
||||||
'/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id{.+}/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/',
|
'/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/',
|
||||||
tweetRequest
|
tweetRequest
|
||||||
);
|
);
|
||||||
twitter.get(
|
twitter.get(
|
||||||
'/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/: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]}',
|
||||||
tweetRequest
|
tweetRequest
|
||||||
);
|
);
|
||||||
twitter.get(
|
twitter.get(
|
||||||
'/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/: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_]+}/:endpoint{status(es)?}/:id/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language',
|
||||||
|
tweetRequest
|
||||||
|
);
|
||||||
|
twitter.get(
|
||||||
|
'/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language/',
|
||||||
|
tweetRequest
|
||||||
|
);
|
||||||
|
twitter.get(
|
||||||
|
'/:prefix{(dir|dl)}/: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_]+}/:endpoint{status(es)?}/:id/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/',
|
||||||
|
tweetRequest
|
||||||
|
);
|
||||||
|
twitter.get(
|
||||||
|
'/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language',
|
||||||
|
tweetRequest
|
||||||
|
);
|
||||||
|
twitter.get(
|
||||||
|
'/:prefix{(dir|dl)}/:handle{[0-9a-zA-Z_]+}/:endpoint{status(es)?}/:id/:mediaType{(photos?|videos?)}/:mediaNumber{[1-4]}/:language/',
|
||||||
tweetRequest
|
tweetRequest
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,6 @@ export const profileRequest = async (c: Context) => {
|
||||||
console.log('Bypass bot check');
|
console.log('Bypass bot check');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This throws the necessary data to handleStatus (in status.ts) */
|
|
||||||
const profileResponse = await handleProfile(c, username, flags);
|
const profileResponse = await handleProfile(c, username, flags);
|
||||||
/* Check for custom redirect */
|
/* Check for custom redirect */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue