@todesktop/shared 7.188.17 → 7.188.19-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +75 -0
- package/eslint.config.mjs +57 -0
- package/lib/base.d.ts +51 -22
- package/lib/base.js +3 -3
- package/lib/desktopify.d.ts +102 -25
- package/lib/desktopify.js +17 -12
- package/lib/desktopify2.d.ts +25 -14
- package/lib/hsm.d.ts +30 -0
- package/lib/hsm.js +42 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -2
- package/lib/plans.d.ts +127 -220
- package/lib/plans.js +619 -78
- package/lib/plugin.d.ts +7 -7
- package/lib/toDesktop.d.ts +4 -8
- package/lib/translation.d.ts +2 -2
- package/lib/validations.d.ts +3 -3
- package/lib/validations.js +2 -1
- package/package.json +8 -5
- package/src/base.ts +56 -23
- package/src/desktopify.ts +83 -5
- package/src/desktopify2.ts +13 -1
- package/src/hsm.ts +63 -0
- package/src/index.ts +1 -0
- package/src/plans.ts +698 -91
- package/src/toDesktop.ts +4 -7
- package/.eslintrc.js +0 -33
package/lib/plugin.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type AjvJSONSchemaType = object;
|
|
2
2
|
export interface DesktopAppPlugin {
|
|
3
3
|
/**
|
|
4
4
|
* Configuration gathered from the todesktop plugin.
|
|
@@ -11,28 +11,28 @@ export interface DesktopAppPlugin {
|
|
|
11
11
|
*/
|
|
12
12
|
package: string;
|
|
13
13
|
}
|
|
14
|
-
export
|
|
14
|
+
export type ToDesktopPlugin = {
|
|
15
15
|
namespace: string;
|
|
16
16
|
version: number;
|
|
17
17
|
main?: string;
|
|
18
18
|
preload?: string;
|
|
19
19
|
preferences?: PluginPreferences;
|
|
20
20
|
};
|
|
21
|
-
export
|
|
21
|
+
export type PluginPreferences = {
|
|
22
22
|
[id: string]: PluginPreference;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
25
|
-
export
|
|
24
|
+
export type PluginPreference = NumberSpec | TextSpec | CheckboxSpec;
|
|
25
|
+
export type TextSpec = PreferenceSpec<'text', {
|
|
26
26
|
validator?: AjvJSONSchemaType;
|
|
27
27
|
value?: string;
|
|
28
28
|
placeholder?: string;
|
|
29
29
|
}>;
|
|
30
|
-
export
|
|
30
|
+
export type NumberSpec = PreferenceSpec<'number', {
|
|
31
31
|
validator?: AjvJSONSchemaType;
|
|
32
32
|
value?: number;
|
|
33
33
|
placeholder?: number;
|
|
34
34
|
}>;
|
|
35
|
-
export
|
|
35
|
+
export type CheckboxSpec = PreferenceSpec<'checkbox', {
|
|
36
36
|
validator?: AjvJSONSchemaType;
|
|
37
37
|
value?: boolean;
|
|
38
38
|
}>;
|
package/lib/toDesktop.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseApp, Schemable } from './base';
|
|
2
2
|
import { IAppBuilderLib } from './desktopify';
|
|
3
|
-
export
|
|
3
|
+
export type IUploadFileStatus = 'error' | 'success' | 'done' | 'uploading' | 'removed';
|
|
4
4
|
export interface IUploadFile {
|
|
5
5
|
uid: string;
|
|
6
6
|
size: number;
|
|
@@ -25,7 +25,7 @@ export interface IAppIcon {
|
|
|
25
25
|
appId: string;
|
|
26
26
|
icon: IHueIcon;
|
|
27
27
|
}
|
|
28
|
-
export
|
|
28
|
+
export type IAppIcons = IAppIcon[];
|
|
29
29
|
export interface IAppWindowOptions {
|
|
30
30
|
startInFullscreenMode: boolean;
|
|
31
31
|
isResizable: boolean;
|
|
@@ -77,12 +77,6 @@ export interface IIcon {
|
|
|
77
77
|
height: number;
|
|
78
78
|
type: string;
|
|
79
79
|
}
|
|
80
|
-
export interface CustomNotarization {
|
|
81
|
-
appleId: string;
|
|
82
|
-
appleIdPassword: string;
|
|
83
|
-
ascProvider?: string;
|
|
84
|
-
teamId?: string;
|
|
85
|
-
}
|
|
86
80
|
export interface IApp extends BaseApp {
|
|
87
81
|
appModelId: string;
|
|
88
82
|
appPkgName?: string;
|
|
@@ -148,9 +142,11 @@ export interface IUser extends Schemable {
|
|
|
148
142
|
disableShouldCodeSign?: boolean;
|
|
149
143
|
allowedIPs?: string[];
|
|
150
144
|
seenReleaseTutorial?: boolean;
|
|
145
|
+
seenApplicationGroupsTutorial?: boolean;
|
|
151
146
|
}
|
|
152
147
|
export interface FeatureFlags {
|
|
153
148
|
desktopAppPlugins: boolean;
|
|
149
|
+
macAppStore: boolean;
|
|
154
150
|
}
|
|
155
151
|
export interface UserIHaveSentInviteTo {
|
|
156
152
|
email: string;
|
package/lib/translation.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type ValidTranslationKeys = 'updateNotification.title' | 'updateNotification.body';
|
|
2
|
+
export type ValidTranslationLanguages = 'default';
|
package/lib/validations.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export declare const appTitleValidation: yup.StringSchema;
|
|
|
5
5
|
export declare const forceVersionValidation: yup.StringSchema;
|
|
6
6
|
export declare const iconValidation: yup.StringSchema;
|
|
7
7
|
export declare const urlValidation: yup.StringSchema;
|
|
8
|
-
export declare const urlValidationForm: yup.ObjectSchema<
|
|
8
|
+
export declare const urlValidationForm: yup.ObjectSchema<{
|
|
9
9
|
url: string;
|
|
10
|
-
}
|
|
10
|
+
}>;
|
|
11
11
|
export declare const heightValidation: yup.NumberSchema;
|
|
12
12
|
export declare const widthValidation: yup.NumberSchema;
|
|
13
13
|
export declare const internalAppRegexValidation: yup.StringSchema;
|
|
@@ -51,4 +51,4 @@ export declare const appConfigValidation: yup.ObjectSchema<{
|
|
|
51
51
|
publishedVersions: any;
|
|
52
52
|
};
|
|
53
53
|
}>;
|
|
54
|
-
export declare const shouldMinimizeToTrayIsActive: <
|
|
54
|
+
export declare const shouldMinimizeToTrayIsActive: <Plugin = DesktopAppPlugin>(desktopApp: DesktopifyApp2<Plugin>) => boolean;
|
package/lib/validations.js
CHANGED
|
@@ -133,6 +133,7 @@ exports.appConfigValidation = yup.object({
|
|
|
133
133
|
})
|
|
134
134
|
.required(),
|
|
135
135
|
});
|
|
136
|
-
|
|
136
|
+
const shouldMinimizeToTrayIsActive = (desktopApp) => {
|
|
137
137
|
return desktopApp.trays.some((t) => t.leftClick.role === 'toggleMenu' || t.rightClick.role === 'toggleMenu');
|
|
138
138
|
};
|
|
139
|
+
exports.shouldMinimizeToTrayIsActive = shouldMinimizeToTrayIsActive;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@todesktop/shared",
|
|
3
|
-
"version": "7.188.
|
|
3
|
+
"version": "7.188.19-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -26,14 +26,17 @@
|
|
|
26
26
|
"yup": "^0.26.10"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
30
|
+
"@eslint/js": "^9.9.1",
|
|
29
31
|
"@types/semver": "^7.3.9",
|
|
30
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
31
|
-
"@typescript-eslint/parser": "^
|
|
32
|
+
"@typescript-eslint/eslint-plugin": "^8.4.0",
|
|
33
|
+
"@typescript-eslint/parser": "^8.4.0",
|
|
32
34
|
"app-builder-lib": "^22.10.4",
|
|
33
|
-
"eslint": "^
|
|
35
|
+
"eslint": "^9.9.1",
|
|
34
36
|
"eslint-config-prettier": "^8.8.0",
|
|
35
37
|
"eslint-plugin-prettier": "^4.2.1",
|
|
38
|
+
"globals": "^15.9.0",
|
|
36
39
|
"prettier": "^2.8.8",
|
|
37
|
-
"typescript": "^
|
|
40
|
+
"typescript": "^5.5.4"
|
|
38
41
|
}
|
|
39
42
|
}
|
package/src/base.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
ExtraFileReference,
|
|
3
3
|
FilePath,
|
|
4
4
|
IAppBuilderLib,
|
|
5
|
+
PlatformName,
|
|
5
6
|
Release,
|
|
6
7
|
} from './desktopify';
|
|
7
8
|
export interface Schemable {
|
|
@@ -115,6 +116,7 @@ export interface ToDesktopJson {
|
|
|
115
116
|
asar?: boolean;
|
|
116
117
|
asarUnpack?: boolean | string[];
|
|
117
118
|
bucket?: string;
|
|
119
|
+
buildVersion?: string;
|
|
118
120
|
copyright?: string;
|
|
119
121
|
dmg?: {
|
|
120
122
|
background?: FilePath;
|
|
@@ -150,6 +152,13 @@ export interface ToDesktopJson {
|
|
|
150
152
|
icon?: FilePath;
|
|
151
153
|
requirements?: FilePath;
|
|
152
154
|
};
|
|
155
|
+
mas?: {
|
|
156
|
+
type?: 'development' | 'distribution'; // defaults to development
|
|
157
|
+
entitlements?: FilePath;
|
|
158
|
+
entitlementsInherit?: FilePath;
|
|
159
|
+
provisioningProfile?: FilePath;
|
|
160
|
+
x64ArchFiles?: string;
|
|
161
|
+
};
|
|
153
162
|
nodeVersion?: string;
|
|
154
163
|
npmVersion?: string;
|
|
155
164
|
packageManager?: 'npm' | 'yarn' | 'pnpm';
|
|
@@ -181,9 +190,6 @@ export interface CustomWindowsCodeSignFile {
|
|
|
181
190
|
certType: string;
|
|
182
191
|
hsmCertType: WindowsHSMCertType.file;
|
|
183
192
|
hsmCertName: string;
|
|
184
|
-
// following are still used in desktopify, but no longer used/saved from web app
|
|
185
|
-
certPassword?: string;
|
|
186
|
-
certUrl?: URL;
|
|
187
193
|
}
|
|
188
194
|
|
|
189
195
|
export interface CustomWindowsCodeSignEV {
|
|
@@ -204,19 +210,27 @@ export type CustomMacCodeSign =
|
|
|
204
210
|
};
|
|
205
211
|
|
|
206
212
|
export type CustomMacNotarization =
|
|
207
|
-
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
213
|
+
| CustomNotarizationApiKeyAuth
|
|
214
|
+
| CustomNotarizationPasswordAuth
|
|
215
|
+
| CustomNotarizationPasswordHsmAuth;
|
|
216
|
+
|
|
217
|
+
export interface CustomNotarizationApiKeyAuth {
|
|
218
|
+
appleApiKeyId: string;
|
|
219
|
+
appleApiIssuer: string;
|
|
220
|
+
type: 'hsm-api';
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface CustomNotarizationPasswordAuth {
|
|
224
|
+
appleId: string;
|
|
225
|
+
appleIdPassword: string;
|
|
226
|
+
teamId: string;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface CustomNotarizationPasswordHsmAuth {
|
|
230
|
+
appleId: string;
|
|
231
|
+
teamId: string;
|
|
232
|
+
type: 'hsm';
|
|
233
|
+
}
|
|
220
234
|
|
|
221
235
|
export type ReleaseRedirectionRule =
|
|
222
236
|
| {
|
|
@@ -232,6 +246,11 @@ export type ReleaseRedirectionRule =
|
|
|
232
246
|
buildId: string;
|
|
233
247
|
ipList: string[];
|
|
234
248
|
rule: 'buildByIp';
|
|
249
|
+
}
|
|
250
|
+
| {
|
|
251
|
+
buildId: string;
|
|
252
|
+
platforms: PlatformName[];
|
|
253
|
+
rule: 'buildByPlatform';
|
|
235
254
|
};
|
|
236
255
|
|
|
237
256
|
export interface BaseApp extends Schemable {
|
|
@@ -243,12 +262,10 @@ export interface BaseApp extends Schemable {
|
|
|
243
262
|
customWindowsCodeSign?: CustomWindowsCodeSignFile | CustomWindowsCodeSignEV;
|
|
244
263
|
|
|
245
264
|
meta?: IAppMeta;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
planId: string;
|
|
251
|
-
};
|
|
265
|
+
// this property is dynamically resolved at queueBuild in cloud functions
|
|
266
|
+
parentApp?: BaseApp;
|
|
267
|
+
parent?: { id: string; relationshipToParent: string } | null;
|
|
268
|
+
subscription?: Subscription;
|
|
252
269
|
|
|
253
270
|
// artifacts
|
|
254
271
|
shouldCreate32BitWindowsArtifacts?: boolean;
|
|
@@ -259,6 +276,8 @@ export interface BaseApp extends Schemable {
|
|
|
259
276
|
shouldCreateArm64WindowsArtifacts?: boolean;
|
|
260
277
|
shouldCreateDebianPackages?: boolean;
|
|
261
278
|
shouldCreateDMGs?: boolean;
|
|
279
|
+
shouldCreateMacAppStoreFiles?: boolean;
|
|
280
|
+
shouldCreateMacPKG?: boolean;
|
|
262
281
|
shouldCreateMacUniversalInstaller?: boolean;
|
|
263
282
|
shouldCreateMacZipInstallers?: boolean;
|
|
264
283
|
shouldCreateMSIInstallers?: boolean;
|
|
@@ -266,9 +285,23 @@ export interface BaseApp extends Schemable {
|
|
|
266
285
|
shouldCreateNSISWebInstaller?: boolean;
|
|
267
286
|
shouldCreateRPMPackages?: boolean;
|
|
268
287
|
shouldCreateSnapFiles?: boolean;
|
|
269
|
-
|
|
270
288
|
// artifact configs
|
|
271
289
|
appxConfig?: Partial<IAppBuilderLib['config']['appx']>;
|
|
290
|
+
masConfig?: Partial<IAppBuilderLib['config']['mas']>;
|
|
272
291
|
nsisConfig?: Partial<IAppBuilderLib['config']['nsis']>;
|
|
273
292
|
snapStore?: { login?: string; description?: string };
|
|
293
|
+
macUniversalInstallerConfig?: {
|
|
294
|
+
shouldPinToVersion?: boolean;
|
|
295
|
+
};
|
|
274
296
|
}
|
|
297
|
+
|
|
298
|
+
export type Subscription = {
|
|
299
|
+
status: string;
|
|
300
|
+
subscriptionId: string;
|
|
301
|
+
itemId: string;
|
|
302
|
+
planId: string;
|
|
303
|
+
|
|
304
|
+
// todo: remove optional qualifier once we complete migration
|
|
305
|
+
productId?: string;
|
|
306
|
+
priceId?: string;
|
|
307
|
+
};
|
package/src/desktopify.ts
CHANGED
|
@@ -62,7 +62,7 @@ export type MacArch = 'x64' | 'arm64' | 'universal';
|
|
|
62
62
|
export type LinuxArch = 'x64' | 'arm64';
|
|
63
63
|
export type WindowsArch = 'ia32' | 'x64' | 'arm64' | 'universal';
|
|
64
64
|
export type LinuxArtifactName = 'appImage' | 'deb' | 'rpm' | 'snap';
|
|
65
|
-
export type MacArtifactName = 'dmg' | 'zip' | 'installer';
|
|
65
|
+
export type MacArtifactName = 'dmg' | 'zip' | 'installer' | 'mas' | 'pkg';
|
|
66
66
|
export type WindowsArtifactName =
|
|
67
67
|
| 'msi'
|
|
68
68
|
| 'nsis'
|
|
@@ -145,14 +145,17 @@ export interface Build {
|
|
|
145
145
|
hash?: string;
|
|
146
146
|
icon?: string;
|
|
147
147
|
id: string;
|
|
148
|
+
isArtifactsPruned?: boolean;
|
|
148
149
|
isBeingCancelled?: boolean;
|
|
149
150
|
linux?: PlatformBuild;
|
|
150
151
|
mac?: PlatformBuild;
|
|
151
152
|
onBuildFinishedWebhook?: string;
|
|
153
|
+
partiallyReleasedAt?: ISODate;
|
|
152
154
|
projectConfig?: string; // Stringified version of todesktop.json
|
|
153
155
|
releasedAt?: ISODate;
|
|
154
156
|
shouldCodeSign: boolean;
|
|
155
157
|
shouldRelease: boolean;
|
|
158
|
+
shouldRetainForever?: boolean; // Artifacts can't be pruned
|
|
156
159
|
smokeTest?: {
|
|
157
160
|
buildServerExecutionId?: string;
|
|
158
161
|
isCanceled?: boolean;
|
|
@@ -164,6 +167,7 @@ export interface Build {
|
|
|
164
167
|
status: AnalysisStatus;
|
|
165
168
|
// `result` is a stringified JSON object
|
|
166
169
|
result?: string;
|
|
170
|
+
error?: string;
|
|
167
171
|
};
|
|
168
172
|
dependencyAnalysis?: {
|
|
169
173
|
status: AnalysisStatus;
|
|
@@ -194,10 +198,13 @@ export interface Build {
|
|
|
194
198
|
}
|
|
195
199
|
|
|
196
200
|
export type BundlePhobiaItem = {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
+
result: {
|
|
202
|
+
description: string;
|
|
203
|
+
gzip: string;
|
|
204
|
+
name: string;
|
|
205
|
+
size: number;
|
|
206
|
+
} | null;
|
|
207
|
+
error: string | null;
|
|
201
208
|
};
|
|
202
209
|
|
|
203
210
|
export type ComputedBuildProperties = Pick<
|
|
@@ -258,15 +265,86 @@ export interface WindowsCustomManifest extends CustomManifest {
|
|
|
258
265
|
|
|
259
266
|
export interface SmokeTestProgress {
|
|
260
267
|
abState?: SmokeTestState;
|
|
268
|
+
abSkipReason?: string;
|
|
261
269
|
appLaunched?: boolean;
|
|
262
270
|
appUpdated?: boolean;
|
|
263
271
|
bcState?: SmokeTestState;
|
|
272
|
+
buildAId?: string;
|
|
264
273
|
code?: string; // string currently, since it's still a subject to change
|
|
265
274
|
message?: string;
|
|
275
|
+
performance?: {
|
|
276
|
+
ab?: SmokeTestPerformance;
|
|
277
|
+
bc: SmokeTestPerformance;
|
|
278
|
+
};
|
|
266
279
|
progress: number;
|
|
267
280
|
screenshot?: string;
|
|
268
281
|
state: SmokeTestState;
|
|
269
282
|
updatedAppHasNoMainErrors?: boolean;
|
|
283
|
+
vm: {
|
|
284
|
+
agentVersion: string;
|
|
285
|
+
cpu?: string; // win only
|
|
286
|
+
image: string;
|
|
287
|
+
imageVersion: string;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export interface SmokeTestPerformance {
|
|
292
|
+
/**
|
|
293
|
+
* Time between `process.getCreationTime()` and `App#redy event`
|
|
294
|
+
*/
|
|
295
|
+
appReadyMs: number;
|
|
296
|
+
/**
|
|
297
|
+
* Time between `process.getCreationTime()` and app is closed for update
|
|
298
|
+
*/
|
|
299
|
+
appReadyToRestartForUpdateMs: number;
|
|
300
|
+
/**
|
|
301
|
+
* Time between `process.getCreationTime()` and connect event received from
|
|
302
|
+
* the restarted app. It can be up to 4 minutes on Windows.
|
|
303
|
+
*/
|
|
304
|
+
appRestartedAfterUpdateMs: number;
|
|
305
|
+
/**
|
|
306
|
+
* From `process.cpuUsage()` user + system.
|
|
307
|
+
* This value measures time spent in user and system code, and may end up
|
|
308
|
+
* being greater than actual elapsed time if multiple CPU cores are
|
|
309
|
+
* performing work for this process.
|
|
310
|
+
* Under the hood, low-level calls like `getrusage` are used, so this value
|
|
311
|
+
* is calculated from the process start.
|
|
312
|
+
* It measures for the first 10-12 seconds of the app execution.
|
|
313
|
+
*/
|
|
314
|
+
cpuUsageMainProcessMs: number;
|
|
315
|
+
/**
|
|
316
|
+
* Maximum memory consumption by the main + renders + any other helper
|
|
317
|
+
* processes
|
|
318
|
+
*/
|
|
319
|
+
memoryUsageAllProcessesMb: number;
|
|
320
|
+
/**
|
|
321
|
+
* Maximum memory consumption by the main process
|
|
322
|
+
*/
|
|
323
|
+
memoryUsageMainProcessMb: number;
|
|
324
|
+
/**
|
|
325
|
+
* Maximum memory consumption by a renderer process (if started)
|
|
326
|
+
*/
|
|
327
|
+
memoryUsageRendererProcessMb?: number;
|
|
328
|
+
/**
|
|
329
|
+
* Time between `process.getCreationTime()` and `initSmokeTest()` of
|
|
330
|
+
* runtime execution
|
|
331
|
+
*/
|
|
332
|
+
runtimeLoadedMs: number;
|
|
333
|
+
/**
|
|
334
|
+
* Time between `process.getCreationTime()` and the update file downloaded
|
|
335
|
+
* from the server.
|
|
336
|
+
*/
|
|
337
|
+
updateDownloadedMs: number;
|
|
338
|
+
/**
|
|
339
|
+
* Time between `process.getCreationTime()` and the first firing of
|
|
340
|
+
* WebContents#dom-ready if any window is created
|
|
341
|
+
*/
|
|
342
|
+
webContentsDomReadyMs?: number;
|
|
343
|
+
/**
|
|
344
|
+
* Time between `process.getCreationTime()` and the first firing of
|
|
345
|
+
* WebContents#did-finish-load if any window is created
|
|
346
|
+
*/
|
|
347
|
+
webContentsFinishLoadMs?: number;
|
|
270
348
|
}
|
|
271
349
|
|
|
272
350
|
export type SmokeTestState = 'progress' | 'done' | 'error' | 'skipped';
|
package/src/desktopify2.ts
CHANGED
|
@@ -288,6 +288,10 @@ export interface DesktopifyAppWindow {
|
|
|
288
288
|
* Disables default rightClick menu
|
|
289
289
|
*/
|
|
290
290
|
disableContextMenu: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Disables the menu item for opening a link in a new app window
|
|
293
|
+
*/
|
|
294
|
+
disableContextMenuOpenInWindow: boolean;
|
|
291
295
|
/**
|
|
292
296
|
* Allows user to `Cmd+F` or `Edit>Find` to search for text on page
|
|
293
297
|
*/
|
|
@@ -521,9 +525,17 @@ export interface DesktopifyApp2<Plugin = DesktopAppPlugin> {
|
|
|
521
525
|
*/
|
|
522
526
|
shouldMakeSameDomainAnExternalLink?: boolean;
|
|
523
527
|
/**
|
|
524
|
-
* Enables push notifications
|
|
528
|
+
* Enables push notifications — uses `electron-push-receiver`
|
|
525
529
|
*/
|
|
526
530
|
enablePushNotifications?: boolean;
|
|
531
|
+
/**
|
|
532
|
+
* Enables NEW push notifications — uses `@cuj1559/electron-push-receiver`
|
|
533
|
+
*/
|
|
534
|
+
enableNewPushNotifications?: boolean;
|
|
535
|
+
/**
|
|
536
|
+
* Disable error reporting (Sentry)
|
|
537
|
+
*/
|
|
538
|
+
disableErrorTracking?: boolean;
|
|
527
539
|
/**
|
|
528
540
|
* Sets theme for Electron UI elements and css.
|
|
529
541
|
*
|
package/src/hsm.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* - mac = Developer ID Application
|
|
3
|
+
* - mac-installer = Developer ID Installer
|
|
4
|
+
* - mas = Apple Distribution or Mac App Distribution (for Mac App Store)
|
|
5
|
+
* - mas-installer = Mac Installer Distribution (for Mac App Store)
|
|
6
|
+
* - mas-dev = Apple Development
|
|
7
|
+
*/
|
|
8
|
+
export type MacTarget =
|
|
9
|
+
| 'mac'
|
|
10
|
+
| 'mac-installer'
|
|
11
|
+
| 'mas'
|
|
12
|
+
| 'mas-installer'
|
|
13
|
+
| 'mas-dev';
|
|
14
|
+
|
|
15
|
+
export type WindowsTarget = 'windows';
|
|
16
|
+
|
|
17
|
+
export function isMacTarget(type: string): type is MacTarget {
|
|
18
|
+
return ['mac', 'mac-installer', 'mas', 'mas-installer', 'mas-dev'].includes(
|
|
19
|
+
type
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function isWindowsTarget(type: string): type is MacTarget {
|
|
24
|
+
return ['windows'].includes(type);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
|
|
29
|
+
* This function returns the key name that is used for certificate files that have a `.p12` postfix.
|
|
30
|
+
*
|
|
31
|
+
* @param appId the application id
|
|
32
|
+
* @param target the target type
|
|
33
|
+
* @returns the name of the secret that is required for downloading the cert from HSM.
|
|
34
|
+
*/
|
|
35
|
+
export const getCertificateNameFromHSM = (
|
|
36
|
+
appId: string,
|
|
37
|
+
target: MacTarget | WindowsTarget
|
|
38
|
+
) => {
|
|
39
|
+
if (!isMacTarget(target) && !isWindowsTarget(target)) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Invalid target '${target}'. Only windows or mac certs are supported`
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return `todesktop-${appId}-${target}-cert`;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Files that are uploaded to HSM have a unique secretName that depends on the appId and target.
|
|
50
|
+
* This function returns the key name that is used for key files that have a `.p8` postfix.
|
|
51
|
+
* Currently only used for mac notarization.
|
|
52
|
+
*
|
|
53
|
+
* @param appId the application id
|
|
54
|
+
* @param target the target type
|
|
55
|
+
* @returns the name of the secret that is required for downloading the cert from HSM.
|
|
56
|
+
*/
|
|
57
|
+
export const getAPIKeyNameFromHSM = (appId: string, target: MacTarget) => {
|
|
58
|
+
if (!isMacTarget(target)) {
|
|
59
|
+
throw new Error(`Invalid target '${target}'. Only mac certs are supported`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return `todesktop-${appId}-${target}-api-key`;
|
|
63
|
+
};
|