Skip to content
This repository has been archived by the owner on Feb 5, 2025. It is now read-only.

Commit

Permalink
rm grant logic for unix socket
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Sep 27, 2024
1 parent 2148349 commit dec1eb2
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions src/main/core/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit dec1eb2

Please sign in to comment.