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