fix on fix
This commit is contained in:
8
db.py
8
db.py
@@ -356,10 +356,18 @@ def init_db():
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
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.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def generate_clan_key():
|
def generate_clan_key():
|
||||||
"""Generate a short, unique, human-readable clan key."""
|
"""Generate a short, unique, human-readable clan key."""
|
||||||
return secrets.token_urlsafe(8).upper()[:10]
|
return secrets.token_urlsafe(8).upper()[:10]
|
||||||
|
|||||||
@@ -659,7 +659,17 @@
|
|||||||
celebration_type: celType
|
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();
|
closeModal();
|
||||||
if (r.ok && d.ok) {
|
if (r.ok && d.ok) {
|
||||||
showToast(`✅ Εντολή στάλθηκε — ${TYPE_LABELS[celType]}`, 'ok');
|
showToast(`✅ Εντολή στάλθηκε — ${TYPE_LABELS[celType]}`, 'ok');
|
||||||
@@ -673,6 +683,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ── Log ──────────────────────────────────────────────────────────
|
// ── Log ──────────────────────────────────────────────────────────
|
||||||
function toggleLog() {
|
function toggleLog() {
|
||||||
logOpen = !logOpen;
|
logOpen = !logOpen;
|
||||||
|
|||||||
Reference in New Issue
Block a user