rm grant logic for unix socket
Some checks are pending
Build / windows (arm64) (push) Waiting to run
Build / windows (ia32) (push) Waiting to run
Build / windows (x64) (push) Waiting to run
Build / windows7 (ia32) (push) Waiting to run
Build / windows7 (x64) (push) Waiting to run
Build / linux (arm64) (push) Waiting to run
Build / linux (x64) (push) Waiting to run
Build / macos (arm64) (push) Waiting to run
Build / macos (x64) (push) Waiting to run
Build / updater (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-bin) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-electron) (push) Blocked by required conditions
Build / aur-release-updater (mihomo-party-electron-bin) (push) Blocked by required conditions
Build / aur-git-updater (push) Waiting to run
Build / Update WinGet Package (push) Blocked by required conditions
Build / Update Homebrew cask (push) Blocked by required conditions

This commit is contained in:
pompurin404 2024-09-27 22:39:34 +08:00
parent 2148349b5e
commit dec1eb249f
No known key found for this signature in database

View File

@ -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()