Tried a different approach — basically using caching. Not sure if this is what was meant or not, but here are two patches:
The first patch adds a new function to save a cached version of the Dashboard page.
The second patch modifies index.php to call it when needed.
--- /usr/local/www/guiconfig.inc
+++ /usr/local/www/guiconfig.inc
@@ -31,6 +31,25 @@
header("X-Frame-Options: SAMEORIGIN");
include_once('phpsessionmanager.inc');
include_once("util.inc");
+
+// --- FAST DASHBOARD: BACKGROUND SAVER ---
+function save_dashboard_snapshot() {
+ // Only take a snapshot if this is a clean load of the main page (no POST data, no AJAX)
+ if (strpos($_SERVER['SCRIPT_NAME'], 'index.php') !== false && empty($_POST) && !isset($_GET['get_updates_only'])) {
+ $html = ob_get_contents();
+ // SECURITY CHECK: Ensure we are saving the actual dashboard (has widgetSequence) and user is logged in
+ if (!empty($html) && strlen($html) > 5000 && strpos($html, 'widgetSequence') !== false && !empty($_SESSION['Username'])) {
+ @file_put_contents("/tmp/dashboard.cache", $html);
+ }
+ }
+}
+
+// Start output buffering and register the shutdown function
+if (strpos($_SERVER['SCRIPT_NAME'], 'index.php') !== false && !isset($_GET['get_updates_only'])) {
+ ob_start();
+ register_shutdown_function('save_dashboard_snapshot');
+}
+// --- END FAST DASHBOARD ---
function pfSense_csrf_callback() {
include "csrf_error.php";
--- /usr/local/www/index.php
+++ /usr/local/www/index.php
@@ -95,4 +95,43 @@
$platform = system_identify_specific_platform();
+// --- FAST DASHBOARD: CACHE LOGIC ---
+$is_valid_cache = false;
+
+// 1. Determine if we should serve the cache (strictly on clean login)
+if (empty($_POST) && !isset($_GET['get_updates_only']) && !isset($_GET['logout'])) {
+ if (!empty($_SESSION['Username']) && empty($_SESSION['dashboard_cache_shown'])) {
+ $is_valid_cache = true;
+ }
+}
+
+// 2. CACHE KILLER: If saving settings (POST), destroy the old cache
+if (!empty($_POST) && !isset($_POST['login'])) {
+ @unlink("/tmp/dashboard.cache");
+ $_SESSION['dashboard_cache_shown'] = true;
+}
+
+// 3. SERVE CACHE
+if ($is_valid_cache && file_exists("/tmp/dashboard.cache")) {
+ $_SESSION['dashboard_cache_shown'] = true;
+
+ // STRICT ANTI-CACHE HEADERS: Prevent browser from caching this output locally
+ // This fixes the "seeing dashboard after logout" bug
+ header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
+ header("Cache-Control: post-check=0, pre-check=0", false);
+ header("Pragma: no-cache");
+
+ // Output the static snapshot
+ readfile("/tmp/dashboard.cache");
+
+ // Trigger background AJAX update
+ echo "<script>setTimeout(function(){ if (typeof(ajax_update) === 'function') ajax_update(); }, 500);</script>";
+ exit;
+} else {
+ // 4. LIVE MODE FALLBACK: Guarantee live mode for normal browsing
+ if (!empty($_SESSION['Username'])) {
+ $_SESSION['dashboard_cache_shown'] = true;
+ }
+}
+// --- END FAST DASHBOARD ---
## Include each widget php include file.
## These define vars that specify the widget title and title link.
After first and every logout or saving changes on dashboard cache is re-saved. As usual if you want to try it, do it at your own risk. For me it works much better then previous minimal mode selector button.