업데이트 알림(joke-app과 같게): 웹 빌드 id를 index.html meta(mq-build)에 넣고 서버가 /api/version·welcome으로 알려 줌, 다르면 위쪽에 '업데이트 내용이 있습니다 · 지금 새로고침하기 · ✕' 카드(소켓 다시 연결될 때·5분마다·탭으로 돌아올 때 확인)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-19 22:28:38 +09:00
parent 127513db63
commit 6ed669d5b4
11 changed files with 185 additions and 8 deletions

View File

@@ -21,6 +21,8 @@ export interface GatewayDeps {
rooms: RoomManager;
/** Chat flood guard (docs/12 채팅): off by default, the admin turns it on in site settings. */
chatGuard?: () => { on: boolean; ratePerSec: number; burst: number };
/** The web build being served (업데이트 알림). */
build?: () => string | null;
}
export class Gateway {
@@ -63,7 +65,7 @@ export class Gateway {
const set = this.conns.get(ws.data.userId) ?? new Set();
set.add(ws);
this.conns.set(ws.data.userId, set);
this.send(ws, { t: 'welcome', protocol: PROTOCOL, userId: ws.data.userId, serverNow: Date.now() });
this.send(ws, { t: 'welcome', protocol: PROTOCOL, userId: ws.data.userId, serverNow: Date.now(), build: this.d.build?.() ?? null });
},
message: (ws: ServerWebSocket<WsData>, raw: string | Buffer): void => {
const text = typeof raw === 'string' ? raw : raw.toString();