Skip to content

Commit 51cf7a9

Browse files
committed
- add notarization scripts.
- fix some small issues of StatConfirm.
1 parent 79a7065 commit 51cf7a9

11 files changed

+94
-10
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,6 @@ xcdebugger
2222
npm-debug.log*
2323
.nyc_output
2424
coverage/
25+
26+
.env
27+

app-ui/frame/MyFrame.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default class MyFrame extends React.Component {
6060
if (!this.props.show) {
6161
return null
6262
}
63-
let {show, title, body, lang, width, okText, cancelText} = this.props
63+
let {show, title, body, lang, width, okText, cancelText, maskClosable} = this.props
6464

6565
return (
6666
<Modal
@@ -78,6 +78,7 @@ export default class MyFrame extends React.Component {
7878
{okText || lang.ok}
7979
</Button>
8080
]}
81+
maskClosable={maskClosable}
8182
>
8283
<div className="prompt-body">{body}</div>
8384
{/*<div className="prompt">*/}

app-ui/frame/StatConfirm.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ const StatConfirm = (props) => {
3333
show={show}
3434
title={lang.pref_tab_usage_data_title}
3535
body={<div className="ln">{lang.pref_tab_usage_data_desc}</div>}
36-
onOK={() => setShow(true)}
36+
onOK={() => setSend(true)}
3737
onCancel={() => setSend(false)}
3838
lang={lang}
3939
width={400}
4040
okText={lang.send_usage_data_ok}
4141
cancelText={lang.send_usage_data_cancel}
42+
maskClosable={false}
4243
/>
4344
)
4445
}

app/ui/app.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/ui/common.js.LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! SwitchHosts! common.js, 2019-11-25 20:56:14 */
1+
/*! SwitchHosts! common.js, 2020-01-09 13:52:30 */
22

33
/*!
44
Copyright (c) 2017 Jed Watson.

app/version.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = [3, 5, 3, 5510]
1+
module.exports = [3, 5, 3, 5514]

package-lock.json

+30-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@
7373
"copy-webpack-plugin": "^5.0.5",
7474
"cross-env": "^6.0.3",
7575
"css-loader": "^3.2.0",
76+
"dotenv": "^8.2.0",
7677
"electron": "^7.1.2",
7778
"electron-builder": "^21.2.0",
79+
"electron-notarize": "^0.2.1",
7880
"eslint": "^6.7.1",
7981
"eslint-config-standard": "^14.1.0",
8082
"eslint-friendly-formatter": "^4.0.1",
@@ -142,5 +144,8 @@
142144
"stage-0"
143145
]
144146
}
147+
},
148+
"build": {
149+
"afterSign": "scripts/notarize.js"
145150
}
146-
}
151+
}

scripts/entitlements.mac.plist

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
6+
<true/>
7+
</dict>
8+
</plist>

scripts/make.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ const makeApp = async () => {
3939
category: 'public.app-category.productivity',
4040
icon: 'assets/app.icns',
4141
gatekeeperAssess: false,
42-
identity: 'oldj',
42+
hardenedRuntime: true,
43+
entitlements: 'scripts/entitlements.mac.plist',
44+
entitlementsInherit: 'scripts/entitlements.mac.plist',
4345
artifactName: '${productName}_macOS_${version}(${buildVersion}).${ext}'
4446
},
4547
dmg: {
@@ -60,6 +62,7 @@ const makeApp = async () => {
6062
type: 'link',
6163
path: '/Applications'
6264
}],
65+
sign: false,
6366
artifactName: '${productName}_macOS_${version}(${buildVersion}).${ext}'
6467
},
6568
win: {
@@ -75,6 +78,7 @@ const makeApp = async () => {
7578
artifactName: '${productName}_windows_portable_${version}(${buildVersion}).${ext}'
7679
},
7780
linux: {
81+
category: 'Development',
7882
artifactName: '${productName}_linux_${arch}_${version}(${buildVersion}).${ext}'
7983
}
8084
}

scripts/notarize.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* notarize.js
3+
*
4+
* @see https://oldj.net/blog/2019/12/29/electron-builder-sign-and-notarize-for-macos
5+
*/
6+
7+
require('dotenv').config()
8+
const {notarize} = require('electron-notarize')
9+
10+
exports.default = async function notarizing (context) {
11+
const appName = context.packager.appInfo.productFilename
12+
const {electronPlatformName, appOutDir} = context
13+
if (electronPlatformName !== 'darwin') {
14+
return
15+
}
16+
17+
let appPath = `${appOutDir}/${appName}.app`
18+
let {appleId, appBundleId, ascProvider, appleIdPassword} = process.env
19+
if (!appleIdPassword) {
20+
appleIdPassword = `@keychain:Application Loader: ${appleId}`
21+
}
22+
23+
if (!appleId || !appBundleId || !ascProvider || !appleIdPassword) {
24+
console.log('Not notarized.')
25+
return
26+
}
27+
28+
return await notarize({
29+
appBundleId,
30+
appPath,
31+
ascProvider,
32+
appleId,
33+
appleIdPassword
34+
})
35+
}

0 commit comments

Comments
 (0)