mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-17 11:37:06 +08:00
feat: 设置页面新UI 未做完
This commit is contained in:
+33
-1
@@ -1,5 +1,15 @@
|
||||
import './preload-env'
|
||||
import { app, shell, BrowserWindow, ipcMain, nativeImage, clipboard, Menu, Tray } from 'electron'
|
||||
import {
|
||||
app,
|
||||
shell,
|
||||
BrowserWindow,
|
||||
ipcMain,
|
||||
nativeImage,
|
||||
clipboard,
|
||||
Menu,
|
||||
Tray,
|
||||
dialog
|
||||
} from 'electron'
|
||||
import { join } from 'path'
|
||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||
import icon from '../../resources/icon.png?asset'
|
||||
@@ -478,6 +488,28 @@ app.whenReady().then(async () => {
|
||||
return { success: true, info }
|
||||
})
|
||||
|
||||
ipcMain.handle('settings:selectDbRoot', async (event) => {
|
||||
const result = await dialog.showOpenDialog(BrowserWindow.fromWebContents(event.sender)!, {
|
||||
title: '选择微信数据库目录',
|
||||
defaultPath: loadSettings().dbRoot || undefined,
|
||||
properties: ['openDirectory']
|
||||
})
|
||||
return result.canceled ? { canceled: true } : { canceled: false, path: result.filePaths[0] }
|
||||
})
|
||||
|
||||
ipcMain.handle('settings:openAccountRoot', async () => {
|
||||
const accountRoot = chat.getCurrentAccountRoot()
|
||||
if (!accountRoot) return { success: false, error: '当前没有可打开的账号目录' }
|
||||
const error = await shell.openPath(accountRoot)
|
||||
return error ? { success: false, error } : { success: true }
|
||||
})
|
||||
|
||||
ipcMain.handle('db:disconnect', () => {
|
||||
if (!chat.isReady()) return { success: false, error: '数据库当前未连接' }
|
||||
chat.setChatDb(null)
|
||||
return { success: true }
|
||||
})
|
||||
|
||||
ipcMain.handle('api:getStatus', () => apiServer.getState())
|
||||
|
||||
ipcMain.handle('api:start', async (_, host?: string, port?: number) => {
|
||||
|
||||
Reference in New Issue
Block a user