Add Android forensics, IOC threat-intel DB, Compose companion; scrub secrets from configs

This commit is contained in:
SsSnake
2026-07-13 15:45:47 -07:00
parent 925216290f
commit e48d577bd5
387 changed files with 211976 additions and 921 deletions

View File

@@ -0,0 +1,537 @@
/* ================================================================
* AutarchOS — desktop chrome + design system
* Loaded AFTER style.css; cascades over and re-themes the platform.
* ================================================================ */
:root {
/* New AutarchOS palette */
--bg: #05070a;
--panel: #0b1118;
--panel2: #0e161e;
--glass: rgba(11,17,24,.72);
--line: rgba(61,240,192,.16);
--line2: rgba(61,240,192,.07);
--text: #cdd9d6;
--dim: #5d716e;
--dimmer: #3a4845;
--phos: #3df0c0;
--phos-d: #1d9c80;
--mag: #ff3d81;
--amber: #ffb13d;
--red: #ff4d57;
--blue: #52b6ff;
--glow: 0 0 18px rgba(61,240,192,.35);
/* Re-map legacy style.css variables to the new palette so all
* existing 79 templates inherit the AutarchOS theme automatically.
* The legacy names stay defined for backward compatibility. */
--bg-primary: var(--bg);
--bg-secondary: var(--panel);
--bg-card: var(--panel2);
--bg-input: var(--bg);
--border: var(--line2);
--text-primary: var(--text);
--text-secondary: var(--dim);
--text-muted: var(--dimmer);
--accent: var(--phos);
--accent-hover: #6cf4cd;
--primary: var(--phos);
--surface: var(--panel2);
--success: var(--phos);
--warning: var(--amber);
--danger: var(--red);
--danger-hover: #ff6b73;
--defense: var(--blue);
--offense: var(--red);
--counter: var(--mag);
--analyze: var(--phos);
--osint: #76e0b4;
--simulate: var(--amber);
--hardware: #ffa05a;
--radius: 6px;
--font-disp: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
--font-mono: 'JetBrains Mono', 'Consolas', monospace;
}
/* ── Base type & background ─────────────────────────────────────── */
body {
font-family: var(--font-mono);
font-size: 12.5px;
color: var(--text);
background: var(--bg);
background-image:
radial-gradient(1100px 700px at 78% -8%, rgba(61,240,192,.08), transparent 58%),
radial-gradient(900px 600px at 8% 108%, rgba(255,61,129,.06), transparent 60%),
radial-gradient(700px 500px at 50% 50%, rgba(82,182,255,.03), transparent 70%);
}
::selection { background: var(--phos); color: #04110d; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb{ background: var(--line); border-radius: 4px; }
::-webkit-scrollbar-track{ background: transparent; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-disp); letter-spacing: .04em; }
/* Neutralize the legacy sidebar layout in case any template still ships it. */
.layout { display: block; }
.layout > .sidebar { display: none !important; }
.layout > .content { margin-left: 0; max-width: none; padding: 0; }
/* ── Desktop substrate (grid + scanlines + watermark) ──────────── */
.desktop-bg {
position: fixed; inset: 30px 0 64px 0; z-index: 0; pointer-events: none;
background-image:
linear-gradient(rgba(61,240,192,.025) 1px, transparent 1px),
linear-gradient(90deg, rgba(61,240,192,.025) 1px, transparent 1px);
background-size: 40px 40px;
}
.desktop-bg::after {
content: ""; position: absolute; inset: 0;
background: repeating-linear-gradient(0deg, transparent 0 2px,
rgba(0,0,0,.16) 2px 3px);
mix-blend-mode: multiply; opacity: .35;
}
.watermark {
position: fixed; right: 6%; bottom: 12%;
font-family: var(--font-disp); font-weight: 700; font-size: 200px;
color: rgba(61,240,192,.025); letter-spacing: .05em;
pointer-events: none; user-select: none; z-index: 0;
}
/* ── Top system bar ────────────────────────────────────────────── */
.aos-topbar {
position: fixed; top: 0; left: 0; right: 0; height: 30px; z-index: 9000;
background: var(--glass);
backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
border-bottom: 1px solid var(--line2);
display: flex; align-items: center; gap: 18px;
padding: 0 14px; font-size: 11.5px;
}
.aos-topbar .logo {
font-family: var(--font-disp); font-weight: 700; letter-spacing: .06em;
color: #fff; display: flex; align-items: center; gap: 7px;
text-decoration: none;
}
.aos-topbar .logo b { color: var(--phos); }
.aos-topbar .mk {
width: 16px; height: 16px; border: 1px solid var(--phos);
display: grid; place-items: center; color: var(--phos); font-size: 11px;
box-shadow: var(--glow);
}
.aos-topbar .mi {
color: var(--dim); cursor: pointer; transition: .15s; text-decoration: none;
}
.aos-topbar .mi:hover { color: var(--text); }
.aos-topbar .sp { flex: 1; }
.aos-topbar .posture {
display: flex; align-items: center; gap: 7px; color: var(--amber);
border: 1px solid rgba(255,177,61,.35);
padding: 2px 9px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
}
.aos-topbar .tray { display: flex; align-items: center; gap: 14px; color: var(--dim); }
.aos-topbar .tray svg { width: 15px; height: 15px; }
.aos-topbar .tray .shield { color: var(--phos); }
.aos-topbar .clock {
color: var(--text); letter-spacing: .04em; min-width: 64px; text-align: right;
}
.aos-topbar .user {
color: var(--dim); font-size: 10.5px; letter-spacing: .04em;
}
.aos-topbar .user b { color: var(--text); }
.aos-topbar .user a { color: var(--mag); margin-left: 8px; text-decoration: none; }
.aos-topbar .user a:hover { text-shadow: 0 0 10px rgba(255,61,129,.5); }
.pulse {
width: 7px; height: 7px; border-radius: 50%;
background: var(--phos); box-shadow: var(--glow);
animation: aos-pulse 1.6s infinite; display: inline-block;
}
@keyframes aos-pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: .4; transform: scale(.65); }
}
/* ── Workspace (where {% block content %} lives) ──────────────── */
.aos-workspace {
position: relative; z-index: 1;
margin-top: 30px; /* clear topbar */
margin-bottom: 64px; /* clear dock */
padding: 20px 28px;
min-height: calc(100vh - 30px - 64px);
}
/* Flash messages re-skin */
.flash-messages { margin-bottom: 14px; }
.flash {
border: 1px solid var(--line2);
background: var(--panel2);
color: var(--text);
padding: 10px 14px;
font-family: var(--font-mono);
font-size: 11.5px;
margin-bottom: 8px;
}
.flash-success { border-left: 3px solid var(--phos); }
.flash-error,
.flash-danger { border-left: 3px solid var(--red); }
.flash-warning { border-left: 3px solid var(--amber); }
.flash-info { border-left: 3px solid var(--blue); }
/* ── Dock ──────────────────────────────────────────────────────── */
.aos-dock {
position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
z-index: 9000;
display: flex; align-items: center; gap: 6px;
padding: 8px 10px;
background: var(--glass);
backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
border: 1px solid var(--line2);
}
.aos-dock .app {
width: 42px; height: 42px;
display: grid; place-items: center;
color: var(--dim);
border: 1px solid transparent;
cursor: pointer; position: relative;
transition: .16s; text-decoration: none;
}
.aos-dock .app svg { width: 21px; height: 21px; }
.aos-dock .app:hover {
color: var(--phos); transform: translateY(-5px);
border-color: var(--line); background: rgba(61,240,192,.05);
}
.aos-dock .app.active { color: var(--text); }
.aos-dock .app.active::after {
content: ""; position: absolute; bottom: -3px; left: 50%;
transform: translateX(-50%);
width: 4px; height: 4px; border-radius: 50%;
background: var(--phos); box-shadow: var(--glow);
}
.aos-dock .app .tip {
position: absolute; bottom: 52px; left: 50%; transform: translateX(-50%);
background: var(--panel); border: 1px solid var(--line);
padding: 3px 8px; font-size: 9.5px; letter-spacing: .08em;
text-transform: uppercase; color: var(--phos); white-space: nowrap;
opacity: 0; pointer-events: none; transition: .15s;
}
.aos-dock .app:hover .tip { opacity: 1; bottom: 48px; }
.aos-dock .divider { width: 1px; height: 26px; background: var(--line2); margin: 0 4px; }
/* ── Apps launcher modal ───────────────────────────────────────── */
.aos-launcher-backdrop {
position: fixed; inset: 0; z-index: 9500;
background: rgba(5,7,10,.72);
backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
display: none; align-items: flex-start; justify-content: center;
padding-top: 70px;
}
.aos-launcher-backdrop.open { display: flex; }
.aos-launcher {
width: min(1100px, 92vw); max-height: 78vh; overflow: auto;
background: var(--panel); border: 1px solid var(--line);
box-shadow: 0 30px 90px rgba(0,0,0,.7), 0 0 30px rgba(61,240,192,.08);
padding: 18px 22px 22px;
}
.aos-launcher h2 {
font-family: var(--font-disp); font-weight: 700; letter-spacing: .08em;
font-size: 14px; color: var(--phos); text-transform: uppercase;
margin-bottom: 14px;
}
.aos-launcher .search {
width: 100%; background: var(--bg); border: 1px solid var(--line);
color: var(--text); padding: 9px 12px; font-family: var(--font-mono);
font-size: 12px; outline: none; margin-bottom: 14px;
}
.aos-launcher .group { margin-bottom: 14px; }
.aos-launcher .group-title {
font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
color: var(--dimmer); margin: 4px 0 8px;
}
.aos-launcher .apps {
display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
gap: 8px;
}
.aos-launcher .app-card {
border: 1px solid var(--line2);
background: var(--panel2);
padding: 10px 12px;
font-size: 11.5px;
color: var(--text);
text-decoration: none;
display: flex; align-items: center; gap: 9px;
transition: .12s;
}
.aos-launcher .app-card:hover {
border-color: var(--line); background: rgba(61,240,192,.04);
color: var(--phos);
}
.aos-launcher .app-card .ico {
width: 22px; height: 22px; flex-shrink: 0;
display: grid; place-items: center; color: var(--phos);
}
.aos-launcher .app-card .ico svg { width: 16px; height: 16px; }
.aos-launcher .app-card .meta { display: flex; flex-direction: column; min-width: 0; }
.aos-launcher .app-card .meta b { color: var(--text); font-weight: 600; }
.aos-launcher .app-card .meta small {
color: var(--dim); font-size: 9.5px; letter-spacing: .03em;
overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* ── Mockup component library ─────────────────────────────────── */
.kpis {
display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 10px; margin-bottom: 14px;
}
.kpi {
border: 1px solid var(--line2); background: var(--panel2);
padding: 12px; transition: .12s;
}
.kpi:hover { border-color: var(--line); }
.kpi .l {
font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim);
}
.kpi .n {
font-family: var(--font-disp); font-weight: 700; font-size: 28px;
color: #fff; margin-top: 4px; line-height: 1;
}
.kpi .n small { font-size: 13px; color: var(--phos); }
.kpi.danger .n { color: var(--red); }
.kpi.warn .n { color: var(--amber); }
.sec {
font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase;
color: var(--dimmer); margin: 6px 0 10px;
display: flex; align-items: center; gap: 8px;
}
.sec .live {
margin-left: auto; color: var(--phos);
display: flex; align-items: center; gap: 5px;
}
.log { font-size: 11px; line-height: 1.85; }
.log .row {
display: flex; gap: 9px; white-space: nowrap; overflow: hidden;
}
.log .t { color: var(--dimmer); }
.log .lv { width: 44px; flex-shrink: 0; }
.log .lv.i { color: var(--blue); }
.log .lv.w { color: var(--amber); }
.log .lv.c { color: var(--red); }
.log .lv.o { color: var(--phos); }
.log .m { color: var(--dim); text-overflow: ellipsis; overflow: hidden; }
.log .m b { color: var(--text); }
.cursor {
display: inline-block; width: 6px; height: 12px;
background: var(--phos); animation: aos-blink 1s steps(1) infinite;
vertical-align: middle; margin-top: 6px;
}
@keyframes aos-blink { 50% { opacity: 0; } }
.spark {
display: flex; align-items: flex-end; gap: 2px; height: 64px; margin-top: 6px;
}
.spark i {
flex: 1; background: linear-gradient(180deg, var(--phos), var(--phos-d));
opacity: .85;
}
.spark i.hot { background: linear-gradient(180deg, var(--mag), #a01f4e); }
.insight {
border: 1px solid rgba(61,240,192,.2);
background: linear-gradient(135deg, rgba(61,240,192,.05), transparent);
padding: 12px; margin-top: 14px;
font-size: 11.5px; line-height: 1.6;
}
.insight .ih {
color: var(--phos); font-size: 9.5px; letter-spacing: .12em;
text-transform: uppercase; margin-bottom: 7px;
display: flex; align-items: center; gap: 7px;
}
.insight b { color: var(--phos); }
.inc {
border: 1px solid var(--line2); background: var(--panel2);
padding: 10px 12px; margin-bottom: 8px; cursor: pointer; transition: .12s;
}
.inc:hover { border-color: var(--line); }
.inc.open { border-color: var(--line); background: rgba(61,240,192,.04); }
.inc .top { display: flex; align-items: center; gap: 10px; }
.inc .id { font-size: 11.5px; color: var(--text); }
.inc .id b { color: #fff; }
.inc .age { margin-left: auto; font-size: 10px; color: var(--dimmer); }
.inc .body {
display: none; margin-top: 9px;
font-size: 11px; color: var(--dim); line-height: 1.7;
}
.inc.open .body { display: block; }
.rec {
border-left: 2px solid var(--phos); padding-left: 9px; margin-top: 8px;
color: var(--text);
}
.sev {
font-size: 9px; letter-spacing: .06em; text-transform: uppercase;
padding: 2px 7px; border: 1px solid; flex-shrink: 0;
}
.sev.crit { color: var(--red); border-color: rgba(255,77,87,.4); background: rgba(255,77,87,.07); }
.sev.high { color: var(--amber); border-color: rgba(255,177,61,.4); }
.sev.med { color: var(--blue); border-color: rgba(82,182,255,.4); }
.sev.low { color: var(--dim); border-color: var(--line2); }
.term {
font-family: var(--font-mono); font-size: 11.5px; line-height: 1.7;
color: var(--phos); white-space: pre-wrap;
}
.term .pl { color: var(--mag); }
.term .d { color: var(--dim); }
.term .w { color: var(--amber); }
.chat { display: flex; flex-direction: column; height: 100%; }
.stream { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 14px; padding-right: 4px; }
.mrow { display: flex; gap: 10px; max-width: 90%; }
.mrow.me { align-self: flex-end; flex-direction: row-reverse; }
.av {
width: 26px; height: 26px; border: 1px solid var(--line);
display: grid; place-items: center; flex-shrink: 0;
font-size: 10px; color: var(--phos); font-family: var(--font-disp);
}
.mrow.me .av { color: var(--mag); border-color: rgba(255,61,129,.4); }
.bub { font-size: 11.5px; line-height: 1.65; }
.mrow.me .bub { color: var(--dim); text-align: right; }
.bub b { color: var(--phos); }
.codeblk {
background: var(--bg); border-left: 2px solid var(--phos);
padding: 8px 10px; font-size: 10.5px; color: var(--phos);
margin: 7px 0; white-space: pre-wrap; font-family: var(--font-mono);
}
.composer { display: flex; gap: 8px; margin-top: 12px; flex-shrink: 0; }
.field {
flex: 1; display: flex; align-items: center; gap: 7px;
border: 1px solid var(--line); padding: 8px 10px; background: var(--bg);
}
.field span { color: var(--phos); }
.field input {
flex: 1; background: none; border: none; color: var(--text);
font-family: inherit; font-size: 11.5px; outline: none;
}
.send {
border: 1px solid var(--line); background: rgba(61,240,192,.06);
color: var(--phos); padding: 0 14px;
font-family: inherit; font-size: 10px; letter-spacing: .08em;
text-transform: uppercase; cursor: pointer;
}
.send:hover { box-shadow: var(--glow); }
/* ── Legacy class refinements (existing templates) ────────────── */
.page-header {
margin-bottom: 18px; padding-bottom: 10px;
border-bottom: 1px solid var(--line2);
}
.page-header h1 {
font-family: var(--font-disp); font-weight: 700;
color: var(--phos); letter-spacing: .04em;
font-size: 22px;
}
.page-header .subtitle { color: var(--dim); font-size: 11.5px; margin-top: 4px; }
.section {
margin-top: 22px; padding-top: 14px;
border-top: 1px solid var(--line2);
}
.section h2 {
font-family: var(--font-disp); font-weight: 600; font-size: 13px;
color: var(--text); letter-spacing: .1em; text-transform: uppercase;
margin-bottom: 10px;
}
.stats-grid {
display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 10px; margin-bottom: 16px;
}
.stat-card {
border: 1px solid var(--line2); background: var(--panel2);
padding: 12px;
}
.stat-label { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.stat-value { font-family: var(--font-disp); font-weight: 700; font-size: 22px; color: #fff; margin-top: 4px; }
.stat-value.small { font-size: 13px; color: var(--text); }
.category-grid {
display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
gap: 10px;
}
.category-card {
border: 1px solid var(--line2); background: var(--panel2);
padding: 14px; text-decoration: none; color: var(--text);
display: flex; flex-direction: column; gap: 4px; transition: .12s;
position: relative; overflow: hidden;
}
.category-card:hover { border-color: var(--line); background: rgba(61,240,192,.04); }
.category-card h3 {
font-family: var(--font-disp); font-weight: 700; font-size: 14px;
color: var(--phos); letter-spacing: .04em;
}
.category-card p { color: var(--dim); font-size: 11px; }
.category-card .badge {
align-self: flex-start; margin-top: 6px;
font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
color: var(--dim); border: 1px solid var(--line2); padding: 2px 6px;
}
.category-card.cat-defense h3 { color: var(--blue); }
.category-card.cat-offense h3 { color: var(--red); }
.category-card.cat-counter h3 { color: var(--mag); }
.category-card.cat-analyze h3 { color: var(--phos); }
.category-card.cat-osint h3 { color: #76e0b4; }
.category-card.cat-simulate h3 { color: var(--amber); }
.category-card.cat-hardware h3 { color: #ffa05a; }
.data-table {
width: 100%; border-collapse: collapse;
font-size: 11.5px;
}
.data-table th, .data-table td {
padding: 8px 10px; text-align: left;
border-bottom: 1px solid var(--line2);
}
.data-table th {
font-family: var(--font-disp); font-weight: 600; font-size: 10.5px;
letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
}
.data-table tr:hover td { background: rgba(61,240,192,.025); }
.status-dot {
display: inline-block; width: 7px; height: 7px; border-radius: 50%;
background: var(--dim); margin-right: 7px; vertical-align: middle;
}
.status-dot.active { background: var(--phos); box-shadow: var(--glow); }
.btn {
background: var(--panel2); color: var(--text);
border: 1px solid var(--line2); padding: 7px 14px;
font-family: var(--font-mono); font-size: 11px;
cursor: pointer; transition: .12s;
}
.btn:hover { border-color: var(--line); color: var(--phos); }
.btn-sm, .btn-small { padding: 4px 10px; font-size: 10px; }
.btn-primary { background: rgba(61,240,192,.08); border-color: var(--line); color: var(--phos); }
.btn-primary:hover { box-shadow: var(--glow); }
.btn-danger { color: var(--red); border-color: rgba(255,77,87,.35); }
.btn-danger:hover { box-shadow: 0 0 12px rgba(255,77,87,.25); }
/* ── Login wrapper ─────────────────────────────────────────────── */
.login-wrapper {
position: relative; z-index: 1;
display: flex; align-items: center; justify-content: center;
min-height: 100vh; padding: 20px;
}

View File

@@ -2161,6 +2161,8 @@ function halToggle() {
if (!p) return;
var visible = p.style.display !== 'none';
p.style.display = visible ? 'none' : 'flex';
// Remember open/closed state across page navigation
sessionStorage.setItem('hal_panel_open', visible ? 'false' : 'true');
if (!visible) {
var inp = document.getElementById('hal-input');
if (inp) inp.focus();
@@ -2279,6 +2281,7 @@ function halAppendStyled(type, text) {
}
msgs.appendChild(div);
halScroll();
_halSaveMessages();
}
function halAppend(role, text) {
@@ -2289,6 +2292,8 @@ function halAppend(role, text) {
div.textContent = text;
msgs.appendChild(div);
halScroll();
// Persist to sessionStorage so messages survive page navigation
_halSaveMessages();
return div;
}
@@ -2300,9 +2305,60 @@ function halScroll() {
function halClear() {
var m = document.getElementById('hal-messages');
if (m) m.innerHTML = '';
sessionStorage.removeItem('hal_messages');
sessionStorage.removeItem('hal_panel_open');
fetch('/api/chat/reset', {method: 'POST'}).catch(function() {});
}
// Persist chat messages across page navigation
function _halSaveMessages() {
var msgs = document.getElementById('hal-messages');
if (!msgs) return;
var items = [];
msgs.querySelectorAll('.hal-msg').forEach(function(el) {
var role = 'hal';
if (el.classList.contains('hal-msg-user')) role = 'user';
else if (el.classList.contains('hal-msg-status')) role = 'status';
else if (el.classList.contains('hal-msg-action')) role = 'action';
else if (el.classList.contains('hal-msg-error')) role = 'error';
items.push({role: role, text: el.textContent});
});
// Keep last 100 messages to avoid storage bloat
if (items.length > 100) items = items.slice(-100);
try { sessionStorage.setItem('hal_messages', JSON.stringify(items)); } catch(e) {}
}
function _halRestoreMessages() {
var msgs = document.getElementById('hal-messages');
if (!msgs) return;
try {
var saved = sessionStorage.getItem('hal_messages');
if (!saved) return;
var items = JSON.parse(saved);
items.forEach(function(item) {
var div = document.createElement('div');
if (item.role === 'user' || item.role === 'hal') {
div.className = 'hal-msg hal-msg-' + item.role;
div.textContent = item.text;
} else {
div.className = 'hal-msg hal-msg-' + item.role;
div.textContent = item.text;
}
msgs.appendChild(div);
});
halScroll();
} catch(e) {}
// Restore panel visibility
if (sessionStorage.getItem('hal_panel_open') === 'true') {
var p = document.getElementById('hal-panel');
if (p) p.style.display = 'flex';
}
}
// Restore on page load
document.addEventListener('DOMContentLoaded', _halRestoreMessages);
// ── HAL Auto-Analyst ──────────────────────────────────────────────────────────
// Call halAnalyze() after any tool displays results. HAL will analyze the output
// via the loaded LLM and open the chat panel with findings.

120
web/static/js/autarchos.js Normal file
View File

@@ -0,0 +1,120 @@
/* AutarchOS — desktop chrome client-side wiring.
*
* Owns: live clock, dock state highlight for current blueprint, apps launcher
* modal (filterable list of every blueprint), keyboard shortcuts.
*/
(function () {
'use strict';
// ── Clock ────────────────────────────────────────────────────────
function tickClock() {
var el = document.getElementById('aos-clock');
if (!el) return;
el.textContent = new Date().toTimeString().slice(0, 8);
}
setInterval(tickClock, 1000);
tickClock();
// ── Mark dock app for current blueprint ─────────────────────────
function markActiveDockApp() {
var bp = document.body.getAttribute('data-blueprint') || '';
document.querySelectorAll('.aos-dock .app').forEach(function (a) {
var slug = a.getAttribute('data-app') || '';
a.classList.toggle('active', slug && slug === bp);
});
}
markActiveDockApp();
// ── Apps launcher modal ─────────────────────────────────────────
var backdrop = document.getElementById('aos-launcher');
var searchInput = document.getElementById('aos-launcher-search');
function openLauncher() {
if (!backdrop) return;
backdrop.classList.add('open');
if (searchInput) {
searchInput.value = '';
searchInput.focus();
filterApps('');
}
}
function closeLauncher() {
if (!backdrop) return;
backdrop.classList.remove('open');
}
function filterApps(query) {
var q = (query || '').trim().toLowerCase();
document.querySelectorAll('.aos-launcher .app-card').forEach(function (card) {
var hay = (card.textContent || '').toLowerCase();
card.style.display = (!q || hay.indexOf(q) !== -1) ? '' : 'none';
});
document.querySelectorAll('.aos-launcher .group').forEach(function (g) {
var visible = g.querySelectorAll('.app-card:not([style*="display: none"])').length;
g.style.display = visible ? '' : 'none';
});
}
document.querySelectorAll('[data-aos-action="open-launcher"]').forEach(function (el) {
el.addEventListener('click', function (e) {
e.preventDefault();
openLauncher();
});
});
if (backdrop) {
backdrop.addEventListener('click', function (e) {
if (e.target === backdrop) closeLauncher();
});
}
if (searchInput) {
searchInput.addEventListener('input', function () { filterApps(this.value); });
searchInput.addEventListener('keydown', function (e) {
if (e.key === 'Escape') closeLauncher();
if (e.key === 'Enter') {
var first = document.querySelector(
'.aos-launcher .app-card:not([style*="display: none"])'
);
if (first && first.href) window.location.href = first.href;
}
});
}
// Global shortcuts
document.addEventListener('keydown', function (e) {
if (e.key === 'Escape' && backdrop && backdrop.classList.contains('open')) {
closeLauncher();
}
// Super/Ctrl+Space → open launcher
if ((e.ctrlKey || e.metaKey) && e.code === 'Space') {
e.preventDefault();
if (backdrop && backdrop.classList.contains('open')) {
closeLauncher();
} else {
openLauncher();
}
}
});
// ── Sparkline helper (used by dashboard widgets) ────────────────
window.aosRenderSpark = function (el, count, hotIndices) {
if (!el) return;
el.innerHTML = '';
var hot = new Set(hotIndices || []);
for (var i = 0; i < count; i++) {
var b = document.createElement('i');
b.style.height = (16 + Math.abs(Math.sin(i * 0.55)) * 60 + Math.random() * 18) + '%';
if (hot.has(i)) {
b.classList.add('hot');
b.style.height = '92%';
}
el.appendChild(b);
}
};
// ── Expandable incidents (dashboard / triage views) ─────────────
document.querySelectorAll('.inc').forEach(function (i) {
i.addEventListener('click', function () { i.classList.toggle('open'); });
});
})();