mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +08:00
readable error output
This commit is contained in:
parent
cebece3748
commit
911d72975e
|
@ -31,6 +31,7 @@
|
||||||
"chokidar": "^4.0.1",
|
"chokidar": "^4.0.1",
|
||||||
"dayjs": "^1.11.13",
|
"dayjs": "^1.11.13",
|
||||||
"express": "^5.0.1",
|
"express": "^5.0.1",
|
||||||
|
"iconv-lite": "^0.6.3",
|
||||||
"webdav": "^5.7.1",
|
"webdav": "^5.7.1",
|
||||||
"ws": "^8.18.0",
|
"ws": "^8.18.0",
|
||||||
"yaml": "^2.6.0"
|
"yaml": "^2.6.0"
|
||||||
|
|
|
@ -32,6 +32,9 @@ importers:
|
||||||
express:
|
express:
|
||||||
specifier: ^5.0.1
|
specifier: ^5.0.1
|
||||||
version: 5.0.1
|
version: 5.0.1
|
||||||
|
iconv-lite:
|
||||||
|
specifier: ^0.6.3
|
||||||
|
version: 0.6.3
|
||||||
webdav:
|
webdav:
|
||||||
specifier: ^5.7.1
|
specifier: ^5.7.1
|
||||||
version: 5.7.1
|
version: 5.7.1
|
||||||
|
|
|
@ -18,11 +18,12 @@ import { exePath, taskDir } from './utils/dirs'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { startMonitor } from './resolve/trafficMonitor'
|
import { startMonitor } from './resolve/trafficMonitor'
|
||||||
import { showFloatingWindow } from './resolve/floatingWindow'
|
import { showFloatingWindow } from './resolve/floatingWindow'
|
||||||
|
import iconv from 'iconv-lite'
|
||||||
|
|
||||||
let quitTimeout: NodeJS.Timeout | null = null
|
let quitTimeout: NodeJS.Timeout | null = null
|
||||||
export let mainWindow: BrowserWindow | null = null
|
export let mainWindow: BrowserWindow | null = null
|
||||||
|
|
||||||
if (process.platform === 'win32' && !is.dev && !process.argv.includes('noadmin')) {
|
if (process.platform === 'win32' && !process.argv.includes('noadmin')) {
|
||||||
try {
|
try {
|
||||||
createElevateTask()
|
createElevateTask()
|
||||||
} catch (createError) {
|
} catch (createError) {
|
||||||
|
@ -38,9 +39,17 @@ if (process.platform === 'win32' && !is.dev && !process.argv.includes('noadmin')
|
||||||
execSync('C:\\\\Windows\\System32\\schtasks.exe /run /tn mihomo-party-run')
|
execSync('C:\\\\Windows\\System32\\schtasks.exe /run /tn mihomo-party-run')
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
let createErrorStr = `${createError}`
|
||||||
|
let eStr = `${e}`
|
||||||
|
try {
|
||||||
|
createErrorStr = iconv.decode((createError as { stderr: Buffer }).stderr, 'gbk')
|
||||||
|
eStr = iconv.decode((e as { stderr: Buffer }).stderr, 'gbk')
|
||||||
|
} catch {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
dialog.showErrorBox(
|
dialog.showErrorBox(
|
||||||
'首次启动请以管理员权限运行',
|
'首次启动请以管理员权限运行',
|
||||||
`首次启动请以管理员权限运行\n${createError}\n${e}`
|
`首次启动请以管理员权限运行\n${createErrorStr}\n${eStr}`
|
||||||
)
|
)
|
||||||
} finally {
|
} finally {
|
||||||
app.exit()
|
app.exit()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user