diff --git a/ProcessMaker/Models/Setting.php b/ProcessMaker/Models/Setting.php index 87395b44d8..a97db998df 100644 --- a/ProcessMaker/Models/Setting.php +++ b/ProcessMaker/Models/Setting.php @@ -311,6 +311,7 @@ public static function getLogin() { // default login $url = asset(config('app.settings.login_logo_path')); + $customized = false; //custom login $setting = self::byKey('css-override'); @@ -320,10 +321,18 @@ public static function getLogin() foreach ($mediaFile as $media) { $url = $media->getFullUrl(); + $customized = true; } } - return $url . '?id=' . bin2hex(random_bytes(16)); + // Use a stable cache-busting key based on the setting's last update time. + // This allows the browser to cache the logo long-term and only re-fetch + // when an admin actually changes it, instead of on every page request. + if ($customized && $setting) { + return $url . '?v=' . $setting->updated_at?->timestamp; + } + + return $url; } /** @@ -359,6 +368,8 @@ public static function getIcon() { // default icon $url = asset(config('app.settings.icon_path')); + $setting = null; + $customized = false; // custom icon if (config()->has($key = 'css-override')) { @@ -369,11 +380,17 @@ public static function getIcon() foreach ($mediaFile as $media) { $url = $media->getFullUrl(); + $customized = true; } } } - return $url . '?id=' . bin2hex(random_bytes(16)); + // Use a stable cache-busting key based on the setting's last update time. + if ($customized && $setting) { + return $url . '?v=' . $setting->updated_at?->timestamp; + } + + return $url; } /** @@ -384,6 +401,8 @@ public static function getFavicon() { // default icon $url = asset(config('app.settings.favicon_path')); + $setting = null; + $customized = false; // custom icon if (config()->has($key = 'css-override')) { @@ -394,11 +413,19 @@ public static function getFavicon() foreach ($mediaFile as $media) { $url = $media->getFullUrl(); + $customized = true; } } } - return $url . '?id=' . bin2hex(random_bytes(16)); + // Use a stable cache-busting key based on the setting's last update time. + // Eliminates the previous random_bytes() that prevented browser caching + // on every request, forcing a full re-download of the favicon each visit. + if ($customized && $setting) { + return $url . '?v=' . $setting->updated_at?->timestamp; + } + + return $url; } /** diff --git a/resources/fonts/pm-font/processmaker-font.scss b/resources/fonts/pm-font/processmaker-font.scss index e6e8bbda03..695ce401a4 100644 --- a/resources/fonts/pm-font/processmaker-font.scss +++ b/resources/fonts/pm-font/processmaker-font.scss @@ -1,4 +1,5 @@ @font-face {font-family: "processmaker-font"; + font-display: swap; src: url('processmaker-font.eot?t=1770239064379'); /* IE9*/ src: url('processmaker-font.eot?t=1770239064379#iefix') format('embedded-opentype'), /* IE6-IE8 */ url("processmaker-font.woff2?t=1770239064379") format("woff2"), diff --git a/resources/views/auth/layouts/auth.blade.php b/resources/views/auth/layouts/auth.blade.php index 6c32bd13a3..1448bb720e 100644 --- a/resources/views/auth/layouts/auth.blade.php +++ b/resources/views/auth/layouts/auth.blade.php @@ -9,7 +9,7 @@