e6875f0b4b
- 13-service async plugin framework - Textual TUI with CLI fallback - Plugin hot-reload + permission system - Web management panel (aiohttp) - Bridge-based inter-module communication - 10 regression tests Fixes applied: - PBKDF2-SHA256 auth (was plain SHA256) - Auth bypass removed (was allow-all on fail) - Bare excepts replaced with logged errors - CatFramework/DreamSu -> SenSu naming unified - ServiceManager: health checks + startup_order - Env var credentials (SENSU_ADMIN_PASSWORD etc)
30 lines
1.2 KiB
JavaScript
30 lines
1.2 KiB
JavaScript
window.ConsoleModule = {
|
|
init: () => {
|
|
const box = document.getElementById('cmd-box');
|
|
const input = document.getElementById('cmd-input');
|
|
input.focus();
|
|
|
|
const append = (text, cls='') => {
|
|
box.innerHTML += `<div style="margin-top:2px;${cls?'color:'+cls:''}">${text}</div>`;
|
|
box.scrollTop = box.scrollHeight;
|
|
};
|
|
|
|
input.onkeydown = async (e) => {
|
|
if(e.key === 'Enter' && input.value.trim()) {
|
|
const cmd = input.value.trim();
|
|
append(`$ ${cmd}`, 'var(--accent)');
|
|
input.value = '';
|
|
try {
|
|
const res = await fetch('./api/command', {
|
|
method:'POST', headers:{'Content-Type':'application/json'}, credentials:'include',
|
|
body: JSON.stringify({command: cmd})
|
|
});
|
|
const d = await res.json();
|
|
append(d.success ? d.output : `Error: ${d.error}`, d.success ? '#ccc' : 'var(--error)');
|
|
} catch(err) { append(`Network Error: ${err.message}`, 'var(--error)'); }
|
|
}
|
|
};
|
|
},
|
|
destroy: () => {}
|
|
};
|