From 31d6e74a1912b2eebeae64e20053cebfcd369fb5 Mon Sep 17 00:00:00 2001 From: loma-one Date: Mon, 22 Jan 2024 19:19:04 +0100 Subject: [PATCH] Replaces links to twitter.com and x.com to a nitter server Some links are now linked to x.com instead of twitter.com. The addon does not redirect the links to x.com yet. This will now be changed. --- nitter/nitter.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nitter/nitter.php b/nitter/nitter.php index e9454c5d..699c8099 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) { @@ -70,7 +70,11 @@ function nitter_render(array &$b) $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) . '

'; } -} +} \ No newline at end of file