Skip to content

Commit 66299ce

Browse files
authored
Macos (#19)
1 parent 6136eda commit 66299ce

18 files changed

+115
-92
lines changed

.erb/scripts/DoNothing.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exports.default = () => {};

.erb/scripts/Notarize.js

+24-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1-
exports.default = async function notarizeMacos() {
2-
console.warn('Skipping notarizing step.');
1+
const { notarize } = require('electron-notarize');
2+
const { build } = require('../../package.json');
3+
4+
exports.default = async function notarizeMacos(context) {
5+
const { electronPlatformName, appOutDir } = context;
6+
if (electronPlatformName !== 'darwin') {
7+
return;
8+
}
9+
10+
if (!('APPLE_ID' in process.env && 'APPLE_ID_PASS' in process.env)) {
11+
console.warn(
12+
'Skipping notarizing step. APPLE_ID and APPLE_ID_PASS env variables must be set'
13+
);
14+
return;
15+
}
16+
17+
const appName = context.packager.appInfo.productFilename;
18+
19+
await notarize({
20+
appBundleId: build.appId,
21+
appPath: `${appOutDir}/${appName}.app`,
22+
appleId: process.env.APPLE_ID,
23+
appleIdPassword: process.env.APPLE_ID_PASS,
24+
});
325
};

.github/ISSUE_TEMPLATE/1-Bug_report.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,6 @@ labels: 'bug'
5252
<!--- Include as many relevant details about the environment you experienced the bug in -->
5353

5454
- Node version:
55-
- PlainPrinter version or branch:
55+
- Screen Printer version or branch:
5656
- Operating System and version:
5757
- Link to your project:
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
22
name: Feature request
3-
about: You want something added to PlainPrinter. 🎉
3+
about: You want something added to Screen Printer. 🎉
44
labels: 'enhancement'
55
---

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ logs
66
pids
77
*.pid
88
*.seed
9+
*.p12
910

1011
# Coverage directory used by tools like istanbul
1112
coverage

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[![Publish](https://github.com/plainlab/plainprinter/actions/workflows/publish.yml/badge.svg)](https://github.com/plainlab/plainprinter/actions/workflows/publish.yml)
22
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/plainlab/plainprinter)](https://github.com/plainlab/plainprinter/releases/latest)
33

4-
# PlainPrinter
4+
# Screen Printer
55

66
> Take multiple screenshots and convert them into a PDF file
77

assets/embedded.provisionprofile

11.9 KB
Binary file not shown.

assets/entitlements.mas.inherit.plist

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.inherit</key>
8+
<true/>
9+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
10+
<true/>
11+
<key>com.apple.security.cs.disable-library-validation</key>
12+
<true/>
13+
</dict>
14+
</plist>

assets/entitlements.mas.plist

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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.app-sandbox</key>
6+
<true/>
7+
<key>com.apple.security.cs.allow-jit</key>
8+
<true/>
9+
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
10+
<true/>
11+
<key>com.apple.security.cs.disable-library-validation</key>
12+
<true/>
13+
</dict>
14+
</plist>

assets/icon.icns

98.1 KB
Binary file not shown.

assets/icon.ico

-101 KB
Binary file not shown.

assets/icon.png

-3.68 KB
Loading

assets/icon.svg

-30
This file was deleted.

package.json

+26-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"description": "Plain screen printer",
2+
"description": "PDF screen printer",
33
"keywords": [
44
"pdf",
55
"screen printer"
@@ -26,6 +26,7 @@
2626
"postinstall": "ts-node .erb/scripts/check-native-dep.js && electron-builder install-app-deps && cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
2727
"lint": "cross-env NODE_ENV=development eslint . --ext .js,.jsx,.ts,.tsx",
2828
"package": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --publish never",
29+
"package:mas": "ts-node ./.erb/scripts/clean.js dist && npm run build && electron-builder build --mac mas --x64 --config.afterSign=.erb/scripts/doNothing.js --publish never",
2930
"prepare": "husky install",
3031
"rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir release/app",
3132
"start": "ts-node ./.erb/scripts/check-port-in-use.js && npm run start:renderer",
@@ -180,8 +181,8 @@
180181
"webpack-merge": "^5.8.0"
181182
},
182183
"build": {
183-
"productName": "PlainPrinter",
184-
"appId": "com.plainprinter",
184+
"productName": "Screen Printer",
185+
"appId": "com.manhtai.screenprinter",
185186
"asar": true,
186187
"asarUnpack": [
187188
"node_modules/screenshot-desktop/lib/win32",
@@ -194,19 +195,34 @@
194195
],
195196
"afterSign": ".erb/scripts/notarize.js",
196197
"mac": {
197-
"target": {
198-
"target": "default",
199-
"arch": [
200-
"arm64",
201-
"x64"
202-
]
203-
},
198+
"target": [
199+
{
200+
"target": "dmg",
201+
"arch": [
202+
"arm64",
203+
"x64"
204+
]
205+
},
206+
{
207+
"target": "mas",
208+
"arch": [
209+
"x64"
210+
]
211+
}
212+
],
204213
"type": "distribution",
205214
"hardenedRuntime": true,
206215
"entitlements": "assets/entitlements.mac.plist",
207216
"entitlementsInherit": "assets/entitlements.mac.plist",
217+
"provisioningProfile": "assets/embedded.provisionprofile",
208218
"gatekeeperAssess": false
209219
},
220+
"mas": {
221+
"entitlements": "assets/entitlements.mas.plist",
222+
"entitlementsInherit": "assets/entitlements.mas.inherit.plist",
223+
"entitlementsLoginHelper": "assets/entitlements.mas.inherit.plist",
224+
"hardenedRuntime": false
225+
},
210226
"dmg": {
211227
"contents": [
212228
{

release/app/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "plainprinter",
3-
"productName": "PlainPrinter",
4-
"version": "0.2.3",
5-
"description": "Plain screen printer",
3+
"productName": "Screen Printer",
4+
"version": "1.0.0",
5+
"description": "PDF screen printer",
66
"main": "./dist/main/main.js",
77
"author": {
88
"name": "PlainLab",

src/main/main.ts

+4
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,10 @@ const createWindow = async () => {
100100
show: false,
101101
width: 800,
102102
height: 400,
103+
maximizable: false,
104+
fullscreen: false,
105+
fullscreenable: false,
106+
resizable: false,
103107
icon: getAssetPath('icon.png'),
104108
webPreferences: {
105109
preload: app.isPackaged

src/main/menu.ts

+24-43
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ export default class MenuBuilder {
5454

5555
buildDarwinTemplate(): MenuItemConstructorOptions[] {
5656
const subMenuAbout: DarwinMenuItemConstructorOptions = {
57-
label: 'PlainPrinter',
57+
label: 'Help',
5858
submenu: [
5959
{
60-
label: 'About PlainPrinter',
60+
label: 'About',
6161
selector: 'orderFrontStandardAboutPanel:',
6262
},
6363
{ type: 'separator' },
6464
{
65-
label: 'Hide PlainPrinter',
65+
label: 'Hide',
6666
accelerator: 'Command+H',
6767
selector: 'hide:',
6868
},
@@ -82,22 +82,6 @@ export default class MenuBuilder {
8282
},
8383
],
8484
};
85-
const subMenuEdit: DarwinMenuItemConstructorOptions = {
86-
label: 'Edit',
87-
submenu: [
88-
{ label: 'Undo', accelerator: 'Command+Z', selector: 'undo:' },
89-
{ label: 'Redo', accelerator: 'Shift+Command+Z', selector: 'redo:' },
90-
{ type: 'separator' },
91-
{ label: 'Cut', accelerator: 'Command+X', selector: 'cut:' },
92-
{ label: 'Copy', accelerator: 'Command+C', selector: 'copy:' },
93-
{ label: 'Paste', accelerator: 'Command+V', selector: 'paste:' },
94-
{
95-
label: 'Select All',
96-
accelerator: 'Command+A',
97-
selector: 'selectAll:',
98-
},
99-
],
100-
};
10185
const subMenuViewDev: MenuItemConstructorOptions = {
10286
label: 'View',
10387
submenu: [
@@ -124,18 +108,6 @@ export default class MenuBuilder {
124108
},
125109
],
126110
};
127-
const subMenuViewProd: MenuItemConstructorOptions = {
128-
label: 'View',
129-
submenu: [
130-
{
131-
label: 'Toggle Full Screen',
132-
accelerator: 'Ctrl+Command+F',
133-
click: () => {
134-
this.mainWindow.setFullScreen(!this.mainWindow.isFullScreen());
135-
},
136-
},
137-
],
138-
};
139111
const subMenuWindow: DarwinMenuItemConstructorOptions = {
140112
label: 'Window',
141113
submenu: [
@@ -153,27 +125,32 @@ export default class MenuBuilder {
153125
label: 'Help',
154126
submenu: [
155127
{
156-
label: 'PlainLab home page',
128+
label: 'Privacy',
157129
click() {
158-
shell.openExternal('https://plainlab.github.io');
130+
shell.openExternal(
131+
'https://screenprinter.manhtai.com/privacy.html'
132+
);
159133
},
160134
},
161135
{
162-
label: 'PlainPrinter repo',
136+
label: 'Support',
163137
click() {
164-
shell.openExternal('https://github.com/plainlab/plainprinter');
138+
shell.openExternal(
139+
'https://screenprinter.manhtai.com/support.html'
140+
);
165141
},
166142
},
167143
],
168144
};
169145

170-
const subMenuView =
146+
if (
171147
process.env.NODE_ENV === 'development' ||
172148
process.env.DEBUG_PROD === 'true'
173-
? subMenuViewDev
174-
: subMenuViewProd;
149+
) {
150+
return [subMenuAbout, subMenuViewDev, subMenuWindow, subMenuHelp];
151+
}
175152

176-
return [subMenuAbout, subMenuEdit, subMenuView, subMenuWindow, subMenuHelp];
153+
return [subMenuAbout, subMenuWindow, subMenuHelp];
177154
}
178155

179156
buildDefaultTemplate() {
@@ -240,15 +217,19 @@ export default class MenuBuilder {
240217
label: 'Help',
241218
submenu: [
242219
{
243-
label: 'Home Page',
220+
label: 'Privacy',
244221
click() {
245-
shell.openExternal('https://plainlab.github.io');
222+
shell.openExternal(
223+
'https://screenprinter.manhtai.com/privacy.html'
224+
);
246225
},
247226
},
248227
{
249-
label: 'GitHub',
228+
label: 'Support',
250229
click() {
251-
shell.openExternal('https://github.com/plainlab/plainprinter');
230+
shell.openExternal(
231+
'https://screenprinter.manhtai.com/support.html'
232+
);
252233
},
253234
},
254235
],

src/renderer/index.ejs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
http-equiv="Content-Security-Policy"
77
content="script-src 'self' 'unsafe-inline'"
88
/>
9-
<title>PlainPrinter &middot; Plain screen printer</title>
9+
<title>Screen Printer &middot; PDF screen printer</title>
1010
</head>
1111
<body class="text-sm text-gray-700">
1212
<div id="root"></div>

0 commit comments

Comments
 (0)