mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-02 18:39:06 +08:00
refactor(ipc): streamline IPC handler definitions and improve import organization
- Simplified the registration of IPC handlers for the search window by removing unnecessary async/await syntax. - Improved import organization by removing duplicate import statements for ASRServerService.
This commit is contained in:
parent
73209a4f0a
commit
97ea0e5a03
@ -9,6 +9,7 @@ import log from 'electron-log'
|
|||||||
|
|
||||||
import { titleBarOverlayDark, titleBarOverlayLight } from './config'
|
import { titleBarOverlayDark, titleBarOverlayLight } from './config'
|
||||||
import AppUpdater from './services/AppUpdater'
|
import AppUpdater from './services/AppUpdater'
|
||||||
|
import { asrServerService } from './services/ASRServerService'
|
||||||
import BackupManager from './services/BackupManager'
|
import BackupManager from './services/BackupManager'
|
||||||
import { configManager } from './services/ConfigManager'
|
import { configManager } from './services/ConfigManager'
|
||||||
import CopilotService from './services/CopilotService'
|
import CopilotService from './services/CopilotService'
|
||||||
@ -21,7 +22,6 @@ import mcpService from './services/MCPService'
|
|||||||
import * as NutstoreService from './services/NutstoreService'
|
import * as NutstoreService from './services/NutstoreService'
|
||||||
import ObsidianVaultService from './services/ObsidianVaultService'
|
import ObsidianVaultService from './services/ObsidianVaultService'
|
||||||
import { ProxyConfig, proxyManager } from './services/ProxyManager'
|
import { ProxyConfig, proxyManager } from './services/ProxyManager'
|
||||||
import { asrServerService } from './services/ASRServerService'
|
|
||||||
import { searchService } from './services/SearchService'
|
import { searchService } from './services/SearchService'
|
||||||
import { registerShortcuts, unregisterAllShortcuts } from './services/ShortcutService'
|
import { registerShortcuts, unregisterAllShortcuts } from './services/ShortcutService'
|
||||||
import { TrayService } from './services/TrayService'
|
import { TrayService } from './services/TrayService'
|
||||||
@ -31,8 +31,6 @@ import { decrypt, encrypt } from './utils/aes'
|
|||||||
import { getConfigDir, getFilesDir } from './utils/file'
|
import { getConfigDir, getFilesDir } from './utils/file'
|
||||||
import { compress, decompress } from './utils/zip'
|
import { compress, decompress } from './utils/zip'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const fileManager = new FileStorage()
|
const fileManager = new FileStorage()
|
||||||
const backupManager = new BackupManager()
|
const backupManager = new BackupManager()
|
||||||
const exportService = new ExportService(fileManager)
|
const exportService = new ExportService(fileManager)
|
||||||
@ -297,15 +295,11 @@ export function registerIpc(mainWindow: BrowserWindow, app: Electron.App) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// search window
|
// search window
|
||||||
ipcMain.handle(IpcChannel.SearchWindow_Open, async (_, uid: string) => {
|
ipcMain.handle(IpcChannel.SearchWindow_Open, (_, uid: string) => searchService.openSearchWindow(uid))
|
||||||
await searchService.openSearchWindow(uid)
|
ipcMain.handle(IpcChannel.SearchWindow_Close, (_, uid: string) => searchService.closeSearchWindow(uid))
|
||||||
})
|
ipcMain.handle(IpcChannel.SearchWindow_OpenUrl, (_, uid: string, url: string) =>
|
||||||
ipcMain.handle(IpcChannel.SearchWindow_Close, async (_, uid: string) => {
|
searchService.openUrlInSearchWindow(uid, url)
|
||||||
await searchService.closeSearchWindow(uid)
|
)
|
||||||
})
|
|
||||||
ipcMain.handle(IpcChannel.SearchWindow_OpenUrl, async (_, uid: string, url: string) => {
|
|
||||||
return await searchService.openUrlInSearchWindow(uid, url)
|
|
||||||
})
|
|
||||||
|
|
||||||
// 注册ASR服务器IPC处理程序
|
// 注册ASR服务器IPC处理程序
|
||||||
asrServerService.registerIpcHandlers()
|
asrServerService.registerIpcHandlers()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user