mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +08:00
rm grant logic for unix socket
This commit is contained in:
parent
f55ea7d320
commit
46486d75c9
|
@ -125,7 +125,6 @@ export async function startCore(detached = false): Promise<Promise<void>[]> {
|
|||
(process.platform !== 'win32' && str.includes('RESTful API unix listening at')) ||
|
||||
(process.platform === 'win32' && str.includes('RESTful API pipe listening at'))
|
||||
) {
|
||||
await autoGrantUnixSocket()
|
||||
resolve([
|
||||
new Promise((resolve) => {
|
||||
child.stdout?.on('data', async (data) => {
|
||||
|
@ -217,25 +216,6 @@ async function checkProfile(): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
async function autoGrantUnixSocket(): Promise<void> {
|
||||
if (process.platform === 'win32') return
|
||||
const { encryptedPassword } = await getAppConfig()
|
||||
const { 'external-controller-unix': mihomoUnix = 'mihomo-party.sock' } =
|
||||
await getControledMihomoConfig()
|
||||
const execPromise = promisify(exec)
|
||||
if (encryptedPassword && isEncryptionAvailable()) {
|
||||
try {
|
||||
const password = safeStorage.decryptString(Buffer.from(encryptedPassword))
|
||||
await execPromise(
|
||||
`echo "${password}" | sudo -S chmod 777 "${path.join(mihomoWorkDir(), mihomoUnix)}"`
|
||||
)
|
||||
} catch (error) {
|
||||
patchAppConfig({ encryptedPassword: undefined })
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function autoGrantCorePermition(corePath: string): Promise<void> {
|
||||
if (process.platform === 'win32') return
|
||||
const { encryptedPassword } = await getAppConfig()
|
||||
|
|
Loading…
Reference in New Issue
Block a user