From 037d2f114b276cd75e984d6e217995b5c24da790 Mon Sep 17 00:00:00 2001 From: janis steiner Date: Sun, 31 May 2026 21:14:55 +0200 Subject: [PATCH] fixing settings page --- public/index.html | 204 ++++++++++++++++++++++++++++------------------ 1 file changed, 125 insertions(+), 79 deletions(-) diff --git a/public/index.html b/public/index.html index 4e8c756..13b9ef2 100644 --- a/public/index.html +++ b/public/index.html @@ -265,34 +265,30 @@ pre.raw-line { background: var(--bs-tertiary-bg); padding: .75rem; border-radius
Settings
+
+
+ +
-
System Info
-
-
-
Health
checking...
-
SQLite
checking...
-
ClickHouse
checking...
-
DB Size
-
Auth Server
auth.jakach.ch
-
Logged in as
-
+
Database
+
+
+
SQLitechecking...
+
ClickHousechecking...
+
Healthchecking...
+
DB Size
+
-
-
Quick Reference
-
-

File sources — path to a log file on the worker container

-

TCP/UDP sourcestcp://0.0.0.0:9514

-

Rules — PHP regex patterns, e.g. /error/i

-
-
-
+ + +
Data Retention
-

Auto-purge old data to keep the database small.

+

ClickHouse TTL auto-deletes old data. Manual purge below removes rate-limiter state.

@@ -307,52 +303,14 @@ pre.raw-line { background: var(--bs-tertiary-bg); padding: .75rem; border-radius
-
-
Audit Log
-
-
- - -
Loading...
-
-
-
-
-
+ +
-
Security
-
-
- -

Only these Jakach user tokens can access this system. Leave empty to allow any authenticated Jakach user.

- -
- - +
+ False Positives
-
-
-
Telegram Notifications
-

Send alerts to a Telegram chat via a bot.

-
- - -
-
- - -
- - - -
-
-
-
False Positives
-
-

Lines matching these patterns will be ignored and not trigger any alert.

-
+
@@ -360,21 +318,85 @@ pre.raw-line { background: var(--bs-tertiary-bg); padding: .75rem; border-radius
- - + +
-
-
How to get your user token
-
-
    -
  1. Log in at auth.jakach.ch
  2. -
  3. Your user_token is shown in your profile
  4. -
  5. Paste it above to grant access
  6. -
+ + +
+
Audit Log
+
+
+
PatternDescription
+ +
Loading...
+
+ +
+ + +
+ + +
+
Security
+
+
+ + +
+
+ + + Your token: +
+
+
+ + +
+
+ Telegram Notifications + +
+
+
+ +
+ + +
+
+
+ + +
+
+ + + +
+
+
+ + +
+
System
+
+
+
Logged in as
+
Auth Server
auth.jakach.ch
+
File sources
path on worker container
+
TCP/UDP
tcp://0.0.0.0:9514
+
Rules
PHP regex, e.g. /error/i
+
+
+
+
@@ -1037,27 +1059,39 @@ async function loadSettings() { document.getElementById('sysSqlite').className = 'badge bg-' + (health.sqlite === 'connected' ? 'success' : 'danger'); document.getElementById('sysClickhouse').textContent = health.clickhouse === 'connected' ? 'Connected' : 'Error'; document.getElementById('sysClickhouse').className = 'badge bg-' + (health.clickhouse === 'connected' ? 'success' : 'danger'); - if (health.db_size) { - document.getElementById('sysDbSize').textContent = health.db_size; - } + document.getElementById('sysDbSize').textContent = health.db_size || '—'; } catch { document.getElementById('sysHealth').textContent = 'Unreachable'; document.getElementById('sysHealth').className = 'badge bg-danger'; } try { - const res = await api('/config/allowed_tokens'); - const tokens = res.tokens || []; + const [tokensRes, meRes] = await Promise.all([ + api('/config/allowed_tokens'), + api('/auth/me'), + ]); + const tokens = tokensRes.tokens || []; document.getElementById('allowedTokensInput').value = tokens.join('\n'); + const userToken = meRes.user?.user_token || ''; + document.getElementById('settingsUserToken').textContent = userToken || '—'; + document.getElementById('settingsUser').textContent = meRes.user?.username || '—'; } catch (e) { console.error('load tokens error', e); } try { const res = await api('/config/telegram'); document.getElementById('telegramBotToken').value = ''; document.getElementById('telegramBotToken').placeholder = res.bot_token_configured - ? (res.bot_token_masked || 'Token configured') + ? 'Token configured (enter new to change)' : 'Enter bot token'; document.getElementById('telegramChatId').value = res.chat_id || ''; + const badge = document.getElementById('telegramStatusBadge'); + if (res.bot_token_configured && res.chat_id) { + badge.innerHTML = 'Configured'; + } else if (res.bot_token_configured) { + badge.innerHTML = 'Missing Chat ID'; + } else { + badge.innerHTML = 'Not configured'; + } } catch (e) { console.error('load telegram error', e); } try { @@ -1095,6 +1129,18 @@ document.getElementById('saveTokensBtn').addEventListener('click', async () => { } }); +function toggleTelegramToken() { + const input = document.getElementById('telegramBotToken'); + const btn = document.getElementById('telegramTokenToggle'); + if (input.type === 'password') { + input.type = 'text'; + btn.innerHTML = ''; + } else { + input.type = 'password'; + btn.innerHTML = ''; + } +} + document.getElementById('saveTelegramBtn').addEventListener('click', async () => { const botToken = document.getElementById('telegramBotToken').value.trim(); const chatId = document.getElementById('telegramChatId').value.trim();