diff --git a/nitter/README.md b/nitter/README.md index 24b10798..8fab6304 100644 --- a/nitter/README.md +++ b/nitter/README.md @@ -21,9 +21,6 @@ Excerp from nitters about page. Changelog --------- -* **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 * **Version 1.1** * Initial localization support with DE translation * Configurable nitter instance address from the admin panel diff --git a/nitter/lang/C/messages.po b/nitter/lang/C/messages.po index 984707cc..a9e2428a 100644 --- a/nitter/lang/C/messages.po +++ b/nitter/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-01 16:10+0200\n" +"POT-Creation-Date: 2021-03-08 07:44+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: nitter.php:52 +#: nitter.php:51 #, php-format msgid "" "Which nitter server shall be used for the replacements in the post bodies? " @@ -25,17 +25,17 @@ msgid "" "public Nitter servers." msgstr "" -#: nitter.php:53 +#: nitter.php:52 msgid "Nitter server" msgstr "" -#: nitter.php:54 +#: nitter.php:53 msgid "Save Settings" msgstr "" -#: nitter.php:99 +#: nitter.php:65 #, php-format msgid "" -"In an attempt to protect your privacy, links to Twitter in this posting were " -"replaced by links to the Nitter instance at %s" +"Links to Twitter in this posting were replaced by links to the Nitter " +"instance at %s" msgstr "" diff --git a/nitter/lang/de/messages.po b/nitter/lang/de/messages.po index ba95c1a2..fb3825f5 100644 --- a/nitter/lang/de/messages.po +++ b/nitter/lang/de/messages.po @@ -1,50 +1,41 @@ # ADDON nitter -# Copyright (C) +# Copyright (C) # This file is distributed under the same license as the Friendica nitter addon package. # -# -# Translators: -# Tobias Diekershoff , 2021 -# +# #, fuzzy msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-10-01 16:10+0200\n" -"PO-Revision-Date: 2021-05-21 12:58+0000\n" -"Last-Translator: Tobias Diekershoff , 2021\n" -"Language-Team: German (https://www.transifex.com/Friendica/teams/12172/de/)\n" +"POT-Creation-Date: 2021-03-08 07:44+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Language: de\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: nitter.php:52 +#: nitter.php:51 #, php-format msgid "" "Which nitter server shall be used for the replacements in the post bodies? " "Use the URL with servername and protocol. See %s for a list of available " "public Nitter servers." -msgstr "" -"Welcher Nitter server soll für die Ersetzungen verwendet werden? Gib die URL" -" mit Servername und Protokoll an. Eine Liste von öffentlichen Nitter servern" -" findest du unter %s." +msgstr "Welcher Nitter server soll für die Ersetzungen verwendet werden? Gib die URL mit Servername und Protokoll an. Eine Liste von öffentlichen Nitter servern findest du unter %s." -#: nitter.php:53 +#: nitter.php:52 msgid "Nitter server" msgstr "Nitter Server" -#: nitter.php:54 +#: nitter.php:53 msgid "Save Settings" msgstr "Einstellungen Speichern" -#: nitter.php:99 +#: nitter.php:65 #, php-format msgid "" -"In an attempt to protect your privacy, links to Twitter in this posting were" -" replaced by links to the Nitter instance at %s" -msgstr "" -"Um deine Privatsphäre zu schützen, wurden in diesem Beitrag Links nach " -"twitter.com durch die Nitter Instanz auf %s ersetzt." +"Links to Twitter in this posting were replaced by links to the Nitter " +"instance at %s" +msgstr "In diesem Beitrag wurden Links nach twitter.com durch die Nitter Instanz auf %s ersetzt." diff --git a/nitter/lang/de/strings.php b/nitter/lang/de/strings.php index 75ba72f9..33a0ed2e 100644 --- a/nitter/lang/de/strings.php +++ b/nitter/lang/de/strings.php @@ -1,10 +1,7 @@ strings["Which nitter server shall be used for the replacements in the post bodies? Use the URL with servername and protocol. See %s for a list of available public Nitter servers."] = "Welcher Nitter server soll für die Ersetzungen verwendet werden? Gib die URL mit Servername und Protokoll an. Eine Liste von öffentlichen Nitter servern findest du unter %s."; $a->strings["Nitter server"] = "Nitter Server"; $a->strings["Save Settings"] = "Einstellungen Speichern"; +$a->strings["Links to Twitter in this posting were replaced by links to the Nitter instance at %s"] = "In diesem Beitrag wurden Links nach twitter.com durch die Nitter Instanz auf %s ersetzt."; diff --git a/nitter/nitter.php b/nitter/nitter.php index 49808a12..28bd9857 100644 --- a/nitter/nitter.php +++ b/nitter/nitter.php @@ -2,7 +2,7 @@ /* * Name: nitter * Description: Replaces links to twitter.com to a nitter server in all displays of postings on a node. - * Version: 2.0 + * Version: 1.1 * Author: Tobias Diekershoff * * Copyright (c) 2020 Tobias Diekershoff @@ -30,7 +30,7 @@ use Friendica\DI; function nitter_install() { - Addon::registerHook ('prepare_body_final', 'addon/nitter/nitter.php', 'nitter_render'); + Addon::registerHook ('prepare_body', 'addon/nitter/nitter.php', 'nitter_render'); } /* Handle the send data from the admin settings @@ -72,6 +72,6 @@ function nitter_render(&$a, &$o) $replaced = true; } if ($replaced) { - $o['html'] .= '

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

'; + $o['html'] .= '

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

'; } } diff --git a/twitter/twitter.php b/twitter/twitter.php index d3e6c1e9..f753ee97 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -104,6 +104,7 @@ function twitter_install() Hook::register('notifier_normal' , __FILE__, 'twitter_post_hook'); Hook::register('jot_networks' , __FILE__, 'twitter_jot_nets'); Hook::register('cron' , __FILE__, 'twitter_cron'); + Hook::register('support_follow' , __FILE__, 'twitter_support_follow'); Hook::register('follow' , __FILE__, 'twitter_follow'); Hook::register('unfollow' , __FILE__, 'twitter_unfollow'); Hook::register('expire' , __FILE__, 'twitter_expire'); @@ -135,6 +136,13 @@ function twitter_check_item_notification(App $a, array &$notification_data) } } +function twitter_support_follow(App $a, array &$data) +{ + if ($data['protocol'] == Protocol::TWITTER) { + $data['result'] = true; + } +} + function twitter_follow(App $a, array &$contact) { Logger::info('Check if contact is twitter contact', ['url' => $contact["url"]]); @@ -711,7 +719,7 @@ function twitter_post_hook(App $a, array &$b) } // Add the link to the body if the type isn't a photo or there are more than 4 images in the post - if (!empty($msgarr['url']) && (strpos($msg, $msgarr['url']) === false) && (($msgarr['type'] != 'photo') || empty($msgarr['images']) || (count($msgarr['images']) > 4))) { + if (!empty($msgarr['url']) && (($msgarr['type'] != 'photo') || empty($msgarr['images']) || (count($msgarr['images']) > 4))) { $msg .= "\n" . $msgarr['url']; }