From 5356aa4d73f85092bd733ed422137be9c8b29987 Mon Sep 17 00:00:00 2001 From: dangered wolf Date: Mon, 8 Aug 2022 21:51:07 -0400 Subject: [PATCH] Notice about TwitFix API no longer being available --- src/constants.ts | 2 +- src/server.ts | 7 +++++++ src/strings.ts | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 8e7bff4..b4eb56d 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -9,7 +9,7 @@ export const Constants = { HOST_URL: HOST_URL, REDIRECT_URL: REDIRECT_URL, RELEASE_NAME: RELEASE_NAME, - API_DOCS_URL: `https://github.com/dangeredwolf/FixTweet/wiki/Status-API`, + API_DOCS_URL: `https://github.com/dangeredwolf/FixTweet/wiki/API-Home`, TWITTER_ROOT: 'https://twitter.com', TWITTER_API_ROOT: 'https://api.twitter.com', /* We used to use Bearer AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA diff --git a/src/server.ts b/src/server.ts index d509ad2..7e25492 100644 --- a/src/server.ts +++ b/src/server.ts @@ -176,6 +176,13 @@ export const cacheWrapper = async ( }); } + if (cacheUrl.pathname.startsWith('/api/') || cacheUrl.pathname.startsWith('/other/') || cacheUrl.pathname.startsWith('/info/')) { + return new Response(Strings.TWITFIX_API_SUNSET, { + headers: Constants.RESPONSE_HEADERS, + status: 404 + }); + } + switch (request.method) { case 'GET': if (cacheUrl.hostname !== Constants.API_HOST) { diff --git a/src/strings.ts b/src/strings.ts index 646fd75..b7e7b45 100644 --- a/src/strings.ts +++ b/src/strings.ts @@ -86,5 +86,6 @@ This is caused by Twitter API downtime or a new bug. Try again in a little while ERROR_API_FAIL: 'Tweet failed to load due to an API error :(', 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 :(` + 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}`, };