diff --git a/.env.example b/.env.example
index db9ed5b..4f4697d 100644
--- a/.env.example
+++ b/.env.example
@@ -2,7 +2,7 @@ BRANDING_NAME = "FixTweet"
BRANDING_NAME_DISCORD = "FixTweet - Embed videos, polls & more!"
DIRECT_MEDIA_DOMAINS = "d.fxtwitter.com,dl.fxtwitter.com,d.pxtwitter.com,d.twittpr.com,dl.pxtwitter.com,dl.twittpr.com"
MOSAIC_DOMAIN_LIST = "mosaic.fxtwitter.com"
-API_HOST = "api.fxtwitter.com"
+API_HOST_LIST = "api.fxtwitter.com,api-canary.fxtwitter.com"
HOST_URL = "https://fxtwitter.com"
REDIRECT_URL = "https://github.com/dangeredwolf/FixTweet"
SENTRY_DSN = "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@aaaaaa.ingest.sentry.io/69"
diff --git a/jestconfig.json b/jestconfig.json
index 813125c..a389846 100644
--- a/jestconfig.json
+++ b/jestconfig.json
@@ -8,7 +8,7 @@
"BRANDING_NAME_DISCORD": "FixTweetBrandingDiscord",
"DIRECT_MEDIA_DOMAINS": "d.fxtwitter.com,dl.fxtwitter.com",
"MOSAIC_DOMAIN_LIST": "mosaic.fxtwitter.com",
- "API_HOST": "api.fxtwitter.com",
+ "API_HOST_LIST": "api.fxtwitter.com",
"HOST_URL": "https://fxtwitter.com",
"REDIRECT_URL": "https://github.com/dangeredwolf/FixTweet",
"RELEASE_NAME": "fixtweet-test",
diff --git a/src/constants.ts b/src/constants.ts
index 5453d8c..bf345ad 100644
--- a/src/constants.ts
+++ b/src/constants.ts
@@ -5,7 +5,7 @@ export const Constants = {
BRANDING_NAME_DISCORD: BRANDING_NAME_DISCORD,
DIRECT_MEDIA_DOMAINS: DIRECT_MEDIA_DOMAINS.split(','),
MOSAIC_DOMAIN_LIST: MOSAIC_DOMAIN_LIST.split(','),
- API_HOST: API_HOST,
+ API_HOST_LIST: API_HOST_LIST.split(','),
HOST_URL: HOST_URL,
REDIRECT_URL: REDIRECT_URL,
RELEASE_NAME: RELEASE_NAME,
diff --git a/src/env.d.ts b/src/env.d.ts
index be9b25b..5ef4c9d 100644
--- a/src/env.d.ts
+++ b/src/env.d.ts
@@ -4,7 +4,7 @@ declare const DIRECT_MEDIA_DOMAINS: string;
declare const HOST_URL: string;
declare const REDIRECT_URL: string;
declare const MOSAIC_DOMAIN_LIST: string;
-declare const API_HOST: string;
+declare const API_HOST_LIST: string;
declare const SENTRY_DSN: string;
declare const RELEASE_NAME: string;
diff --git a/src/server.ts b/src/server.ts
index b443142..dcc7706 100644
--- a/src/server.ts
+++ b/src/server.ts
@@ -33,7 +33,7 @@ const statusRequest = async (
if (
url.pathname.match(/\/status(es)?\/\d+\.(json)/g) !== null ||
- url.hostname === Constants.API_HOST
+ Constants.API_HOST_LIST.includes(url.hostname)
) {
console.log('JSON API request');
flags.api = true;
@@ -139,7 +139,7 @@ router.get('/:handle/', profileRequest);
router.get('*', async (request: Request) => {
const url = new URL(request.url);
- if (url.hostname === Constants.API_HOST) {
+ if (Constants.API_HOST_LIST.includes(url.hostname)) {
return Response.redirect(Constants.API_DOCS_URL, 302);
}
return Response.redirect(Constants.REDIRECT_URL, 302);
@@ -185,7 +185,7 @@ export const cacheWrapper = async (
switch (request.method) {
case 'GET':
- if (cacheUrl.hostname !== Constants.API_HOST) {
+ if (!Constants.API_HOST_LIST.includes(cacheUrl.hostname)) {
/* cache may be undefined in tests */
const cachedResponse = await cache.match(cacheKey);
diff --git a/src/strings.ts b/src/strings.ts
index b7e7b45..7848821 100644
--- a/src/strings.ts
+++ b/src/strings.ts
@@ -87,5 +87,5 @@ This is caused by Twitter API downtime or a new bug. Try again in a little while
ERROR_PRIVATE: `I can't embed Tweets from private accounts, sorry about that :(`,
ERROR_TWEET_NOT_FOUND: `Sorry, that Tweet doesn't exist :(`,
ERROR_UNKNOWN: `Unknown error occurred, sorry about that :(`,
- TWITFIX_API_SUNSET: `The original TwitFix API has been sunset. To learn more about the FixTweet API, check out ${API_HOST}`,
+ TWITFIX_API_SUNSET: `The original TwitFix API has been sunset. To learn more about the FixTweet API, check out ${API_HOST_LIST.split(',')[0]}`,
};
diff --git a/webpack.config.js b/webpack.config.js
index df3b6b5..6bee257 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -37,7 +37,7 @@ let plugins = [
MOSAIC_DOMAIN_LIST: `'${process.env.MOSAIC_DOMAIN_LIST}'`
}),
new webpack.DefinePlugin({
- API_HOST: `'${process.env.API_HOST}'`
+ API_HOST_LIST: `'${process.env.API_HOST_LIST}'`
}),
new webpack.DefinePlugin({
SENTRY_DSN: `'${process.env.SENTRY_DSN}'`