fix deck editor login; rename to Decks
This commit is contained in:
+7
-11
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Image Decks — Orison Reach</title>
|
||||
<title>Decks — Orison Reach</title>
|
||||
<style>
|
||||
:root {
|
||||
--void:#171513;--void-soft:#211e1a;--panel:#2a2520;--paper:#e8dcc4;
|
||||
@@ -166,7 +166,7 @@
|
||||
<div class="shell">
|
||||
<a href="index.html">Archive</a>
|
||||
<a href="games.html">Sessions</a>
|
||||
<a href="deck-editor.html" class="active">Image Decks</a>
|
||||
<a href="deck-editor.html" class="active">Decks</a>
|
||||
<button x-show="adminToken && !needsAuth" class="btn sm ghost" @click="logout()" style="margin-left:auto">Log out</button>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -399,15 +399,11 @@
|
||||
saving: false, uploading: false, uploadProg: '',
|
||||
|
||||
async init() {
|
||||
// Check if auth is required
|
||||
const r = await fetch('/api/admin/login', { method: 'POST',
|
||||
headers: this.adminHeaders(), body: JSON.stringify({password:''}) })
|
||||
if (r.status === 401) {
|
||||
// Server has a password set — check our stored token
|
||||
const check = await fetch('/api/decks', { headers: {'x-admin-token': this.adminToken} })
|
||||
this.needsAuth = check.status === 401
|
||||
}
|
||||
if (!this.needsAuth) await this.load()
|
||||
const check = await fetch('/api/admin/check', {
|
||||
headers: { 'x-admin-token': this.adminToken }
|
||||
})
|
||||
if (check.status === 401) { this.needsAuth = true; return }
|
||||
await this.load()
|
||||
},
|
||||
|
||||
async login() {
|
||||
|
||||
+1
-1
@@ -238,7 +238,7 @@
|
||||
<a href="#labour">Labour Project</a>
|
||||
<a href="#ledger">Survival Ledger</a>
|
||||
<a href="games.html" style="margin-left:auto">Game Sessions</a>
|
||||
<a href="deck-editor.html" style="color:var(--brass)">Image Decks</a>
|
||||
<a href="deck-editor.html" style="color:var(--brass)">Decks</a>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
@@ -101,6 +101,8 @@ app.post('/api/admin/login', (req, res) => {
|
||||
res.json({ token: makeAdminToken() })
|
||||
})
|
||||
|
||||
app.get('/api/admin/check', requireAdmin, (req, res) => res.json({ ok: true }))
|
||||
|
||||
// --- Live updates (SSE) ---
|
||||
app.get('/api/games/:slug/live', (req, res) => {
|
||||
res.writeHead(200, {
|
||||
|
||||
Reference in New Issue
Block a user