From dec1eb249f7c3d45f371bfb976c4cbfe185bdc52 Mon Sep 17 00:00:00 2001 From: pompurin404 Date: Fri, 27 Sep 2024 22:39:34 +0800 Subject: [PATCH] rm grant logic for unix socket --- src/main/core/manager.ts | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/src/main/core/manager.ts b/src/main/core/manager.ts index 1c8ebd83..21e00417 100644 --- a/src/main/core/manager.ts +++ b/src/main/core/manager.ts @@ -125,7 +125,6 @@ export async function startCore(detached = false): Promise[]> { (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 { } } -async function autoGrantUnixSocket(): Promise { - 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 { if (process.platform === 'win32') return const { encryptedPassword } = await getAppConfig()