채팅 소리 기본 크기를 게임 소리의 80%로 올리고(60%는 너무 안 들린다는 의견), 관리자 사이트 설정에 "채팅 소리 크기"(게임 소리의 0~200%, 정수, 기본 80%)를 추가. 0%면 채팅 소리 없음. 각자의 소리 크기(0~100)는 그대로 곱해짐. 저장하면 /api/config와 방 정보(RoomView.chatSound)로 열린 방에도 바로 적용. 설정 화면에 저장 없이 그 값으로 울려 보는 "들어 보기" 버튼. feedback.test.ts·admin.test.ts·admin.e2e.ts에 확인 추가, docs/14-admin.md 표에 항목 추가
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -223,6 +223,32 @@ describe('site settings, rooms, users', () => {
|
||||
expect((await next).room.gameSpeed).toBe(2);
|
||||
});
|
||||
|
||||
test('chat sound: 0~200% (default 80), shown in /api/config and open rooms, out of range rejected', async () => {
|
||||
const s = start();
|
||||
const sup = await discordLogin(s, SUPER);
|
||||
const site = (await api(s.base, '/api/admin/site', { cookie: sup.cookie })).body.site;
|
||||
expect(site.chatSound).toBe(80);
|
||||
expect((await api(s.base, '/api/config')).body.chatSound).toBe(80);
|
||||
for (const bad of [-1, 201, 50.5]) {
|
||||
const r = await api(s.base, '/api/admin/site', { method: 'PUT', cookie: sup.cookie, body: JSON.stringify({ ...site, chatSound: bad }) });
|
||||
expect(r.res.status).toBe(400);
|
||||
}
|
||||
for (const ok of [0, 200, 120]) {
|
||||
const r = await api(s.base, '/api/admin/site', { method: 'PUT', cookie: sup.cookie, body: JSON.stringify({ ...site, chatSound: ok }) });
|
||||
expect(r.res.status).toBe(200);
|
||||
expect((await api(s.base, '/api/config')).body.chatSound).toBe(ok);
|
||||
}
|
||||
const g = await guest(s.base, '방장님');
|
||||
const room = await api(s.base, '/api/rooms', { method: 'POST', cookie: g.cookie, body: JSON.stringify({ gameId: 'omok' }) });
|
||||
const c = await new Client(s.base, g.cookie, g.id).connect();
|
||||
clients.push(c);
|
||||
c.send({ t: 'join', code: room.body.code, as: 'player' });
|
||||
expect((await c.next('room')).room.chatSound).toBe(120);
|
||||
const next = c.next('room');
|
||||
await api(s.base, '/api/admin/site', { method: 'PUT', cookie: sup.cookie, body: JSON.stringify({ ...site, chatSound: 30 }) });
|
||||
expect((await next).room.chatSound).toBe(30);
|
||||
});
|
||||
|
||||
test('admin closes a room: everyone is told and disconnected from it', async () => {
|
||||
const s = start();
|
||||
const sup = await discordLogin(s, SUPER);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import type { Database } from 'bun:sqlite';
|
||||
import { z } from 'zod';
|
||||
import type { AnyGameDefinition } from '@bg/engine';
|
||||
import { CATALOG, GAME_SPEED_DEFAULT, GAME_SPEED_MAX, GAME_SPEED_MIN, type CatalogEntry } from '@bg/shared';
|
||||
import { CATALOG, CHAT_SOUND_DEFAULT, CHAT_SOUND_MAX, CHAT_SOUND_MIN, GAME_SPEED_DEFAULT, GAME_SPEED_MAX, GAME_SPEED_MIN, type CatalogEntry } from '@bg/shared';
|
||||
|
||||
export const SiteSettingsSchema = z.object({
|
||||
siteName: z.string().trim().min(1).max(40).default('같이 놀자 보드게임'),
|
||||
@@ -21,6 +21,8 @@ export const SiteSettingsSchema = z.object({
|
||||
chatFloodGuard: z.boolean().default(false),
|
||||
/** Animations and the computers' thinking time are divided by this (applies at once, also to running games). */
|
||||
gameSpeed: z.number().min(GAME_SPEED_MIN).max(GAME_SPEED_MAX).default(GAME_SPEED_DEFAULT),
|
||||
/** Chat sound in % of a game sound (0 = silent, applies at once, also to open rooms). */
|
||||
chatSound: z.number().int().min(CHAT_SOUND_MIN).max(CHAT_SOUND_MAX).default(CHAT_SOUND_DEFAULT),
|
||||
});
|
||||
export type SiteSettings = z.infer<typeof SiteSettingsSchema>;
|
||||
|
||||
|
||||
@@ -93,8 +93,8 @@ export function createAdminApp(d: AdminDeps) {
|
||||
const before = d.settings.getSite();
|
||||
d.settings.setSite(parsed.data, actor(c));
|
||||
d.audit.log(actor(c), 'site.update', null, before, parsed.data);
|
||||
// The game speed applies at once: open rooms get it with a fresh room view (their animations follow it).
|
||||
if (before.gameSpeed !== parsed.data.gameSpeed) for (const r of d.rooms.all()) r.broadcastRoom();
|
||||
// The game speed and chat sound apply at once: open rooms get them with a fresh room view.
|
||||
if (before.gameSpeed !== parsed.data.gameSpeed || before.chatSound !== parsed.data.chatSound) for (const r of d.rooms.all()) r.broadcastRoom();
|
||||
return c.json({ site: parsed.data });
|
||||
});
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ export function createHttpApp(d: HttpDeps) {
|
||||
announcement: site.announcement,
|
||||
maintenance: site.maintenance,
|
||||
gameSpeed: site.gameSpeed,
|
||||
chatSound: site.chatSound,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
import { ulid } from 'ulid';
|
||||
import { SeededRng, createSeed, secureRandom, seedToHex, type AnyGameDefinition, type ChaChaSeed, type GameResult, type RngState } from '@bg/engine';
|
||||
import { botChatRequired, clampGameSpeed, botsAllowed, isBotId, makeBotId, botNumber, maskProfanity, type BotPick, type PublicUser, type RoomView, type ServerMessage, type SeatView } from '@bg/shared';
|
||||
import { botChatRequired, clampChatSound, clampGameSpeed, botsAllowed, isBotId, makeBotId, botNumber, maskProfanity, type BotPick, type PublicUser, type RoomView, type ServerMessage, type SeatView } from '@bg/shared';
|
||||
import { botPersona } from '@bg/games/bots';
|
||||
import { luckApplies, shufflesFor, type LuckJob } from '@bg/games/bots/luck';
|
||||
import { sha256Hex } from '../auth/sessions';
|
||||
@@ -440,6 +440,7 @@ export class Room {
|
||||
// Levels are revealed only once the game is over (fairness check).
|
||||
...(this.game?.finished && this.game.bots ? { lastBots: this.game.bots, lastShuffles: this.game.shuffles ?? 1 } : {}),
|
||||
gameSpeed: this.gameSpeed(),
|
||||
chatSound: clampChatSound(this.deps.settings?.getSite().chatSound),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class FakeCtx {
|
||||
// The real settings store needs a page (document); only the sound settings matter here.
|
||||
let settings = { sound: true, volume: 100 };
|
||||
mock.module('../store/session', () => ({ useSession: { getState: () => ({ settings }) } }));
|
||||
const { CHAT_LEVEL, GAME_LEVEL, chatSound, sounds } = await import('./feedback');
|
||||
const { GAME_LEVEL, chatLevel, chatSound, setChatSound, sounds } = await import('./feedback');
|
||||
|
||||
const setVolume = (volume: number, sound = true) => {
|
||||
settings = { sound, volume };
|
||||
@@ -67,19 +67,19 @@ beforeEach(() => {
|
||||
notes = [];
|
||||
});
|
||||
|
||||
test('chat sound is 60% of the game sounds', () => {
|
||||
test('chat sound is 80% of the game sounds by default', () => {
|
||||
expect(GAME_LEVEL).toBe(0.15);
|
||||
expect(CHAT_LEVEL).toBeCloseTo(GAME_LEVEL * 0.6, 10);
|
||||
expect(chatLevel()).toBeCloseTo(GAME_LEVEL * 0.8, 10);
|
||||
setVolume(100);
|
||||
sounds.myTurn(); // a typical game sound at the usual level
|
||||
const game = Math.max(...notes.map((n) => n.peak));
|
||||
notes = [];
|
||||
chatSound();
|
||||
// Notes playing at the same moment add up; the loudest moment of the chat sound is 60% of a game sound.
|
||||
// Notes playing at the same moment add up; the loudest moment of the chat sound is 80% of a game sound.
|
||||
const byStart = new Map<number, number>();
|
||||
for (const n of notes) byStart.set(n.start, (byStart.get(n.start) ?? 0) + n.peak);
|
||||
const loudest = Math.max(...byStart.values());
|
||||
expect(loudest).toBeCloseTo(game * 0.6, 6);
|
||||
expect(loudest).toBeCloseTo(game * 0.8, 6);
|
||||
// One bubble ("뽁") gliding up from a low start.
|
||||
expect(notes.map((n) => n.freq)).toEqual([380]);
|
||||
expect(notes.map((n) => n.to)).toEqual([1150]);
|
||||
@@ -110,3 +110,28 @@ test('lines arriving in a burst share one sound', async () => {
|
||||
chatSound();
|
||||
expect(notes.length).toBe(one * 2);
|
||||
});
|
||||
|
||||
test('admin chat sound setting: 0~200% of a game sound, 0 is silent, preview does not change it', async () => {
|
||||
setVolume(100);
|
||||
for (const [pct, want] of [[200, 2], [150, 1.5], [999, 2], [-5, 0]] as const) {
|
||||
setChatSound(pct);
|
||||
expect(chatLevel()).toBeCloseTo(GAME_LEVEL * want, 10);
|
||||
}
|
||||
setChatSound(0);
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
notes = [];
|
||||
chatSound();
|
||||
expect(notes).toEqual([]);
|
||||
setChatSound(200);
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
chatSound();
|
||||
expect(Math.max(...notes.map((n) => n.peak))).toBeCloseTo(GAME_LEVEL * 2, 6);
|
||||
// Previewing another value in the admin page plays it once and leaves the setting alone.
|
||||
await new Promise((r) => setTimeout(r, 100));
|
||||
notes = [];
|
||||
chatSound(50);
|
||||
expect(Math.max(...notes.map((n) => n.peak))).toBeCloseTo(GAME_LEVEL * 0.5, 6);
|
||||
expect(chatLevel()).toBeCloseTo(GAME_LEVEL * 2, 10);
|
||||
setChatSound(undefined); // missing from an old server → the default 80%
|
||||
expect(chatLevel()).toBeCloseTo(GAME_LEVEL * 0.8, 10);
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* directly for something of their own.
|
||||
*/
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { CHAT_SOUND_DEFAULT, clampChatSound } from '@bg/shared/lite';
|
||||
import { useSession } from '../store/session';
|
||||
|
||||
let ctx: AudioContext | null = null;
|
||||
@@ -190,21 +191,30 @@ export const sounds = {
|
||||
|
||||
/** The usual level of a game sound at volume 100 (`tone`'s default). */
|
||||
export const GAME_LEVEL = 0.15;
|
||||
/** Chat sound: 60% of the game sounds (it follows the same volume setting); 90% hit the ears too hard. */
|
||||
export const CHAT_LEVEL = GAME_LEVEL * 0.6;
|
||||
/** Chat sound in % of a game sound (admin setting `chatSound`, 0~200, default 80); it also follows the volume setting. */
|
||||
let chatPercent = CHAT_SOUND_DEFAULT;
|
||||
/** Sets the chat sound percent from /api/config or the room view (out-of-range values are clamped). */
|
||||
export function setChatSound(x: unknown): void {
|
||||
chatPercent = clampChatSound(x);
|
||||
}
|
||||
/** Peak level of the chat sound at volume 100 (`percent`: the admin setting unless previewing another value). */
|
||||
export const chatLevel = (percent = chatPercent): number => (GAME_LEVEL * clampChatSound(percent)) / 100;
|
||||
let lastChatAt = -Infinity;
|
||||
|
||||
/**
|
||||
* Chat "뽁": one water-drop bubble like a messenger, a sine gliding up fast from low (about 0.08 s).
|
||||
* Kept apart from the UI/game sounds, which are steady notes (click, good, myTurn …), so it is not mistaken for one;
|
||||
* it also starts lower and is shorter and softer than the game "pop" (700→1400 Hz).
|
||||
* It peaks at CHAT_LEVEL and fades in over 12 ms so it does not snap. Lines arriving in a burst share one sound.
|
||||
* It peaks at `chatLevel()` (none at 0%) and fades in over 12 ms so it does not snap. Lines arriving in a burst share one sound.
|
||||
* `percent` previews another level (admin settings) without changing the setting.
|
||||
*/
|
||||
export function chatSound(): void {
|
||||
export function chatSound(percent?: number): void {
|
||||
const level = chatLevel(percent);
|
||||
if (level <= 0) return;
|
||||
const now = performance.now();
|
||||
if (now - lastChatAt < 80) return;
|
||||
lastChatAt = now;
|
||||
tone(380, 80, 'sine', CHAT_LEVEL, 0, { attack: 12, slideTo: 1150 });
|
||||
tone(380, 80, 'sine', level, 0, { attack: 12, slideTo: 1150 });
|
||||
}
|
||||
|
||||
/** Plays the chat sound whenever `lastKey` (the newest live chat line) changes after the first render. */
|
||||
|
||||
@@ -67,7 +67,7 @@ export interface RoomPreview {
|
||||
|
||||
export const api = {
|
||||
config: () =>
|
||||
call<{ discord: boolean; catalog: (CatalogEntry & { notice?: string })[]; siteName: string; announcement: string; maintenance: boolean; gameSpeed?: number }>('GET', '/api/config'),
|
||||
call<{ discord: boolean; catalog: (CatalogEntry & { notice?: string })[]; siteName: string; announcement: string; maintenance: boolean; gameSpeed?: number; chatSound?: number }>('GET', '/api/config'),
|
||||
me: () => call<MeResponse>('GET', '/api/me'),
|
||||
guest: (nickname: string) => call<{ me: PublicUser }>('POST', '/api/auth/guest', { nickname }),
|
||||
updateMe: (patch: { nickname?: string; useAvatar?: boolean; settings?: Settings }) => call<{ me: PublicUser }>('PATCH', '/api/me', patch),
|
||||
|
||||
@@ -7,6 +7,7 @@ import { PROTOCOL, type GameResultView, type PublicUser, type RoomView, type Ser
|
||||
import { toast } from '../store/toast';
|
||||
import { markOutdated, noteServerBuild } from '../lib/update';
|
||||
import { setGameSpeed } from '../lib/motion';
|
||||
import { setChatSound } from '../lib/feedback';
|
||||
|
||||
export type ConnStatus = 'idle' | 'connecting' | 'open' | 'reconnecting' | 'replaced' | 'offline';
|
||||
|
||||
@@ -285,6 +286,7 @@ class GameSocket {
|
||||
case 'room':
|
||||
if (m.seq >= st.roomSeq || m.room.code !== st.room?.code) {
|
||||
if (m.room.gameSpeed !== undefined) setGameSpeed(m.room.gameSpeed);
|
||||
if (m.room.chatSound !== undefined) setChatSound(m.room.chatSound);
|
||||
useRoom.setState({ room: m.room, roomSeq: m.seq, joinError: null });
|
||||
if (m.room.status === 'playing' && st.result) useRoom.setState({ result: null });
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** 관리자 사이트 (docs/14-admin.md). Downloaded only when /admin is opened. */
|
||||
import { useCallback, useEffect, useState, type ReactNode } from 'react';
|
||||
import { NavLink, Route, Routes, useNavigate, useParams } from 'react-router';
|
||||
import { formatRoomCode, GAME_SPEED_MAX, GAME_SPEED_MIN, type MyGameSummary } from '@bg/shared/lite';
|
||||
import { CHAT_SOUND_DEFAULT, CHAT_SOUND_MAX, CHAT_SOUND_MIN, formatRoomCode, GAME_SPEED_MAX, GAME_SPEED_MIN, type MyGameSummary } from '@bg/shared/lite';
|
||||
import { ConfirmSheet, Sheet } from '../../components/ui';
|
||||
import { apiCall, discordLoginUrl, type Role } from '../../net/api';
|
||||
import { useSession } from '../../store/session';
|
||||
@@ -10,6 +10,7 @@ import { SchemaForm, type JsonSchema } from './SchemaForm';
|
||||
import { gameName } from '../../components/GameNotice';
|
||||
import { RecordCell, record, recordText, resultLabel, sumStats } from '../../components/PlayerCard';
|
||||
import type { GameStat } from '../../net/api';
|
||||
import { chatSound } from '../../lib/feedback';
|
||||
|
||||
const a = {
|
||||
get: <T,>(p: string) => apiCall<T>('GET', `/api/admin${p}`),
|
||||
@@ -445,6 +446,43 @@ function Site() {
|
||||
</span>
|
||||
</div>
|
||||
</section>
|
||||
<section className="card stack">
|
||||
<div className="stack" style={{ gap: 6 }}>
|
||||
<strong id="chat-sound-label">
|
||||
채팅 소리 크기 <span className="muted small">(게임 소리의 {CHAT_SOUND_MIN}~{CHAT_SOUND_MAX}%, 기본 {CHAT_SOUND_DEFAULT}%)</span>
|
||||
</strong>
|
||||
<p className="muted small" style={{ margin: 0 }}>
|
||||
새 채팅이 올 때 나는 "뽁" 소리의 크기예요. 100%면 게임 소리와 같고, 0%면 채팅 소리가 안 나요. 각자 정한 소리 크기도 그대로 곱해져요. 저장하면 열린 방에도 바로 적용돼요.
|
||||
</p>
|
||||
<div className="row" style={{ gap: 8, alignItems: 'center', flexWrap: 'wrap' }}>
|
||||
<input
|
||||
type="range"
|
||||
min={CHAT_SOUND_MIN}
|
||||
max={CHAT_SOUND_MAX}
|
||||
step={5}
|
||||
value={s.chatSound}
|
||||
aria-labelledby="chat-sound-label"
|
||||
style={{ accentColor: 'var(--primary)', flex: '1 1 160px' }}
|
||||
onChange={(e) => setS({ ...s, chatSound: Number(e.target.value) })}
|
||||
/>
|
||||
<input
|
||||
className="input"
|
||||
type="number"
|
||||
min={CHAT_SOUND_MIN}
|
||||
max={CHAT_SOUND_MAX}
|
||||
step={1}
|
||||
value={s.chatSound}
|
||||
aria-label="채팅 소리 크기(%)"
|
||||
style={{ width: 90 }}
|
||||
onChange={(e) => setS({ ...s, chatSound: Number(e.target.value) })}
|
||||
/>
|
||||
<span className="muted small">%</span>
|
||||
<button type="button" className="btn btn-ghost btn-sm" onClick={() => chatSound(s.chatSound)}>
|
||||
들어 보기
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<section className="card stack">
|
||||
{num('maxRoomsPerUser', '사용자당 동시에 만들 수 있는 방', 1, 50)}
|
||||
{num('maxRooms', '서버 전체 방 수 제한', 10, 20000)}
|
||||
|
||||
@@ -4,6 +4,7 @@ import type { CatalogEntry, PublicUser } from '@bg/shared/lite';
|
||||
import { api, type Settings } from '../net/api';
|
||||
import { socket } from '../net/socket';
|
||||
import { setGameSpeed } from '../lib/motion';
|
||||
import { setChatSound } from '../lib/feedback';
|
||||
|
||||
const LS_KEY = 'bg.settings';
|
||||
|
||||
@@ -76,7 +77,7 @@ export const useSession = create<SessionState>((set, get) => ({
|
||||
hasDiscordAvatar: false,
|
||||
async refresh() {
|
||||
const [cfg, me] = await Promise.all([
|
||||
api.config().catch(() => ({ discord: false, catalog: [] as CatalogEntry[], siteName: '같이 놀자 보드게임', announcement: '', maintenance: false, gameSpeed: 1 })),
|
||||
api.config().catch(() => ({ discord: false, catalog: [] as CatalogEntry[], siteName: '같이 놀자 보드게임', announcement: '', maintenance: false, gameSpeed: 1, chatSound: undefined })),
|
||||
api.me().catch(() => ({ me: null }) as Awaited<ReturnType<typeof api.me>>),
|
||||
]);
|
||||
const settings = { ...get().settings, ...withoutDeviceOnly(me.settings ?? {}) };
|
||||
@@ -84,6 +85,7 @@ export const useSession = create<SessionState>((set, get) => ({
|
||||
localStorage.setItem(LS_KEY, JSON.stringify(settings));
|
||||
document.title = cfg.siteName;
|
||||
setGameSpeed(cfg.gameSpeed);
|
||||
setChatSound(cfg.chatSound);
|
||||
set({
|
||||
loaded: true,
|
||||
me: me.me,
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
| 채팅 기본값 | 켜짐 / 필터 켜짐 | 새 방의 기본값 |
|
||||
| 채팅 도배 방지 | 꺼짐 | 켜면 접속마다 채팅·입력 중 신호를 초당 50개(한 번에 200개)까지만 받음(`03-realtime-protocol.md` §8). 끄면 채팅 속도 제한 없음. 저장하면 바로 적용 |
|
||||
| 게임 속도 배율 | 1배 | 1/16~16배. 게임 화면의 애니메이션·연출(배너가 떠 있는 시간, 차례로 이어지는 연출, 다시 보기 한 칸)과 컴퓨터가 생각하는 시간을 이 배율로 나눈다(2배 = 두 배 빠르게). 저장하면 열린 방에도 바로 적용(방 정보 `RoomView.gameSpeed`로 다시 보냄). 턴 제한 시간·결과 화면 대기 같은 규칙 시간, 원카드 외치기 같은 반응 경쟁, 실시간 게임의 판정 시간은 그대로 |
|
||||
| 채팅 소리 크기 | 80% | 0~200%(정수). 새 채팅 "뽁" 소리의 크기를 게임 소리 기준(0.15)에 대한 비율로 정한다(100% = 게임 소리와 같음, 0% = 채팅 소리 없음). 각자 정한 소리 크기(0~100)가 그대로 곱해진다. 저장하면 열린 방에도 바로 적용(`/api/config`와 방 정보 `RoomView.chatSound`). 설정 화면의 "들어 보기"는 저장하지 않고 그 값으로 한 번 울린다 |
|
||||
|
||||
## 6. 사용자 관리 (슈퍼어드민)
|
||||
- **이용 제한**: 사유와 함께 설정. 즉시 그 사용자의 모든 세션 삭제와 접속 종료. 제한된 디스코드 계정은 다시 로그인할 수 없다("이용이 제한된 계정이에요"). 해제하면 다시 로그인 가능.
|
||||
|
||||
@@ -131,6 +131,19 @@ try {
|
||||
if (app.settings.getSite().chatFloodGuard !== true) throw new Error('chat flood guard not saved');
|
||||
});
|
||||
|
||||
await step('사이트 탭: 채팅 소리 크기 기본 80%, 150% 저장 → /api/config 반영', async () => {
|
||||
const pct = a.getByLabel('채팅 소리 크기(%)');
|
||||
if ((await pct.inputValue()) !== '80') throw new Error(`chat sound should default to 80: ${await pct.inputValue()}`);
|
||||
await pct.fill('150');
|
||||
await pct.evaluate((el) => el.scrollIntoView({ block: 'center' }));
|
||||
await a.getByRole('button', { name: '들어 보기' }).click();
|
||||
await a.screenshot({ path: join(SHOTS, 'admin-6-chat-sound.png') });
|
||||
await a.getByRole('button', { name: '저장', exact: true }).click();
|
||||
await a.getByText('저장했어요.').last().waitFor();
|
||||
const cfg = await a.evaluate(async () => (await (await fetch('/api/config')).json()).chatSound);
|
||||
if (cfg !== 150) throw new Error(`chatSound not saved: ${cfg}`);
|
||||
});
|
||||
|
||||
await step('기록 탭에 변경 내역', async () => {
|
||||
await a.locator('.admin-side').getByRole('link', { name: '기록', exact: true }).click();
|
||||
await a.getByText('어드민 추가').waitFor();
|
||||
|
||||
@@ -16,6 +16,19 @@ export function clampGameSpeed(x: unknown): number {
|
||||
return Math.min(GAME_SPEED_MAX, Math.max(GAME_SPEED_MIN, x));
|
||||
}
|
||||
|
||||
/**
|
||||
* Chat sound level (admin site setting, docs/14-admin.md §5): percent of the usual game sound level, 0 = no chat sound.
|
||||
* It still follows each player's own volume setting.
|
||||
*/
|
||||
export const CHAT_SOUND_MIN = 0;
|
||||
export const CHAT_SOUND_MAX = 200;
|
||||
export const CHAT_SOUND_DEFAULT = 80;
|
||||
/** Clamps a chat sound percent from the network / settings into the range (anything not a number → the default). */
|
||||
export function clampChatSound(x: unknown): number {
|
||||
if (typeof x !== 'number' || !Number.isFinite(x)) return CHAT_SOUND_DEFAULT;
|
||||
return Math.min(CHAT_SOUND_MAX, Math.max(CHAT_SOUND_MIN, x));
|
||||
}
|
||||
|
||||
export const EMOTES = ['thumbs', 'laugh', 'wow', 'sad', 'clap', 'nice', 'hurry', 'gg'] as const;
|
||||
export const EMOTE_LABEL: Record<(typeof EMOTES)[number], string> = {
|
||||
thumbs: '👍',
|
||||
@@ -83,6 +96,8 @@ export interface RoomView {
|
||||
lastShuffles?: number;
|
||||
/** Game speed set by the admin (1/16 ~ 16, 1 = normal): the screen's animations follow it. */
|
||||
gameSpeed?: number;
|
||||
/** Chat sound set by the admin (0~200, % of a game sound): the chat "뽁" follows it. */
|
||||
chatSound?: number;
|
||||
}
|
||||
|
||||
export interface GameResultView {
|
||||
|
||||
Reference in New Issue
Block a user