chore: land in-progress workspace changes before 1.16.2
The tree carried uncommitted work from several areas (web push, mobile screens, admin charts, test-hygiene cleanup, CI and map docs). It is landed as one commit so the release pipeline can start from a clean tree; the desktop transcript-correction behaviour shipped in the previous commit and is unchanged here.
This commit is contained in:
parent
9c2b6a9782
commit
7fe49c437e
144 changed files with 3760 additions and 4523 deletions
|
|
@ -17,8 +17,10 @@ import { bootstrap } from './bootstrap'
|
|||
import { setupLifecycle } from './lifecycle'
|
||||
import { showMainWindow } from './windows/WindowManager'
|
||||
import { getLogger } from './services/LoggerService'
|
||||
import { isUpdateDialogPreviewRequested } from './update-dialog-preview'
|
||||
|
||||
const deepLinkLogger = getLogger('deep-link')
|
||||
const updateDialogPreviewRequested = isUpdateDialogPreviewRequested()
|
||||
|
||||
// EPIPE 에러 방지: electron-log가 stdout/stderr에 쓸 때 파이프가 끊기면 크래시 방지
|
||||
process.stdout?.on?.('error', () => { /* ignore EPIPE */ })
|
||||
|
|
@ -31,12 +33,14 @@ process.on('uncaughtException', (err) => {
|
|||
|
||||
// V2-4: deep link 프로토콜 등록 — d3ro-voice://auth-callback?code=...
|
||||
const PROTOCOL = 'd3ro-voice'
|
||||
if (process.defaultApp) {
|
||||
if (process.argv.length >= 2) {
|
||||
app.setAsDefaultProtocolClient(PROTOCOL, process.execPath, [path.resolve(process.argv[1])])
|
||||
if (!updateDialogPreviewRequested) {
|
||||
if (process.defaultApp) {
|
||||
if (process.argv.length >= 2) {
|
||||
app.setAsDefaultProtocolClient(PROTOCOL, process.execPath, [path.resolve(process.argv[1])])
|
||||
}
|
||||
} else {
|
||||
app.setAsDefaultProtocolClient(PROTOCOL)
|
||||
}
|
||||
} else {
|
||||
app.setAsDefaultProtocolClient(PROTOCOL)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -130,7 +134,10 @@ async function handleDeepLink(url: string): Promise<void> {
|
|||
}
|
||||
|
||||
// 단일 인스턴스 잠금 (테스트 모드에서는 다중 인스턴스 허용)
|
||||
const gotTheLock = process.env.NODE_ENV === 'test' ? true : app.requestSingleInstanceLock()
|
||||
const gotTheLock =
|
||||
process.env.NODE_ENV === 'test' || updateDialogPreviewRequested
|
||||
? true
|
||||
: app.requestSingleInstanceLock()
|
||||
|
||||
if (!gotTheLock) {
|
||||
deepLinkLogger.info('Another instance is already running. Existing window focused.')
|
||||
|
|
@ -170,6 +177,17 @@ if (!gotTheLock) {
|
|||
})
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
if (updateDialogPreviewRequested) {
|
||||
try {
|
||||
const { runUpdateDialogPreview } = await import('./update-dialog-preview')
|
||||
await runUpdateDialogPreview()
|
||||
app.quit()
|
||||
} catch (err) {
|
||||
electronLog.error('Update dialog preview failed:', err)
|
||||
app.exit(1)
|
||||
}
|
||||
return
|
||||
}
|
||||
await bootstrap()
|
||||
setupLifecycle()
|
||||
})
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
// - 읽기 실패/타임아웃은 텍스트를 쓰지 않는다 (available=false).
|
||||
// - 실패 후에는 백오프를 걸어 매 키입력마다 사이드카를 두드리지 않는다.
|
||||
|
||||
import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
||||
import {
|
||||
emptyFocusSnapshot,
|
||||
type FocusSnapshot,
|
||||
|
|
@ -208,8 +207,3 @@ export function getUiaContextService(): UiaContextService {
|
|||
export function resetUiaContextServiceForTests(): void {
|
||||
instance = null
|
||||
}
|
||||
|
||||
/** 진단용 — D3ROError 로 감싼 브리지 오류 생성. */
|
||||
export function createUiaBridgeError(reason: string): D3ROError {
|
||||
return new D3ROError(ErrorCode.UiaBridgeUnavailable, `UIA bridge unavailable: ${reason}`)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,16 +54,8 @@ export function acquireGlobalInputHook(): () => void {
|
|||
}
|
||||
}
|
||||
|
||||
export function isGlobalInputHookRunning(): boolean {
|
||||
return running
|
||||
}
|
||||
|
||||
export function getGlobalInputHookRefCount(): number {
|
||||
return refCount
|
||||
}
|
||||
|
||||
/** 테스트 전용 — 모듈 상태 초기화. */
|
||||
export function resetGlobalInputHookForTests(): void {
|
||||
refCount = 0
|
||||
running = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,10 +19,6 @@ const SERVER_TO_DESKTOP_BUILTIN: Readonly<Record<string, string>> = Object.fromE
|
|||
Object.entries(DESKTOP_TO_SERVER_BUILTIN).map(([desktop, server]) => [server, desktop])
|
||||
)
|
||||
|
||||
export function isSyncedBuiltin(id: string): boolean {
|
||||
return id in DESKTOP_TO_SERVER_BUILTIN
|
||||
}
|
||||
|
||||
/**
|
||||
* 폰은 `{{text}}` 외의 자리표시자를 치환하지 않는다. 서버 번역 프리셋은 영어 고정(translate_en)이고
|
||||
* 데스크톱 번역도 대상 언어 설정이 없어 영어로만 번역하므로 `{{targetLanguage}}` 를 English 로 바꿔 올린다.
|
||||
|
|
|
|||
|
|
@ -6,8 +6,7 @@ import { existsSync, readdirSync } from 'node:fs'
|
|||
import { dirname, join } from 'node:path'
|
||||
import { app, dialog } from 'electron'
|
||||
import { getLogger } from './LoggerService'
|
||||
import { configGet } from './ConfigService'
|
||||
import { getMainWindow } from '../windows/WindowManager'
|
||||
import { getMainWindow, getPopupTranslator } from '../windows/WindowManager'
|
||||
import { UPDATE_FEED_URL, UPDATE_POLICY_URL, versionedManifestUrl } from '../update-feed'
|
||||
import { verifyDownloadedUpdate } from '../update-signature'
|
||||
import { DEFAULT_UPDATE_POLICY, parseUpdatePolicy, type UpdatePolicy } from '../update-policy'
|
||||
|
|
@ -195,12 +194,8 @@ export function createRemotePolicySource(
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* electron dialog 기반 프롬프터.
|
||||
* TODO(i18n): 문구가 아직 ko/en 인라인이다 — update.* 키를 locale 파일에 추가한 뒤 t() 로 옮긴다.
|
||||
*/
|
||||
/** electron dialog 기반 프롬프터. 문구는 현재 앱 로케일의 update.dialog.* 키에서 가져온다. */
|
||||
export function createDialogPrompter(): UpdatePrompter {
|
||||
const isKorean = (): boolean => (configGet('language') as string | undefined)?.startsWith('ko') ?? true
|
||||
const show = async (options: Electron.MessageBoxOptions): Promise<number> => {
|
||||
const win = getMainWindow()
|
||||
const { response } =
|
||||
|
|
@ -212,22 +207,19 @@ export function createDialogPrompter(): UpdatePrompter {
|
|||
|
||||
return {
|
||||
async askConsent({ version, releaseNotes, mandatory }): Promise<ConsentAnswer> {
|
||||
const isKo = isKorean()
|
||||
const notesText = typeof releaseNotes === 'string' ? `\n\n[주요 변경사항]\n${releaseNotes}` : ''
|
||||
const mandatoryNote = mandatory
|
||||
? isKo
|
||||
? '\n\n이 업데이트는 필수입니다 (지원 종료 버전).'
|
||||
: '\n\nThis update is required (end of support).'
|
||||
: ''
|
||||
const t = getPopupTranslator()
|
||||
const notesText =
|
||||
typeof releaseNotes === 'string'
|
||||
? `\n\n${t('update.dialog.releaseNotesHeading')}\n${releaseNotes}`
|
||||
: ''
|
||||
const mandatoryNote = mandatory ? `\n\n${t('update.dialog.mandatoryNote')}` : ''
|
||||
|
||||
if (mandatory) {
|
||||
const response = await show({
|
||||
type: 'info',
|
||||
title: isKo ? '필수 업데이트' : 'Required Update',
|
||||
message: isKo
|
||||
? `D3RO Voice v${version} 업데이트가 필요합니다.${mandatoryNote}${notesText}`
|
||||
: `D3RO Voice v${version} is required.${mandatoryNote}${notesText}`,
|
||||
buttons: isKo ? ['지금 업데이트'] : ['Update Now'],
|
||||
title: t('update.dialog.requiredTitle'),
|
||||
message: `${t('update.dialog.requiredMessage', { version })}${mandatoryNote}${notesText}`,
|
||||
buttons: [t('update.dialog.updateNow')],
|
||||
defaultId: 0,
|
||||
cancelId: -1,
|
||||
})
|
||||
|
|
@ -236,13 +228,13 @@ export function createDialogPrompter(): UpdatePrompter {
|
|||
|
||||
const response = await show({
|
||||
type: 'info',
|
||||
title: isKo ? '새 버전 업데이트' : 'Software Update',
|
||||
message: isKo
|
||||
? `D3RO Voice v${version} 새 버전이 출시되었습니다. 지금 다운로드할까요?${notesText}`
|
||||
: `A new version of D3RO Voice (v${version}) is available. Would you like to download it now?${notesText}`,
|
||||
buttons: isKo
|
||||
? ['지금 다운로드', '나중에', '이 버전 건너뛰기']
|
||||
: ['Download Now', 'Later', 'Skip This Version'],
|
||||
title: t('update.dialog.availableTitle'),
|
||||
message: `${t('update.dialog.availableMessage', { version })}${notesText}`,
|
||||
buttons: [
|
||||
t('update.dialog.downloadNow'),
|
||||
t('update.dialog.later'),
|
||||
t('update.dialog.skipVersion'),
|
||||
],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
})
|
||||
|
|
@ -252,16 +244,14 @@ export function createDialogPrompter(): UpdatePrompter {
|
|||
},
|
||||
|
||||
async askRestart(version, { mandatory }): Promise<RestartAnswer> {
|
||||
const isKo = isKorean()
|
||||
const t = getPopupTranslator()
|
||||
if (mandatory) {
|
||||
// 필수 업데이트는 미룰 수 없다 — 작업을 마칠 시간만 주고, 닫아도 재시작한다.
|
||||
await show({
|
||||
type: 'warning',
|
||||
title: isKo ? '필수 업데이트 설치' : 'Required Update',
|
||||
message: isKo
|
||||
? `D3RO Voice v${version} 필수 업데이트가 준비되었습니다. 확인을 누르면 앱을 재시작하여 설치합니다.`
|
||||
: `Required update D3RO Voice v${version} is ready. The app will restart to install it when you continue.`,
|
||||
buttons: isKo ? ['지금 재시작 및 설치'] : ['Restart & Install Now'],
|
||||
title: t('update.dialog.requiredInstallTitle'),
|
||||
message: t('update.dialog.requiredRestartMessage', { version }),
|
||||
buttons: [t('update.dialog.restartInstallNow')],
|
||||
defaultId: 0,
|
||||
cancelId: 0,
|
||||
})
|
||||
|
|
@ -269,11 +259,9 @@ export function createDialogPrompter(): UpdatePrompter {
|
|||
}
|
||||
const response = await show({
|
||||
type: 'info',
|
||||
title: isKo ? '업데이트 준비 완료' : 'Update Ready',
|
||||
message: isKo
|
||||
? `D3RO Voice v${version} 다운로드가 완료되었습니다. 지금 앱을 재시작하여 설치를 완료할까요?`
|
||||
: `D3RO Voice v${version} has been downloaded. Restart now to complete installation?`,
|
||||
buttons: isKo ? ['지금 재시작 및 설치', '종료 시 자동 설치'] : ['Restart & Install Now', 'Install on Exit'],
|
||||
title: t('update.dialog.readyTitle'),
|
||||
message: t('update.dialog.readyMessage', { version }),
|
||||
buttons: [t('update.dialog.restartInstallNow'), t('update.dialog.installOnExit')],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
})
|
||||
|
|
|
|||
21
apps/desktop/src/main/update-dialog-preview.ts
Normal file
21
apps/desktop/src/main/update-dialog-preview.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// 명시적으로 요청한 수동 QA 실행에서만 native updater dialog를 순서대로 보여 준다.
|
||||
// 실제 feed, 다운로드, 설치, 사용자 설정은 건드리지 않는다.
|
||||
|
||||
export const UPDATE_DIALOG_PREVIEW_ARG = '--preview-update-dialogs'
|
||||
|
||||
export function isUpdateDialogPreviewRequested(argv: readonly string[] = process.argv): boolean {
|
||||
return argv.includes(UPDATE_DIALOG_PREVIEW_ARG)
|
||||
}
|
||||
|
||||
export async function runUpdateDialogPreview(): Promise<void> {
|
||||
const { createDialogPrompter } = await import('./services/update-adapters')
|
||||
const prompter = createDialogPrompter()
|
||||
const version = '99.0.0-preview'
|
||||
|
||||
// 반환값은 의도적으로 버린다. 이 진입점은 native layout/interaction만 확인하며
|
||||
// UpdateService나 electron-updater를 만들지 않으므로 다운로드·설치 부작용이 없다.
|
||||
await prompter.askConsent({ version, releaseNotes: undefined, mandatory: false })
|
||||
await prompter.askConsent({ version, releaseNotes: undefined, mandatory: true })
|
||||
await prompter.askRestart(version, { mandatory: false })
|
||||
await prompter.askRestart(version, { mandatory: true })
|
||||
}
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
// src/main/utils/feature-gate.ts
|
||||
// Phase 11: Feature gating 유틸리티
|
||||
// 서비스에서 기능 사용 전 호출하여 접근 권한 확인 + 쿼터 차단
|
||||
|
||||
import { getLicenseService } from '../services/LicenseService'
|
||||
import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
||||
import type { FeatureAccess } from '@d3ro/core/types'
|
||||
import { Feature } from '@d3ro/core/types'
|
||||
|
||||
/**
|
||||
* 기능 접근 권한을 확인하고, 불가 시 D3ROError를 throw한다.
|
||||
* 서비스의 진입점에서 호출하여 게이팅한다.
|
||||
*
|
||||
* @throws D3ROError(QuotaExceeded) 일일 쿼터 초과 시
|
||||
* @throws D3ROError(TierRequired) 티어 부족 시
|
||||
*/
|
||||
export function requireFeature(feature: Feature): void {
|
||||
const access = getLicenseService().canUse(feature)
|
||||
if (access.allowed) return
|
||||
|
||||
if (access.reason === 'quota_exceeded') {
|
||||
getLicenseService().promptUpgrade(feature, 'quota_exceeded')
|
||||
throw new D3ROError(
|
||||
ErrorCode.QuotaExceeded,
|
||||
`Daily quota exceeded for ${feature}. Upgrade to Pro for unlimited access.`,
|
||||
{
|
||||
feature,
|
||||
quota: access.quota,
|
||||
requiredTier: access.requiredTier,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (access.reason === 'tier_required') {
|
||||
getLicenseService().promptUpgrade(feature, 'tier_required')
|
||||
throw new D3ROError(
|
||||
ErrorCode.TierRequired,
|
||||
`Feature "${feature}" requires ${access.requiredTier ?? 'pro'} tier.`,
|
||||
{
|
||||
feature,
|
||||
requiredTier: access.requiredTier,
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
// license_expired 등 기타 사유
|
||||
throw new D3ROError(
|
||||
ErrorCode.FeatureNotAvailable,
|
||||
`Feature "${feature}" is not available: ${access.reason}`,
|
||||
{ feature, reason: access.reason }
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* 기능 접근 가능 여부를 확인하고 결과를 반환한다 (throw하지 않음).
|
||||
* UI에서 버튼 활성/비활성 등 조건부 렌더링에 사용한다.
|
||||
*/
|
||||
export function checkFeature(feature: Feature): FeatureAccess {
|
||||
return getLicenseService().canUse(feature)
|
||||
}
|
||||
|
||||
/**
|
||||
* 쿼터가 있는 기능의 사용을 기록한다.
|
||||
* requireFeature() 통과 후, 실제 작업 성공 시 호출한다.
|
||||
*
|
||||
* @throws D3ROError(QuotaExceeded) 쿼터 초과 시 (이중 안전장치)
|
||||
*/
|
||||
export function consumeFeature(feature: Feature): void {
|
||||
getLicenseService().consumeQuota(feature)
|
||||
}
|
||||
|
||||
export { Feature }
|
||||
|
|
@ -135,23 +135,6 @@ export function getSoxPath(): string {
|
|||
return cachedSoxPath
|
||||
}
|
||||
|
||||
/**
|
||||
* rec 실행 파일 경로 (SoX의 음 명령).
|
||||
* node-record-lpcm16은 rec를 사용한다.
|
||||
*/
|
||||
export function getRecPath(): string {
|
||||
const recBin = `rec${EXE_SUFFIX}`
|
||||
const bundledRec = isPackaged()
|
||||
? packagedResourcePath('sox', recBin)
|
||||
: devResourcePath('sox', recBin)
|
||||
|
||||
if (existsSync(bundledRec)) {
|
||||
return bundledRec
|
||||
}
|
||||
|
||||
return 'rec'
|
||||
}
|
||||
|
||||
/** sidecar 실행 방법 */
|
||||
export interface SidecarLaunch {
|
||||
command: string
|
||||
|
|
@ -285,13 +268,6 @@ export function getFfmpegPath(): string {
|
|||
return 'ffmpeg'
|
||||
}
|
||||
|
||||
/**
|
||||
* 사용자 데이터 경로 (DB, 로그 등).
|
||||
*/
|
||||
export function getUserDataPath(): string {
|
||||
return app.getPath('userData')
|
||||
}
|
||||
|
||||
/**
|
||||
* Whisper 모델 사전 다운로드 디렉토리.
|
||||
* sidecar --models-dir로 전달되며, 메인 프로세스의 downloaded 판정에도 사용된다.
|
||||
|
|
@ -312,4 +288,4 @@ export function getAppIconPath(): string | null {
|
|||
? packagedResourcePath('icons', filename)
|
||||
: path.join(getAppRoot(), 'build', filename)
|
||||
return existsSync(candidate) ? candidate : null
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,3 @@ export function createTray(): void {
|
|||
|
||||
logger.info('Tray created')
|
||||
}
|
||||
|
||||
export function getTray(): Tray | null {
|
||||
return tray
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,13 +68,15 @@ interface ModeCardProps {
|
|||
points: readonly string[]
|
||||
action: React.ReactNode
|
||||
onSelect: () => void
|
||||
testId: string
|
||||
}
|
||||
|
||||
/** 사용 방식 카드 — 카드 전체를 눌러도, 안의 버튼(키보드 포커스·Enter)으로도 고를 수 있다. */
|
||||
function ModeCard({ icon, title, badge, description, points, action, onSelect }: ModeCardProps): React.ReactElement {
|
||||
function ModeCard({ icon, title, badge, description, points, action, onSelect, testId }: ModeCardProps): React.ReactElement {
|
||||
return (
|
||||
<Box
|
||||
onClick={onSelect}
|
||||
data-testid={testId}
|
||||
sx={{
|
||||
p: 2.5,
|
||||
cursor: 'pointer',
|
||||
|
|
@ -323,6 +325,7 @@ export function OnboardingModal({ open, onClose }: OnboardingModalProps): React.
|
|||
description={t('onboarding.mode.local.desc')}
|
||||
points={LOCAL_POINTS.map((key) => t(key))}
|
||||
onSelect={handleSelectLocalMode}
|
||||
testId="onboarding-mode-local"
|
||||
action={
|
||||
// 첫 포커스 — Enter 로 권장 경로를 바로 시작한다. 클릭은 카드 onClick 으로 전파된다.
|
||||
<Button variant="contained" fullWidth autoFocus>
|
||||
|
|
@ -336,6 +339,7 @@ export function OnboardingModal({ open, onClose }: OnboardingModalProps): React.
|
|||
description={t('onboarding.mode.online.desc')}
|
||||
points={ONLINE_POINTS.map((key) => t(key))}
|
||||
onSelect={() => setPhase('online_auth')}
|
||||
testId="onboarding-mode-online"
|
||||
action={
|
||||
<Button variant="outlined" fullWidth>
|
||||
{t('onboarding.mode.online.action')}
|
||||
|
|
|
|||
|
|
@ -327,7 +327,14 @@ export function SettingsModal({ open, initialTab = DEFAULT_SETTINGS_TAB, onClose
|
|||
}}
|
||||
>
|
||||
{SETTINGS_TAB_ORDER.map((tab) => (
|
||||
<Tab key={tab} value={tab} label={tabMeta[tab].label} icon={tabMeta[tab].icon} iconPosition="start" />
|
||||
<Tab
|
||||
key={tab}
|
||||
value={tab}
|
||||
label={tabMeta[tab].label}
|
||||
icon={tabMeta[tab].icon}
|
||||
iconPosition="start"
|
||||
data-testid={`settings-tab-${tab}`}
|
||||
/>
|
||||
))}
|
||||
</Tabs>
|
||||
</Box>
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ function NavButton({
|
|||
trailing,
|
||||
onClick,
|
||||
shortcut,
|
||||
testId,
|
||||
}: {
|
||||
active: boolean
|
||||
icon: React.ReactElement
|
||||
|
|
@ -56,10 +57,12 @@ function NavButton({
|
|||
trailing?: React.ReactNode
|
||||
onClick: () => void
|
||||
shortcut?: string
|
||||
testId: string
|
||||
}): React.ReactElement {
|
||||
const button = (
|
||||
<ButtonBase
|
||||
onClick={onClick}
|
||||
data-testid={testId}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
sx={{
|
||||
width: '100%',
|
||||
|
|
@ -189,6 +192,7 @@ export function AppSidebar({
|
|||
trailing={trailing}
|
||||
shortcut={index !== undefined ? t('nav.shortcutHint', { n: index + 1 }) : undefined}
|
||||
onClick={() => navigate(r)}
|
||||
testId={`nav-${r}`}
|
||||
/>
|
||||
)
|
||||
|
||||
|
|
@ -246,7 +250,13 @@ export function AppSidebar({
|
|||
</Box>
|
||||
)}
|
||||
|
||||
<NavButton active={false} icon={<Headphones size={ICON} />} label={t('nav.support')} onClick={onOpenSupport} />
|
||||
<NavButton
|
||||
active={false}
|
||||
icon={<Headphones size={ICON} />}
|
||||
label={t('nav.support')}
|
||||
onClick={onOpenSupport}
|
||||
testId="nav-support"
|
||||
/>
|
||||
{item('settings')}
|
||||
|
||||
<Box sx={{ borderTop: `1px solid ${d3roPalette.border.subtle}`, mt: 1 }}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue