fix deck editor login; rename to Decks

This commit is contained in:
2026-08-03 19:31:20 +02:00
parent da7ba4b7a7
commit 4b3a9ef7d7
3 changed files with 10 additions and 12 deletions
+7 -11
View File
@@ -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() {