mirror of
https://github.com/CompeyDev/fxtwitter-docker.git
synced 2025-04-10 21:10:54 +01:00
API_HOST -> API_HOST_LIST
This commit is contained in:
parent
bb1aa3b44d
commit
c333ccbdc9
7 changed files with 9 additions and 9 deletions
|
@ -2,7 +2,7 @@ BRANDING_NAME = "FixTweet"
|
||||||
BRANDING_NAME_DISCORD = "FixTweet - Embed videos, polls & more!"
|
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"
|
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"
|
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"
|
HOST_URL = "https://fxtwitter.com"
|
||||||
REDIRECT_URL = "https://github.com/dangeredwolf/FixTweet"
|
REDIRECT_URL = "https://github.com/dangeredwolf/FixTweet"
|
||||||
SENTRY_DSN = "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@aaaaaa.ingest.sentry.io/69"
|
SENTRY_DSN = "https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@aaaaaa.ingest.sentry.io/69"
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
"BRANDING_NAME_DISCORD": "FixTweetBrandingDiscord",
|
"BRANDING_NAME_DISCORD": "FixTweetBrandingDiscord",
|
||||||
"DIRECT_MEDIA_DOMAINS": "d.fxtwitter.com,dl.fxtwitter.com",
|
"DIRECT_MEDIA_DOMAINS": "d.fxtwitter.com,dl.fxtwitter.com",
|
||||||
"MOSAIC_DOMAIN_LIST": "mosaic.fxtwitter.com",
|
"MOSAIC_DOMAIN_LIST": "mosaic.fxtwitter.com",
|
||||||
"API_HOST": "api.fxtwitter.com",
|
"API_HOST_LIST": "api.fxtwitter.com",
|
||||||
"HOST_URL": "https://fxtwitter.com",
|
"HOST_URL": "https://fxtwitter.com",
|
||||||
"REDIRECT_URL": "https://github.com/dangeredwolf/FixTweet",
|
"REDIRECT_URL": "https://github.com/dangeredwolf/FixTweet",
|
||||||
"RELEASE_NAME": "fixtweet-test",
|
"RELEASE_NAME": "fixtweet-test",
|
||||||
|
|
|
@ -5,7 +5,7 @@ export const Constants = {
|
||||||
BRANDING_NAME_DISCORD: BRANDING_NAME_DISCORD,
|
BRANDING_NAME_DISCORD: BRANDING_NAME_DISCORD,
|
||||||
DIRECT_MEDIA_DOMAINS: DIRECT_MEDIA_DOMAINS.split(','),
|
DIRECT_MEDIA_DOMAINS: DIRECT_MEDIA_DOMAINS.split(','),
|
||||||
MOSAIC_DOMAIN_LIST: MOSAIC_DOMAIN_LIST.split(','),
|
MOSAIC_DOMAIN_LIST: MOSAIC_DOMAIN_LIST.split(','),
|
||||||
API_HOST: API_HOST,
|
API_HOST_LIST: API_HOST_LIST.split(','),
|
||||||
HOST_URL: HOST_URL,
|
HOST_URL: HOST_URL,
|
||||||
REDIRECT_URL: REDIRECT_URL,
|
REDIRECT_URL: REDIRECT_URL,
|
||||||
RELEASE_NAME: RELEASE_NAME,
|
RELEASE_NAME: RELEASE_NAME,
|
||||||
|
|
2
src/env.d.ts
vendored
2
src/env.d.ts
vendored
|
@ -4,7 +4,7 @@ declare const DIRECT_MEDIA_DOMAINS: string;
|
||||||
declare const HOST_URL: string;
|
declare const HOST_URL: string;
|
||||||
declare const REDIRECT_URL: string;
|
declare const REDIRECT_URL: string;
|
||||||
declare const MOSAIC_DOMAIN_LIST: 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 SENTRY_DSN: string;
|
||||||
declare const RELEASE_NAME: string;
|
declare const RELEASE_NAME: string;
|
||||||
|
|
|
@ -33,7 +33,7 @@ const statusRequest = async (
|
||||||
|
|
||||||
if (
|
if (
|
||||||
url.pathname.match(/\/status(es)?\/\d+\.(json)/g) !== null ||
|
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');
|
console.log('JSON API request');
|
||||||
flags.api = true;
|
flags.api = true;
|
||||||
|
@ -139,7 +139,7 @@ router.get('/:handle/', profileRequest);
|
||||||
router.get('*', async (request: Request) => {
|
router.get('*', async (request: Request) => {
|
||||||
const url = new URL(request.url);
|
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.API_DOCS_URL, 302);
|
||||||
}
|
}
|
||||||
return Response.redirect(Constants.REDIRECT_URL, 302);
|
return Response.redirect(Constants.REDIRECT_URL, 302);
|
||||||
|
@ -185,7 +185,7 @@ export const cacheWrapper = async (
|
||||||
|
|
||||||
switch (request.method) {
|
switch (request.method) {
|
||||||
case 'GET':
|
case 'GET':
|
||||||
if (cacheUrl.hostname !== Constants.API_HOST) {
|
if (!Constants.API_HOST_LIST.includes(cacheUrl.hostname)) {
|
||||||
/* cache may be undefined in tests */
|
/* cache may be undefined in tests */
|
||||||
const cachedResponse = await cache.match(cacheKey);
|
const cachedResponse = await cache.match(cacheKey);
|
||||||
|
|
||||||
|
|
|
@ -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_PRIVATE: `I can't embed Tweets from private accounts, sorry about that :(`,
|
||||||
ERROR_TWEET_NOT_FOUND: `Sorry, that Tweet doesn't exist :(`,
|
ERROR_TWEET_NOT_FOUND: `Sorry, that Tweet doesn't exist :(`,
|
||||||
ERROR_UNKNOWN: `Unknown error occurred, sorry about that :(`,
|
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 <a href="https://${API_HOST}">${API_HOST}</a>`,
|
TWITFIX_API_SUNSET: `The original TwitFix API has been sunset. To learn more about the FixTweet API, check out <a href="https://${API_HOST_LIST.split(',')[0]}">${API_HOST_LIST.split(',')[0]}</a>`,
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,7 +37,7 @@ let plugins = [
|
||||||
MOSAIC_DOMAIN_LIST: `'${process.env.MOSAIC_DOMAIN_LIST}'`
|
MOSAIC_DOMAIN_LIST: `'${process.env.MOSAIC_DOMAIN_LIST}'`
|
||||||
}),
|
}),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
API_HOST: `'${process.env.API_HOST}'`
|
API_HOST_LIST: `'${process.env.API_HOST_LIST}'`
|
||||||
}),
|
}),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
SENTRY_DSN: `'${process.env.SENTRY_DSN}'`
|
SENTRY_DSN: `'${process.env.SENTRY_DSN}'`
|
||||||
|
|
Loading…
Add table
Reference in a new issue