fix on fix
This commit is contained in:
8
db.py
8
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]
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user