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

Function loadEpaperDisplay

web/scripts/ragnar_modern.js:13087–13145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13085 }
13086
13087 const reinstallBtn = document.getElementById('pwn-reinstall-btn');
13088 if (reinstallBtn) {
13089 reinstallBtn.addEventListener('click', handlePwnReinstallClick);
13090 }
13091
13092 const swapToPwnBtn = document.getElementById('pwn-swap-to-pwn-btn');
13093 if (swapToPwnBtn) {
13094 swapToPwnBtn.addEventListener('click', () => handlePwnSwap('pwnagotchi'));
13095 }
13096
13097 const refreshBtn = document.getElementById('pwn-refresh-btn');
13098 if (refreshBtn) {
13099 refreshBtn.addEventListener('click', () => refreshPwnagotchiStatus());
13100 }
13101
13102 const logRefreshBtn = document.getElementById('pwn-log-refresh-btn');
13103 if (logRefreshBtn) {
13104 logRefreshBtn.addEventListener('click', () => fetchPwnLogs({ initial: pwnLogCursor === 0 }));
13105 }
13106
13107 updatePwnButtons();
13108 resetPwnLogState();
13109 refreshPwnagotchiStatus({ silent: true });
13110
13111 // Pwnagotchi config card buttons
13112 const cfgReloadBtn = document.getElementById('pwn-config-reload-btn');
13113 if (cfgReloadBtn) {
13114 cfgReloadBtn.addEventListener('click', () => loadPwnConfig());
13115 }
13116 const cfgSaveBtn = document.getElementById('pwn-config-save-btn');
13117 if (cfgSaveBtn) {
13118 cfgSaveBtn.addEventListener('click', () => savePwnConfig());
13119 }
13120}
13121
13122async function refreshPwnagotchiStatus(options = {}) {
13123 const silent = Boolean(options && options.silent);
13124 try {
13125 const response = await fetchAPI('/api/pwnagotchi/status');
13126 if (response && response.success && response.status) {
13127 updatePwnagotchiUI(response.status);
13128 return response.status;
13129 }
13130 if (!silent) {
13131 addConsoleMessage('Unable to load Pwnagotchi status', 'warning');
13132 }
13133 } catch (error) {
13134 console.error('Error refreshing Pwnagotchi status:', error);
13135 if (!silent) {
13136 addConsoleMessage(`Pwnagotchi status error: ${error.message}`, 'error');
13137 }
13138 }
13139 return null;
13140}
13141
13142function updatePwnagotchiUI(status = {}) {
13143 if (!status || typeof status !== 'object') {
13144 return;

Callers 4

preloadAllTabsFunction · 0.70
loadTabDataFunction · 0.70
refreshEpaperDisplayFunction · 0.70
setupEpaperAutoRefreshFunction · 0.70

Calls 4

errorMethod · 0.80
fetchAPIFunction · 0.70
updateElementFunction · 0.70
addConsoleMessageFunction · 0.70

Tested by

no test coverage detected