경기 기록 가져오기 진행 바 · 취소: Riot 경기 기록을 가져오는 동안 사이트 경기 탭 · 앱 게임 연동 탭에 목록 확인 중(얼마나 걸릴지 모름) → 받은 경기 / 받을 경기 · % · 남은 시간 진행 바와 취소 버튼 (취소하면 받은 경기는 남고 다음 주기에 남은 것부터 이어서) · 진행 상황은 games.state 의 history 로 보냄 · POST /api/games/history/cancel · 끝나면 경기 목록 새로 · 목록 불러오는 중 표시 · schema.ts 사본 다시 맞춤
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -120,6 +120,14 @@ export async function buildApi(d: ApiDeps): Promise<FastifyInstance> {
|
||||
return { user: toUser(u, store.listAccounts()), stats: { talkMs: st.ms, count: st.n, topWords }, matches };
|
||||
});
|
||||
|
||||
// Riot 경기 기록 가져오기 취소 (v1.9.1, 사이트 경기 탭 진행 바). 받은 경기는 그대로 두고 다음 주기(30분 뒤)에 이어서 한다
|
||||
app.post<{ Body: { game?: string } }>('/api/games/history/cancel', async (req) => {
|
||||
const g = req.body?.game;
|
||||
const r = d.games.cancelHistory(g === 'valorant' || g === 'lol' ? g : undefined);
|
||||
if (r.cancelled.length) log.info(`경기 기록 가져오기 취소 (${r.cancelled.join(', ')}) · ${req.headers['x-gvr-user'] ? '사이트' : '이 PC'}`);
|
||||
return { ok: true, ...r };
|
||||
});
|
||||
|
||||
// 유저 설정 (v1.6.0, 사이트 "내 정보" · 관리 화면): 색 · 녹음 제외 · 라이엇 ID. 본인 또는 관리자만
|
||||
app.patch<{ Params: { id: string }; Body: { color?: string; excluded?: boolean; riotIds?: string[] } }>('/api/users/:id', async (req, reply) => {
|
||||
const u = store.getUser(req.params.id);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,3 +1,4 @@
|
||||
import type { HistoryProgress } from '@gvr/shared';
|
||||
import type { Store } from '../db/db.js';
|
||||
import { logger } from '../util/log.js';
|
||||
|
||||
@@ -31,6 +32,11 @@ export interface HistoryOptions {
|
||||
export class HistorySync {
|
||||
private running = false;
|
||||
private lastAt = 0;
|
||||
private everyMs = 0;
|
||||
/** 지금 가져오는 중이면 진행 상황 (사이트 · 앱 화면 진행 바, v1.9.1) */
|
||||
private prog: HistoryProgress | null = null;
|
||||
/** 사용자가 취소함: 이번 실행만 멈추고 다음 주기에 이어서 한다 */
|
||||
private cancelled = false;
|
||||
|
||||
constructor(
|
||||
private store: Store,
|
||||
@@ -41,12 +47,40 @@ export class HistorySync {
|
||||
/** 주기 확인: 앞 실행에서 everyMs 가 지났고 게임 중이 아니면 백그라운드로 돌린다 */
|
||||
maybeRun(everyMs: number, firstDelayMs = 60000): void {
|
||||
const now = Date.now();
|
||||
this.everyMs = everyMs;
|
||||
if (!this.lastAt) this.lastAt = now - everyMs + Math.min(firstDelayMs, everyMs);
|
||||
if (this.running || now - this.lastAt < everyMs || !this.src.idle()) return;
|
||||
this.lastAt = now;
|
||||
void this.run().catch((e) => log.warn(`${this.src.game} 경기 기록 가져오기 실패`, e));
|
||||
}
|
||||
|
||||
/** 진행 상황 (가져오는 중이 아니면 null). 남은 시간은 지금까지 한 경기에 걸린 평균으로 잰다 */
|
||||
progress(): HistoryProgress | null {
|
||||
const p = this.prog;
|
||||
if (!p) return null;
|
||||
let etaMs: number | null = null;
|
||||
if (p.phase === 'fetch' && p.done > 0 && this.fetchStartedAt) {
|
||||
const per = (Date.now() - this.fetchStartedAt) / p.done;
|
||||
etaMs = Math.round(per * (p.total - p.done));
|
||||
}
|
||||
return { ...p, etaMs };
|
||||
}
|
||||
private fetchStartedAt = 0;
|
||||
|
||||
/** 지금 가져오기 취소. 받은 경기는 그대로 두고, 다음 주기(everyMs 뒤)에 남은 것부터 이어서 한다 */
|
||||
cancel(): { cancelled: boolean; resumeAt: number | null } {
|
||||
if (!this.running || this.cancelled) return { cancelled: false, resumeAt: null };
|
||||
this.cancelled = true;
|
||||
this.prog = null;
|
||||
log.info(`${this.src.game} 경기 기록 가져오기: 사용자가 취소함`);
|
||||
return { cancelled: true, resumeAt: this.everyMs ? this.lastAt + this.everyMs : null };
|
||||
}
|
||||
|
||||
/** 멈춰야 하나 (게임 시작 · 취소) */
|
||||
private halted(): boolean {
|
||||
return this.cancelled || !this.src.idle();
|
||||
}
|
||||
|
||||
private skipKey(): string {
|
||||
return `history_skip:${this.src.game}`;
|
||||
}
|
||||
@@ -64,26 +98,31 @@ export class HistorySync {
|
||||
const acct = this.src.account();
|
||||
if (!acct) return 0;
|
||||
this.running = true;
|
||||
this.cancelled = false;
|
||||
try {
|
||||
const fullKey = `history_full:${this.src.game}:${acct}`;
|
||||
const full = !!this.store.meta(fullKey);
|
||||
const skip = this.skipped();
|
||||
const todo: string[] = [];
|
||||
this.prog = { phase: 'scan', first: !full, scanned: 0, done: 0, total: 0, startedAt: Date.now(), etaMs: null };
|
||||
for (let start = 0; start < this.opts.max; start += this.opts.pageSize) {
|
||||
if (!this.src.idle()) return 0;
|
||||
if (this.halted()) return 0;
|
||||
const p = await this.src.page(start, this.opts.pageSize);
|
||||
if (p === 'retry') return 0;
|
||||
if (p === 'retry' || this.cancelled) return 0;
|
||||
const fresh = p.ids.filter((id) => !skip.has(id) && !this.store.getMatch(id) && !todo.includes(id));
|
||||
todo.push(...fresh);
|
||||
this.prog = { ...this.prog, scanned: this.prog.scanned + p.ids.length, total: todo.length };
|
||||
if (!p.ids.length || p.ids.length < this.opts.pageSize || (p.total !== null && start + this.opts.pageSize >= p.total)) break;
|
||||
// 한 번 끝까지 훑은 뒤에는 아는 경기만 나오는 쪽에서 멈춘다
|
||||
if (full && !fresh.length) break;
|
||||
}
|
||||
if (todo.length) log.info(`${this.src.game} 경기 기록: 새 경기 ${todo.length}개 가져오는 중`);
|
||||
let added = 0;
|
||||
for (const id of todo) {
|
||||
if (!this.src.idle()) {
|
||||
log.info(`${this.src.game} 경기 기록: 게임이 시작돼 멈춤 (${added}/${todo.length})`);
|
||||
this.fetchStartedAt = Date.now();
|
||||
if (this.prog) this.prog = { ...this.prog, phase: 'fetch', done: 0, total: todo.length };
|
||||
for (const [i, id] of todo.entries()) {
|
||||
if (this.halted()) {
|
||||
log.info(`${this.src.game} 경기 기록: ${this.cancelled ? '취소해서' : '게임이 시작돼'} 멈춤 (${added}/${todo.length})`);
|
||||
return added;
|
||||
}
|
||||
const r = await this.src.fetch(id).catch(() => 'retry' as const);
|
||||
@@ -93,14 +132,17 @@ export class HistorySync {
|
||||
skip.add(id);
|
||||
this.store.setMeta(this.skipKey(), JSON.stringify([...skip].slice(-2000)));
|
||||
}
|
||||
if (this.prog) this.prog = { ...this.prog, done: i + 1 };
|
||||
await new Promise((res) => setTimeout(res, this.opts.gapMs));
|
||||
}
|
||||
if (this.cancelled) return added;
|
||||
// 끝(또는 max)까지 다 받았다: 다음부터는 새 경기만 본다
|
||||
this.store.setMeta(fullKey, '1');
|
||||
if (added) log.info(`${this.src.game} 경기 기록: ${added}개 저장`);
|
||||
return added;
|
||||
} finally {
|
||||
this.running = false;
|
||||
this.prog = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,6 +166,7 @@ export class LolAdapter implements GameAdapter {
|
||||
self: this.lcu || inMatch ? { name: this.selfRiotId, character: snap?.champ ?? null, characterImage: snap?.champIcon ?? null, kda: snap?.kda ?? null, extra: snap?.extra ?? null } : null,
|
||||
players: snap?.players ?? null,
|
||||
error: this.lastErr || null,
|
||||
history: this.history.progress(),
|
||||
updatedAt: Date.now(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,6 +67,26 @@ export class GameManager implements AdapterHost {
|
||||
return this.adapters.map((a) => a.liveGame());
|
||||
}
|
||||
|
||||
/** Riot 경기 기록 가져오기 취소 (사이트 경기 탭 · 앱 게임 연동 탭의 취소 버튼, v1.9.1). game 이 없으면 둘 다 */
|
||||
cancelHistory(game?: 'valorant' | 'lol'): { cancelled: ('valorant' | 'lol')[]; resumeAt: number | null } {
|
||||
const cancelled: ('valorant' | 'lol')[] = [];
|
||||
let resumeAt: number | null = null;
|
||||
for (const a of this.adapters) {
|
||||
if (game && a.game !== game) continue;
|
||||
const r = a.history.cancel();
|
||||
if (!r.cancelled) continue;
|
||||
cancelled.push(a.game);
|
||||
if (r.resumeAt && (!resumeAt || r.resumeAt < resumeAt)) resumeAt = r.resumeAt;
|
||||
}
|
||||
// 화면에서 진행 바가 바로 사라지게
|
||||
if (cancelled.length) {
|
||||
const live = this.live();
|
||||
this.lastLive = JSON.stringify(live.map(({ updatedAt: _u, ...rest }) => rest));
|
||||
this.bus.live({ type: 'games.state', data: live });
|
||||
}
|
||||
return { cancelled, resumeAt };
|
||||
}
|
||||
|
||||
private liveTimer: NodeJS.Timeout | null = null;
|
||||
private lastLive = '';
|
||||
/** 게임 상태가 바뀌면 사이트로 알린다 (2초마다 확인) */
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { EventRow, MatchRow, Store } from '../db/db.js';
|
||||
import type { Settings } from '../settings.js';
|
||||
import type { WorkerClient } from '../stt/worker.js';
|
||||
import type { GameAssets } from './assets.js';
|
||||
import type { HistorySync } from './history.js';
|
||||
|
||||
export interface MatchStart {
|
||||
id: string;
|
||||
@@ -45,4 +46,6 @@ export interface GameAdapter {
|
||||
gameRunning(): boolean;
|
||||
/** 지금 게임 상태 (자세히) */
|
||||
liveGame(): LiveGame;
|
||||
/** Riot 경기 기록 가져오기 */
|
||||
readonly history: HistorySync;
|
||||
}
|
||||
|
||||
@@ -184,6 +184,7 @@ export class ValorantAdapter implements GameAdapter {
|
||||
self: this.auth ? { name: this.selfName, character: m?.selfAgent ?? null, characterImage: null, kda: null, extra: null } : null,
|
||||
players: m?.players || null,
|
||||
error: this.lastErr || null,
|
||||
history: this.history.progress(),
|
||||
updatedAt: Date.now(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -110,6 +110,8 @@ export interface GvrApi {
|
||||
users(): Promise<User[]>;
|
||||
setRiotIds(userId: string, riotIds: string[]): Promise<void>;
|
||||
setExcluded(userId: string, excluded: boolean): Promise<void>;
|
||||
/** Riot 경기 기록 가져오기 취소 (v1.9.1). game 이 없으면 둘 다. resumeAt = 다시 이어서 하는 시각 */
|
||||
cancelHistory(game?: 'valorant' | 'lol'): Promise<{ cancelled: ('valorant' | 'lol')[]; resumeAt: number | null }>;
|
||||
dictionary(): Promise<{ labels: Record<string, string>; packs: { key: string; label: string; count: number }[]; entries: { id: number; word: string; from: string | null; kind: 'hotword' | 'correction'; pack: string; source: string; enabled: boolean; hits: number }[] }>;
|
||||
addWord(word: string): Promise<void>;
|
||||
addCorrection(from: string, to: string): Promise<void>;
|
||||
|
||||
@@ -244,6 +244,7 @@ export function registerIpc(ctx: IpcContext) {
|
||||
core.store.setRiotIds(userId, riotIds, true);
|
||||
core.bus.live({ type: 'users.updated', data: [] });
|
||||
},
|
||||
cancelHistory: (game?: 'valorant' | 'lol') => core.games.cancelHistory(game),
|
||||
setExcluded: (userId: string, excluded: boolean) => {
|
||||
core.store.setExcluded(userId, excluded);
|
||||
core.bus.live({ type: 'users.updated', data: [] });
|
||||
|
||||
@@ -4,7 +4,7 @@ import { contextBridge, ipcRenderer } from 'electron';
|
||||
const METHODS = [
|
||||
'getState', 'updateSettings', 'setSecret', 'testBotToken', 'restartBot', 'guildMembers', 'previewTts', 'gpuInfo', 'models',
|
||||
'download', 'deleteModel', 'applyModels', 'chooseFolder', 'registerDevice', 'unregisterDevice', 'runDiagnostics', 'storageUsage',
|
||||
'runRetention', 'users', 'setRiotIds', 'setExcluded', 'dictionary', 'addWord', 'addCorrection', 'deleteDict', 'setDictEnabled',
|
||||
'runRetention', 'users', 'setRiotIds', 'setExcluded', 'cancelHistory', 'dictionary', 'addWord', 'addCorrection', 'deleteDict', 'setDictEnabled',
|
||||
'finetuneStatus', 'finetuneInstall', 'finetuneStart', 'finetuneStop', 'finetuneRollback', 'clearTrainingData', 'openExternal',
|
||||
'openPath', 'setAutoStart', 'finishWizard', 'recentLogs', 'quit',
|
||||
'authState', 'authLogin', 'authCancel', 'authLogout', 'authRecheck', 'adminUsers', 'adminAddUser', 'adminSetRole', 'adminRemoveUser', 'adminDisplayNames', 'adminSetDisplayName',
|
||||
|
||||
@@ -168,7 +168,8 @@ export function createMockGvr(): GvrApi {
|
||||
},
|
||||
{
|
||||
game: 'lol', enabled: true, connected: true, phase: '로비', inMatch: false, matchId: null, mode: '솔로 랭크', map: null, mapImage: null,
|
||||
startedAt: null, round: null, score: null, gameTimeSec: null, teamKills: null, self: { name: '하늘#KR1', character: null, characterImage: null, kda: null, extra: null }, players: null, error: null, updatedAt: now,
|
||||
startedAt: null, round: null, score: null, gameTimeSec: null, teamKills: null, self: { name: '하늘#KR1', character: null, characterImage: null, kda: null, extra: null }, players: null, error: null,
|
||||
history: q.has('nohistory') ? null : { phase: 'fetch', first: true, scanned: 140, done: 37, total: 120, startedAt: now - 40000, etaMs: 90000 }, updatedAt: now,
|
||||
},
|
||||
],
|
||||
counts: { utterances: 1824, matches: 37 },
|
||||
@@ -519,6 +520,18 @@ export function createMockGvr(): GvrApi {
|
||||
const u = users.find((x) => x.id === userId);
|
||||
if (u) u.riot = riotIds.map((r, i) => ({ puuid: `${userId}-${i}`, riotId: r }));
|
||||
},
|
||||
async cancelHistory(game) {
|
||||
await sleep(150);
|
||||
const cancelled: ('valorant' | 'lol')[] = [];
|
||||
for (const g of state.liveGames ?? []) {
|
||||
if (g.history && (!game || g.game === game)) {
|
||||
g.history = null;
|
||||
cancelled.push(g.game);
|
||||
}
|
||||
}
|
||||
emit();
|
||||
return { cancelled, resumeAt: cancelled.length ? Date.now() + 30 * 60000 : null };
|
||||
},
|
||||
async setExcluded(userId, excluded) {
|
||||
const u = users.find((x) => x.id === userId);
|
||||
if (u) u.excluded = excluded;
|
||||
|
||||
@@ -149,6 +149,10 @@ input[type='number'].input { flex: none; padding: 7px 8px; }
|
||||
.pbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ff7a85); border-radius: 5px; transition: width 0.25s; }
|
||||
.pbar.done i { background: linear-gradient(90deg, #1fb383, var(--good)); }
|
||||
.pbar.error i { background: #6b2a33; }
|
||||
.pbar.indet i { width: 35%; animation: pbar-indet 1.4s ease-in-out infinite; }
|
||||
@keyframes pbar-indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
|
||||
.hist-row + .hist-row { margin-top: 12px; }
|
||||
.hist-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
|
||||
.prog { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
|
||||
.prog-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
|
||||
.dl-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState } from 'react';
|
||||
import { GAME_NAME, liveGameRows, type LiveGame, type User } from '@gvr/shared';
|
||||
import { GAME_NAME, historyStatus, liveGameRows, resumeText, type LiveGame, type User } from '@gvr/shared';
|
||||
import { gvr, useAction, useApp, useLoad } from '../store';
|
||||
import { Avatar, Btn, Dot, Err, FolderRow, Page, Section, Spinner, Toggle } from '../ui';
|
||||
|
||||
@@ -84,6 +84,44 @@ function LiveGames() {
|
||||
);
|
||||
}
|
||||
|
||||
/** Riot 경기 기록 가져오기 진행 바 · 취소 (v1.9.1). 게임 중이 아닐 때 30분마다 돈다 */
|
||||
function HistoryImport() {
|
||||
const { state, toast } = useApp();
|
||||
const act = useAction();
|
||||
const rows = (state.liveGames ?? []).filter((g) => g.history);
|
||||
if (!rows.length) return null;
|
||||
const cancel = async (game: LiveGame['game']) => {
|
||||
const r = await act.run(() => gvr.cancelHistory(game));
|
||||
if (r?.cancelled.length) toast(`${GAME_NAME[game]} 경기 기록 가져오기를 멈췄습니다. 받은 경기는 남고, ${resumeText(r.resumeAt)} 남은 것부터 이어서 가져옵니다`);
|
||||
};
|
||||
return (
|
||||
<Section title="Riot 경기 기록" sub="사이트 경기 탭에 지난 경기 채우기">
|
||||
{rows.map((g) => {
|
||||
const st = historyStatus(g.history!);
|
||||
return (
|
||||
<div key={g.game} className="hist-row">
|
||||
<div className="hist-top">
|
||||
<Spinner />
|
||||
<b>{GAME_NAME[g.game]}</b>
|
||||
<span>{st.title}</span>
|
||||
<span className="muted">{st.detail}</span>
|
||||
<span style={{ flex: 1 }} />
|
||||
<Btn small ghost busy={act.busy} onClick={() => cancel(g.game)}>
|
||||
취소
|
||||
</Btn>
|
||||
</div>
|
||||
<div className={`pbar${st.pct == null ? ' indet' : ''}`}>
|
||||
<i style={{ width: st.pct == null ? undefined : `${st.pct}%` }} />
|
||||
</div>
|
||||
{g.history!.first && <div className="hint">처음 한 번은 지난 경기를 끝까지 가져와서 오래 걸립니다. 게임을 켜면 바로 멈추고, 다음부터는 새 경기만 가져옵니다.</div>}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<Err>{act.error}</Err>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
|
||||
const RIOT_RE = /^[^#]{1,16}#[^#\s]{2,5}$/;
|
||||
|
||||
function RiotRow({ u }: { u: User }) {
|
||||
@@ -178,6 +216,7 @@ export function GamesTab() {
|
||||
return (
|
||||
<Page title="게임 연동">
|
||||
<GameCards />
|
||||
<HistoryImport />
|
||||
<LiveGames />
|
||||
<Section title="리그 오브 레전드 세부 설정" className={g.lol ? '' : 'disabled'}>
|
||||
<div className="muted" style={{ marginBottom: 8 }}>
|
||||
|
||||
@@ -113,3 +113,139 @@ test('경기 기록: 발로란트 · 롤 기록을 가져와 history 경기로
|
||||
for (const k of ['GVR_HISTORY_EVERY_MS', 'GVR_HISTORY_GAP_MS']) delete process.env[k];
|
||||
}
|
||||
});
|
||||
|
||||
test('경기 기록: 진행 상황 (목록 확인 → 경기 받기 · 남은 시간) · 취소하면 멈추고 다음에 이어서', async () => {
|
||||
const dir = tmp();
|
||||
const { Store } = await import('../src/core/db/db.ts');
|
||||
const { HistorySync } = await import('../src/core/games/history.ts');
|
||||
const store = new Store(path.join(dir, 'db.sqlite'));
|
||||
const all = Array.from({ length: 30 }, (_, i) => `val-p-${i}`);
|
||||
let gate: (() => void) | null = null;
|
||||
const fetched: string[] = [];
|
||||
const src = {
|
||||
game: 'valorant' as const,
|
||||
idle: () => true,
|
||||
account: () => 'me',
|
||||
page: async (start: number, n: number) => {
|
||||
// 첫 쪽은 화면에서 목록 확인 중을 볼 수 있게 잠깐 멈춘다
|
||||
if (start === 0) await new Promise<void>((r) => (gate = r));
|
||||
return { ids: all.slice(start, start + n), total: all.length };
|
||||
},
|
||||
fetch: async (id: string) => {
|
||||
await sleep(15);
|
||||
store.upsertMatch({ id, game: 'valorant', started_at: Date.now(), status: 'complete' });
|
||||
fetched.push(id);
|
||||
return 'ok' as const;
|
||||
},
|
||||
};
|
||||
const h = new HistorySync(store, src, { pageSize: 10, max: 500, gapMs: 5 });
|
||||
try {
|
||||
assert.equal(h.progress(), null, '가져오는 중이 아니면 없음');
|
||||
assert.deepEqual(h.cancel(), { cancelled: false, resumeAt: null }, '돌지 않을 때 취소는 아무 일 없음');
|
||||
h.maybeRun(60000, 0);
|
||||
await until(() => !!gate, 2000, 'scan start');
|
||||
const s0 = h.progress()!;
|
||||
assert.equal(s0.phase, 'scan');
|
||||
assert.equal(s0.first, true, '처음 끝까지 훑는 중');
|
||||
assert.equal(s0.etaMs, null);
|
||||
gate!();
|
||||
await until(() => h.progress()?.phase === 'fetch' && h.progress()!.done >= 5, 5000, 'fetching');
|
||||
const p = h.progress()!;
|
||||
assert.equal(p.total, 30);
|
||||
assert.equal(p.scanned, 30);
|
||||
assert.ok(p.etaMs !== null && p.etaMs > 0 && p.etaMs < 10000, `남은 시간 (${p.etaMs})`);
|
||||
|
||||
// 취소: 진행 상황은 바로 사라지고, 루프는 다음 경기 전에 멈춘다
|
||||
const c = h.cancel();
|
||||
assert.equal(c.cancelled, true);
|
||||
assert.ok(c.resumeAt && c.resumeAt > Date.now() + 50000, '다음 주기에 이어서');
|
||||
assert.equal(h.progress(), null);
|
||||
const n = fetched.length;
|
||||
await sleep(150);
|
||||
assert.ok(fetched.length <= n + 1, `취소 뒤 더 받지 않음 (${n} → ${fetched.length})`);
|
||||
assert.ok(fetched.length < 30);
|
||||
assert.ok(!store.meta('history_full:valorant:me'), '끝까지 받지 않았으니 다음에도 끝까지 훑는다');
|
||||
|
||||
// 다음 실행: 받은 경기는 건너뛰고 남은 것만
|
||||
gate = null;
|
||||
const run = h.run();
|
||||
await until(() => !!gate, 2000, 'scan 2');
|
||||
gate!();
|
||||
const before = fetched.length;
|
||||
await run;
|
||||
assert.equal(fetched.length, 30, '남은 것부터 끝까지');
|
||||
assert.equal(new Set(fetched).size, 30, '같은 경기를 두 번 받지 않음');
|
||||
assert.ok(fetched.length - before === 30 - before);
|
||||
assert.equal(store.meta('history_full:valorant:me'), '1');
|
||||
assert.equal(h.progress(), null, '끝나면 진행 상황 없음');
|
||||
} finally {
|
||||
store.close();
|
||||
}
|
||||
});
|
||||
|
||||
test('경기 기록: 진행 상황은 지금 게임 상태(games.state)로 나가고, 사이트에서 POST /api/games/history/cancel 로 취소', async () => {
|
||||
const dir = tmp();
|
||||
const { Store } = await import('../src/core/db/db.ts');
|
||||
const { Timeline } = await import('../src/core/timeline.ts');
|
||||
const { GameAssets } = await import('../src/core/games/assets.ts');
|
||||
const { GameManager } = await import('../src/core/games/manager.ts');
|
||||
const { Bus } = await import('../src/core/util/events.ts');
|
||||
const { buildApi } = await import('../src/core/api/server.ts');
|
||||
const { defaultSettings } = await import('../src/core/settings.ts');
|
||||
const { historyStatus, fmtEta } = await import('@gvr/shared');
|
||||
const store = new Store(path.join(dir, 'db.sqlite'));
|
||||
const bus = new Bus();
|
||||
const sent: any[] = [];
|
||||
bus.on('live', (e) => sent.push(e));
|
||||
const s = defaultSettings();
|
||||
const stt: any = { setGameActive: async () => undefined };
|
||||
const gm = new GameManager(store, new GameAssets(path.join(dir, 'cache')), Object.assign(new EventEmitter(), { request: async () => ({}) }) as any, stt, new Timeline(store), bus, () => s, () => null);
|
||||
// 롤만 가져오는 중
|
||||
let lolRunning = true;
|
||||
const fake = (game: 'valorant' | 'lol') => ({
|
||||
progress: () => (game === 'lol' && lolRunning ? { phase: 'fetch', first: true, scanned: 40, done: 10, total: 40, startedAt: Date.now() - 20000, etaMs: 60000 } : null),
|
||||
cancel: () => {
|
||||
if (game !== 'lol' || !lolRunning) return { cancelled: false, resumeAt: null };
|
||||
lolRunning = false;
|
||||
return { cancelled: true, resumeAt: Date.now() + 30 * 60000 };
|
||||
},
|
||||
});
|
||||
for (const a of gm.adapters) (a as any).history = fake(a.game);
|
||||
const app = await buildApi({
|
||||
store,
|
||||
timeline: new Timeline(store),
|
||||
games: gm,
|
||||
dict: {} as any,
|
||||
culprit: {} as any,
|
||||
bus,
|
||||
settings: () => s,
|
||||
trainingDir: () => dir,
|
||||
overviewExtra: () => ({ guild: null, recording: {} as any }),
|
||||
version: 'test',
|
||||
});
|
||||
try {
|
||||
const lol = gm.live().find((g) => g.game === 'lol')!;
|
||||
assert.equal(lol.history?.done, 10);
|
||||
assert.equal(gm.live().find((g) => g.game === 'valorant')!.history, null);
|
||||
assert.deepEqual(historyStatus(lol.history!), { title: '경기 기록 가져오는 중', detail: '10 / 40경기 (25%) · 약 1분 남음', pct: 25 });
|
||||
assert.equal(historyStatus({ ...lol.history!, phase: 'scan', total: 3 }).pct, null, '목록 확인 중에는 얼마나 걸릴지 모름');
|
||||
assert.equal(fmtEta(null), '남은 시간 계산 중');
|
||||
assert.equal(fmtEta(25000), '30초 남음');
|
||||
assert.equal(fmtEta(2 * 3600000 + 5 * 60000), '약 2시간 5분 남음');
|
||||
|
||||
const member = { 'x-gvr-user': encodeURIComponent(JSON.stringify({ id: 'm1', name: 'm1', avatar: null })), 'x-gvr-role': 'member' };
|
||||
const r = await app.inject({ method: 'POST', url: '/api/games/history/cancel', headers: member, payload: { game: 'lol' } });
|
||||
assert.equal(r.statusCode, 200);
|
||||
const b = r.json();
|
||||
assert.deepEqual(b.cancelled, ['lol'], '서버 멤버 누구나 취소 (다음 주기에 이어서 하니 지워지는 것 없음)');
|
||||
assert.ok(b.resumeAt > Date.now());
|
||||
const st = sent.filter((e) => e.type === 'games.state').at(-1);
|
||||
assert.ok(st, '취소하면 바로 게임 상태를 보낸다');
|
||||
assert.equal(st.data.find((g: any) => g.game === 'lol').history, null);
|
||||
const again = await app.inject({ method: 'POST', url: '/api/games/history/cancel', payload: {} });
|
||||
assert.deepEqual(again.json().cancelled, [], '이미 멈췄으면 아무 일 없음');
|
||||
} finally {
|
||||
await app.close();
|
||||
store.close();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { LiveGame } from './protocol.js';
|
||||
import type { HistoryProgress, LiveGame } from './protocol.js';
|
||||
import { fmtClock } from './time.js';
|
||||
|
||||
export const GAME_NAME: Record<LiveGame['game'], string> = { valorant: '발로란트', lol: '리그 오브 레전드' };
|
||||
@@ -33,3 +33,25 @@ export function liveGameRows(g: LiveGame, now = Date.now()): [string, string][]
|
||||
if (g.error) rows.push(['오류', g.error]);
|
||||
return rows;
|
||||
}
|
||||
|
||||
/** 남은 시간 글자: "약 3분 남음" · "40초 남음" · "남은 시간 계산 중" */
|
||||
export function fmtEta(ms: number | null): string {
|
||||
if (ms == null) return '남은 시간 계산 중';
|
||||
if (ms < 60000) return `${Math.max(1, Math.ceil(ms / 10000) * 10)}초 남음`;
|
||||
const min = Math.ceil(ms / 60000);
|
||||
return min < 60 ? `약 ${min}분 남음` : `약 ${Math.floor(min / 60)}시간 ${min % 60}분 남음`;
|
||||
}
|
||||
|
||||
/** 경기 기록 가져오기 진행 바 글자 (v1.9.1, 사이트 경기 탭 · 앱 게임 연동 탭). pct = null 이면 얼마나 걸릴지 아직 모름 */
|
||||
export function historyStatus(p: HistoryProgress): { title: string; detail: string; pct: number | null } {
|
||||
if (p.phase === 'scan')
|
||||
return { title: '경기 기록 목록 확인 중', detail: `${p.scanned}경기 확인${p.total ? ` · 새 경기 ${p.total}개` : ''}`, pct: null };
|
||||
const pct = p.total ? Math.min(100, Math.round((p.done / p.total) * 100)) : 100;
|
||||
return { title: '경기 기록 가져오는 중', detail: `${p.done} / ${p.total}경기 (${pct}%) · ${fmtEta(p.etaMs)}`, pct };
|
||||
}
|
||||
|
||||
/** 취소한 가져오기를 다시 하는 때: "약 30분 뒤" (모르면 "다음 확인 때") */
|
||||
export function resumeText(resumeAt: number | null, now = Date.now()): string {
|
||||
if (!resumeAt) return '다음 확인 때';
|
||||
return `약 ${Math.max(1, Math.ceil((resumeAt - now) / 60000))}분 뒤`;
|
||||
}
|
||||
|
||||
@@ -279,9 +279,28 @@ export interface LiveGame {
|
||||
players: number | null;
|
||||
/** 마지막 오류 (연결 실패 등) */
|
||||
error: string | null;
|
||||
/** Riot 경기 기록 가져오는 중이면 진행 상황 (v1.9.1~, 예전 앱은 없음) */
|
||||
history?: HistoryProgress | null;
|
||||
updatedAt: number;
|
||||
}
|
||||
|
||||
/** Riot 경기 기록 가져오기 진행 상황 (v1.9.1~). 사이트 경기 탭 · 앱 게임 연동 탭에 진행 바로 보여 준다 */
|
||||
export interface HistoryProgress {
|
||||
/** scan = 경기 목록 훑는 중 (몇 경기를 받을지 아직 모름), fetch = 경기 하나씩 받는 중 */
|
||||
phase: 'scan' | 'fetch';
|
||||
/** 처음 끝까지 훑는 중 (오래 걸림) */
|
||||
first: boolean;
|
||||
/** 경기 목록에서 확인한 경기 수 (scan) */
|
||||
scanned: number;
|
||||
/** 받은 경기 수 / 받을 경기 수 (fetch) */
|
||||
done: number;
|
||||
total: number;
|
||||
/** 시작 시각 (PC 시계) */
|
||||
startedAt: number;
|
||||
/** 남은 시간 예상 (ms). scan 중이거나 아직 모르면 null */
|
||||
etaMs: number | null;
|
||||
}
|
||||
|
||||
/** 기록 묶음 (사이트 기록 관리, v1.3.7~): 경기 하나 또는 경기 밖 대화 한 덩어리 */
|
||||
export interface BundleInfo {
|
||||
/** match-<경기ID> 또는 talk-<첫 발화ID> */
|
||||
|
||||
@@ -39,7 +39,22 @@ const state = {
|
||||
device: { registered: true, online: process.env.MOCK_OFFLINE !== '1', name: '하늘의 게임 PC', lastSeen: Date.now(), version: '1.0.0' },
|
||||
live: process.env.MOCK_LIVE !== '0',
|
||||
liveInterval: Number(process.env.MOCK_LIVE_INTERVAL ?? 15000),
|
||||
// 롤 경기 기록 가져오기 흉내 (v1.9.1 진행 바): 1.5초에 한 경기, MOCK_HISTORY=0 이면 끔
|
||||
hist: process.env.MOCK_HISTORY === '0' ? null : { startedAt: Date.now(), total: Number(process.env.MOCK_HISTORY_TOTAL ?? 120) },
|
||||
};
|
||||
const histProgress = () => {
|
||||
const h = state.hist;
|
||||
if (!h) return null;
|
||||
const el = Date.now() - h.startedAt;
|
||||
if (el < 4000) return { phase: 'scan', first: true, scanned: Math.floor(el / 400) * 20, done: 0, total: Math.floor(el / 400) * 12, startedAt: h.startedAt, etaMs: null };
|
||||
const done = Math.min(h.total, Math.floor((el - 4000) / 1500));
|
||||
if (done >= h.total) return (state.hist = null);
|
||||
return { phase: 'fetch', first: true, scanned: 200, done, total: h.total, startedAt: h.startedAt, etaMs: done ? (h.total - done) * 1500 : null };
|
||||
};
|
||||
const liveGames = () => [
|
||||
{ game: 'valorant', enabled: true, connected: true, phase: '경기 중', inMatch: true, matchId: 'val-demo', mode: '경쟁전', map: '어센트', mapImage: null, startedAt: Date.now() - 23 * 60000, round: 15, score: { ally: 8, enemy: 6 }, gameTimeSec: null, teamKills: null, self: { name: '하늘#KR1', character: '제트', characterImage: null, kda: null, extra: null }, players: 10, error: null, updatedAt: Date.now() },
|
||||
{ game: 'lol', enabled: true, connected: !!state.hist, phase: state.hist ? '로비' : '롤 클라이언트 꺼짐', inMatch: false, matchId: null, mode: null, map: null, mapImage: null, startedAt: null, round: null, score: null, gameTimeSec: null, teamKills: null, self: null, players: null, error: null, history: histProgress(), updatedAt: Date.now() },
|
||||
];
|
||||
|
||||
const json = (res, status, body, headers = {}) => {
|
||||
const s = JSON.stringify(body, (k, v) => (k.startsWith('_') ? undefined : v));
|
||||
@@ -303,10 +318,7 @@ async function handle(req, res) {
|
||||
recording: { active: true, channel: '발로 음성방', since: NOW - 150 * 60000, participants: db.SPEAKERS.map((u) => u.id) },
|
||||
users: db.users,
|
||||
games: { valorant: { connected: true, inMatch: false }, lol: { connected: false, inMatch: false } },
|
||||
live: [
|
||||
{ game: 'valorant', enabled: true, connected: true, phase: '경기 중', inMatch: true, matchId: 'val-demo', mode: '경쟁전', map: '어센트', mapImage: null, startedAt: Date.now() - 23 * 60000, round: 15, score: { ally: 8, enemy: 6 }, gameTimeSec: null, teamKills: null, self: { name: '하늘#KR1', character: '제트', characterImage: null, kda: null, extra: null }, players: 10, error: null, updatedAt: Date.now() },
|
||||
{ game: 'lol', enabled: true, connected: false, phase: '롤 클라이언트 꺼짐', inMatch: false, matchId: null, mode: null, map: null, mapImage: null, startedAt: null, round: null, score: null, gameTimeSec: null, teamKills: null, self: null, players: null, error: null, updatedAt: Date.now() },
|
||||
],
|
||||
live: liveGames(),
|
||||
counts: { utterances: db.utterances.length, matches: db.matches.length },
|
||||
version: '1.0.0',
|
||||
});
|
||||
@@ -422,6 +434,12 @@ async function handle(req, res) {
|
||||
}
|
||||
return json(res, 200, { bundles: out.sort((a, b) => b.from - a.from) });
|
||||
}
|
||||
if (p === '/api/games/history/cancel' && req.method === 'POST') {
|
||||
const was = !!histProgress();
|
||||
state.hist = null;
|
||||
broadcast({ type: 'games.state', data: liveGames() });
|
||||
return json(res, 200, { ok: true, cancelled: was ? ['lol'] : [], resumeAt: was ? Date.now() + 30 * 60000 : null });
|
||||
}
|
||||
if (p === '/api/bundles/delete' && req.method === 'POST') return json(res, 200, { bundles: 1, utterances: 12, files: 12 });
|
||||
if (p === '/api/bundles/export' && req.method === 'POST') {
|
||||
req.resume();
|
||||
@@ -491,10 +509,17 @@ export function startMock({ port = Number(process.env.MOCK_PORT ?? 18787) } = {}
|
||||
if (state.live && wss.clients.size) emitLive();
|
||||
}, state.liveInterval);
|
||||
const hb = setInterval(() => deviceOk() && pushStatus(), 20000);
|
||||
// 경기 기록 가져오기 진행 (앱은 2초마다 바뀌면 보낸다)
|
||||
const histTimer = setInterval(() => {
|
||||
if (!wss.clients.size) return;
|
||||
const had = !!state.hist;
|
||||
if (had) broadcast({ type: 'games.state', data: liveGames() });
|
||||
}, 2000);
|
||||
server.listen(port, '127.0.0.1', () => console.log(`[mock] http://127.0.0.1:${port} (데이터: 발화 ${db.utterances.length} · 이벤트 ${db.events.length} · 경기 ${db.matches.length} · 기준 ${fmtClock(0)})`));
|
||||
server.on('close', () => {
|
||||
clearInterval(timer);
|
||||
clearInterval(hb);
|
||||
clearInterval(histTimer);
|
||||
});
|
||||
return server;
|
||||
}
|
||||
|
||||
71
site/web/src/components/HistoryImport.tsx
Normal file
71
site/web/src/components/HistoryImport.tsx
Normal file
@@ -0,0 +1,71 @@
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { GAME_NAME, historyStatus, resumeText, type GameType } from '@gvr/shared';
|
||||
import { api } from '../lib/api';
|
||||
import { useData } from '../store/app';
|
||||
|
||||
/**
|
||||
* Riot 경기 기록 가져오기 진행 바 (v1.9.1, 경기 탭 위). 게임 PC 앱이 게임 중이 아닐 때 30분마다 지난 경기를 받아 온다.
|
||||
* 받을 경기 수 · 남은 시간을 보여 주고 취소할 수 있다. 끝나면 onDone 으로 경기 목록을 다시 받게 한다.
|
||||
*/
|
||||
export function HistoryImport({ onDone }: { onDone: () => void }) {
|
||||
const { overview } = useData();
|
||||
const rows = (overview?.live ?? []).filter((g) => g.history);
|
||||
const [busy, setBusy] = useState<GameType | null>(null);
|
||||
const [msg, setMsg] = useState<{ text: string; bad?: boolean } | null>(null);
|
||||
// 가져오기가 끝나거나 멈추면 경기 목록을 새로
|
||||
const active = rows.map((g) => g.game).join(',');
|
||||
const prev = useRef(active);
|
||||
useEffect(() => {
|
||||
const now = active.split(',');
|
||||
if (prev.current.split(',').some((g) => g && !now.includes(g))) onDone();
|
||||
prev.current = active;
|
||||
}, [active, onDone]);
|
||||
const cancel = (game: GameType) => {
|
||||
setBusy(game);
|
||||
setMsg(null);
|
||||
api
|
||||
.cancelHistory(game)
|
||||
.then((r) => {
|
||||
if (r.cancelled.length) setMsg({ text: `${GAME_NAME[game]} 경기 기록 가져오기를 멈췄습니다. 받은 경기는 그대로 있고, ${resumeText(r.resumeAt)} 남은 것부터 이어서 가져옵니다.` });
|
||||
})
|
||||
.catch((e) => setMsg({ text: `취소하지 못했습니다: ${e instanceof Error ? e.message : String(e)}`, bad: true }))
|
||||
.finally(() => setBusy(null));
|
||||
};
|
||||
if (!rows.length && !msg) return null;
|
||||
return (
|
||||
<div className="hist-import">
|
||||
{rows.map((g) => {
|
||||
const st = historyStatus(g.history!);
|
||||
return (
|
||||
<div key={g.game} className={`hist-card ${g.game}`} role="status">
|
||||
<div className="hist-top">
|
||||
<span className="hist-dot" />
|
||||
<b>{GAME_NAME[g.game]}</b>
|
||||
<span>{st.title}</span>
|
||||
<span className="dim small">{st.detail}</span>
|
||||
<span className="hist-gap" />
|
||||
<button className="btn small" disabled={busy === g.game} onClick={() => cancel(g.game)}>
|
||||
{busy === g.game ? '멈추는 중…' : '취소'}
|
||||
</button>
|
||||
</div>
|
||||
<span className={`bar hist-bar${st.pct == null ? ' indet' : ''}`}>
|
||||
<i style={st.pct == null ? undefined : { width: `${st.pct}%` }} />
|
||||
</span>
|
||||
<div className="dim small">
|
||||
{g.history!.first ? '처음 한 번은 지난 경기를 끝까지 가져와서 오래 걸립니다. ' : ''}
|
||||
게임을 켜면 바로 멈추고, 끝나면 이 목록에 자동으로 나타납니다.
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
{msg && (
|
||||
<div className={`hist-msg${msg.bad ? ' bad' : ''}`}>
|
||||
{msg.text}
|
||||
<button className="btn small" onClick={() => setMsg(null)}>
|
||||
닫기
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -232,6 +232,9 @@ export const api = {
|
||||
/** 발화 지우기 (v1.4.0). noise = 잡음이라 삭제 (같은 문장을 다음부터 잡음으로) */
|
||||
deleteUtterance: (id: string, noise: boolean) =>
|
||||
request<{ ok: true; learned: string | null }>(`/api/utterances/${encodeURIComponent(id)}/delete`, { method: 'POST', body: JSON.stringify({ noise }) }),
|
||||
/** Riot 경기 기록 가져오기 취소 (v1.9.1). 받은 경기는 남고 resumeAt 에 이어서 한다 */
|
||||
cancelHistory: (game?: GameType) =>
|
||||
request<{ ok: true; cancelled: GameType[]; resumeAt: number | null }>('/api/games/history/cancel', { method: 'POST', body: JSON.stringify({ game }) }),
|
||||
noisePhrases: () => request<{ phrases: NoisePhrase[] }>('/api/noise-phrases'),
|
||||
deleteNoisePhrase: (id: number) => request<{ ok: true }>(`/api/noise-phrases/${id}`, { method: 'DELETE' }),
|
||||
};
|
||||
|
||||
@@ -7,6 +7,7 @@ import { fmtDuration, fmtDay } from '../lib/format';
|
||||
import { sfx } from '../lib/sfx';
|
||||
import { Avatar, ErrorBox, Spinner } from '../components/common';
|
||||
import { MatchItem } from './Sidebar';
|
||||
import { HistoryImport } from '../components/HistoryImport';
|
||||
|
||||
function useLoad<T>(fn: () => Promise<T>, deps: unknown[]) {
|
||||
const { epoch } = useStatus();
|
||||
@@ -120,8 +121,9 @@ export function MatchesPage() {
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<HistoryImport onDone={retry} />
|
||||
{err != null && <ErrorBox error={err} onRetry={retry} />}
|
||||
{!data && !err && <Spinner />}
|
||||
{!data && !err && <Spinner label="경기 목록 불러오는 중" />}
|
||||
{data && all.length === 0 && (
|
||||
<div className="empty">
|
||||
{has === 'voice' ? '목소리가 녹음된 경기가 없습니다.' : has === 'timeline' ? '타임라인이 있는 경기가 없습니다.' : '경기 기록이 없습니다.'}
|
||||
|
||||
@@ -4528,3 +4528,83 @@ button.match:hover {
|
||||
max-height: calc(100vh - var(--header-h) - 16px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Riot 경기 기록 가져오기 진행 바 (v1.9.1, 경기 탭) */
|
||||
.hist-import {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
margin: 10px 0 4px;
|
||||
}
|
||||
.hist-card {
|
||||
border: 1px solid var(--line);
|
||||
border-left: 3px solid var(--accent);
|
||||
border-radius: 10px;
|
||||
background: var(--panel);
|
||||
padding: 10px 14px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 7px;
|
||||
}
|
||||
.hist-card.lol {
|
||||
border-left-color: var(--lol);
|
||||
}
|
||||
.hist-top {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
font-size: 13.5px;
|
||||
}
|
||||
.hist-gap {
|
||||
flex: 1;
|
||||
}
|
||||
.hist-dot {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--mint);
|
||||
animation: hist-pulse 1.2s ease-in-out infinite;
|
||||
}
|
||||
@keyframes hist-pulse {
|
||||
50% {
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
.hist-card .btn,
|
||||
.hist-msg .btn {
|
||||
padding: 5px 12px;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
.hist-bar i {
|
||||
background: var(--mint);
|
||||
}
|
||||
.hist-card.lol .hist-bar i {
|
||||
background: var(--lol);
|
||||
}
|
||||
.hist-bar.indet i {
|
||||
width: 35%;
|
||||
animation: hist-indet 1.4s ease-in-out infinite;
|
||||
}
|
||||
@keyframes hist-indet {
|
||||
0% {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
100% {
|
||||
transform: translateX(290%);
|
||||
}
|
||||
}
|
||||
.hist-msg {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
font-size: 13px;
|
||||
padding: 8px 14px;
|
||||
border-radius: 10px;
|
||||
background: var(--panel2);
|
||||
color: var(--muted);
|
||||
}
|
||||
.hist-msg.bad {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user