Let admins delete tables from the lobby

Admins see a "削除" button on every table in the lobby. It calls the new
admin-only DELETE /api/tables/:id (404 for non-admins, same-origin only),
which closes the table the same way as when every human leaves. Players
and spectators still at the table are told "管理者がテーブルを削除しました。"

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
agomizi1cmandClaude Opus 5.5 committed 2026-10-19 23:03:24 +09:00
1 parent 3f2515a9fa
commit 0318ee2b5e
5 files changed
+53 -13

No files matched your search

+4 -3
View File
@@ -54,7 +54,7 @@
});
socket.on('disconnect', () => { $('conn-lost').hidden = false; });
socket.on('connect_error', () => { $('conn-lost').hidden = false; });
socket.on('table:closed', () => showNotFound(true));
socket.on('table:closed', (p) => showNotFound(true, p && p.reason));
socket.on('table:state', (s) => {
state = s;
pending = false;
@@ -94,10 +94,11 @@
}
// closed: プレイヤーが全員退席してテーブルが閉じられた
function showNotFound(closed) {
function showNotFound(closed, reason) {
if (closed) {
$('not-found-title').textContent = 'テーブルが終了しました';
$('not-found-text').textContent = 'プレイヤーが全員退席したため、テーブルを閉じました。';
$('not-found-text').textContent =
reason === 'deleted' ? '管理者がテーブルを削除しました。' : 'プレイヤーが全員退席したため、テーブルを閉じました。';
}
$('main').hidden = true;
$('action-bar').hidden = true;