From 90c96c6f80b9c09d054d933da621359c7f58a87a Mon Sep 17 00:00:00 2001 From: Yun Chan Date: Tue, 20 Oct 2026 09:56:29 +0900 Subject: [PATCH] fix(desktop): stop re-asking for downloaded updates, local-date memo export, end template sessions on delete, reject blank chain renames - UpdateService: an already-downloaded version no longer reopens the consent dialog every 24h, where choosing skip still installed it on quit - MemoService: export groups and titles by local date so KST 00-09h memos stop landing under the previous day - DictationTemplateService: deleting (or remotely removing) the active session's template cancels the session instead of blocking new ones - ChainService: update trims names and rejects blank ones like create does --- apps/desktop/src/main/services/ChainService.ts | 6 +++++- .../src/main/services/DictationTemplateService.ts | 7 +++++++ apps/desktop/src/main/services/MemoService.ts | 11 +++++++++-- apps/desktop/src/main/services/UpdateService.ts | 5 ++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/apps/desktop/src/main/services/ChainService.ts b/apps/desktop/src/main/services/ChainService.ts index f360ceb..8706afc 100644 --- a/apps/desktop/src/main/services/ChainService.ts +++ b/apps/desktop/src/main/services/ChainService.ts @@ -107,10 +107,14 @@ class ChainService { throw new D3ROError(ErrorCode.ChainNotFound, `Chain not found: ${params.id}`) } + if (params.name !== undefined && !params.name.trim()) { + throw new D3ROError(ErrorCode.ConfigInvalidValue, 'Chain name is empty') + } + const existing = chains[index] const updated: LLMChain = { ...existing, - name: params.name ?? existing.name, + name: params.name?.trim() ?? existing.name, steps: params.steps ?? existing.steps, updatedAt: Date.now() } diff --git a/apps/desktop/src/main/services/DictationTemplateService.ts b/apps/desktop/src/main/services/DictationTemplateService.ts index ad546df..bfc85a6 100644 --- a/apps/desktop/src/main/services/DictationTemplateService.ts +++ b/apps/desktop/src/main/services/DictationTemplateService.ts @@ -171,6 +171,7 @@ class DictationTemplateService extends EventEmitter { } this._save(templates.filter((t) => t.id !== id)) + this._endSessionFor(id) getCloudSyncService().pushDelete('user_templates', id) } @@ -190,9 +191,15 @@ class DictationTemplateService extends EventEmitter { const target = templates.find((t) => t.id === id) if (!target || target.isBuiltin) return false this._save(templates.filter((t) => t.id !== id)) + this._endSessionFor(id) return true } + /** 진행 중인 세션의 템플릿이 지워지면 세션도 끝낸다. 안 그러면 새 세션이 영영 거절된다. */ + private _endSessionFor(templateId: string): void { + if (this._session?.templateId === templateId) this.cancelSession() + } + // ── 세션 관리 ── getSessionState(): TemplateSessionInfo | null { diff --git a/apps/desktop/src/main/services/MemoService.ts b/apps/desktop/src/main/services/MemoService.ts index 768807a..d887a24 100644 --- a/apps/desktop/src/main/services/MemoService.ts +++ b/apps/desktop/src/main/services/MemoService.ts @@ -247,7 +247,7 @@ class MemoService { // 태그별 → 날짜별 그룹핑 const grouped = new Map>() for (const row of rows) { - const dateKey = new Date(row.createdAt).toISOString().split('T')[0] + const dateKey = localDateKey(new Date(row.createdAt)) if (!grouped.has(row.tag)) { grouped.set(row.tag, new Map()) } @@ -260,7 +260,7 @@ class MemoService { // 마크다운 생성 const lines: string[] = [] - const exportDate = new Date().toISOString().split('T')[0] + const exportDate = localDateKey(new Date()) lines.push(`# Voice Memo Export — ${exportDate}`) lines.push('') @@ -396,3 +396,10 @@ export function getMemoService(): MemoService { } return instance } + +// 항목 시각을 현지 시각으로 쓰므로 날짜 머리글도 현지 날짜여야 한다(UTC면 KST 0~9시 메모가 전날로 묶인다). +function localDateKey(date: Date): string { + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${date.getFullYear()}-${month}-${day}` +} diff --git a/apps/desktop/src/main/services/UpdateService.ts b/apps/desktop/src/main/services/UpdateService.ts index d89ff50..7992e16 100644 --- a/apps/desktop/src/main/services/UpdateService.ts +++ b/apps/desktop/src/main/services/UpdateService.ts @@ -275,7 +275,10 @@ class UpdateService extends EventEmitter { reason: decision.reason, }) - if (this._session.payload?.phase === 'downloading') return + // 이미 받아 둔 버전은 다시 묻지 않는다. 다시 물으면 '건너뛰기'를 골라도 종료 시 설치돼 버린다. + const pending = this._session.payload + if (pending?.phase === 'downloading') return + if (pending?.phase === 'downloaded' && pending.version === info.version) return // forceInstallBelow는 동의 대화상자 없이 받는다 (보안 하한선). 재시작 단계도 미룰 수 없다. if (offer.action === 'force-download') {