diff --git a/src/constants.ts b/src/constants.ts index f7bce14..822b9a3 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -17,6 +17,7 @@ export const Constants = { GIF_TRANSCODE_DOMAIN: GIF_TRANSCODE_DOMAIN, API_DOCS_URL: `https://github.com/FixTweet/FxTwitter/wiki/API-Home`, TWITTER_ROOT: 'https://twitter.com', + X_ROOT: 'https://x.com', TWITTER_GLOBAL_NAME_ROOT: 'twitter.com', TWITTER_API_ROOT: 'https://api.twitter.com', TWITTER_VIDEO_BASE: 'https://video.twimg.com', diff --git a/src/realms/twitter/router.ts b/src/realms/twitter/router.ts index 5df0bd7..7f3edc8 100644 --- a/src/realms/twitter/router.ts +++ b/src/realms/twitter/router.ts @@ -24,7 +24,12 @@ export const getBaseRedirectUrl = (c: Context) => { return baseRedirect.endsWith('/') ? baseRedirect.slice(0, -1) : baseRedirect; } - return Constants.TWITTER_ROOT; + // Workaround to redirect to correct root depending on request URL + if (c.req.url.includes('fixup')) { + return Constants.X_ROOT + } else { + return Constants.TWITTER_ROOT; + } }; /* Workaround for some dumb maybe-build time issue where statusRequest isn't ready or something because none of these trigger*/ diff --git a/src/realms/twitter/routes/redirects.ts b/src/realms/twitter/routes/redirects.ts index fc711b8..f8b87f3 100644 --- a/src/realms/twitter/routes/redirects.ts +++ b/src/realms/twitter/routes/redirects.ts @@ -14,7 +14,7 @@ export const genericTwitterRedirect = async (c: Context) => { c.header('cache-control', cacheControl); } - return c.redirect(`${baseUrl}${url.pathname}`, 302); + return c.redirect(`${baseUrl}${url.pathname}?mx=1`, 302); }; export const setRedirectRequest = async (c: Context) => { diff --git a/src/realms/twitter/routes/status.ts b/src/realms/twitter/routes/status.ts index d08cf3f..5b0d528 100644 --- a/src/realms/twitter/routes/status.ts +++ b/src/realms/twitter/routes/status.ts @@ -119,7 +119,7 @@ export const statusRequest = async (c: Context) => { if (!isBotUA && !flags.api && !flags.direct) { const baseUrl = getBaseRedirectUrl(c); - return c.redirect(`${baseUrl}/${handle || 'i'}/status/${id}`, 302); + return c.redirect(`${baseUrl}/${handle || 'i'}/status/${id}?mx=1`, 302); } c.status(200);