diff --git a/src/api.ts b/src/api.ts index b6087f0..7ca8628 100644 --- a/src/api.ts +++ b/src/api.ts @@ -63,6 +63,7 @@ const populateTweetProperties = async ( apiTweet.likes = tweet.favorite_count; apiTweet.color = apiTweet.author.avatar_color; apiTweet.twitter_card = 'tweet'; + apiTweet.created_at = tweet.created_at; if (tweet.lang !== 'unk') { apiTweet.lang = tweet.lang; diff --git a/src/constants.ts b/src/constants.ts index 6b88afd..84e8879 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -8,6 +8,7 @@ export const Constants = { API_HOST: API_HOST, HOST_URL: HOST_URL, REDIRECT_URL: REDIRECT_URL, + API_DOCS_URL: `https://github.com/dangeredwolf/FixTweet/wiki/Status-API`, 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 d1bfc07..89c383f 100644 --- a/src/server.ts +++ b/src/server.ts @@ -133,7 +133,13 @@ router.get('/owoembed', async (request: Request) => { router.get('/:handle', profileRequest); router.get('/:handle/', profileRequest); -router.get('*', async (_request: Request) => { +router.get('*', async (request: Request) => { + const url = new URL(request.url); + + if (url.hostname === Constants.API_HOST) { + return Response.redirect(Constants.API_DOCS_URL, 307); + } + return Response.redirect(Constants.REDIRECT_URL, 307); }); diff --git a/src/types.d.ts b/src/types.d.ts index 6be8250..13e5098 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -86,7 +86,6 @@ interface APIVideo { interface APITweet { id: string; url: string; - tweet: string; text: string; created_at: string;