fix(sync): bind sync engine to its user DB, scope instructions/templates per account, harden navigation
This commit is contained in:
parent
1b8fe445f3
commit
9aa7302944
30 changed files with 2614 additions and 386 deletions
|
|
@ -1,7 +1,7 @@
|
|||
// src/main/ipc/license-handlers.ts
|
||||
// Phase 11: 라이센스 IPC 핸들러
|
||||
|
||||
import { app, ipcMain, BrowserWindow, shell } from 'electron'
|
||||
import { app, ipcMain, BrowserWindow } from 'electron'
|
||||
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
|
||||
import { ipcSuccess, ipcError, ErrorCode } from '@d3ro/core/errors'
|
||||
import { getLicenseService } from '../services/LicenseService'
|
||||
|
|
@ -12,6 +12,7 @@ import type {
|
|||
} from '@d3ro/core/types'
|
||||
import { Feature } from '@d3ro/core/types'
|
||||
import { billingUrl, PUBLIC_SITE_ORIGIN } from '@d3ro/core/web-urls'
|
||||
import { openExternalSafe } from '../windows/web-contents-hardening'
|
||||
|
||||
/** 개발 빌드는 로컬 웹앱(`npm run dev --workspace=@d3ro/web`)의 결제 페이지를 연다. */
|
||||
const DEV_WEB_ORIGIN = 'http://localhost:3000'
|
||||
|
|
@ -105,7 +106,10 @@ export function registerLicenseHandlers(): void {
|
|||
ipcMain.handle(IPC_CHANNELS.LICENSE.OPEN_BILLING, async (_event, params: { tier: 'pro' | 'pro_plus' }) => {
|
||||
try {
|
||||
const url = billingUrl({ tier: params.tier })
|
||||
await shell.openExternal(app.isPackaged ? url : url.replace(PUBLIC_SITE_ORIGIN, DEV_WEB_ORIGIN))
|
||||
const target = app.isPackaged ? url : url.replace(PUBLIC_SITE_ORIGIN, DEV_WEB_ORIGIN)
|
||||
// 개발 빌드만 로컬 웹앱(http://localhost:3000) 오리진을 추가로 허용한다.
|
||||
const opened = await openExternalSafe(target, app.isPackaged ? {} : { allowOrigins: [DEV_WEB_ORIGIN] })
|
||||
if (!opened) return ipcError(ErrorCode.UnknownError, 'Failed to open billing: URL not allowed')
|
||||
return ipcSuccess(undefined)
|
||||
} catch (err) {
|
||||
return ipcError(ErrorCode.UnknownError, `Failed to open billing: ${err}`)
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
// src/main/ipc/window-handlers.ts
|
||||
|
||||
import { ipcMain, shell } from 'electron'
|
||||
import { ipcMain } from 'electron'
|
||||
import { IPC_CHANNELS } from '@d3ro/core/ipc-channels'
|
||||
import { ipcSuccess } from '@d3ro/core/errors'
|
||||
import { ErrorCode, ipcError, ipcSuccess } from '@d3ro/core/errors'
|
||||
import { getMainWindow, hideResultPopup, hideRecordingTip } from '../windows/WindowManager'
|
||||
import { isTrustedIpcSender, openExternalSafe } from '../windows/web-contents-hardening'
|
||||
|
||||
export function registerWindowHandlers(): void {
|
||||
ipcMain.on(IPC_CHANNELS.WINDOW.MINIMIZE, () => {
|
||||
|
|
@ -38,9 +39,15 @@ export function registerWindowHandlers(): void {
|
|||
hideRecordingTip()
|
||||
})
|
||||
|
||||
// 외부 URL 열기
|
||||
ipcMain.handle(IPC_CHANNELS.SYSTEM.OPEN_EXTERNAL, async (_event, params: { url: string }) => {
|
||||
await shell.openExternal(params.url)
|
||||
// 외부 URL 열기 — 앱 페이지가 보낸 요청만, 허용 scheme(https/mailto)만 연다.
|
||||
ipcMain.handle(IPC_CHANNELS.SYSTEM.OPEN_EXTERNAL, async (event, params: { url: string }) => {
|
||||
if (!isTrustedIpcSender(event)) {
|
||||
return ipcError(ErrorCode.ConfigInvalidValue, 'openExternal: untrusted sender')
|
||||
}
|
||||
const url = typeof params?.url === 'string' ? params.url : ''
|
||||
if (!(await openExternalSafe(url))) {
|
||||
return ipcError(ErrorCode.ConfigInvalidValue, 'openExternal: URL scheme not allowed')
|
||||
}
|
||||
return ipcSuccess(undefined)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue