v2.1 — Session-Passcode System für Multi-Device

Features:
- 6-stelliger Passcode pro Session (z.B. 5E92C5)
- /join Seite: Passcode-Eingabe für andere Geräte
- /api/session/join: Verifiziert Passcode, setzt Cookie
- /api/session/info: Gibt Session-ID + Passcode zurück
- Index-Seite zeigt Passcode mit Hinweis
- Chat-Header zeigt Passcode (lila hervorgehoben)
- Passcode in sessions Tabelle gespeichert
- Falscher Code = Fehlermeldung, kein Raten möglich

Workflow:
1. Desktop: Öffne NeonChat → siehst Passcode im Header
2. Handy: Öffne http://[IP]:5252/join → Code eingeben
3. Handy bekommt gleiches Cookie → gleicher Chat-Verlauf
This commit is contained in:
arch_agent
2026-07-24 21:47:30 +02:00
parent a432226824
commit c60d1219b2
4 changed files with 147 additions and 41 deletions
+5 -2
View File
@@ -68,7 +68,8 @@
<div class="char-desc">{{ character.description[:60] }}{% if character.description|length > 60 %}...{% endif %}</div>
</div>
<div class="header-actions">
<span class="session-info" id="sessionInfo">Session: ...</span>
<span class="session-info" id="sessionInfo" title="Session-ID">Session: ...</span>
<span class="session-info" id="passcodeInfo" title="Passcode für andere Geräte" style="border-color: var(--accent); color: var(--accent);">Code: ...</span>
<button class="btn" onclick="toggleMemory()">🧠 Gedächtnis</button>
<button class="btn btn-danger" onclick="clearMemory()">🗑️ Vergessen</button>
</div>
@@ -107,9 +108,11 @@
const sendBtn = document.getElementById('send');
let isSending = false;
// Show session ID (short)
// Show session ID (short) and passcode
const sessionId = "{{ session_id }}";
const passcode = "{{ passcode }}";
document.getElementById('sessionInfo').textContent = 'Session: ' + sessionId.substring(0, 8) + '...';
document.getElementById('passcodeInfo').textContent = 'Code: ' + passcode;
// Auto-scroll
chat.scrollTop = chat.scrollHeight;