UI/runtime polish, session rotation limit, login errors, docs update
This commit is contained in:
Regular → Executable
+15
-4
@@ -39,7 +39,7 @@ cat > /opt/portal/index.html <<'HTML'
|
||||
}
|
||||
.status.hidden{display:none}
|
||||
.nav-panel{
|
||||
position:fixed;left:16px;top:16px;z-index:99;display:flex;gap:10px;
|
||||
position:fixed;left:16px;top:64px;z-index:99;display:flex;gap:10px;
|
||||
background:linear-gradient(180deg,rgba(15,24,36,.78),rgba(9,14,22,.86));border:1px solid rgba(255,255,255,.22);backdrop-filter: blur(5px);
|
||||
box-shadow:0 10px 28px rgba(0,0,0,.36);padding:9px 10px;border-radius:14px
|
||||
}
|
||||
@@ -55,8 +55,8 @@ cat > /opt/portal/index.html <<'HTML'
|
||||
<div id="screen"></div>
|
||||
<div id="status" class="status">Подключение к слоту...</div>
|
||||
<div class="nav-panel">
|
||||
<button class="nav-btn" id="btn-back" type="button">Назад</button>
|
||||
<button class="nav-btn" id="btn-home" type="button">Главная</button>
|
||||
<button class="nav-btn" id="btn-back" type="button" title="Назад">←</button>
|
||||
<button class="nav-btn" id="btn-home" type="button" title="Главная">⌂</button>
|
||||
</div>
|
||||
<script type="module">
|
||||
import RFB from './core/rfb.js';
|
||||
@@ -102,6 +102,7 @@ cat > /opt/portal/index.html <<'HTML'
|
||||
const enableHeartbeat = (new URLSearchParams(location.search).get('hb') ?? '1') !== '0';
|
||||
const sid = new URLSearchParams(location.search).get('sid');
|
||||
const SESSION_CLOSED_URL = '/?session_closed=idle';
|
||||
const CLOSE_PATH = sid ? `/api/sessions/${sid}/close` : '';
|
||||
function goSessionClosed() {
|
||||
try {
|
||||
if (window.top && window.top !== window) {
|
||||
@@ -120,9 +121,19 @@ cat > /opt/portal/index.html <<'HTML'
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
let closing = false;
|
||||
async function closeSessionNow() {
|
||||
if (!CLOSE_PATH || closing) return;
|
||||
closing = true;
|
||||
try {
|
||||
await fetch(CLOSE_PATH, {method: 'POST', credentials: 'include', keepalive: true});
|
||||
} catch (e) {}
|
||||
}
|
||||
if (enableHeartbeat) {
|
||||
setInterval(touch, 60000);
|
||||
setInterval(touch, 15000);
|
||||
touch();
|
||||
window.addEventListener('pagehide', closeSessionNow);
|
||||
window.addEventListener('beforeunload', closeSessionNow);
|
||||
}
|
||||
function keyTap(keysym, code) {
|
||||
rfb.sendKey(keysym, code, true);
|
||||
|
||||
Reference in New Issue
Block a user