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
This commit is contained in:
Yun Chan 2026-10-20 09:56:29 +09:00
parent 59d0261254
commit 90c96c6f80
4 changed files with 25 additions and 4 deletions

View file

@ -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()
}

View file

@ -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 {

View file

@ -247,7 +247,7 @@ class MemoService {
// 태그별 → 날짜별 그룹핑
const grouped = new Map<string, Map<string, typeof rows>>()
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}`
}

View file

@ -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') {