Skip to content

Commit

Permalink
Revert "Separate x / twitter redirects #822"
Browse files Browse the repository at this point in the history
This reverts commit ac32c0a.
  • Loading branch information
dangeredwolf committed Aug 6, 2024
1 parent 054dbd6 commit 649f82e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ 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',
Expand Down
7 changes: 1 addition & 6 deletions src/realms/twitter/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ export const getBaseRedirectUrl = (c: Context) => {
return baseRedirect.endsWith('/') ? baseRedirect.slice(0, -1) : baseRedirect;
}

// 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;
}
return Constants.TWITTER_ROOT;
};

/* Workaround for some dumb maybe-build time issue where statusRequest isn't ready or something because none of these trigger*/
Expand Down
2 changes: 1 addition & 1 deletion src/realms/twitter/routes/redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const genericTwitterRedirect = async (c: Context) => {
c.header('cache-control', cacheControl);
}

return c.redirect(`${baseUrl}${url.pathname}?mx=1`, 302);
return c.redirect(`${baseUrl}${url.pathname}`, 302);
};

export const setRedirectRequest = async (c: Context) => {
Expand Down
2 changes: 1 addition & 1 deletion src/realms/twitter/routes/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}?mx=1`, 302);
return c.redirect(`${baseUrl}/${handle || 'i'}/status/${id}`, 302);
}

c.status(200);
Expand Down

0 comments on commit 649f82e

Please sign in to comment.