Przeglądaj źródła

Merge pull request #1304 from Alkarex/favicon-refresh

Randomize favicon refresh
Alexandre Alapetite 9 lat temu
rodzic
commit
2630393587
2 zmienionych plików z 3 dodań i 3 usunięć
  1. 1 1
      CHANGELOG.md
  2. 2 2
      p/f.php

+ 1 - 1
CHANGELOG.md

@@ -15,7 +15,7 @@
 	* In a multi-user context, take better advantage of other users’ refreshes [#1280](https://github.com/FreshRSS/FreshRSS/pull/1280)
 	* Support custom ports `localhost:3306` for database servers [#1241](https://github.com/FreshRSS/FreshRSS/issues/1241)
 	* Add date to exported files [#1240](https://github.com/FreshRSS/FreshRSS/issues/1240)
-	* Auto-refresh favicons after 15 days [#1181](https://github.com/FreshRSS/FreshRSS/issues/1181)
+	* Auto-refresh favicons once or twice a month [#1181](https://github.com/FreshRSS/FreshRSS/issues/1181), [#1298](https://github.com/FreshRSS/FreshRSS/issues/1298)
 * Bug fixing
 	* Correction of bugs related CSRF tokens introduced in version 1.5.0 [#1253](https://github.com/FreshRSS/FreshRSS/issues/1253), [44f22ab](https://github.com/FreshRSS/FreshRSS/pull/1261/commits/d9bf9b2c6f0b2cc9dec3b638841b7e3040dcf46f)
 	* Fix bug in Global view introduced in version 1.5.0 [#1269](https://github.com/FreshRSS/FreshRSS/pull/1269)

+ 2 - 2
p/f.php

@@ -71,7 +71,7 @@ $txt_mtime = @filemtime($txt);
 
 header('Content-Type: image/x-icon');
 
-if ($ico_mtime == false || $txt_mtime > $ico_mtime || ($ico_mtime < time() - 15 * 86400)) {
+if ($ico_mtime == false || $txt_mtime > $ico_mtime || ($ico_mtime < time() - (rand(15, 20) * 86400))) {
 	if ($txt_mtime == false) {
 		show_default_favicon(1800);
 		exit();
@@ -92,6 +92,6 @@ if ($ico_mtime == false || $txt_mtime > $ico_mtime || ($ico_mtime < time() - 15
 
 header('Content-Disposition: inline; filename="' . $id . '.ico"');
 
-if (!httpConditional($ico_mtime, 2592000, 2)) {
+if (!httpConditional($ico_mtime, rand(14, 21) * 86400, 2)) {
 	readfile($ico);
 }