From ebd54b2398b9b4c5696c2e655b7dd7e842c64858 Mon Sep 17 00:00:00 2001 From: loma-one Date: Mon, 22 Jan 2024 19:41:04 +0100 Subject: [PATCH] Replaces links to twitter.com an "x.com" to a nitter server In the meantime, links are increasingly being shared on x.com instead of twitter.com. The addon has not yet been able to capture links on x.com and redirect them to nitter. --- nitter/nitter.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nitter/nitter.php b/nitter/nitter.php index e9454c5d..ed587777 100644 --- a/nitter/nitter.php +++ b/nitter/nitter.php @@ -1,8 +1,8 @@ * * Copyright (c) 2020 Tobias Diekershoff @@ -55,7 +55,7 @@ function nitter_addon_admin(string &$o) } /* - * replace "twitter.com" with "nitter.net" + * replace "twitter.com" an "x.com" with "nitter.net" */ function nitter_render(array &$b) { @@ -69,6 +69,10 @@ function nitter_render(array &$b) if (strstr($b['html'], 'https://twitter.com')) { $b['html'] = str_replace('https://twitter.com', $nitter, $b['html']); $replaced = true; + } + if (strstr($b['html'], 'https://x.com')) { + $b['html'] = str_replace('https://x.com', $nitter, $b['html']); + $replaced = true; } if ($replaced) { $b['html'] .= '

' . DI::l10n()->t('(Nitter addon enabled: Twitter links via %s)', $nitter) . '

';