diff --git a/electron/index.ts b/electron/index.ts index fc32cd8..9bc95a7 100644 --- a/electron/index.ts +++ b/electron/index.ts @@ -26,20 +26,6 @@ log.initialize({ preload: true }); sharp.cache(false); logit("🚃 App Path: ", app.getAppPath()); -// SECURITY SCOPED BOOKMARKS -const fileBookmarks = settings.get("file-bookmarks", true); -const folderBookmarks = settings.get("folder-bookmarks", true); -const customModelsBookmarks = settings.get("custom-models-bookmarks", true); -if (fileBookmarks) { - app.startAccessingSecurityScopedResource(fileBookmarks); -} -if (folderBookmarks) { - app.startAccessingSecurityScopedResource(folderBookmarks as string); -} -if (customModelsBookmarks) { - app.startAccessingSecurityScopedResource(customModelsBookmarks as string); -} - app.on("ready", async () => { await prepareNext("./renderer"); @@ -58,6 +44,23 @@ app.on("ready", async () => { log.info("🚀 UPSCAYL EXEC PATH: ", execPath("bin")); log.info("🚀 MODELS PATH: ", modelsPath); + + // SECURITY SCOPED BOOKMARKS + const fileBookmarks = settings.get("file-bookmarks", true); + const folderBookmarks = settings.get("folder-bookmarks", true); + const customModelsBookmarks = settings.get("custom-models-bookmarks", true); + if (fileBookmarks) { + log.info("📁 File Bookmarks: ", fileBookmarks); + app.startAccessingSecurityScopedResource(fileBookmarks); + } + if (folderBookmarks) { + log.info("📁 Folder Bookmarks: ", folderBookmarks); + app.startAccessingSecurityScopedResource(folderBookmarks); + } + if (customModelsBookmarks) { + log.info("📁 Custom Models Bookmarks: ", customModelsBookmarks); + app.startAccessingSecurityScopedResource(customModelsBookmarks); + } }); // Quit the app once all windows are closed diff --git a/electron/utils/settings.ts b/electron/utils/settings.ts index b615dd7..b0299f1 100644 --- a/electron/utils/settings.ts +++ b/electron/utils/settings.ts @@ -12,9 +12,9 @@ import { getMainWindow } from "../main-window"; * settings.set("key", value); */ export const settings = { - get: (key: string, parse: boolean = false) => { + get: (key: string, parse: boolean = false): any => { const mainWindow = getMainWindow(); - if (!mainWindow) return; + if (!mainWindow) return null; let result = null; mainWindow.webContents .executeJavaScript(`localStorage.getItem("${key}");`, true) diff --git a/mas-dev.json b/mas-dev.json index 818989f..4dc4975 100644 --- a/mas-dev.json +++ b/mas-dev.json @@ -1,5 +1,9 @@ { "appId": "org.upscayl.Upscayl", + "afterSign": "./notarize.js", + "asar": true, + "artifactName": "${name}-${version}-${os}.${ext}", + "asarUnpack": ["**/node_modules/sharp/**/*"], "extraFiles": [ { "from": "resources/${os}/bin", @@ -14,16 +18,29 @@ ], "mac": { "type": "development", - "identity": null, + "hardenedRuntime": true, + "gatekeeperAssess": false, + "entitlements": "resources/entitlements.mac.plist", + "entitlementsInherit": "resources/entitlements.mac.plist", + "provisioningProfile": "dev.provisionprofile", "mergeASARs": false, "x64ArchFiles": "*" }, "masDev": { "type": "development", - "artifactName": "${name}_${version}_macos.${ext}", - "category": "public.app-category.photography", "hardenedRuntime": false, - "entitlements": "resources/entitlements.mas.plist", - "entitlementsInherit": "resources/entitlements.mas.plist" + "gatekeeperAssess": false, + "electronLanguages": ["en"], + "category": "public.app-category.photography", + "entitlements": "resources/entitlements.mas-dev.plist", + "provisioningProfile": "dev.provisionprofile", + "entitlementsInherit": "resources/entitlements.mas.inherit.plist", + "icon": "build/icon.icns", + "target": [ + { + "target": "mas", + "arch": ["universal"] + } + ] } } diff --git a/package.json b/package.json index e32031b..d76cc19 100644 --- a/package.json +++ b/package.json @@ -72,7 +72,7 @@ "artifactName": "${name}-${version}-${os}.${ext}", "afterSign": "./notarize.js", "asar": true, - "buildVersion": "23.11.3", + "buildVersion": "23.11.4", "asarUnpack": [ "**/node_modules/sharp/**/*" ], diff --git a/resources/entitlements.mas-dev.plist b/resources/entitlements.mas-dev.plist new file mode 100644 index 0000000..07287e9 --- /dev/null +++ b/resources/entitlements.mas-dev.plist @@ -0,0 +1,36 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.cs.allow-jit + + com.apple.security.cs.allow-unsigned-executable-memory + + com.apple.security.cs.disable-library-validation + + com.apple.security.cs.allow-dyld-environment-variables + + com.apple.security.network.client + + com.apple.security.network.server + + com.apple.security.files.user-selected.read-write + + com.apple.security.inherit + + com.apple.security.files.bookmarks.document-scope + + com.apple.security.files.bookmarks.app-scope + + com.apple.security.application-groups + + W2T4W74X87.org.upscayl.Upscayl + + com.apple.application-identifier + W2T4W74X87.org.upscayl.Upscayl + com.apple.developer.team-identifier + W2T4W74X87 + + \ No newline at end of file