From b1b0bfc280fcba90d56b1b2d0c89f0c138fff6a5 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 19 Dec 2022 10:05:21 -0500 Subject: [PATCH 1/4] Don't compute system.update_interval when it's -1 (disabled) - Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1357768936 --- src/Module/Update/Display.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Module/Update/Display.php b/src/Module/Update/Display.php index 4b84cba7a8..9f149d7dc8 100644 --- a/src/Module/Update/Display.php +++ b/src/Module/Update/Display.php @@ -59,9 +59,9 @@ class Display extends DisplayModule $parentUriId = $item['parent-uri-id']; if (empty($force)) { - $browserUpdate = $this->pConfig->get($profileUid, 'system', 'update_interval'); - if (!empty($browserUpdate)) { - $updateDate = date(DateTimeFormat::MYSQL, time() - (intval($browserUpdate) / 500)); + $browserUpdate = intval($this->pConfig->get($profileUid, 'system', 'update_interval') ?? 40000); + if ($browserUpdate >= 1000) { + $updateDate = date(DateTimeFormat::MYSQL, time() - ($browserUpdate * 2 / 1000)); if (!Post::exists([ "`parent-uri-id` = ? AND `uid` IN (?, ?) AND `received` > ?", $parentUriId, 0, From 6a17223289034476b6aa906cfbd2063bb08ce0cf Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 19 Dec 2022 10:11:12 -0500 Subject: [PATCH 2/4] Ward against null value in language key of item array in Mastodon\Status object - Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1357768936 --- src/Object/Api/Mastodon/Status.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Object/Api/Mastodon/Status.php b/src/Object/Api/Mastodon/Status.php index 2889388558..eae53ef4a9 100644 --- a/src/Object/Api/Mastodon/Status.php +++ b/src/Object/Api/Mastodon/Status.php @@ -114,7 +114,7 @@ class Status extends BaseDataTransferObject $visibility = ['public', 'private', 'unlisted']; $this->visibility = $visibility[$item['private']]; - $languages = json_decode($item['language'], true); + $languages = json_decode($item['language'] ?? '', true); if (is_array($languages)) { reset($languages); $this->language = key($languages); From 06ea61f0edc0164d40f65594386a3148802ed96a Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 19 Dec 2022 10:17:57 -0500 Subject: [PATCH 3/4] Provide default value for system.banner config key - Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1357768936 --- src/Module/Admin/Site.php | 4 ---- static/settings.config.php | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Module/Admin/Site.php b/src/Module/Admin/Site.php index ef7d5b9871..a6e73cea4a 100644 --- a/src/Module/Admin/Site.php +++ b/src/Module/Admin/Site.php @@ -388,10 +388,6 @@ class Site extends BaseAdmin /* Banner */ $banner = DI::config()->get('system', 'banner'); - if ($banner == false) { - $banner = 'logoFriendica'; - } - $email_banner = DI::config()->get('system', 'email_banner'); if ($email_banner == false) { diff --git a/static/settings.config.php b/static/settings.config.php index 3ec7fef9b7..4cebd0955b 100644 --- a/static/settings.config.php +++ b/static/settings.config.php @@ -64,6 +64,10 @@ return [ // Themes users can change to in their settings. 'allowed_themes' => 'frio,vier', + // banner (HTML string) + // HTML snippet of the top navigation banner. Not supported by frio. + 'banner' => 'logoFriendica', + // cache_contact_avatar (Boolean) // Cache versions of the contact avatars. Uses a lot of storage space 'cache_contact_avatar' => true, From f2188835e79fc850fd4ae56083cc78092cbf4f00 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Mon, 19 Dec 2022 10:22:05 -0500 Subject: [PATCH 4/4] Add logging and default value when JSON encode->decode fails in JsonLD::compact - Address part of https://github.com/friendica/friendica/issues/12011#issuecomment-1357768936 --- src/Util/JsonLD.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Util/JsonLD.php b/src/Util/JsonLD.php index 25ce74fcc7..51d15cb10a 100644 --- a/src/Util/JsonLD.php +++ b/src/Util/JsonLD.php @@ -140,7 +140,7 @@ class JsonLD * @return array Compacted JSON array * @throws Exception */ - public static function compact($json, bool $logfailed = true) + public static function compact($json, bool $logfailed = true): array { jsonld_set_document_loader('Friendica\Util\JsonLD::documentLoader'); @@ -203,6 +203,11 @@ class JsonLD $json = json_decode(json_encode($compacted, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), true); + if ($json === false) { + Logger::notice('JSON encode->decode failed', ['orig_json' => $orig_json, 'compacted' => $compacted]); + $json = []; + } + return $json; }