Merge branch 'master' of git.tt-rss.org:tt-rss/tt-rss

This commit is contained in:
Andrew Dolgov 2023-02-25 19:31:07 +03:00
commit 04c2fa9f15
No known key found for this signature in database
GPG Key ID: 1A56B4FA25D4AF2A
7 changed files with 33 additions and 14 deletions

View File

@ -706,6 +706,7 @@ class Feeds extends Handler_Protected {
<?= javascript_tag("js/common.js") ?> <?= javascript_tag("js/common.js") ?>
<?= javascript_tag("lib/dojo/dojo.js") ?> <?= javascript_tag("lib/dojo/dojo.js") ?>
<?= javascript_tag("lib/dojo/tt-rss-layer.js") ?> <?= javascript_tag("lib/dojo/tt-rss-layer.js") ?>
<?= Config::get_override_links() ?>
</head> </head>
<body class="flat ttrss_utility feed_debugger css_loading"> <body class="flat ttrss_utility feed_debugger css_loading">
<script type="text/javascript"> <script type="text/javascript">

View File

@ -451,6 +451,7 @@ class Handler_Public extends Handler {
echo javascript_tag("lib/dojo/dojo.js"); echo javascript_tag("lib/dojo/dojo.js");
echo javascript_tag("lib/dojo/tt-rss-layer.js"); echo javascript_tag("lib/dojo/tt-rss-layer.js");
?> ?>
<?= Config::get_override_links() ?>
</head> </head>
<body class='flat ttrss_utility'> <body class='flat ttrss_utility'>
<div class='container'> <div class='container'>

View File

@ -316,14 +316,20 @@ class RSSUtils {
$feed_data = trim($feed_data); $feed_data = trim($feed_data);
$rss = new FeedParser($feed_data); if ($feed_data) {
$rss->init(); $rss = new FeedParser($feed_data);
$rss->init();
if (!$rss->error()) { if (!$rss->error()) {
$basic_info = [ $basic_info = [
'title' => mb_substr(clean($rss->get_title()), 0, 199), '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), '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);
} }
} }
@ -597,10 +603,13 @@ class RSSUtils {
Debug::log("site_url: {$feed_obj->site_url}", Debug::LOG_VERBOSE); Debug::log("site_url: {$feed_obj->site_url}", Debug::LOG_VERBOSE);
Debug::log("feed_title: {$rss->get_title()}", 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); 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 // restrict update attempts to once per 12h
$feed_obj->favicon_last_checked = Db::NOW(); $feed_obj->favicon_last_checked = Db::NOW();
@ -631,13 +640,16 @@ class RSSUtils {
$feed_obj->favicon_avg_color = 'fail'; $feed_obj->favicon_avg_color = 'fail';
$feed_obj->save(); $feed_obj->save();
$feed_obj->favicon_avg_color = \Colors\calculate_avg_color($favicon_cache->get_full_path($feed)); $calculated_avg_color = \Colors\calculate_avg_color($favicon_cache->get_full_path($feed));
$feed_obj->save(); if ($calculated_avg_color) {
$feed_obj->favicon_avg_color = $calculated_avg_color;
$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') { } 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);
} }
} }

View File

@ -355,8 +355,9 @@ function colorPalette(string $imageFile, int $numColors, int $granularity = 5):
} else { } else {
$img = @$ico->images[count($ico->images)-1]->getImageResource(); $img = @$ico->images[count($ico->images)-1]->getImageResource();
} }
} else {
return null;
} }
return null;
} else if ($size[0] > 0 && $size[1] > 0) { } else if ($size[0] > 0 && $size[1] > 0) {
$img = @imagecreatefromstring(file_get_contents($imageFile)); $img = @imagecreatefromstring(file_get_contents($imageFile));
} }

View File

@ -76,6 +76,7 @@ class Auth_Internal extends Auth_Base {
}, },
}; };
</script> </script>
<?= Config::get_override_links() ?>
</head> </head>
<body class="flat ttrss_utility otp css_loading"> <body class="flat ttrss_utility otp css_loading">
<h1><?= __("Authentication") ?></h1> <h1><?= __("Authentication") ?></h1>

View File

@ -56,6 +56,7 @@ class Bookmarklets extends Plugin {
display : none; display : none;
} }
</style> </style>
<?= Config::get_override_links() ?>
</head> </head>
<body class='flat ttrss_utility css_loading'> <body class='flat ttrss_utility css_loading'>
<script type="text/javascript"> <script type="text/javascript">
@ -202,6 +203,7 @@ class Bookmarklets extends Plugin {
display : none; display : none;
} }
</style> </style>
<?= Config::get_override_links() ?>
</head> </head>
<body class='flat ttrss_utility share_popup css_loading'> <body class='flat ttrss_utility share_popup css_loading'>
<script type="text/javascript"> <script type="text/javascript">

View File

@ -195,6 +195,7 @@ class Share extends Plugin {
) )
), 500, "...")) ?>"> ), 500, "...")) ?>">
<meta property='og:image' content="<?= htmlspecialchars($og_image) ?>"> <meta property='og:image' content="<?= htmlspecialchars($og_image) ?>">
<?= Config::get_override_links() ?>
</head> </head>
<body class='flat ttrss_utility ttrss_zoom css_loading'> <body class='flat ttrss_utility ttrss_zoom css_loading'>