From ebd54b2398b9b4c5696c2e655b7dd7e842c64858 Mon Sep 17 00:00:00 2001 From: loma-one Date: Mon, 22 Jan 2024 19:41:04 +0100 Subject: [PATCH 1/3] 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) . '

'; -- 2.45.3 From 1e13884a12b0cf38a033cc431e7a77133a6c56bd Mon Sep 17 00:00:00 2001 From: loma-one Date: Tue, 23 Jan 2024 08:15:24 +0100 Subject: [PATCH 2/3] nitter/nitter.php aktualisiert --- nitter/nitter.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/nitter/nitter.php b/nitter/nitter.php index ed587777..1e2c59c3 100644 --- a/nitter/nitter.php +++ b/nitter/nitter.php @@ -1,7 +1,7 @@ * @@ -55,23 +55,23 @@ function nitter_addon_admin(string &$o) } /* - * replace "twitter.com" an "x.com" with "nitter.net" + * replace "twitter.com" and "x.com" with "nitter.net" */ function nitter_render(array &$b) { // this needs to be a system setting $replaced = false; $nitter = DI::config()->get('nitter', 'server', 'https://nitter.net'); - if (strstr($b['html'], 'https://mobile.twitter.com')) { - $b['html'] = str_replace('https://mobile.twitter.com', $nitter, $b['html']); + if (strstr($b['html'], 'https://mobile.twitter.com/')) { + $b['html'] = str_replace('https://mobile.twitter.com/', $nitter, $b['html']); $replaced = true; } - if (strstr($b['html'], 'https://twitter.com')) { - $b['html'] = str_replace('https://twitter.com', $nitter, $b['html']); + 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']); + if (strstr($b['html'], 'https://x.com/')) { + $b['html'] = str_replace('https://x.com/', $nitter, $b['html']); $replaced = true; } if ($replaced) { -- 2.45.3 From 27407592d64265f1c844733ca68d2a671bf22059 Mon Sep 17 00:00:00 2001 From: loma-one Date: Tue, 23 Jan 2024 08:16:31 +0100 Subject: [PATCH 3/3] nitter/README.md aktualisiert --- nitter/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nitter/README.md b/nitter/README.md index 24b10798..ecec0db0 100644 --- a/nitter/README.md +++ b/nitter/README.md @@ -21,6 +21,8 @@ Excerp from nitters about page. Changelog --------- +* **Version 2.1** + * Extended by the domain x.com * **Version 2.0** * Changes the used hook by the addon, so that attached previews of postings get replaced as well. This means the admins need to reload the addon -- 2.45.3