From d76963944ad886cfc73183e3c0624627b89662eb Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Jan 2023 13:40:08 +0000 Subject: [PATCH 01/10] More configs moved to key values --- src/Core/Config/Model/Config.php | 3 +++ src/Module/Admin/Summary.php | 3 ++- src/Worker/CheckVersion.php | 2 +- static/dbstructure.config.php | 2 +- update.php | 9 +++++++++ 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Core/Config/Model/Config.php b/src/Core/Config/Model/Config.php index 46d5643b34..0a242c8587 100644 --- a/src/Core/Config/Model/Config.php +++ b/src/Core/Config/Model/Config.php @@ -27,6 +27,8 @@ use Friendica\Core\Config\Exception\ConfigFileException; use Friendica\Core\Config\Exception\ConfigPersistenceException; use Friendica\Core\Config\Util\ConfigFileManager; use Friendica\Core\Config\ValueObject\Cache; +use Friendica\Core\Logger; +use Friendica\Core\System; /** * Configuration model, which manages the whole system configuration @@ -118,6 +120,7 @@ class Config implements IManageConfigValues /** {@inheritDoc} */ public function set(string $cat, string $key, $value): bool { + Logger::debug('Set config value', ['cat' => $cat, 'key' => $key, 'value' => $value, 'callstack' => System::callstack(20)]); if ($this->configCache->set($cat, $key, $value, Cache::SOURCE_DATA)) { $this->save(); return true; diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index e963e7606d..f9c8cefbb6 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -79,7 +79,8 @@ class Summary extends BaseAdmin // Check if github.com/friendica/stable/VERSION is higher then // the local version of Friendica. Check is opt-in, source may be stable or develop branch if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') { - $gitversion = DI::config()->get('system', 'git_friendica_version'); + $gitversion = DI::keyValue()->get('git_friendica_version'); + if (version_compare(App::VERSION, $gitversion) < 0) { $warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', App::VERSION, $gitversion); } diff --git a/src/Worker/CheckVersion.php b/src/Worker/CheckVersion.php index 6676e51127..f4c45fe33d 100644 --- a/src/Worker/CheckVersion.php +++ b/src/Worker/CheckVersion.php @@ -58,7 +58,7 @@ class CheckVersion $gitversion = DBA::escape(trim(DI::httpClient()->fetch($checked_url, HttpClientAccept::TEXT))); Logger::notice("Upstream VERSION is: ".$gitversion); - DI::config()->set('system', 'git_friendica_version', $gitversion); + DI::keyValue()->set('git_friendica_version', $gitversion); Logger::notice('checkversion: end'); diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 4329410b4a..9dfd7820c1 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -55,7 +55,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1512); + define('DB_UPDATE_VERSION', 1513); } return [ diff --git a/update.php b/update.php index 8f93775259..7d9a9d2363 100644 --- a/update.php +++ b/update.php @@ -1244,3 +1244,12 @@ function update_1512() DI::config()->delete('nodeinfo', 'local_posts'); DI::config()->delete('nodeinfo', 'local_comments'); } + +function update_1513() +{ + DI::keyValue()->set('git_friendica_version', DI::config()->get('system', 'git_friendica_version')); + DI::keyValue()->set('twitter_application_name', DI::config()->get('twitter', 'application_name')); + + DI::config()->delete('system', 'git_friendica_version'); + DI::config()->delete('twitter', 'application_name'); +} From 70d942bd8b8807e1d0911b00e17251cec473e813 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Jan 2023 13:47:33 +0000 Subject: [PATCH 02/10] Updated database.sql --- database.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database.sql b/database.sql index 0b91aedc06..843db1f6cf 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2023.03-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1512 +-- DB_UPDATE_VERSION 1513 -- ------------------------------------------ From 415e592886da235bc8ea251cecbea08cf8a234a4 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Jan 2023 13:58:28 +0000 Subject: [PATCH 03/10] Debug message removed --- src/Core/Config/Model/Config.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Core/Config/Model/Config.php b/src/Core/Config/Model/Config.php index 0a242c8587..46d5643b34 100644 --- a/src/Core/Config/Model/Config.php +++ b/src/Core/Config/Model/Config.php @@ -27,8 +27,6 @@ use Friendica\Core\Config\Exception\ConfigFileException; use Friendica\Core\Config\Exception\ConfigPersistenceException; use Friendica\Core\Config\Util\ConfigFileManager; use Friendica\Core\Config\ValueObject\Cache; -use Friendica\Core\Logger; -use Friendica\Core\System; /** * Configuration model, which manages the whole system configuration @@ -120,7 +118,6 @@ class Config implements IManageConfigValues /** {@inheritDoc} */ public function set(string $cat, string $key, $value): bool { - Logger::debug('Set config value', ['cat' => $cat, 'key' => $key, 'value' => $value, 'callstack' => System::callstack(20)]); if ($this->configCache->set($cat, $key, $value, Cache::SOURCE_DATA)) { $this->save(); return true; From 575fb524385231961ebb49654eab0cb5d0ed2a49 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Jan 2023 14:44:57 +0000 Subject: [PATCH 04/10] Fetch data from basic auth when one of the parameters is missing --- src/Module/OAuth/Token.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/OAuth/Token.php b/src/Module/OAuth/Token.php index 6f68215cc6..ecb65048d0 100644 --- a/src/Module/OAuth/Token.php +++ b/src/Module/OAuth/Token.php @@ -60,7 +60,7 @@ class Token extends BaseApi $authorization = $_SERVER['REDIRECT_REMOTE_USER'] ?? ''; } - if (empty($request['client_id']) && substr($authorization, 0, 6) == 'Basic ') { + if ((empty($request['client_id']) || empty($request['client_secret'])) && substr($authorization, 0, 6) == 'Basic ') { // Per RFC2617, usernames can't contain a colon but password can, // so we cut on the first colon to obtain the username and the password // @see https://www.rfc-editor.org/rfc/rfc2617#section-2 From 8e4e2eecb7e332a6ba41c797031b17b9b71c445e Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 22 Jan 2023 17:10:31 +0000 Subject: [PATCH 05/10] Issue 12702: Let the user decide how to handle spoiler texts --- src/Module/Api/Mastodon/Statuses.php | 19 +++- src/Module/Settings/Connectors.php | 4 +- view/lang/C/messages.po | 107 ++++++++++-------- view/templates/settings/connectors.tpl | 1 + .../frio/templates/settings/connectors.tpl | 2 + 5 files changed, 78 insertions(+), 55 deletions(-) diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php index b7b3ff14c4..4c161193e9 100644 --- a/src/Module/Api/Mastodon/Statuses.php +++ b/src/Module/Api/Mastodon/Statuses.php @@ -71,17 +71,17 @@ class Statuses extends BaseApi } // The imput is defined as text. So we can use Markdown for some enhancements - $item = ['body' => Markdown::toBBCode($request['status']), 'app' => $this->getApp()]; + $item = ['body' => Markdown::toBBCode($request['status']), 'app' => $this->getApp(), 'title' => '']; if (!empty($request['language'])) { $item['language'] = json_encode([$request['language'] => 1]); } if (!empty($request['spoiler_text'])) { - if ($request['in_reply_to_id'] != $post['uri-id']) { - $item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body']; - } else { + if (($request['in_reply_to_id'] == $post['uri-id']) && DI::pConfig()->get($uid, 'system', 'api_spoiler_title', true)) { $item['title'] = $request['spoiler_text']; + } else { + $item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body']; } } @@ -119,6 +119,7 @@ class Statuses extends BaseApi $item['verb'] = Activity::POST; $item['contact-id'] = $owner['id']; $item['author-id'] = $item['owner-id'] = Contact::getPublicIdByUserId($uid); + $item['title'] = ''; $item['body'] = $body; $item['app'] = $this->getApp(); @@ -187,13 +188,19 @@ class Statuses extends BaseApi $item['thr-parent'] = $parent['uri']; $item['gravity'] = Item::GRAVITY_COMMENT; $item['object-type'] = Activity\ObjectType::COMMENT; - $item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body']; } else { self::checkThrottleLimit(); $item['gravity'] = Item::GRAVITY_PARENT; $item['object-type'] = Activity\ObjectType::NOTE; - $item['title'] = $request['spoiler_text']; + } + + if (!empty($request['spoiler_text'])) { + if (!$request['in_reply_to_id'] && DI::pConfig()->get($uid, 'system', 'api_spoiler_title', true)) { + $item['title'] = $request['spoiler_text']; + } else { + $item['body'] = '[abstract=' . Protocol::ACTIVITYPUB . ']' . $request['spoiler_text'] . "[/abstract]\n" . $item['body']; + } } $item = DI::contentItem()->expandTags($item, $request['visibility'] == 'direct'); diff --git a/src/Module/Settings/Connectors.php b/src/Module/Settings/Connectors.php index 7c053e1681..a48c9f8018 100644 --- a/src/Module/Settings/Connectors.php +++ b/src/Module/Settings/Connectors.php @@ -72,6 +72,7 @@ class Connectors extends BaseSettings $this->pconfig->set($this->session->getLocalUserId(), 'system', 'no_intelligent_shortening', !intval($request['enable_smart_shortening'])); $this->pconfig->set($this->session->getLocalUserId(), 'system', 'simple_shortening', intval($request['simple_shortening'])); $this->pconfig->set($this->session->getLocalUserId(), 'system', 'attach_link_title', intval($request['attach_link_title'])); + $this->pconfig->set($this->session->getLocalUserId(), 'system', 'api_spoiler_title', intval($request['api_spoiler_title'])); $this->pconfig->set($this->session->getLocalUserId(), 'ostatus', 'legacy_contact', $request['legacy_contact']); } elseif (!empty($request['mail-submit']) && function_exists('imap_open') && !$this->config->get('system', 'imap_disabled')) { $mail_server = $request['mail_server'] ?? ''; @@ -134,6 +135,7 @@ class Connectors extends BaseSettings $enable_smart_shortening = !intval($this->pconfig->get($this->session->getLocalUserId(), 'system', 'no_intelligent_shortening')); $simple_shortening = intval($this->pconfig->get($this->session->getLocalUserId(), 'system', 'simple_shortening')); $attach_link_title = intval($this->pconfig->get($this->session->getLocalUserId(), 'system', 'attach_link_title')); + $api_spoiler_title = intval($this->pconfig->get($this->session->getLocalUserId(), 'system', 'api_spoiler_title', true)); $legacy_contact = $this->pconfig->get($this->session->getLocalUserId(), 'ostatus', 'legacy_contact'); if (!empty($legacy_contact)) { @@ -218,8 +220,8 @@ class Connectors extends BaseSettings '$enable_smart_shortening' => ['enable_smart_shortening', $this->t('Enable intelligent shortening'), $enable_smart_shortening, $this->t('Normally the system tries to find the best link to add to shortened posts. If disabled, every shortened post will always point to the original friendica post.')], '$simple_shortening' => ['simple_shortening', $this->t('Enable simple text shortening'), $simple_shortening, $this->t('Normally the system shortens posts at the next line feed. If this option is enabled then the system will shorten the text at the maximum character limit.')], '$attach_link_title' => ['attach_link_title', $this->t('Attach the link title'), $attach_link_title, $this->t('When activated, the title of the attached link will be added as a title on posts to Diaspora. This is mostly helpful with "remote-self" contacts that share feed content.')], + '$api_spoiler_title' => ['api_spoiler_title', $this->t('API: Use spoiler field as title'), $api_spoiler_title, $this->t('When activated, the "spoiler_text" field in the API will be used for the title on staring posts. When deactivated it will be used for spoiler text. For comments it will be used for spoiler text in any case.')], '$legacy_contact' => ['legacy_contact', $this->t('Your legacy ActivityPub/GNU Social account'), $legacy_contact, $this->t('If you enter your old account name from an ActivityPub based system or your GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.')], - '$repair_ostatus_url' => 'ostatus/repair', '$repair_ostatus_text' => $this->t('Repair OStatus subscriptions'), diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 7634bc8e87..848fd9ce5a 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-21 09:22-0500\n" +"POT-Creation-Date: 2023-01-22 17:07+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -625,7 +625,7 @@ msgstr "" #: src/Module/Moderation/Users/Active.php:136 #: src/Module/Moderation/Users/Blocked.php:136 #: src/Module/Moderation/Users/Index.php:151 -#: src/Module/Settings/Connectors.php:239 +#: src/Module/Settings/Connectors.php:241 msgid "Delete" msgstr "" @@ -653,7 +653,7 @@ msgstr "" msgid "No system theme config value set." msgstr "" -#: src/App.php:592 +#: src/App.php:573 msgid "Apologies but the website is unavailable at the moment." msgstr "" @@ -1825,7 +1825,7 @@ msgstr "" msgid "See all notifications" msgstr "" -#: src/Content/Nav.php:315 src/Module/Settings/Connectors.php:239 +#: src/Content/Nav.php:315 src/Module/Settings/Connectors.php:241 msgid "Mark as seen" msgstr "" @@ -3663,8 +3663,8 @@ msgstr "" #: src/Module/Admin/Logs/Settings.php:81 src/Module/Admin/Site.php:438 #: src/Module/Admin/Themes/Index.php:113 src/Module/Admin/Tos.php:86 #: src/Module/Settings/Account.php:560 src/Module/Settings/Addons.php:78 -#: src/Module/Settings/Connectors.php:156 -#: src/Module/Settings/Connectors.php:241 +#: src/Module/Settings/Connectors.php:158 +#: src/Module/Settings/Connectors.php:243 #: src/Module/Settings/Delegation.php:169 src/Module/Settings/Display.php:247 #: src/Module/Settings/Features.php:76 msgid "Save Settings" @@ -5476,7 +5476,7 @@ msgstr "" msgid "Display" msgstr "" -#: src/Module/BaseSettings.php:127 src/Module/Settings/Connectors.php:200 +#: src/Module/BaseSettings.php:127 src/Module/Settings/Connectors.php:202 msgid "Social Networks" msgstr "" @@ -9365,73 +9365,73 @@ msgstr "" msgid "No Addon settings configured" msgstr "" -#: src/Module/Settings/Connectors.php:118 +#: src/Module/Settings/Connectors.php:119 msgid "Failed to connect with email account using the settings provided." msgstr "" -#: src/Module/Settings/Connectors.php:162 -#: src/Module/Settings/Connectors.php:163 +#: src/Module/Settings/Connectors.php:164 +#: src/Module/Settings/Connectors.php:165 msgid "Diaspora (Socialhome, Hubzilla)" msgstr "" -#: src/Module/Settings/Connectors.php:162 -#: src/Module/Settings/Connectors.php:166 +#: src/Module/Settings/Connectors.php:164 +#: src/Module/Settings/Connectors.php:168 #, php-format msgid "Built-in support for %s connectivity is enabled" msgstr "" -#: src/Module/Settings/Connectors.php:163 #: src/Module/Settings/Connectors.php:165 +#: src/Module/Settings/Connectors.php:167 #, php-format msgid "Built-in support for %s connectivity is disabled" msgstr "" -#: src/Module/Settings/Connectors.php:165 -#: src/Module/Settings/Connectors.php:166 +#: src/Module/Settings/Connectors.php:167 +#: src/Module/Settings/Connectors.php:168 msgid "OStatus (GNU Social)" msgstr "" -#: src/Module/Settings/Connectors.php:178 +#: src/Module/Settings/Connectors.php:180 msgid "Email access is disabled on this site." msgstr "" -#: src/Module/Settings/Connectors.php:193 -#: src/Module/Settings/Connectors.php:239 +#: src/Module/Settings/Connectors.php:195 +#: src/Module/Settings/Connectors.php:241 msgid "None" msgstr "" -#: src/Module/Settings/Connectors.php:205 +#: src/Module/Settings/Connectors.php:207 msgid "General Social Media Settings" msgstr "" -#: src/Module/Settings/Connectors.php:208 +#: src/Module/Settings/Connectors.php:210 msgid "Followed content scope" msgstr "" -#: src/Module/Settings/Connectors.php:210 +#: src/Module/Settings/Connectors.php:212 msgid "" "By default, conversations in which your follows participated but didn't " "start will be shown in your timeline. You can turn this behavior off, or " "expand it to the conversations in which your follows liked a post." msgstr "" -#: src/Module/Settings/Connectors.php:212 +#: src/Module/Settings/Connectors.php:214 msgid "Only conversations my follows started" msgstr "" -#: src/Module/Settings/Connectors.php:213 +#: src/Module/Settings/Connectors.php:215 msgid "Conversations my follows started or commented on (default)" msgstr "" -#: src/Module/Settings/Connectors.php:214 +#: src/Module/Settings/Connectors.php:216 msgid "Any conversation my follows interacted with, including likes" msgstr "" -#: src/Module/Settings/Connectors.php:217 +#: src/Module/Settings/Connectors.php:219 msgid "Enable Content Warning" msgstr "" -#: src/Module/Settings/Connectors.php:217 +#: src/Module/Settings/Connectors.php:219 msgid "" "Users on networks like Mastodon or Pleroma are able to set a content warning " "field which collapse their post by default. This enables the automatic " @@ -9439,104 +9439,115 @@ msgid "" "affect any other content filtering you eventually set up." msgstr "" -#: src/Module/Settings/Connectors.php:218 +#: src/Module/Settings/Connectors.php:220 msgid "Enable intelligent shortening" msgstr "" -#: src/Module/Settings/Connectors.php:218 +#: src/Module/Settings/Connectors.php:220 msgid "" "Normally the system tries to find the best link to add to shortened posts. " "If disabled, every shortened post will always point to the original " "friendica post." msgstr "" -#: src/Module/Settings/Connectors.php:219 +#: src/Module/Settings/Connectors.php:221 msgid "Enable simple text shortening" msgstr "" -#: src/Module/Settings/Connectors.php:219 +#: src/Module/Settings/Connectors.php:221 msgid "" "Normally the system shortens posts at the next line feed. If this option is " "enabled then the system will shorten the text at the maximum character limit." msgstr "" -#: src/Module/Settings/Connectors.php:220 +#: src/Module/Settings/Connectors.php:222 msgid "Attach the link title" msgstr "" -#: src/Module/Settings/Connectors.php:220 +#: src/Module/Settings/Connectors.php:222 msgid "" "When activated, the title of the attached link will be added as a title on " "posts to Diaspora. This is mostly helpful with \"remote-self\" contacts that " "share feed content." msgstr "" -#: src/Module/Settings/Connectors.php:221 +#: src/Module/Settings/Connectors.php:223 +msgid "API: Use spoiler field as title" +msgstr "" + +#: src/Module/Settings/Connectors.php:223 +msgid "" +"When activated, the \"spoiler_text\" field in the API will be used for the " +"title on staring posts. When deactivated it will be used for spoiler text. " +"For comments it will be used for spoiler text in any case." +msgstr "" + +#: src/Module/Settings/Connectors.php:224 msgid "Your legacy ActivityPub/GNU Social account" msgstr "" -#: src/Module/Settings/Connectors.php:221 +#: src/Module/Settings/Connectors.php:224 msgid "" "If you enter your old account name from an ActivityPub based system or your " "GNU Social/Statusnet account name here (in the format user@domain.tld), your " "contacts will be added automatically. The field will be emptied when done." msgstr "" -#: src/Module/Settings/Connectors.php:224 +#: src/Module/Settings/Connectors.php:226 msgid "Repair OStatus subscriptions" msgstr "" -#: src/Module/Settings/Connectors.php:228 +#: src/Module/Settings/Connectors.php:230 msgid "Email/Mailbox Setup" msgstr "" -#: src/Module/Settings/Connectors.php:229 +#: src/Module/Settings/Connectors.php:231 msgid "" "If you wish to communicate with email contacts using this service " "(optional), please specify how to connect to your mailbox." msgstr "" -#: src/Module/Settings/Connectors.php:230 +#: src/Module/Settings/Connectors.php:232 msgid "Last successful email check:" msgstr "" -#: src/Module/Settings/Connectors.php:232 +#: src/Module/Settings/Connectors.php:234 msgid "IMAP server name:" msgstr "" -#: src/Module/Settings/Connectors.php:233 +#: src/Module/Settings/Connectors.php:235 msgid "IMAP port:" msgstr "" -#: src/Module/Settings/Connectors.php:234 +#: src/Module/Settings/Connectors.php:236 msgid "Security:" msgstr "" -#: src/Module/Settings/Connectors.php:235 +#: src/Module/Settings/Connectors.php:237 msgid "Email login name:" msgstr "" -#: src/Module/Settings/Connectors.php:236 +#: src/Module/Settings/Connectors.php:238 msgid "Email password:" msgstr "" -#: src/Module/Settings/Connectors.php:237 +#: src/Module/Settings/Connectors.php:239 msgid "Reply-to address:" msgstr "" -#: src/Module/Settings/Connectors.php:238 +#: src/Module/Settings/Connectors.php:240 msgid "Send public posts to all email contacts:" msgstr "" -#: src/Module/Settings/Connectors.php:239 +#: src/Module/Settings/Connectors.php:241 msgid "Action after import:" msgstr "" -#: src/Module/Settings/Connectors.php:239 +#: src/Module/Settings/Connectors.php:241 msgid "Move to folder" msgstr "" -#: src/Module/Settings/Connectors.php:240 +#: src/Module/Settings/Connectors.php:242 msgid "Move to folder:" msgstr "" diff --git a/view/templates/settings/connectors.tpl b/view/templates/settings/connectors.tpl index 1cd0f73cd6..ae345ce2d3 100644 --- a/view/templates/settings/connectors.tpl +++ b/view/templates/settings/connectors.tpl @@ -16,6 +16,7 @@ {{include file="field_checkbox.tpl" field=$enable_smart_shortening}} {{include file="field_checkbox.tpl" field=$simple_shortening}} {{include file="field_checkbox.tpl" field=$attach_link_title}} + {{include file="field_checkbox.tpl" field=$api_spoiler_title}} {{include file="field_input.tpl" field=$legacy_contact}}

{{$repair_ostatus_text}}

diff --git a/view/theme/frio/templates/settings/connectors.tpl b/view/theme/frio/templates/settings/connectors.tpl index 409512d5ea..c1ebd64f3f 100644 --- a/view/theme/frio/templates/settings/connectors.tpl +++ b/view/theme/frio/templates/settings/connectors.tpl @@ -28,6 +28,8 @@ {{include file="field_checkbox.tpl" field=$attach_link_title}} + {{include file="field_checkbox.tpl" field=$api_spoiler_title}} + {{include file="field_input.tpl" field=$legacy_contact}}

{{$repair_ostatus_text}}

From 9e9aa4b108d3bbfc16f51d56fd03957516b28715 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 22 Jan 2023 21:35:24 +0100 Subject: [PATCH 06/10] Update src/Module/Admin/Summary.php Co-authored-by: Hypolite Petovan --- src/Module/Admin/Summary.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index f9c8cefbb6..9ca71e33d2 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -79,7 +79,7 @@ class Summary extends BaseAdmin // Check if github.com/friendica/stable/VERSION is higher then // the local version of Friendica. Check is opt-in, source may be stable or develop branch if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') { - $gitversion = DI::keyValue()->get('git_friendica_version'); + $gitversion = DI::keyValue()->get('git_friendica_version') ?? ''; if (version_compare(App::VERSION, $gitversion) < 0) { $warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', App::VERSION, $gitversion); From 807c2dfe6a5d90dae59ae2f7a347ce23623e884d Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 23 Jan 2023 04:52:41 +0100 Subject: [PATCH 07/10] Update src/Module/Settings/Connectors.php Co-authored-by: Hypolite Petovan --- src/Module/Settings/Connectors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Module/Settings/Connectors.php b/src/Module/Settings/Connectors.php index a48c9f8018..473531ba3e 100644 --- a/src/Module/Settings/Connectors.php +++ b/src/Module/Settings/Connectors.php @@ -220,7 +220,7 @@ class Connectors extends BaseSettings '$enable_smart_shortening' => ['enable_smart_shortening', $this->t('Enable intelligent shortening'), $enable_smart_shortening, $this->t('Normally the system tries to find the best link to add to shortened posts. If disabled, every shortened post will always point to the original friendica post.')], '$simple_shortening' => ['simple_shortening', $this->t('Enable simple text shortening'), $simple_shortening, $this->t('Normally the system shortens posts at the next line feed. If this option is enabled then the system will shorten the text at the maximum character limit.')], '$attach_link_title' => ['attach_link_title', $this->t('Attach the link title'), $attach_link_title, $this->t('When activated, the title of the attached link will be added as a title on posts to Diaspora. This is mostly helpful with "remote-self" contacts that share feed content.')], - '$api_spoiler_title' => ['api_spoiler_title', $this->t('API: Use spoiler field as title'), $api_spoiler_title, $this->t('When activated, the "spoiler_text" field in the API will be used for the title on staring posts. When deactivated it will be used for spoiler text. For comments it will be used for spoiler text in any case.')], + '$api_spoiler_title' => ['api_spoiler_title', $this->t('API: Use spoiler field as title'), $api_spoiler_title, $this->t('When activated, the "spoiler_text" field in the API will be used for the title on standalone posts. When deactivated it will be used for spoiler text. For comments it will be always be used for spoiler text.')], '$legacy_contact' => ['legacy_contact', $this->t('Your legacy ActivityPub/GNU Social account'), $legacy_contact, $this->t('If you enter your old account name from an ActivityPub based system or your GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.')], '$repair_ostatus_url' => 'ostatus/repair', '$repair_ostatus_text' => $this->t('Repair OStatus subscriptions'), From 557553a856f458c53e5e57d76d07392c6d6c6dd8 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 23 Jan 2023 06:37:45 +0000 Subject: [PATCH 08/10] Updated messages.po --- view/lang/C/messages.po | 44 ++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 7634bc8e87..24ccd012ae 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-21 09:22-0500\n" +"POT-Creation-Date: 2023-01-23 06:36+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -653,7 +653,7 @@ msgstr "" msgid "No system theme config value set." msgstr "" -#: src/App.php:592 +#: src/App.php:573 msgid "Apologies but the website is unavailable at the moment." msgstr "" @@ -3296,7 +3296,7 @@ msgstr "" msgid "Title/Description:" msgstr "" -#: src/Model/Profile.php:1023 src/Module/Admin/Summary.php:220 +#: src/Model/Profile.php:1023 src/Module/Admin/Summary.php:221 #: src/Module/Moderation/Summary.php:77 msgid "Summary" msgstr "" @@ -3623,7 +3623,7 @@ msgstr "" #: src/Module/Admin/Federation.php:207 src/Module/Admin/Logs/Settings.php:79 #: src/Module/Admin/Logs/View.php:84 src/Module/Admin/Queue.php:72 #: src/Module/Admin/Site.php:435 src/Module/Admin/Storage.php:138 -#: src/Module/Admin/Summary.php:219 src/Module/Admin/Themes/Details.php:90 +#: src/Module/Admin/Summary.php:220 src/Module/Admin/Themes/Details.php:90 #: src/Module/Admin/Themes/Index.php:111 src/Module/Admin/Tos.php:77 #: src/Module/Moderation/Users/Create.php:61 #: src/Module/Moderation/Users/Pending.php:96 @@ -5041,39 +5041,39 @@ msgid "" "to %d. See here for more information.
" msgstr "" -#: src/Module/Admin/Summary.php:84 +#: src/Module/Admin/Summary.php:85 #, php-format msgid "" "There is a new version of Friendica available for download. Your current " "version is %1$s, upstream version is %2$s" msgstr "" -#: src/Module/Admin/Summary.php:93 +#: src/Module/Admin/Summary.php:94 msgid "" "The database update failed. Please run \"php bin/console.php dbstructure " "update\" from the command line and have a look at the errors that might " "appear." msgstr "" -#: src/Module/Admin/Summary.php:97 +#: src/Module/Admin/Summary.php:98 msgid "" "The last update failed. Please run \"php bin/console.php dbstructure update" "\" from the command line and have a look at the errors that might appear. " "(Some of the errors are possibly inside the logfile.)" msgstr "" -#: src/Module/Admin/Summary.php:102 +#: src/Module/Admin/Summary.php:103 msgid "The worker was never executed. Please check your database structure!" msgstr "" -#: src/Module/Admin/Summary.php:104 +#: src/Module/Admin/Summary.php:105 #, php-format msgid "" "The last worker execution was on %s UTC. This is older than one hour. Please " "check your crontab settings." msgstr "" -#: src/Module/Admin/Summary.php:109 +#: src/Module/Admin/Summary.php:110 #, php-format msgid "" "Friendica's configuration now is stored in config/local.config.php, please " @@ -5082,7 +5082,7 @@ msgid "" "with the transition." msgstr "" -#: src/Module/Admin/Summary.php:113 +#: src/Module/Admin/Summary.php:114 #, php-format msgid "" "Friendica's configuration now is stored in config/local.config.php, please " @@ -5091,7 +5091,7 @@ msgid "" "with the transition." msgstr "" -#: src/Module/Admin/Summary.php:117 +#: src/Module/Admin/Summary.php:118 #, php-format msgid "" "Friendica's configuration store \"%s\" isn't writable. Until then database " @@ -5099,7 +5099,7 @@ msgid "" "configuration changes won't be saved." msgstr "" -#: src/Module/Admin/Summary.php:123 +#: src/Module/Admin/Summary.php:124 #, php-format msgid "" "%s is not reachable on your system. This is a severe " @@ -5107,50 +5107,50 @@ msgid "" "href=\"%s\">the installation page for help." msgstr "" -#: src/Module/Admin/Summary.php:141 +#: src/Module/Admin/Summary.php:142 #, php-format msgid "The logfile '%s' is not usable. No logging possible (error: '%s')" msgstr "" -#: src/Module/Admin/Summary.php:155 +#: src/Module/Admin/Summary.php:156 #, php-format msgid "The debug logfile '%s' is not usable. No logging possible (error: '%s')" msgstr "" -#: src/Module/Admin/Summary.php:171 +#: src/Module/Admin/Summary.php:172 #, php-format msgid "" "Friendica's system.basepath was updated from '%s' to '%s'. Please remove the " "system.basepath from your db to avoid differences." msgstr "" -#: src/Module/Admin/Summary.php:179 +#: src/Module/Admin/Summary.php:180 #, php-format msgid "" "Friendica's current system.basepath '%s' is wrong and the config file '%s' " "isn't used." msgstr "" -#: src/Module/Admin/Summary.php:187 +#: src/Module/Admin/Summary.php:188 #, php-format msgid "" "Friendica's current system.basepath '%s' is not equal to the config file " "'%s'. Please fix your configuration." msgstr "" -#: src/Module/Admin/Summary.php:198 +#: src/Module/Admin/Summary.php:199 msgid "Message queues" msgstr "" -#: src/Module/Admin/Summary.php:204 +#: src/Module/Admin/Summary.php:205 msgid "Server Settings" msgstr "" -#: src/Module/Admin/Summary.php:222 +#: src/Module/Admin/Summary.php:223 msgid "Version" msgstr "" -#: src/Module/Admin/Summary.php:226 +#: src/Module/Admin/Summary.php:227 msgid "Active addons" msgstr "" From 75cac38fe332018d2341dadcab63dacd60ee5aaa Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 23 Jan 2023 06:43:13 +0000 Subject: [PATCH 09/10] Updated messages.po --- database.sql | 2 +- src/Module/Admin/Summary.php | 3 ++- src/Module/OAuth/Token.php | 2 +- src/Worker/CheckVersion.php | 2 +- static/dbstructure.config.php | 2 +- update.php | 9 +++++++ view/lang/C/messages.po | 46 +++++++++++++++++------------------ 7 files changed, 38 insertions(+), 28 deletions(-) diff --git a/database.sql b/database.sql index 0b91aedc06..843db1f6cf 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2023.03-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1512 +-- DB_UPDATE_VERSION 1513 -- ------------------------------------------ diff --git a/src/Module/Admin/Summary.php b/src/Module/Admin/Summary.php index e963e7606d..9ca71e33d2 100644 --- a/src/Module/Admin/Summary.php +++ b/src/Module/Admin/Summary.php @@ -79,7 +79,8 @@ class Summary extends BaseAdmin // Check if github.com/friendica/stable/VERSION is higher then // the local version of Friendica. Check is opt-in, source may be stable or develop branch if (DI::config()->get('system', 'check_new_version_url', 'none') != 'none') { - $gitversion = DI::config()->get('system', 'git_friendica_version'); + $gitversion = DI::keyValue()->get('git_friendica_version') ?? ''; + if (version_compare(App::VERSION, $gitversion) < 0) { $warningtext[] = DI::l10n()->t('There is a new version of Friendica available for download. Your current version is %1$s, upstream version is %2$s', App::VERSION, $gitversion); } diff --git a/src/Module/OAuth/Token.php b/src/Module/OAuth/Token.php index 6f68215cc6..ecb65048d0 100644 --- a/src/Module/OAuth/Token.php +++ b/src/Module/OAuth/Token.php @@ -60,7 +60,7 @@ class Token extends BaseApi $authorization = $_SERVER['REDIRECT_REMOTE_USER'] ?? ''; } - if (empty($request['client_id']) && substr($authorization, 0, 6) == 'Basic ') { + if ((empty($request['client_id']) || empty($request['client_secret'])) && substr($authorization, 0, 6) == 'Basic ') { // Per RFC2617, usernames can't contain a colon but password can, // so we cut on the first colon to obtain the username and the password // @see https://www.rfc-editor.org/rfc/rfc2617#section-2 diff --git a/src/Worker/CheckVersion.php b/src/Worker/CheckVersion.php index 6676e51127..f4c45fe33d 100644 --- a/src/Worker/CheckVersion.php +++ b/src/Worker/CheckVersion.php @@ -58,7 +58,7 @@ class CheckVersion $gitversion = DBA::escape(trim(DI::httpClient()->fetch($checked_url, HttpClientAccept::TEXT))); Logger::notice("Upstream VERSION is: ".$gitversion); - DI::config()->set('system', 'git_friendica_version', $gitversion); + DI::keyValue()->set('git_friendica_version', $gitversion); Logger::notice('checkversion: end'); diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 4329410b4a..9dfd7820c1 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -55,7 +55,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1512); + define('DB_UPDATE_VERSION', 1513); } return [ diff --git a/update.php b/update.php index 8f93775259..7d9a9d2363 100644 --- a/update.php +++ b/update.php @@ -1244,3 +1244,12 @@ function update_1512() DI::config()->delete('nodeinfo', 'local_posts'); DI::config()->delete('nodeinfo', 'local_comments'); } + +function update_1513() +{ + DI::keyValue()->set('git_friendica_version', DI::config()->get('system', 'git_friendica_version')); + DI::keyValue()->set('twitter_application_name', DI::config()->get('twitter', 'application_name')); + + DI::config()->delete('system', 'git_friendica_version'); + DI::config()->delete('twitter', 'application_name'); +} diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 848fd9ce5a..a5992bdc72 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-22 17:07+0000\n" +"POT-Creation-Date: 2023-01-23 06:41+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -3296,7 +3296,7 @@ msgstr "" msgid "Title/Description:" msgstr "" -#: src/Model/Profile.php:1023 src/Module/Admin/Summary.php:220 +#: src/Model/Profile.php:1023 src/Module/Admin/Summary.php:221 #: src/Module/Moderation/Summary.php:77 msgid "Summary" msgstr "" @@ -3623,7 +3623,7 @@ msgstr "" #: src/Module/Admin/Federation.php:207 src/Module/Admin/Logs/Settings.php:79 #: src/Module/Admin/Logs/View.php:84 src/Module/Admin/Queue.php:72 #: src/Module/Admin/Site.php:435 src/Module/Admin/Storage.php:138 -#: src/Module/Admin/Summary.php:219 src/Module/Admin/Themes/Details.php:90 +#: src/Module/Admin/Summary.php:220 src/Module/Admin/Themes/Details.php:90 #: src/Module/Admin/Themes/Index.php:111 src/Module/Admin/Tos.php:77 #: src/Module/Moderation/Users/Create.php:61 #: src/Module/Moderation/Users/Pending.php:96 @@ -5041,39 +5041,39 @@ msgid "" "to %d. See here for more information.
" msgstr "" -#: src/Module/Admin/Summary.php:84 +#: src/Module/Admin/Summary.php:85 #, php-format msgid "" "There is a new version of Friendica available for download. Your current " "version is %1$s, upstream version is %2$s" msgstr "" -#: src/Module/Admin/Summary.php:93 +#: src/Module/Admin/Summary.php:94 msgid "" "The database update failed. Please run \"php bin/console.php dbstructure " "update\" from the command line and have a look at the errors that might " "appear." msgstr "" -#: src/Module/Admin/Summary.php:97 +#: src/Module/Admin/Summary.php:98 msgid "" "The last update failed. Please run \"php bin/console.php dbstructure update" "\" from the command line and have a look at the errors that might appear. " "(Some of the errors are possibly inside the logfile.)" msgstr "" -#: src/Module/Admin/Summary.php:102 +#: src/Module/Admin/Summary.php:103 msgid "The worker was never executed. Please check your database structure!" msgstr "" -#: src/Module/Admin/Summary.php:104 +#: src/Module/Admin/Summary.php:105 #, php-format msgid "" "The last worker execution was on %s UTC. This is older than one hour. Please " "check your crontab settings." msgstr "" -#: src/Module/Admin/Summary.php:109 +#: src/Module/Admin/Summary.php:110 #, php-format msgid "" "Friendica's configuration now is stored in config/local.config.php, please " @@ -5082,7 +5082,7 @@ msgid "" "with the transition." msgstr "" -#: src/Module/Admin/Summary.php:113 +#: src/Module/Admin/Summary.php:114 #, php-format msgid "" "Friendica's configuration now is stored in config/local.config.php, please " @@ -5091,7 +5091,7 @@ msgid "" "with the transition." msgstr "" -#: src/Module/Admin/Summary.php:117 +#: src/Module/Admin/Summary.php:118 #, php-format msgid "" "Friendica's configuration store \"%s\" isn't writable. Until then database " @@ -5099,7 +5099,7 @@ msgid "" "configuration changes won't be saved." msgstr "" -#: src/Module/Admin/Summary.php:123 +#: src/Module/Admin/Summary.php:124 #, php-format msgid "" "%s is not reachable on your system. This is a severe " @@ -5107,50 +5107,50 @@ msgid "" "href=\"%s\">the installation page for help." msgstr "" -#: src/Module/Admin/Summary.php:141 +#: src/Module/Admin/Summary.php:142 #, php-format msgid "The logfile '%s' is not usable. No logging possible (error: '%s')" msgstr "" -#: src/Module/Admin/Summary.php:155 +#: src/Module/Admin/Summary.php:156 #, php-format msgid "The debug logfile '%s' is not usable. No logging possible (error: '%s')" msgstr "" -#: src/Module/Admin/Summary.php:171 +#: src/Module/Admin/Summary.php:172 #, php-format msgid "" "Friendica's system.basepath was updated from '%s' to '%s'. Please remove the " "system.basepath from your db to avoid differences." msgstr "" -#: src/Module/Admin/Summary.php:179 +#: src/Module/Admin/Summary.php:180 #, php-format msgid "" "Friendica's current system.basepath '%s' is wrong and the config file '%s' " "isn't used." msgstr "" -#: src/Module/Admin/Summary.php:187 +#: src/Module/Admin/Summary.php:188 #, php-format msgid "" "Friendica's current system.basepath '%s' is not equal to the config file " "'%s'. Please fix your configuration." msgstr "" -#: src/Module/Admin/Summary.php:198 +#: src/Module/Admin/Summary.php:199 msgid "Message queues" msgstr "" -#: src/Module/Admin/Summary.php:204 +#: src/Module/Admin/Summary.php:205 msgid "Server Settings" msgstr "" -#: src/Module/Admin/Summary.php:222 +#: src/Module/Admin/Summary.php:223 msgid "Version" msgstr "" -#: src/Module/Admin/Summary.php:226 +#: src/Module/Admin/Summary.php:227 msgid "Active addons" msgstr "" @@ -9478,8 +9478,8 @@ msgstr "" #: src/Module/Settings/Connectors.php:223 msgid "" "When activated, the \"spoiler_text\" field in the API will be used for the " -"title on staring posts. When deactivated it will be used for spoiler text. " -"For comments it will be used for spoiler text in any case." +"title on standalone posts. When deactivated it will be used for spoiler " +"text. For comments it will be always be used for spoiler text." msgstr "" #: src/Module/Settings/Connectors.php:224 From 87e9dafc563a6fe91d9eb6880efa10c354b944e0 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 23 Jan 2023 06:48:42 +0000 Subject: [PATCH 10/10] Removed duplicated "be" --- src/Module/Settings/Connectors.php | 2 +- view/lang/C/messages.po | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Module/Settings/Connectors.php b/src/Module/Settings/Connectors.php index 473531ba3e..99d4ea9912 100644 --- a/src/Module/Settings/Connectors.php +++ b/src/Module/Settings/Connectors.php @@ -220,7 +220,7 @@ class Connectors extends BaseSettings '$enable_smart_shortening' => ['enable_smart_shortening', $this->t('Enable intelligent shortening'), $enable_smart_shortening, $this->t('Normally the system tries to find the best link to add to shortened posts. If disabled, every shortened post will always point to the original friendica post.')], '$simple_shortening' => ['simple_shortening', $this->t('Enable simple text shortening'), $simple_shortening, $this->t('Normally the system shortens posts at the next line feed. If this option is enabled then the system will shorten the text at the maximum character limit.')], '$attach_link_title' => ['attach_link_title', $this->t('Attach the link title'), $attach_link_title, $this->t('When activated, the title of the attached link will be added as a title on posts to Diaspora. This is mostly helpful with "remote-self" contacts that share feed content.')], - '$api_spoiler_title' => ['api_spoiler_title', $this->t('API: Use spoiler field as title'), $api_spoiler_title, $this->t('When activated, the "spoiler_text" field in the API will be used for the title on standalone posts. When deactivated it will be used for spoiler text. For comments it will be always be used for spoiler text.')], + '$api_spoiler_title' => ['api_spoiler_title', $this->t('API: Use spoiler field as title'), $api_spoiler_title, $this->t('When activated, the "spoiler_text" field in the API will be used for the title on standalone posts. When deactivated it will be used for spoiler text. For comments it will always be used for spoiler text.')], '$legacy_contact' => ['legacy_contact', $this->t('Your legacy ActivityPub/GNU Social account'), $legacy_contact, $this->t('If you enter your old account name from an ActivityPub based system or your GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.')], '$repair_ostatus_url' => 'ostatus/repair', '$repair_ostatus_text' => $this->t('Repair OStatus subscriptions'), diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 79e2e65497..89d7808676 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2023.03-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-23 06:44+0000\n" +"POT-Creation-Date: 2023-01-23 06:47+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -9479,7 +9479,7 @@ msgstr "" msgid "" "When activated, the \"spoiler_text\" field in the API will be used for the " "title on standalone posts. When deactivated it will be used for spoiler " -"text. For comments it will be always be used for spoiler text." +"text. For comments it will always be used for spoiler text." msgstr "" #: src/Module/Settings/Connectors.php:224