Require password to access logs page

This commit is contained in:
Peter Stockings
2025-12-23 23:16:56 +11:00
parent dc20afd0f3
commit 45bee0504b
5 changed files with 501 additions and 101 deletions

View File

@@ -366,102 +366,4 @@
</tbody>
</table>
</div>
{% endif %}
<!-- APPLICATION LOGS SECTION -->
<h2 style="margin-top: 32px;">[ APPLICATION LOGS ]</h2>
{% for r in data.apps %}
<div style="
border: 2px solid #30363d;
margin-bottom: 16px;
background: rgba(0, 217, 255, 0.02);
">
<!-- Header -->
<div style="
display: flex;
justify-content: space-between;
align-items: center;
padding: 12px 16px;
cursor: pointer;
" onclick="toggleLogs('logs-{{ loop.index }}')">
<div style="font-weight: 700; color: #00d9ff;">[{{ r.app }}]</div>
<button style="
background: rgba(0, 217, 255, 0.1);
border: 1px solid #00d9ff;
color: #00d9ff;
padding: 4px 12px;
font-family: 'JetBrains Mono', monospace;
font-size: 10px;
font-weight: 700;
cursor: pointer;
pointer-events: none;
">[EXPAND]</button>
</div>
<!-- Collapsible logs -->
<div id="logs-{{ loop.index }}" style="display: none; border-top: 2px solid #30363d;">
<div style="padding: 16px; background: #0a0e17;">
<div style="display: flex; justify-content: space-between; margin-bottom: 12px;">
<div style="color: #00d9ff; font-size: 10px; font-weight: 700; letter-spacing: 2px;">
[LAST 50 LINES]
</div>
<button onclick="event.stopPropagation(); copyLogs('logs-content-{{ loop.index }}')" style="
background: rgba(0, 255, 136, 0.1);
border: 1px solid #00ff88;
color: #00ff88;
padding: 4px 10px;
font-family: 'JetBrains Mono', monospace;
font-size: 10px;
font-weight: 700;
cursor: pointer;
" onmouseover="this.style.background='rgba(0, 255, 136, 0.2)';"
onmouseout="this.style.background='rgba(0, 255, 136, 0.1)';">
COPY
</button>
</div>
<div id="logs-content-{{ loop.index }}" style="
background: #000;
border: 1px solid #30363d;
padding: 12px;
max-height: 400px;
overflow-y: auto;
font-family: 'JetBrains Mono', monospace;
font-size: 11px;
line-height: 1.6;
">
{% if r.logs %}
{% for log in r.logs %}
<div
style="color: {% if log.level == 'error' %}#ff5555{% elif log.level == 'warn' %}#ffb86c{% else %}#8b949e{% endif %};">
{{ log.text }}</div>
{% endfor %}
{% else %}
<div style="color: #8b949e;">[no logs available]</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endfor %}
<script>
function toggleLogs(id) {
const el = document.getElementById(id);
el.style.display = el.style.display === 'none' ? 'block' : 'none';
}
function copyLogs(id) {
const el = document.getElementById(id);
navigator.clipboard.writeText(el.innerText).then(() => {
const btn = event.target;
const orig = btn.textContent;
btn.textContent = 'COPIED!';
btn.style.background = 'rgba(0, 255, 136, 0.3)';
setTimeout(() => {
btn.textContent = orig;
btn.style.background = 'rgba(0, 255, 136, 0.1)';
}, 1500);
});
}
</script>
{% endif %}