mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
refactor: simplify UID handling logic on unix
This commit is contained in:
parent
895b74ca3f
commit
dfbe11deb4
@ -67,13 +67,10 @@ export const getMihomoIpcPath = (): string => {
|
||||
}
|
||||
}
|
||||
|
||||
const uid = process.getuid?.() || 0
|
||||
const uid = process.getuid?.() || 'unknown'
|
||||
const processId = process.pid
|
||||
|
||||
if (uid === 0) {
|
||||
return '/tmp/mihomo-party-admin.sock'
|
||||
} else {
|
||||
return `/tmp/mihomo-party-${uid}.sock`
|
||||
}
|
||||
return `/tmp/mihomo-party-${uid}-${processId}.sock`
|
||||
}
|
||||
|
||||
const ctlParam = process.platform === 'win32' ? '-ext-ctl-pipe' : '-ext-ctl-unix'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user