From 6fb79c17d20406821aa972a398c163378166ed2b Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Sat, 8 Feb 2025 10:57:30 +0800 Subject: [PATCH] feat: enable local network access on macOS #1178 --- build/entitlements.mac.plist | 4 ++++ src/main/index.ts | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/build/entitlements.mac.plist b/build/entitlements.mac.plist index 38c887b2..8059c60e 100644 --- a/build/entitlements.mac.plist +++ b/build/entitlements.mac.plist @@ -8,5 +8,9 @@ com.apple.security.cs.allow-dyld-environment-variables + com.apple.security.network.client + + com.apple.security.network.server + diff --git a/src/main/index.ts b/src/main/index.ts index a3e221df..3e368cf1 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -16,6 +16,12 @@ if (!app.requestSingleInstanceLock()) { // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. + + if (process.platform === 'darwin') { + // Enable local network access + app.commandLine.appendSwitch('enable-local-network-access') + } + app.whenReady().then(async () => { await updateUserDataPath()