mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 19:56:10 +08:00
fix auto grant
This commit is contained in:
parent
4595e3a658
commit
e34acc0c74
|
@ -226,24 +226,19 @@ export async function autoGrantCorePermition(corePath: string): Promise<void> {
|
|||
const { encryptedPassword } = await getAppConfig()
|
||||
const execPromise = promisify(exec)
|
||||
if (encryptedPassword && isEncryptionAvailable()) {
|
||||
const password = safeStorage.decryptString(Buffer.from(encryptedPassword))
|
||||
if (process.platform === 'linux') {
|
||||
try {
|
||||
try {
|
||||
const password = safeStorage.decryptString(Buffer.from(encryptedPassword))
|
||||
if (process.platform === 'linux') {
|
||||
await execPromise(`echo "${password}" | sudo -S chown root:root "${corePath}"`)
|
||||
await execPromise(`echo "${password}" | sudo -S chmod +sx "${corePath}"`)
|
||||
} catch (error) {
|
||||
patchAppConfig({ encryptedPassword: undefined })
|
||||
throw error
|
||||
}
|
||||
}
|
||||
if (process.platform === 'darwin') {
|
||||
try {
|
||||
if (process.platform === 'darwin') {
|
||||
await execPromise(`echo "${password}" | sudo -S chown root:admin "${corePath}"`)
|
||||
await execPromise(`echo "${password}" | sudo -S chmod +sx "${corePath}"`)
|
||||
} catch (error) {
|
||||
patchAppConfig({ encryptedPassword: undefined })
|
||||
throw error
|
||||
}
|
||||
} catch (error) {
|
||||
patchAppConfig({ encryptedPassword: undefined })
|
||||
throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user