|
@@ -8,9 +8,12 @@ require(LIB_PATH . '/http-conditional.php');
|
|
|
header("Content-Security-Policy: default-src 'none'; frame-ancestors 'none'; sandbox");
|
|
header("Content-Security-Policy: default-src 'none'; frame-ancestors 'none'; sandbox");
|
|
|
header('X-Content-Type-Options: nosniff');
|
|
header('X-Content-Type-Options: nosniff');
|
|
|
|
|
|
|
|
|
|
+$no_cache = file_exists(DATA_PATH . '/no-cache.txt');
|
|
|
|
|
+
|
|
|
function show_default_favicon(int $cacheSeconds = 3600): void {
|
|
function show_default_favicon(int $cacheSeconds = 3600): void {
|
|
|
|
|
+ global $no_cache;
|
|
|
$default_mtime = @filemtime(DEFAULT_FAVICON) ?: 0;
|
|
$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-Type: image/x-icon');
|
|
|
header('Content-Disposition: inline; filename="default_favicon.ico"');
|
|
header('Content-Disposition: inline; filename="default_favicon.ico"');
|
|
|
readfile(DEFAULT_FAVICON);
|
|
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);
|
|
$ico_content_type = contentType($ico);
|
|
|
header('Content-Type: ' . $ico_content_type);
|
|
header('Content-Type: ' . $ico_content_type);
|
|
|
header('Content-Disposition: inline; filename="' . $id . '.ico"');
|
|
header('Content-Disposition: inline; filename="' . $id . '.ico"');
|
|
|
- if (isset($_GET['t'])) {
|
|
|
|
|
|
|
+ if (!$no_cache && isset($_GET['t'])) {
|
|
|
header('Cache-Control: immutable');
|
|
header('Cache-Control: immutable');
|
|
|
}
|
|
}
|
|
|
readfile($ico);
|
|
readfile($ico);
|