From: Tobias Diekershoff Date: Wed, 18 Aug 2021 17:04:51 +0000 (+0200) Subject: nitter: replace mobile link to twitter as well X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b78c8a30f6d8c14d6301aa7819ba7f09e05ece8c;p=friendica-addons.git nitter: replace mobile link to twitter as well --- diff --git a/nitter/nitter.php b/nitter/nitter.php index ea8e24be..fab7aa06 100644 --- a/nitter/nitter.php +++ b/nitter/nitter.php @@ -61,9 +61,17 @@ function nitter_addon_admin(App $a, &$o) function nitter_render(&$a, &$o) { // this needs to be a system setting + $replaced = false; $nitter = DI::config()->get('nitter', 'server', 'https://nitter.net'); + if (strstr($o['html'], 'https://mobile.twitter.com')) { + $o['html'] = str_replace('https://mobile.twitter.com', $nitter, $o['html']); + $replace = true; + } if (strstr($o['html'], 'https://twitter.com')) { $o['html'] = str_replace('https://twitter.com', $nitter, $o['html']); + $replace = true; + } + if ($replace) { $o['html'] .= '

' . DI::l10n()->t('Links to Twitter in this posting were replaced by links to the Nitter instance at %s', $nitter) . '

'; } }