MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / formatAIText

Function formatAIText

web/scripts/ragnar_modern.js:15144–15223  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

15142 checkPwnUpdates();
15143 }
15144}
15145
15146function _bindPwnUpdateButtons() {
15147 const checkBtn = document.getElementById('pwn-update-check-btn');
15148 const perfBtn = document.getElementById('pwn-update-perform-btn');
15149 const stashBtn = document.getElementById('pwn-update-stash-btn');
15150 if (checkBtn && !checkBtn.dataset.bound) {
15151 checkBtn.dataset.bound = '1';
15152 checkBtn.onclick = checkPwnUpdates;
15153 }
15154 if (perfBtn && !perfBtn.dataset.bound) {
15155 perfBtn.dataset.bound = '1';
15156 perfBtn.onclick = performPwnUpdate;
15157 }
15158 if (stashBtn && !stashBtn.dataset.bound) {
15159 stashBtn.dataset.bound = '1';
15160 stashBtn.onclick = stashAndUpdatePwn;
15161 }
15162}
15163
15164function updatePwnToggleAvailability(isHeadless) {
15165 // Pwnagotchi now installs on headless too — it runs fine with just its web
15166 // UI (no e-paper face). So the toggle is always enabled; we only note that
15167 // the display face is unavailable on a headless box.
15168 headlessMode = Boolean(isHeadless);
15169 const checkbox = document.getElementById('pwnagotchi-enabled');
15170 if (!checkbox) {
15171 return;
15172 }
15173
15174 const wrapper = document.getElementById('pwn-toggle-wrapper');
15175 const warning = document.getElementById('pwn-headless-warning');
15176
15177 checkbox.disabled = false;
15178 checkbox.removeAttribute('aria-disabled');
15179 if (wrapper) {
15180 wrapper.classList.remove('cursor-not-allowed', 'opacity-60', 'pointer-events-none');
15181 }
15182 if (warning) {
15183 warning.classList.toggle('hidden', !headlessMode);
15184 }
15185}
15186
15187// ============================================================================
15188// HEADLESS MODE DETECTION AND MANAGEMENT
15189// ============================================================================
15190
15191/**
15192 * Detect and handle headless mode (server installations without a display)
15193 * Headless mode hides display-related UI elements
15194 */
15195async function handleHeadlessMode() {
15196 try {
15197 const response = await fetch('/api/system/headless');
15198 const data = await response.json();
15199
15200 const isHeadless = data.headless === true || data.is_headless === true;
15201 headlessMode = isHeadless;

Callers 2

aiAnalyzePcapFunction · 0.70
displayAIInsightsFunction · 0.70

Calls 2

pushMethod · 0.80
escapeHtmlFunction · 0.70

Tested by

no test coverage detected