diff --git a/.drone.yml b/.drone.yml index 4e3239f5..f648ce2c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,53 +19,21 @@ steps: - name: clone friendica addon image: alpine/git commands: - - git clone $DRONE_REPO_LINK addon - - cd addon/ - - git checkout $DRONE_COMMIT_BRANCH - - git fetch origin $DRONE_COMMIT_REF - - git merge $DRONE_COMMIT_SHA - - name: Run Xgettext for addons + - git clone $DRONE_REMOTE_URL addon + - git checkout $DRONE_COMMIT_REF + - name: Run default Xgettext image: friendicaci/transifex commands: - - /xgettext-addon.sh + - export CHANGED_FILES=($(git diff --name-status ${DRONE_COMMIT_BEFORE}..${DRONE_COMMIT_AFTER} | grep ^A | cut -f2)) + - export FIND_RESULT=$(printf "%s\n" "$CHANGED_FILES[@]" | sed '/^\./d' | cut -d "/" -f1 | uniq) + - for addon in $FIND_RESULT; do ./bin/run_xgettext.sh --addon $addon; done - name: Check update necessary - image: friendicaci/transifex - commands: - - /check-addons.sh ---- -kind: pipeline -type: docker -name: php-cs check - -clone: - disable: true - -trigger: - event: - - pull_request - -steps: - - name: Clone friendica base image: alpine/git commands: - - git clone https://github.com/friendica/friendica.git . - - git checkout $DRONE_COMMIT_BRANCH - - name: Clone friendica addon - image: alpine/git - commands: - - git clone $DRONE_REPO_LINK addon - cd addon/ - - git checkout $DRONE_COMMIT_BRANCH - - git fetch origin $DRONE_COMMIT_REF - - git merge $DRONE_COMMIT_SHA - - name: Install dependencies - image: composer - commands: - - ./bin/composer.phar run cs:install - - name: Run coding standards check - image: friendicaci/php-cs - commands: - - cd addon/ - - export CHANGED_FILES="$(git diff --name-status ${DRONE_COMMIT_BEFORE}..${DRONE_COMMIT_AFTER} | grep ^A | cut -f2 | sed -e "s/^/addon\\//")" - - cd ../ - - /check-php-cs.sh + - if [[ $(git diff -U0 "**/messages.po" | awk '!/index|diff|\-\-\-|\+\+\+|@@|\-"POT-Creation-Date|\+"POT-Creation-Date|\+#|\-#/{print }' | wc -l) > 0 ]]; then + echo "::error file=messages.po::messages.po is out of date" + exit 1 + else + echo "Nothing to update" + fi diff --git a/.github/workflows/transifex.yml b/.github/workflows/transifex.yml new file mode 100644 index 00000000..c979dd79 --- /dev/null +++ b/.github/workflows/transifex.yml @@ -0,0 +1,48 @@ +name: Transifex +on: [pull_request] + +jobs: + messages: + name: Check messages.po changes + runs-on: ubuntu-latest + steps: + - name: Install gettext + run: sudo apt-get install gettext + + - name: Checkout Friendica Base + uses: actions/checkout@v2 + with: + repository: 'friendica/friendica' + ref: ${{ github.base_ref }} + + - name: Checkout current Friendica Addons + uses: actions/checkout@v2 + with: + path: 'addon' + + - name: Get changed files + id: changes + uses: jitterbit/get-changed-files@v1 + + - name: Run Xgettext for each changed addon + run: | + addon_files=(${{ steps.changes.outputs.all }}) + find_result=$(printf "%s\n" "${addon_files[@]}" | sed '/^\./d' | cut -d "/" -f1 | uniq) + for addon in $find_result + do + ./bin/run_xgettext.sh --addon $addon + done + + - name: Check if messages.po needs an update + run: | + echo "::group::Check messages.po" + # Skip all lines of the git diff starting with "@@" or comments or starting "POT-Creation-Date" + cd addon/ + if [[ $(git diff -U0 "**/messages.po" | awk '!/index|diff|\-\-\-|\+\+\+|@@|\-"POT-Creation-Date|\+"POT-Creation-Date|\+#|\-#/{print }' | wc -l) > 0 ]]; then + echo "::error file=messages.po::messages.po is out of date" + exit 1 + else + echo "Nothing to update" + fi + echo "::endgroup::" + shell: bash diff --git a/keycloakpassword/lang/C/messages.po b/keycloakpassword/lang/C/messages.po deleted file mode 100644 index 0dd6887b..00000000 --- a/keycloakpassword/lang/C/messages.po +++ /dev/null @@ -1,51 +0,0 @@ -# ADDON keycloakpassword -# Copyright (C) -# This file is distributed under the same license as the Friendica keycloakpassword addon package. -# -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-21 07:56+0200\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" - -#: keycloakpassword.php:118 -msgid "Client ID" -msgstr "" - -#: keycloakpassword.php:119 -msgid "" -"The name of the OpenID Connect client you created for this addon in Keycloak." -msgstr "" - -#: keycloakpassword.php:123 -msgid "Client secret" -msgstr "" - -#: keycloakpassword.php:124 -msgid "" -"The secret assigned to the OpenID Connect client you created for this addon " -"in Keycloak." -msgstr "" - -#: keycloakpassword.php:128 -msgid "OpenID Connect endpoint" -msgstr "" - -#: keycloakpassword.php:130 -msgid "" -"URL to the Keycloak endpoint for your client. (E.g., https://example.com/" -"auth/realms/some-realm/protocol/openid-connect)" -msgstr "" - -#: keycloakpassword.php:136 -msgid "Save Settings" -msgstr "" diff --git a/keycloakpassword/lang/de/messages.po b/keycloakpassword/lang/de/messages.po deleted file mode 100644 index a5d28060..00000000 --- a/keycloakpassword/lang/de/messages.po +++ /dev/null @@ -1,60 +0,0 @@ -# ADDON keycloakpassword -# Copyright (C) -# This file is distributed under the same license as the Friendica keycloakpassword addon package. -# -# -# Translators: -# Tobias Diekershoff , 2021 -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-21 07:56+0200\n" -"PO-Revision-Date: 2021-05-21 12:59+0000\n" -"Last-Translator: Tobias Diekershoff , 2021\n" -"Language-Team: German (https://www.transifex.com/Friendica/teams/12172/de/)\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" - -#: keycloakpassword.php:118 -msgid "Client ID" -msgstr "ID des Clients" - -#: keycloakpassword.php:119 -msgid "" -"The name of the OpenID Connect client you created for this addon in " -"Keycloak." -msgstr "" -"Der Name des OpenID Clients den du für dieses Addon in Keycloak angelegt " -"hast." - -#: keycloakpassword.php:123 -msgid "Client secret" -msgstr "Client Geheimnis" - -#: keycloakpassword.php:124 -msgid "" -"The secret assigned to the OpenID Connect client you created for this addon " -"in Keycloak." -msgstr "Das Geheimnis, das du in Keycloak für den Client hinterlegt hast." - -#: keycloakpassword.php:128 -msgid "OpenID Connect endpoint" -msgstr "OpenID Verbindungsendpunkt" - -#: keycloakpassword.php:130 -msgid "" -"URL to the Keycloak endpoint for your client. (E.g., " -"https://example.com/auth/realms/some-realm/protocol/openid-connect)" -msgstr "" -"Die URL des Keycloak Entpunktes fpr deinen Client (z.B. " -"https://example.com/auth/realms/some-realm/protocol/openid-connect)" - -#: keycloakpassword.php:136 -msgid "Save Settings" -msgstr "Einstellungen speichern" diff --git a/keycloakpassword/lang/de/strings.php b/keycloakpassword/lang/de/strings.php deleted file mode 100644 index 8273a1e3..00000000 --- a/keycloakpassword/lang/de/strings.php +++ /dev/null @@ -1,13 +0,0 @@ -strings["Client ID"] = "ID des Clients"; -$a->strings["Client secret"] = "Client Geheimnis"; -$a->strings["The secret assigned to the OpenID Connect client you created for this addon in Keycloak."] = "Das Geheimnis, das du in Keycloak für den Client hinterlegt hast."; -$a->strings["OpenID Connect endpoint"] = "OpenID Verbindungsendpunkt"; -$a->strings["Save Settings"] = "Einstellungen speichern"; diff --git a/nitter/LICENSE b/nitter/LICENSE deleted file mode 100644 index 69d75892..00000000 --- a/nitter/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright 2020 Tobias Diekershoff - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/nitter/README.md b/nitter/README.md deleted file mode 100644 index 8fab6304..00000000 --- a/nitter/README.md +++ /dev/null @@ -1,27 +0,0 @@ -nitter Addon for Friendica -========================== - -This addon will replace all occurances of the string _https://twitter.com_ with the server address of a nitter installation in all displayed postings on a Friendica node. - -Note: If you are using the twitter connector on your server, the links to the contacts profile pages will not be replaced by this addon. Only links in the body of the postings are affected. - -Nitter sources can be found on [github.com](https://github.com/zedeus/nitter) it is released unter the AGPLv3 or later. - -Why ---- - -Excerp from nitters about page. - -> It's basically impossible to use Twitter without JavaScript enabled. If you try, you're redirected to the legacy mobile version which is awful both functionally and aesthetically. For privacy-minded folks, preventing JavaScript analytics and potential IP-based tracking is important, but apart from using the legacy mobile version and a VPN, it's impossible. -> -> Using an instance of Nitter (hosted on a VPS for example), you can browse Twitter without JavaScript while retaining your privacy. In addition to respecting your privacy, Nitter is on average around 15 times lighter than Twitter, and in some cases serves pages faster. -> -> In the future a simple account system will be added that lets you follow Twitter users, allowing you to have a clean chronological timeline without needing a Twitter account. - -Changelog ---------- - -* **Version 1.1** - * Initial localization support with DE translation - * Configurable nitter instance address from the admin panel -* **Version 1.0**: Initial Release diff --git a/nitter/lang/C/messages.po b/nitter/lang/C/messages.po deleted file mode 100644 index a9e2428a..00000000 --- a/nitter/lang/C/messages.po +++ /dev/null @@ -1,41 +0,0 @@ -# ADDON nitter -# Copyright (C) -# This file is distributed under the same license as the Friendica nitter addon package. -# -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \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" - -#: 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 "" - -#: nitter.php:52 -msgid "Nitter server" -msgstr "" - -#: nitter.php:53 -msgid "Save Settings" -msgstr "" - -#: nitter.php:65 -#, php-format -msgid "" -"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 deleted file mode 100644 index fb3825f5..00000000 --- a/nitter/lang/de/messages.po +++ /dev/null @@ -1,41 +0,0 @@ -# ADDON nitter -# Copyright (C) -# This file is distributed under the same license as the Friendica nitter addon package. -# -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \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" - -#: 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." - -#: nitter.php:52 -msgid "Nitter server" -msgstr "Nitter Server" - -#: nitter.php:53 -msgid "Save Settings" -msgstr "Einstellungen Speichern" - -#: nitter.php:65 -#, php-format -msgid "" -"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 deleted file mode 100644 index 33a0ed2e..00000000 --- a/nitter/lang/de/strings.php +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index ea8e24be..00000000 --- a/nitter/nitter.php +++ /dev/null @@ -1,69 +0,0 @@ - - * - * Copyright (c) 2020 Tobias Diekershoff - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and - * associated documentation files (the "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -use Friendica\App; -use Friendica\Core\Addon; -use Friendica\Core\Renderer; -use Friendica\DI; - -function nitter_install() -{ - Addon::registerHook ('prepare_body', 'addon/nitter/nitter.php', 'nitter_render'); -} - -/* Handle the send data from the admin settings - */ -function nitter_addon_admin_post(App $a) -{ - $nitterserver = trim($_POST['nitterserver']); - DI::config()->set('nitter', 'server', $nitterserver); -} - -/* Hook into the admin settings to let the admin choose a - * nitter server to use for the replacement. - */ -function nitter_addon_admin(App $a, &$o) -{ - $nitterserver = DI::config()->get('nitter', 'server'); - $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/nitter/'); - $o = Renderer::replaceMacros($t, [ - '$settingdescription' => DI::l10n()->t('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.', 'https://github.com/zedeus/nitter/wiki/Instances'), - '$nitterserver' => ['nitterserver', DI::l10n()->t('Nitter server'), $nitterserver, 'http://example.com'], - '$submit' => DI::l10n()->t('Save Settings'), - ]); -} - -/* - * replace "twitter.com" with "nitter.net" - */ -function nitter_render(&$a, &$o) -{ - // this needs to be a system setting - $nitter = DI::config()->get('nitter', 'server', 'https://nitter.net'); - if (strstr($o['html'], 'https://twitter.com')) { - $o['html'] = str_replace('https://twitter.com', $nitter, $o['html']); - $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/nitter/templates/admin.tpl b/nitter/templates/admin.tpl deleted file mode 100644 index b7f02421..00000000 --- a/nitter/templates/admin.tpl +++ /dev/null @@ -1,5 +0,0 @@ -

{{$settingdescription}}

- -{{include file="field_input.tpl" field=$nitterserver}} - -
diff --git a/showmore/showmore.php b/showmore/showmore.php index dd6d4773..c0f581ec 100644 --- a/showmore/showmore.php +++ b/showmore/showmore.php @@ -125,9 +125,9 @@ function showmore_prepare_body(\Friendica\App $a, &$hook_data) if ($found) { $rnd = Strings::getRandomHex(8); - $hook_data['html'] = '' . - ''; + $hook_data['html'] = '' . + ''; } } diff --git a/twitter/twitter.php b/twitter/twitter.php index 41f865e8..bac4871b 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -1668,10 +1668,10 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl $postarray['app'] = strip_tags($post->source); if ($post->user->protected) { - $postarray['private'] = 1; + $postarray['private'] = Item::PRIVATE; $postarray['allow_cid'] = '<' . $self['id'] . '>'; } else { - $postarray['private'] = 0; + $postarray['private'] = Item::UNLISTED; $postarray['allow_cid'] = ''; }