aboutsummaryrefslogtreecommitdiff
path: root/p/f.php
diff options
context:
space:
mode:
authorGravatar Inverle <inverle@proton.me> 2025-09-05 08:16:52 +0200
committerGravatar GitHub <noreply@github.com> 2025-09-05 08:16:52 +0200
commit858616f075e5a66a5e0973af421a9f300b3b9ce1 (patch)
treea67eb709c387d03b6471a41fd6b76c60ed2334bf /p/f.php
parent6c9a9ee2266d7fec554d53218a29d121a4a08ee8 (diff)
Fixes for no-cache.txt (#7907)
* Closes and fixes error from #7885 * `no-cache.txt` is now respected in `f.php`, `ext.php` and `serve` action in `extensionController` * And in all other places that weren't checking for `no-cache.txt` (some extensions maybe)
Diffstat (limited to 'p/f.php')
-rw-r--r--p/f.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/p/f.php b/p/f.php
index fc9a60abd..0238e5846 100644
--- a/p/f.php
+++ b/p/f.php
@@ -8,9 +8,12 @@ require(LIB_PATH . '/http-conditional.php');
header("Content-Security-Policy: default-src 'none'; frame-ancestors 'none'; sandbox");
header('X-Content-Type-Options: nosniff');
+$no_cache = file_exists(DATA_PATH . '/no-cache.txt');
+
function show_default_favicon(int $cacheSeconds = 3600): void {
+ global $no_cache;
$default_mtime = @filemtime(DEFAULT_FAVICON) ?: 0;
- if (!httpConditional($default_mtime, $cacheSeconds, 2)) {
+ if ($no_cache || !httpConditional($default_mtime, $cacheSeconds, 2)) {
header('Content-Type: image/x-icon');
header('Content-Disposition: inline; filename="default_favicon.ico"');
readfile(DEFAULT_FAVICON);
@@ -59,11 +62,11 @@ if (($ico_mtime == false || $ico_mtime < $txt_mtime || ($ico_mtime < time() - (m
}
}
-if (!httpConditional($ico_mtime, mt_rand(14, 21) * 86400, 2)) {
+if ($no_cache || !httpConditional($ico_mtime, mt_rand(14, 21) * 86400, 2)) {
$ico_content_type = contentType($ico);
header('Content-Type: ' . $ico_content_type);
header('Content-Disposition: inline; filename="' . $id . '.ico"');
- if (isset($_GET['t'])) {
+ if (!$no_cache && isset($_GET['t'])) {
header('Cache-Control: immutable');
}
readfile($ico);