mirror of
https://github.com/myronblair/jarvis
synced 2026-07-29 01:03:14 -05:00
Adopt live production state as git baseline
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
ini_set('session.cache_limiter', '');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate, no-transform');
|
||||
session_start();
|
||||
|
||||
if (empty($_SESSION['jarvis_token'])) {
|
||||
header('Location: /login.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
$token = $_SESSION['jarvis_token'];
|
||||
$name = $_SESSION['jarvis_name'] ?? '';
|
||||
$html = file_get_contents(__DIR__ . '/index.html');
|
||||
|
||||
// Inject token as JS globals — __jarvisToken/__jarvisUser only (no var sessionToken/sessionUser
|
||||
// which would conflict with the main script's `let` declarations and cause a SyntaxError)
|
||||
$inject = '<script data-cfasync="false">'
|
||||
. 'var __jarvisToken=' . json_encode($token) . ';'
|
||||
. 'var __jarvisUser=' . json_encode($name) . ';'
|
||||
. 'try{sessionStorage.setItem("jarvis_token",__jarvisToken);'
|
||||
. 'sessionStorage.setItem("jarvis_user",__jarvisUser);}catch(e){}'
|
||||
. '</script>';
|
||||
$html = str_replace('<head>', '<head>' . $inject, $html);
|
||||
|
||||
// Force login screen hidden and app visible at HTML level so the dashboard
|
||||
// shows immediately regardless of JS execution order
|
||||
$html = str_replace(
|
||||
'<div id="loginScreen">',
|
||||
'<div id="loginScreen" style="display:none!important">',
|
||||
$html
|
||||
);
|
||||
$html = str_replace(
|
||||
'<div id="app">',
|
||||
'<div id="app" style="display:flex!important;flex-direction:column">',
|
||||
$html
|
||||
);
|
||||
|
||||
echo $html;
|
||||
Reference in New Issue
Block a user