From 1bd30112dbbc084e88e2ca9eda2ec53ff89cf3aa Mon Sep 17 00:00:00 2001 From: dangered wolf <d@ngeredwolf.me> Date: Wed, 10 Aug 2022 00:21:28 -0400 Subject: [PATCH] Exclude http-equiv=refresh from Telegram responses --- src/status.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/status.ts b/src/status.ts index f2938b4..9867459 100644 --- a/src/status.ts +++ b/src/status.ts @@ -76,10 +76,13 @@ export const handleStatus = async ( `<meta name="twitter:card" content="${tweet.twitter_card}"/>`, `<meta name="twitter:site" content="@${tweet.author.screen_name}"/>`, `<meta name="twitter:creator" content="@${tweet.author.screen_name}"/>`, - `<meta name="twitter:title" content="${tweet.author.name} (@${tweet.author.screen_name})"/>`, - `<meta http-equiv="refresh" content="0;url=https://twitter.com/${tweet.author.screen_name}/status/${tweet.id}"/>` + `<meta name="twitter:title" content="${tweet.author.name} (@${tweet.author.screen_name})"/>` ]; + if (userAgent?.indexOf('Telegram') === -1) { + headers.push(`<meta http-equiv="refresh" content="0;url=https://twitter.com/${tweet.author.screen_name}/status/${tweet.id}"/>`) + } + if (tweet.translation) { const { translation } = tweet;