Add admin role with an admin-only hand range study page
- Optional ADMIN_KEY (6 digits, distinct from ACCESS_KEY): entering it on the key screen signs in as admin (role-specific HMAC cookie; member cookies stay valid). Logged-in members can open /key?admin to enter it. - /range (range chart + color/category quiz, ported from poker-hand and restyled to the site design) and its files under admin/ are served only to admins; everyone else gets 404. Card images cached privately for a day. - Lobby shows a link to the page for admins only (GET /api/me). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e1ac4e91d
commit
e89d867f85
64 files changed
+477
-19
No files matched your search
@@ -8,6 +8,12 @@
|
||||
const submitBtn = document.getElementById('submit');
|
||||
let busy = false;
|
||||
|
||||
// /key?admin … 入室済みの人が管理者キーを入れるための画面
|
||||
if (new URLSearchParams(location.search).has('admin')) {
|
||||
document.getElementById('key-title').textContent = '管理者キーを入力';
|
||||
document.getElementById('key-hint').textContent = '管理者用の6桁の数字';
|
||||
}
|
||||
|
||||
const value = () => inputs.map((i) => i.value).join('');
|
||||
|
||||
function fill(digits, from) {
|
||||
|
||||
@@ -22,6 +22,11 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
// 管理者だけにハンドレンジ学習へのリンクを出す(ページ自体もサーバ側で管理者以外は 404)
|
||||
App.api('GET', '/api/me')
|
||||
.then((me) => { document.getElementById('range-link').hidden = !me.admin; })
|
||||
.catch(() => {});
|
||||
|
||||
document.getElementById('create').addEventListener('click', () => {
|
||||
if (requireName()) location.href = '/create';
|
||||
});
|
||||
|
||||
+2
-2
@@ -14,8 +14,8 @@
|
||||
<div class="logo">Hold'em<br>Night<small>PRIVATE CLUB</small></div>
|
||||
|
||||
<form id="form" class="card" autocomplete="off">
|
||||
<h2 class="key-title">参加キーを入力</h2>
|
||||
<p class="hint key-hint">オーナーから教えてもらった6桁の数字</p>
|
||||
<h2 class="key-title" id="key-title">参加キーを入力</h2>
|
||||
<p class="hint key-hint" id="key-hint">オーナーから教えてもらった6桁の数字</p>
|
||||
<div class="key-inputs" id="digits">
|
||||
<input type="tel" inputmode="numeric" aria-label="1桁目" autocomplete="one-time-code">
|
||||
<input type="tel" inputmode="numeric" aria-label="2桁目">
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<div class="error-text" id="name-error"></div>
|
||||
|
||||
<button id="create" class="btn btn-orange btn-block mt-4" type="button">+ テーブルを作成</button>
|
||||
<a id="range-link" class="btn btn-dark btn-block mt-8" href="/range" hidden>♠ ハンドレンジ学習</a>
|
||||
|
||||
<div class="section-title">
|
||||
<span>開催中のテーブル</span>
|
||||
|
||||
Reference in new issue
Block a user