v1.3.3: 따라갈 사람 목록 · 롤 채팅 OCR 제거 · 표시 이름(실명 숨기기)
- 따라갈 사람: 봇이 서버를 지켜보기 전 멤버 요청을 사이트 서버가 forbidden 으로 거절하고 앱이 오류를 숨겨 빈 목록이 됐다 → 가입한 서버면 지켜보기 전에도 응답(source.members 가 멤버 확인), 앱은 오류 · 다시 불러오기 표시 → 내 계정 → 관리자(GET /app/admins) → 이름순, 녹음할 서버를 바꾸면 봇을 다시 붙여 새 서버를 지켜봄 - 롤 채팅 OCR 제거: 앱 설정 · 마법사 · 진단 · lol.ts · 워커 ocr.py/ocr_* op · pywinrt/mss/Pillow · win-ci ocr_lang 롤은 게임 중 전체/팀 채팅 API 가 없어 LCU(챔피언 선택 · 게임 후) + r3dlog(남아 있을 때, LCU 채팅을 지우지 않고 추가) - 표시 이름: 서버 store.displayNames (세션 · 앱 유저 · 접속 기록 이름까지 바꿈), GET /app/names, PUT /app/admin/names, cli name. 앱은 받아서 users · 지난 범인 분석 이름을 바꾸고 이후 디스코드 이름 대신 저장. 관리자 탭에 편집 UI - 저장소 시연 · 테스트 데이터 · 화면 캡처 · 계획서 PDF 의 실제 이름을 가짜 이름으로 교체 - 테스트: 앱 41 · 서버 16 · 워커 39 통과 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -82,13 +82,15 @@ export interface GvrApi {
|
||||
adminAddUser(id: string, role: 'admin' | 'user'): Promise<{ users: AppUserRow[] }>;
|
||||
adminSetRole(id: string, role: 'admin' | 'user'): Promise<{ users: AppUserRow[] }>;
|
||||
adminRemoveUser(id: string): Promise<{ users: AppUserRow[] }>;
|
||||
adminDisplayNames(): Promise<Record<string, string>>;
|
||||
adminSetDisplayName(id: string, name: string): Promise<Record<string, string>>;
|
||||
getState(): Promise<AppState>;
|
||||
onState(cb: (s: AppState) => void): () => void;
|
||||
updateSettings(patch: DeepPartial<Settings>): Promise<Settings>;
|
||||
setSecret(key: 'botToken' | 'riotApiKey', value: string | null): Promise<void>;
|
||||
testBotToken(token?: string): Promise<{ ok: boolean; bot?: { id: string; name: string; avatar: string | null }; guilds?: { id: string; name: string }[]; error?: string }>;
|
||||
restartBot(): Promise<{ ok: boolean; error?: string }>;
|
||||
guildMembers(): Promise<{ id: string; name: string; avatar: string | null; bot: boolean }[]>;
|
||||
guildMembers(): Promise<{ id: string; name: string; avatar: string | null; bot: boolean; me: boolean; admin: boolean }[]>;
|
||||
previewTts(text: string, voice: string): Promise<{ ok: boolean; dataUrl?: string; error?: string }>;
|
||||
gpuInfo(): Promise<GpuInfo | null>;
|
||||
models(): Promise<ModelsInfo | null>;
|
||||
|
||||
@@ -122,9 +122,14 @@ export function registerIpc(ctx: IpcContext) {
|
||||
await core.startBot();
|
||||
return core.bot.state.status === 'ready' || core.bot.state.status === 'connecting' ? { ok: true } : { ok: false, error: core.bot.state.error ?? '봇을 시작하지 못했습니다' };
|
||||
},
|
||||
// 따라갈 사람 목록: 내 계정 → 관리자 → 나머지(이름순). 실패하면 오류를 그대로 보여 준다
|
||||
guildMembers: async () => {
|
||||
const ms = await core.bot.members().catch(() => []);
|
||||
return ms.map((m) => ({ id: m.id, name: m.name, avatar: m.avatar, bot: m.bot })).sort((a, b) => a.name.localeCompare(b.name, 'ko'));
|
||||
const [ms, admins] = await Promise.all([core.bot.members(), ctx.auth.adminIds().catch(() => [] as string[])]);
|
||||
const meId = ctx.auth.state.user?.id ?? null;
|
||||
const rank = (m: { me: boolean; admin: boolean }) => (m.me ? 0 : m.admin ? 1 : 2);
|
||||
return ms
|
||||
.map((m) => ({ id: m.id, name: core.store.displayNames()[m.id] ?? m.name, avatar: m.avatar, bot: m.bot, me: m.id === meId, admin: admins.includes(m.id) }))
|
||||
.sort((a, b) => rank(a) - rank(b) || a.name.localeCompare(b.name, 'ko'));
|
||||
},
|
||||
previewTts: async (text: string, voice: string) => {
|
||||
try {
|
||||
@@ -343,6 +348,13 @@ export function registerIpc(ctx: IpcContext) {
|
||||
adminAddUser: (id: string, r: 'admin' | 'user') => ctx.auth.adminAddUser(id, r),
|
||||
adminSetRole: (id: string, r: 'admin' | 'user') => ctx.auth.adminSetRole(id, r),
|
||||
adminRemoveUser: (id: string) => ctx.auth.adminRemoveUser(id),
|
||||
adminDisplayNames: () => ctx.auth.displayNames(),
|
||||
adminSetDisplayName: async (id: string, name: string) => {
|
||||
if (role() !== 'superadmin') throw new Error('표시 이름은 최고 관리자만 바꿀 수 있습니다');
|
||||
const r = await ctx.auth.adminSetDisplayName(id, name);
|
||||
ctx.current()?.core.store.setDisplayNames(r.names);
|
||||
return r.names;
|
||||
},
|
||||
openExternal: h.openExternal,
|
||||
quit: h.quit,
|
||||
};
|
||||
|
||||
@@ -228,6 +228,18 @@ const refreshShell = () => {
|
||||
|
||||
let starting: Promise<void> | null = null;
|
||||
|
||||
/** 표시 이름(실명 숨기기)을 사이트 서버에서 받아 녹음 기록 · 범인 분석에 반영한다 (못 받으면 저장해 둔 것을 그대로 쓴다) */
|
||||
async function syncNames(): Promise<void> {
|
||||
const c = core;
|
||||
if (!c || !auth?.ok) return;
|
||||
try {
|
||||
const names = await auth.displayNames();
|
||||
if (core === c) c.store.setDisplayNames(names);
|
||||
} catch (e: any) {
|
||||
log.warn(`표시 이름을 받지 못했습니다: ${e?.message ?? e}`);
|
||||
}
|
||||
}
|
||||
|
||||
/** 로그인 확인 후 코어 시작 */
|
||||
function startApp(): Promise<void> {
|
||||
if (core) return Promise.resolve();
|
||||
@@ -236,6 +248,7 @@ function startApp(): Promise<void> {
|
||||
// 겜녹이 봇 중계가 로그인 만료 · 등록 해제를 알려 오면 10분을 기다리지 않고 바로 확인해서 잠근다
|
||||
const c = await startCore({ dataDir, resourcesDir: resourcesDir(), worker: workerCommand(), version: app.getVersion(), settings: settings!, onBotUnauthorized: () => void auth?.check() });
|
||||
core = c;
|
||||
void syncNames();
|
||||
ft = new Finetuner(c, pushState);
|
||||
ft.scheduleNightly();
|
||||
appError = null;
|
||||
@@ -315,7 +328,7 @@ app.whenReady().then(async () => {
|
||||
const st = a.state.status;
|
||||
if ((st === 'ok' && Date.now() - lastCheck > 10 * 60000) || (st === 'error' && Date.now() - lastCheck > 60000) || (st === 'ok' && a.state.offline && Date.now() - lastCheck > 60000)) {
|
||||
lastCheck = Date.now();
|
||||
void a.check();
|
||||
void a.check().then(syncNames);
|
||||
}
|
||||
}, 15000);
|
||||
setInterval(() => {
|
||||
|
||||
@@ -7,7 +7,7 @@ const METHODS = [
|
||||
'runRetention', 'users', 'setRiotIds', 'setExcluded', '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',
|
||||
'authState', 'authLogin', 'authCancel', 'authLogout', 'authRecheck', 'adminUsers', 'adminAddUser', 'adminSetRole', 'adminRemoveUser', 'adminDisplayNames', 'adminSetDisplayName',
|
||||
];
|
||||
const api: Record<string, unknown> = {};
|
||||
for (const m of METHODS) api[m] = (...args: unknown[]) => ipcRenderer.invoke(`gvr:${m}`, ...args);
|
||||
|
||||
Reference in New Issue
Block a user