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
@@ -30,6 +30,13 @@ if (!ACCESS_KEY || !/^\d{6}$/.test(ACCESS_KEY)) {
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// 管理者キー(任意)。入力すると管理者として入室でき、ハンドレンジ学習ページが見える
|
||||
const ADMIN_KEY = process.env.ADMIN_KEY || null;
|
||||
if (ADMIN_KEY && (!/^\d{6}$/.test(ADMIN_KEY) || ADMIN_KEY === ACCESS_KEY)) {
|
||||
console.error('[config] ADMIN_KEY は ACCESS_KEY と異なる6桁の数字にしてください。');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
PORT: Number(process.env.PORT) || 4671,
|
||||
|
||||
@@ -43,6 +50,7 @@ module.exports = {
|
||||
|
||||
// 参加キー(6桁の数字)。.env の ACCESS_KEY
|
||||
ACCESS_KEY,
|
||||
ADMIN_KEY,
|
||||
|
||||
// 1テーブルの最大着席数
|
||||
MAX_SEATS: 9,
|
||||
|
||||
Reference in new issue
Block a user