Files
cinny/src/lotus-boot.ts
T

93 lines
2.9 KiB
TypeScript
Raw Normal View History

2026-05-13 22:36:48 -04:00
const BOOT_MESSAGES = [
'╔════════════════════════════════════════════════════╗',
2026-05-13 22:36:48 -04:00
'║ LOTUS CHAT — LOTUSGUILD PLATFORM ║',
'║ SECURE MATRIX CLIENT — TERMINAL MODE ACTIVE ║',
2026-05-13 22:36:48 -04:00
'╚════════════════════════════════════════════════════╝',
'',
'[ OK ] Kernel modules loaded',
'[ OK ] Network interfaces configured',
'[ OK ] DNS resolution active',
'[ OK ] TLS certificate verified — matrix.lotusguild.org',
'[ OK ] Matrix homeserver connected',
'[ OK ] E2EE Olm/Megolm keys loaded',
'[ OK ] Cross-signing keys verified',
2026-05-13 22:36:48 -04:00
'[ OK ] Room state synchronized',
'[ OK ] Media proxy available',
'[ OK ] Notification service active',
2026-05-13 22:36:48 -04:00
'[ OK ] Terminal interface rendered',
'',
'> ALL SYSTEMS NOMINAL — LOTUS CHAT',
'> TYPE /help FOR COMMANDS',
2026-05-13 22:36:48 -04:00
'',
];
const STORAGE_KEY = 'lt_booted_lotus-chat';
export function resetBootSequence(): void {
sessionStorage.removeItem(STORAGE_KEY);
}
export function runLotusBootSequence(force = false): void {
if (!force && sessionStorage.getItem(STORAGE_KEY)) return;
if (document.getElementById('lt-boot')) return;
2026-05-13 22:36:48 -04:00
sessionStorage.setItem(STORAGE_KEY, '1');
const overlay = document.createElement('div');
overlay.id = 'lt-boot';
overlay.style.cssText = [
'position:fixed',
'inset:0',
'background:#000',
'z-index:10100',
'display:flex',
'align-items:flex-start',
'justify-content:flex-start',
'padding:3rem',
"font-family:'JetBrains Mono','Fira Code','Courier New',monospace",
].join(';');
const pre = document.createElement('pre');
pre.style.cssText = [
'font-family:inherit',
'font-size:0.78rem',
'color:#00FF88',
'text-shadow:0 0 6px #00FF88,0 0 16px rgba(0,255,136,0.45)',
'line-height:1.7',
'white-space:pre-wrap',
'overflow:hidden',
].join(';');
overlay.appendChild(pre);
document.body.appendChild(overlay);
const dismiss = (): void => {
clearInterval(interval);
document.removeEventListener('keydown', onKey);
overlay.style.transition = 'opacity 0.4s ease';
overlay.style.opacity = '0';
setTimeout(() => overlay.remove(), 400);
};
const onKey = (e: KeyboardEvent): void => {
if (e.key === 'Escape') dismiss();
};
document.addEventListener('keydown', onKey);
2026-05-13 22:36:48 -04:00
let i = 0;
let text = '';
const interval = setInterval(() => {
if (i >= BOOT_MESSAGES.length) {
clearInterval(interval);
document.removeEventListener('keydown', onKey);
2026-05-13 22:36:48 -04:00
setTimeout(() => {
overlay.style.transition = 'opacity 0.5s ease';
overlay.style.opacity = '0';
setTimeout(() => overlay.remove(), 500);
}, 500);
return;
}
text += BOOT_MESSAGES[i] + '\n';
pre.textContent = text;
i++;
}, 65);
}