From ae0322facb59d3497b2cda1c92aee73031368b62 Mon Sep 17 00:00:00 2001 From: haunter Date: Thu, 7 May 2026 22:59:09 +0300 Subject: [PATCH] fix on fix --- db.py | 8 ++++++++ templates/agora.html | 13 ++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/db.py b/db.py index e6ed4e3..989872f 100644 --- a/db.py +++ b/db.py @@ -356,10 +356,18 @@ def init_db(): except Exception: pass + # Migration: add source column to culture_log (added in v4.3) + # Safe to run repeatedly — silently skipped if column already exists. + try: + c.execute("ALTER TABLE culture_log ADD COLUMN source TEXT NOT NULL DEFAULT 'manual'") + except Exception: + pass # column already exists + conn.commit() conn.close() + def generate_clan_key(): """Generate a short, unique, human-readable clan key.""" return secrets.token_urlsafe(8).upper()[:10] diff --git a/templates/agora.html b/templates/agora.html index 9467366..a784017 100644 --- a/templates/agora.html +++ b/templates/agora.html @@ -659,7 +659,17 @@ celebration_type: celType }) }); - const d = await r.json(); + + // Read raw text first — if the server returns an HTML error page, + // JSON.parse would throw a useless SyntaxError. This shows the real problem. + const raw = await r.text(); + let d = {}; + try { d = JSON.parse(raw); } catch (_) { + closeModal(); + showToast(`❌ Server error (${r.status}): ${raw.substring(0, 120)}`, 'err'); + return; + } + closeModal(); if (r.ok && d.ok) { showToast(`✅ Εντολή στάλθηκε — ${TYPE_LABELS[celType]}`, 'ok'); @@ -673,6 +683,7 @@ } } + // ── Log ────────────────────────────────────────────────────────── function toggleLog() { logOpen = !logOpen;