Skip to content

Let's use AI to Earn!

feat: 苹果公证配置

yikaJasonMic17d584cd75ae
diff --git a/.env b/.env
index df2c816e..6eb539af 100644
--- a/.env
+++ b/.env
@@ -1,3 +1,4 @@
+appleId = '[email protected]'
VITE_APP_HOT_URL = 'https://att-contents.yikart.cn/api'
VITE_APP_FILE_HOST = 'https://ai-to-earn.oss-cn-beijing.aliyuncs.com/'
diff --git a/electron-builder.json b/electron-builder.json
index 135f0e16..fd89cc66 100644
--- a/electron-builder.json
+++ b/electron-builder.json
@@ -9,7 +9,11 @@
},
"files": ["dist-electron", "dist"],
"mac": {
- "identity": null,
+ "gatekeeperAssess": false,
+ "hardenedRuntime": true,
+ "entitlements": "scripts/entitlements.mac.plist",
+ "entitlementsInherit": "scripts/entitlements.mac.plist",
+ "identity": "Yika(Beijing)Technology Co., Ltd.",
"artifactName": "${productName}-${version}-${arch}.${ext}",
"target": [
{
diff --git a/package-lock.json b/package-lock.json
index e2e47a71..f8f5f5a0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -79,6 +79,7 @@
"autoprefixer": "^10.4.20",
"electron": "^33.2.0",
"electron-builder": "^26.0.12",
+ "electron-notarize": "^1.2.2",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
@@ -6230,6 +6231,37 @@
"node": ">= 14"
}
},
+ "node_modules/electron-notarize": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmmirror.com/electron-notarize/-/electron-notarize-1.2.2.tgz",
+ "integrity": "sha512-ZStVWYcWI7g87/PgjPJSIIhwQXOaw4/XeXU+pWqMMktSLHaGMLHdyPPN7Cmao7+Cr7fYufA16npdtMndYciHNw==",
+ "deprecated": "Please use @electron/notarize moving forward. There is no API change, just a package name change",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.1.1",
+ "fs-extra": "^9.0.1"
+ },
+ "engines": {
+ "node": ">= 10.0.0"
+ }
+ },
+ "node_modules/electron-notarize/node_modules/fs-extra": {
+ "version": "9.1.0",
+ "resolved": "https://registry.npmmirror.com/fs-extra/-/fs-extra-9.1.0.tgz",
+ "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "at-least-node": "^1.0.0",
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^6.0.1",
+ "universalify": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/electron-publish": {
"version": "26.0.11",
"resolved": "https://registry.npmmirror.com/electron-publish/-/electron-publish-26.0.11.tgz",
diff --git a/package.json b/package.json
index f9a7f799..4b55e22b 100644
--- a/package.json
+++ b/package.json
@@ -1,4 +1,7 @@
{
+ "build": {
+ "afterSign": "scripts/notarize.cjs"
+ },
"name": "att",
"version": "0.6.0-alpha.3",
"main": "dist-electron/main/index.js",
@@ -100,6 +103,7 @@
"autoprefixer": "^10.4.20",
"electron": "^33.2.0",
"electron-builder": "^26.0.12",
+ "electron-notarize": "^1.2.2",
"eslint": "^8.42.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
diff --git a/scripts/entitlements.mac.plist b/scripts/entitlements.mac.plist
new file mode 100644
index 00000000..9f7cf514
--- /dev/null
+++ b/scripts/entitlements.mac.plist
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+ <dict>
+ <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
+ <true/>
+ </dict>
+</plist>
diff --git a/scripts/notarize.cjs b/scripts/notarize.cjs
new file mode 100644
index 00000000..2c8524ac
--- /dev/null
+++ b/scripts/notarize.cjs
@@ -0,0 +1,22 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-04-17 19:22:11
+ * @LastEditTime: 2025-04-17 21:08:57
+ * @LastEditors: nevin
+ * @Description:
+ */
+// 修改后(CommonJS)
+const { notarize } = require('@electron/notarize');
+
+exports.default = async function notarizing(context) {
+ const appName = context.packager.appInfo.productFilename;
+ const { electronPlatformName, appOutDir } = context;
+ if (electronPlatformName !== 'darwin') return;
+
+ let appPath = `${appOutDir}/${appName}.app`;
+ console.log('notarizing-------', appPath);
+
+ return await notarize({
+
+ });
+};