From f0f7a5f9589348e27fa66b1a02e90d669bfc6874 Mon Sep 17 00:00:00 2001 From: wn_ Date: Fri, 3 Feb 2023 00:45:04 +0000 Subject: [PATCH 1/8] Ensure custom favicon color detection happens. --- classes/rssutils.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/rssutils.php b/classes/rssutils.php index 561171d09..b3363954c 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -600,7 +600,8 @@ class RSSUtils { Debug::log("favicon: needs check: {$feed_obj->favicon_needs_check} is custom: {$feed_obj->favicon_is_custom} avg color: {$feed_obj->favicon_avg_color}", Debug::LOG_VERBOSE); - if ($feed_obj->favicon_needs_check || $force_refetch) { + if ($feed_obj->favicon_needs_check || $force_refetch + || ($feed_obj->favicon_is_custom && !$feed_obj->favicon_avg_color)) { // restrict update attempts to once per 12h $feed_obj->favicon_last_checked = Db::NOW(); From 380624a4840f99457b23ed3223f37d4d79b9d1f2 Mon Sep 17 00:00:00 2001 From: wn_ Date: Fri, 3 Feb 2023 01:02:38 +0000 Subject: [PATCH 2/8] Persist failure to detect favicon average color. Previously, an empty string returned by '\Colors\calculate_avg_color()' would be set as the 'favicon_avg_color' value, resulting in always reattempting average color calculation. --- classes/rssutils.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/rssutils.php b/classes/rssutils.php index b3363954c..26e9dd033 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -633,12 +633,14 @@ class RSSUtils { $feed_obj->save(); $feed_obj->favicon_avg_color = \Colors\calculate_avg_color($favicon_cache->get_full_path($feed)); - $feed_obj->save(); + if ($feed_obj->favicon_avg_color) { + $feed_obj->save(); + } Debug::log("favicon: avg color: {$feed_obj->favicon_avg_color}", Debug::LOG_VERBOSE); } else if ($feed_obj->favicon_avg_color == 'fail') { - Debug::log("floicon failed on $feed, not trying to recalculate avg color", Debug::LOG_VERBOSE); + Debug::log("floicon failed on $feed or a suitable avg color couldn't be determined, not trying to recalculate avg color", Debug::LOG_VERBOSE); } } From f484988967511a45b871e8820d5a9b90de5781ba Mon Sep 17 00:00:00 2001 From: wn_ Date: Fri, 3 Feb 2023 01:17:50 +0000 Subject: [PATCH 3/8] Fix logging favicon-related bools in 'RSSUtils::update_rss_feed()'. --- classes/rssutils.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/rssutils.php b/classes/rssutils.php index 26e9dd033..1c07e601c 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -597,7 +597,9 @@ class RSSUtils { Debug::log("site_url: {$feed_obj->site_url}", Debug::LOG_VERBOSE); Debug::log("feed_title: {$rss->get_title()}", Debug::LOG_VERBOSE); - Debug::log("favicon: needs check: {$feed_obj->favicon_needs_check} is custom: {$feed_obj->favicon_is_custom} avg color: {$feed_obj->favicon_avg_color}", + Debug::log('favicon: needs check: ' . ($feed_obj->favicon_needs_check ? 'true' : 'false') + . ', is custom: ' . ($feed_obj->favicon_is_custom ? 'true' : 'false') + . ", avg color: {$feed_obj->favicon_avg_color}", Debug::LOG_VERBOSE); if ($feed_obj->favicon_needs_check || $force_refetch From b28d339bf2d21813864a420e0ae0332d86ce56ae Mon Sep 17 00:00:00 2001 From: wn_ Date: Fri, 3 Feb 2023 01:28:15 +0000 Subject: [PATCH 4/8] Don't set 'favicon_avg_color' on feed obj unless it's valid. --- classes/rssutils.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/rssutils.php b/classes/rssutils.php index 1c07e601c..daa856a0d 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -634,8 +634,9 @@ class RSSUtils { $feed_obj->favicon_avg_color = 'fail'; $feed_obj->save(); - $feed_obj->favicon_avg_color = \Colors\calculate_avg_color($favicon_cache->get_full_path($feed)); - if ($feed_obj->favicon_avg_color) { + $calculated_avg_color = \Colors\calculate_avg_color($favicon_cache->get_full_path($feed)); + if ($calculated_avg_color) { + $feed_obj->favicon_avg_color = $calculated_avg_color; $feed_obj->save(); } From 1646aba944bda7a90b02829d6eb47fa03f7cd1bd Mon Sep 17 00:00:00 2001 From: wn_ Date: Fri, 3 Feb 2023 01:30:35 +0000 Subject: [PATCH 5/8] Minor tweak to favicon avg color debug log message. --- classes/rssutils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/rssutils.php b/classes/rssutils.php index daa856a0d..df7727eb1 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -640,7 +640,7 @@ class RSSUtils { $feed_obj->save(); } - Debug::log("favicon: avg color: {$feed_obj->favicon_avg_color}", Debug::LOG_VERBOSE); + Debug::log("favicon: calculated avg color: {$calculated_avg_color}, setting avg color: {$feed_obj->favicon_avg_color}", Debug::LOG_VERBOSE); } else if ($feed_obj->favicon_avg_color == 'fail') { Debug::log("floicon failed on $feed or a suitable avg color couldn't be determined, not trying to recalculate avg color", Debug::LOG_VERBOSE); From 40afee5d1295729105dbebf7f042ccdadd9fae41 Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen <645432-yan12125@users.noreply.gitlab.com> Date: Fri, 10 Feb 2023 18:20:42 +0800 Subject: [PATCH 6/8] Fix calculating average color for *.ico Currently colorPalette() always fails for *.ico due to a logic error. It's a regression from 8f749fe61b038833069c4e2d0dec4749643b4371. --- include/colors.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/colors.php b/include/colors.php index 5682b55a1..64e24f8f1 100644 --- a/include/colors.php +++ b/include/colors.php @@ -355,8 +355,9 @@ function colorPalette(string $imageFile, int $numColors, int $granularity = 5): } else { $img = @$ico->images[count($ico->images)-1]->getImageResource(); } + } else { + return null; } - return null; } else if ($size[0] > 0 && $size[1] > 0) { $img = @imagecreatefromstring(file_get_contents($imageFile)); } From fd55e492c3a9c6dc583336d65d81e7e6d0009363 Mon Sep 17 00:00:00 2001 From: wn_ Date: Fri, 17 Feb 2023 12:10:51 +0000 Subject: [PATCH 7/8] Handle fetch issues in 'RSSUtils::update_basic_info'. --- classes/rssutils.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/classes/rssutils.php b/classes/rssutils.php index df7727eb1..385ab31e6 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -316,14 +316,20 @@ class RSSUtils { $feed_data = trim($feed_data); - $rss = new FeedParser($feed_data); - $rss->init(); + if ($feed_data) { + $rss = new FeedParser($feed_data); + $rss->init(); - if (!$rss->error()) { - $basic_info = [ - 'title' => mb_substr(clean($rss->get_title()), 0, 199), - 'site_url' => mb_substr(UrlHelper::rewrite_relative($feed->feed_url, clean($rss->get_link())), 0, 245), - ]; + if (!$rss->error()) { + $basic_info = [ + 'title' => mb_substr(clean($rss->get_title()), 0, 199), + 'site_url' => mb_substr(UrlHelper::rewrite_relative($feed->feed_url, clean($rss->get_link())), 0, 245), + ]; + } else { + Debug::log(sprintf("unable to parse feed for basic info: %s", $rss->error()), Debug::LOG_VERBOSE); + } + } else { + Debug::log(sprintf("unable to fetch feed for basic info: %s [%s]", UrlHelper::$fetch_last_error, UrlHelper::$fetch_last_error_code), Debug::LOG_VERBOSE); } } From aa2b770e3068705bd948196c82e396513ffc8a01 Mon Sep 17 00:00:00 2001 From: Veit Lehmann Date: Fri, 24 Feb 2023 00:46:40 +0100 Subject: [PATCH 8/8] add override links to utility views This enables `local-overrides.css` and `local-overrides.js` for all utility views, for example to add polyfills, enable responsive styling or to adjust styles globally. --- classes/feeds.php | 1 + classes/handler/public.php | 1 + plugins/auth_internal/init.php | 1 + plugins/bookmarklets/init.php | 2 ++ plugins/share/init.php | 1 + 5 files changed, 6 insertions(+) diff --git a/classes/feeds.php b/classes/feeds.php index de2f750cd..b4b20d2fc 100755 --- a/classes/feeds.php +++ b/classes/feeds.php @@ -706,6 +706,7 @@ class Feeds extends Handler_Protected { + +

diff --git a/plugins/bookmarklets/init.php b/plugins/bookmarklets/init.php index 4a7a35608..f5b3ab1ca 100644 --- a/plugins/bookmarklets/init.php +++ b/plugins/bookmarklets/init.php @@ -56,6 +56,7 @@ class Bookmarklets extends Plugin { display : none; } +