@todesktop/shared 7.190.0 → 7.191.0

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.
Files changed (46) hide show
  1. package/.prettierignore +0 -2
  2. package/CHANGELOG.md +13 -0
  3. package/README.md +42 -15
  4. package/eslint.config.mjs +8 -55
  5. package/lib/base.d.ts +81 -75
  6. package/lib/base.js +9 -12
  7. package/lib/desktopify.d.ts +74 -74
  8. package/lib/desktopify.js +28 -35
  9. package/lib/desktopify2.d.ts +223 -223
  10. package/lib/desktopify2.js +2 -5
  11. package/lib/getSiteInfo.d.ts +6 -6
  12. package/lib/getSiteInfo.js +1 -2
  13. package/lib/hsm.d.ts +1 -1
  14. package/lib/hsm.js +5 -12
  15. package/lib/index.d.ts +12 -13
  16. package/lib/index.js +13 -31
  17. package/lib/invitePermissionLabels.d.ts +4 -2
  18. package/lib/invitePermissionLabels.js +14 -11
  19. package/lib/personalAccessTokens.d.ts +12 -12
  20. package/lib/personalAccessTokens.js +1 -2
  21. package/lib/plans.d.ts +27 -27
  22. package/lib/plans.js +181 -185
  23. package/lib/plugin.d.ts +18 -18
  24. package/lib/plugin.js +1 -2
  25. package/lib/toDesktop.d.ts +66 -66
  26. package/lib/toDesktop.js +1 -2
  27. package/lib/translation.d.ts +1 -1
  28. package/lib/translation.js +1 -2
  29. package/lib/validations.d.ts +66 -66
  30. package/lib/validations.js +54 -56
  31. package/package.json +11 -17
  32. package/src/base.ts +89 -82
  33. package/src/desktopify.ts +82 -80
  34. package/src/desktopify2.ts +240 -240
  35. package/src/getSiteInfo.ts +6 -6
  36. package/src/hsm.ts +7 -7
  37. package/src/index.ts +13 -14
  38. package/src/invitePermissionLabels.ts +20 -6
  39. package/src/personalAccessTokens.ts +12 -12
  40. package/src/plans.ts +191 -191
  41. package/src/plugin.ts +19 -19
  42. package/src/toDesktop.ts +70 -70
  43. package/src/translation.ts +2 -2
  44. package/src/validations.ts +51 -49
  45. package/tsconfig.json +6 -3
  46. package/.prettierrc +0 -5
@@ -1,17 +1,17 @@
1
- import { ISwitchableValue } from './toDesktop';
2
- import { MenuItemConstructorOptions, BrowserWindowConstructorOptions, WebPreferences, NotificationConstructorOptions, MessageBoxOptions } from '@todesktop/client-electron-types';
1
+ import { BrowserWindowConstructorOptions, MenuItemConstructorOptions, MessageBoxOptions, NotificationConstructorOptions, WebPreferences } from '@todesktop/client-electron-types';
3
2
  import { BaseApp } from './base';
4
3
  import { CustomPlugin, DesktopAppPlugin } from './plugin';
4
+ import { ISwitchableValue } from './toDesktop';
5
5
  import { ValidTranslationKeys, ValidTranslationLanguages } from './translation';
6
6
  interface BaseAssetDetails {
7
- /**
8
- * Remote URL where the asset can be downloaded
9
- */
10
- url: string;
11
7
  /**
12
8
  * Local path where the asset is/should be stored. This path is relative to the app directory
13
9
  */
14
10
  relativeLocalPath: string;
11
+ /**
12
+ * Remote URL where the asset can be downloaded
13
+ */
14
+ url: string;
15
15
  }
16
16
  export interface AppIconAssetDetails extends BaseAssetDetails {
17
17
  type: 'appIcon';
@@ -26,24 +26,24 @@ export interface FileAssetDetails extends BaseAssetDetails {
26
26
  md5Hash: string;
27
27
  type: 'file';
28
28
  }
29
- export type AssetDetails = AppIconAssetDetails | MenuIconAssetDetails | TrayMenubarIconAssetDetails | FileAssetDetails;
29
+ export type AssetDetails = AppIconAssetDetails | FileAssetDetails | MenuIconAssetDetails | TrayMenubarIconAssetDetails;
30
30
  /**
31
31
  * Custom ToDesktop Roles for Application & Tray Menus
32
32
  */
33
- type todesktopRoles = 'todesktop:launch-at-startup' | 'todesktop:check-for-updates' | 'todesktop:quit' | 'todesktop:quit-completely' | 'todesktop:new-window' | 'todesktop:new-tab' | 'todesktop:check-for-updates' | 'todesktop:history-home' | 'todesktop:history-back' | 'todesktop:history-forward' | 'todesktop:show-window' | 'todesktop:hide-window' | 'todesktop:toggle-window' | 'todesktop:toggle-window0' | 'todesktop:toggle-window1' | 'todesktop:toggle-window2' | 'todesktop:toggle-window3' | 'todesktop:toggle-window4';
33
+ type todesktopRoles = 'todesktop:check-for-updates' | 'todesktop:check-for-updates' | 'todesktop:hide-window' | 'todesktop:history-back' | 'todesktop:history-forward' | 'todesktop:history-home' | 'todesktop:launch-at-startup' | 'todesktop:new-tab' | 'todesktop:new-window' | 'todesktop:quit-completely' | 'todesktop:quit' | 'todesktop:show-window' | 'todesktop:toggle-window' | 'todesktop:toggle-window0' | 'todesktop:toggle-window1' | 'todesktop:toggle-window2' | 'todesktop:toggle-window3' | 'todesktop:toggle-window4';
34
34
  export interface DesktopifyMenuItemConstructorOptions extends Omit<MenuItemConstructorOptions, 'role' | 'submenu'> {
35
- platforms?: NodeJS.Platform[];
36
- submenu?: DesktopifyMenuItemConstructorOptions[];
37
- role?: MenuItemConstructorOptions['role'] | todesktopRoles;
38
- useSystemLabel?: boolean;
39
- event?: string;
40
- targetWindowId?: string;
35
+ acceleratorBehaviour?: 'custom' | 'default' | 'explicit-none' | 'none';
41
36
  actionType?: 'jsEvent' | 'role';
42
- iconUrl?: string;
43
37
  bundledIcon?: string;
38
+ event?: string;
44
39
  iconAssetDetails?: MenuIconAssetDetails;
40
+ iconUrl?: string;
41
+ platforms?: NodeJS.Platform[];
42
+ role?: MenuItemConstructorOptions['role'] | todesktopRoles;
43
+ submenu?: DesktopifyMenuItemConstructorOptions[];
44
+ targetWindowId?: string;
45
+ useSystemLabel?: boolean;
45
46
  useTemplateImage?: boolean;
46
- acceleratorBehaviour?: 'none' | 'explicit-none' | 'default' | 'custom';
47
47
  }
48
48
  /**
49
49
  * Toggle Window Tray Action
@@ -60,8 +60,8 @@ export type DesktopifyAppTrayToggleWindowAction = {
60
60
  * @param menu - The menu to show when action triggered
61
61
  */
62
62
  export type DesktopifyAppTrayToggleMenuAction = {
63
- role: 'toggleMenu';
64
63
  menu: DesktopifyMenuItemConstructorOptions[];
64
+ role: 'toggleMenu';
65
65
  };
66
66
  /**
67
67
  * JS Event Tray Action
@@ -69,8 +69,8 @@ export type DesktopifyAppTrayToggleMenuAction = {
69
69
  * @param event - The name of the event
70
70
  */
71
71
  export type DesktopifyAppTrayJSEventAction = {
72
- role: 'jsEvent';
73
72
  event: string;
73
+ role: 'jsEvent';
74
74
  };
75
75
  /**
76
76
  * No Action Tray Action
@@ -78,24 +78,24 @@ export type DesktopifyAppTrayJSEventAction = {
78
78
  export type DesktopifyAppTrayNoAction = {
79
79
  role: 'noAction';
80
80
  };
81
- export type DesktopifyAppTrayAction = DesktopifyAppTrayToggleMenuAction | DesktopifyAppTrayToggleWindowAction | DesktopifyAppTrayJSEventAction | DesktopifyAppTrayNoAction;
81
+ export type DesktopifyAppTrayAction = DesktopifyAppTrayJSEventAction | DesktopifyAppTrayNoAction | DesktopifyAppTrayToggleMenuAction | DesktopifyAppTrayToggleWindowAction;
82
82
  export interface DesktopifyAppTray {
83
- id: string;
84
- objectId?: string;
83
+ bundledIcon?: string;
85
84
  icon?: string;
86
- useSeparateIcons?: boolean;
87
- windowsIcon?: string;
88
- windowsIconAssetDetails?: TrayMenubarIconAssetDetails;
89
- macOSIcon?: string;
90
- macOSIconAssetDetails?: TrayMenubarIconAssetDetails;
85
+ iconAssetDetails?: TrayMenubarIconAssetDetails;
86
+ id: string;
87
+ leftClick: DesktopifyAppTrayAction;
91
88
  linuxIcon?: string;
92
89
  linuxIconAssetDetails?: TrayMenubarIconAssetDetails;
93
- bundledIcon?: string;
94
- iconAssetDetails?: TrayMenubarIconAssetDetails;
90
+ macOSIcon?: string;
91
+ macOSIconAssetDetails?: TrayMenubarIconAssetDetails;
92
+ objectId?: string;
93
+ rightClick: DesktopifyAppTrayAction;
95
94
  swapClickHandlers?: boolean;
95
+ useSeparateIcons?: boolean;
96
96
  useTemplateImage?: boolean;
97
- rightClick: DesktopifyAppTrayAction;
98
- leftClick: DesktopifyAppTrayAction;
97
+ windowsIcon?: string;
98
+ windowsIconAssetDetails?: TrayMenubarIconAssetDetails;
99
99
  }
100
100
  export type DesktopifyAppMenu = DesktopifyMenuItemConstructorOptions;
101
101
  /**
@@ -116,47 +116,10 @@ export type whitelistedWebPreferencesOptions = (typeof allowedWebPreferencesOpti
116
116
  * Interface for ToDesktop App Windows
117
117
  */
118
118
  export interface DesktopifyAppWindow {
119
- /**
120
- * A unique window id
121
- */
122
- id: string;
123
- /**
124
- * A *mutable* window object id
125
- */
126
- objectId?: string;
127
119
  /**
128
120
  * The window's background type
129
121
  */
130
- backgroundType?: 'normal' | 'vibrant' | 'transparent' | 'color';
131
- /**
132
- * The window name. Only visible to developer
133
- */
134
- name: string;
135
- /**
136
- * The window's url
137
- */
138
- url: string;
139
- /**
140
- * Whether this is the main window. The main window handles deeplinks
141
- */
142
- isMain: boolean;
143
- /**
144
- * The type of window
145
- */
146
- type: 'menubar' | 'app' | 'panel' | 'desktop';
147
- /**
148
- * Keyboard shortcut to toggle window visibility
149
- */
150
- toggleVisibilityKeyboardShortcut?: string;
151
- /**
152
- * By default ToDesktop remembers window width & height between sessions.
153
- * Setting to `true` disables behaviour
154
- */
155
- shouldResetDimensions?: boolean;
156
- /**
157
- * If `true` prevents the native window's title from changing when the document title changes
158
- */
159
- isTitleStatic?: boolean;
122
+ backgroundType?: 'color' | 'normal' | 'transparent' | 'vibrant';
160
123
  /**
161
124
  * Disables default rightClick menu
162
125
  */
@@ -166,88 +129,125 @@ export interface DesktopifyAppWindow {
166
129
  */
167
130
  disableContextMenuOpenInWindow: boolean;
168
131
  /**
169
- * Allows user to `Cmd+F` or `Edit>Find` to search for text on page
132
+ * Don't allow tabs in window (macOS only)
170
133
  */
171
- isFindInPageEnabled?: boolean;
134
+ disableTabs: boolean;
135
+ /**
136
+ * The path to the file to load if `shouldUseFileInsteadOfUrl` is `true`.
137
+ */
138
+ file?: string;
172
139
  /**
173
140
  * Configuration options for find in page
174
141
  */
175
142
  findInPageOptions?: {
176
143
  horizontalPlacement?: {
177
- type: 'left' | 'default' | 'right';
178
- left: FindInPagePlacement;
179
144
  default: FindInPagePlacement;
145
+ left: FindInPagePlacement;
180
146
  right: FindInPagePlacement;
147
+ type: 'default' | 'left' | 'right';
181
148
  };
182
149
  verticalPlacement?: {
183
- type: 'top' | 'default' | 'bottom';
184
- top: FindInPagePlacement;
185
- default: FindInPagePlacement;
186
150
  bottom: FindInPagePlacement;
151
+ default: FindInPagePlacement;
152
+ top: FindInPagePlacement;
153
+ type: 'bottom' | 'default' | 'top';
187
154
  };
188
155
  };
189
156
  /**
190
- * Inital visibility of window
157
+ * Does the window have a maximum height. Default is `false`
158
+ */
159
+ hasMaxHeight: boolean;
160
+ /**
161
+ * Does the window have a maximum width. Default is `false`
191
162
  */
192
- visibility: 'visible' | 'hidden' | 'show-when-contents-loaded';
163
+ hasMaxWidth: boolean;
193
164
  /**
194
- * MacOS option for whether the window should be visible on all workspaces
165
+ * Does the window have a minimum height. Default is `false`
195
166
  */
196
- visibleOnAllWorkspaces: boolean;
167
+ hasMinHeight: boolean;
197
168
  /**
198
169
  * Does the window have a minimum width. Default is `false`
199
170
  */
200
171
  hasMinWidth: boolean;
201
172
  /**
202
- * Does the window have a maximum width. Default is `false`
173
+ * A unique window id
203
174
  */
204
- hasMaxWidth: boolean;
175
+ id: string;
205
176
  /**
206
- * Does the window have a minimum height. Default is `false`
177
+ * Allows user to `Cmd+F` or `Edit>Find` to search for text on page
207
178
  */
208
- hasMinHeight: boolean;
179
+ isFindInPageEnabled?: boolean;
209
180
  /**
210
- * Does the window have a maximum height. Default is `false`
181
+ * Whether this is the main window. The main window handles deeplinks
211
182
  */
212
- hasMaxHeight: boolean;
183
+ isMain: boolean;
213
184
  /**
214
- * Don't allow tabs in window (macOS only)
185
+ * If `true` prevents the native window's title from changing when the document title changes
215
186
  */
216
- disableTabs: boolean;
187
+ isTitleStatic?: boolean;
188
+ /**
189
+ * The window name. Only visible to developer
190
+ */
191
+ name: string;
192
+ /**
193
+ * A *mutable* window object id
194
+ */
195
+ objectId?: string;
217
196
  /**
218
197
  * BrowserWindow Constructor Options
219
198
  */
220
- options: Pick<BrowserWindowConstructorOptions, whitelistedBrowserWindowConstructorOptions> & {
199
+ options: {
221
200
  /**
222
201
  * Settings of web page's features.
223
202
  */
224
203
  webPreferences?: Pick<WebPreferences, whitelistedWebPreferencesOptions>;
225
- };
204
+ } & Pick<BrowserWindowConstructorOptions, whitelistedBrowserWindowConstructorOptions>;
205
+ /**
206
+ * By default ToDesktop remembers window width & height between sessions.
207
+ * Setting to `true` disables behaviour
208
+ */
209
+ shouldResetDimensions?: boolean;
226
210
  /**
227
211
  * The window should load a file instead of a URL.
228
212
  * The file property (below) should also be set if the value is `true`.
229
213
  */
230
214
  shouldUseFileInsteadOfUrl?: boolean;
231
215
  /**
232
- * The path to the file to load if `shouldUseFileInsteadOfUrl` is `true`.
216
+ * Keyboard shortcut to toggle window visibility
233
217
  */
234
- file?: string;
218
+ toggleVisibilityKeyboardShortcut?: string;
219
+ /**
220
+ * The type of window
221
+ */
222
+ type: 'app' | 'desktop' | 'menubar' | 'panel';
223
+ /**
224
+ * The window's url
225
+ */
226
+ url: string;
227
+ /**
228
+ * Inital visibility of window
229
+ */
230
+ visibility: 'hidden' | 'show-when-contents-loaded' | 'visible';
231
+ /**
232
+ * MacOS option for whether the window should be visible on all workspaces
233
+ */
234
+ visibleOnAllWorkspaces: boolean;
235
235
  }
236
236
  export type AutoUpdateConfiguration = {
237
+ autoCheckIntervalMins: number;
237
238
  autoUpdater: boolean;
238
- shouldAutoCheckOnLaunch: boolean;
239
239
  shouldAutoCheckInterval: boolean;
240
- autoCheckIntervalMins: number;
240
+ shouldAutoCheckOnLaunch: boolean;
241
241
  updateReadyAction: {
242
242
  showInstallAndRestartPrompt: {
243
- mode: 'always' | 'whenInForeground' | 'never';
244
- options: Omit<MessageBoxOptions, 'buttons'> & {
243
+ mode: 'always' | 'never' | 'whenInForeground';
244
+ options: {
245
245
  installOnNextLaunchButton: string;
246
246
  restartAndInstallButton: string;
247
- };
247
+ } & Omit<MessageBoxOptions, 'buttons'>;
248
248
  };
249
249
  showNotification: {
250
- mode: 'always' | 'whenInBackground' | 'never';
250
+ mode: 'always' | 'never' | 'whenInBackground';
251
251
  options: Omit<NotificationConstructorOptions, 'actions'>;
252
252
  };
253
253
  };
@@ -261,65 +261,94 @@ export interface DesktopifyApp2<Plugin = DesktopAppPlugin> {
261
261
  * Used as appUserModelId on windows
262
262
  */
263
263
  appModelId?: string;
264
+ /**
265
+ * Registers an app protocol. Format should be `{APP_PROTOCOL}://` e.g. `example://`
266
+ */
267
+ appProtocol: ISwitchableValue<string>;
268
+ /**
269
+ * Sets strings to be used in the app UI. Currently only supports English
270
+ */
271
+ appStrings?: {
272
+ [key in ValidTranslationKeys]?: {
273
+ [lang in ValidTranslationLanguages]?: string;
274
+ };
275
+ };
276
+ /**
277
+ * Sets whether the window menu bar should hide itself automatically.
278
+ * Once set the menu bar will only show when users press the single Alt key.
279
+ */
280
+ autoHideMenuBar?: boolean;
264
281
  /**
265
282
  * Configure auto updates
266
283
  */
267
284
  autoUpdates: AutoUpdateConfiguration;
268
285
  /**
269
- * App identifier
286
+ * The locally-bundled app icon.
270
287
  */
271
- id: string;
288
+ bundledIcon?: string;
272
289
  /**
273
- * Last desktopify version that was used to update the app
290
+ * Command line switches
291
+ * Learn more {@link https://www.electronjs.org/docs/api/command-line-switches}
292
+ * @example
293
+ * {
294
+ * 'remote-debugging-port': '8315'
295
+ * }
274
296
  */
275
- lastUsedDesktopifyVersion?: string;
297
+ commandLineSwitches?: {
298
+ [key: string]: string;
299
+ };
276
300
  /**
277
- * Last todesktop builder version that was used to update the app
301
+ * The name of the company that the app belongs to
278
302
  */
279
- lastUsedBuilderVersion?: string;
303
+ companyName?: string;
280
304
  /**
281
- * The name of the app
305
+ * URL that crash reports will be POSTed to
282
306
  */
283
- name: string;
307
+ crashReporter?: string;
284
308
  /**
285
- * The app icon url
309
+ * Metadata about plugins that were manually linked into the app
286
310
  */
287
- icon?: string;
311
+ customPlugins?: CustomPlugin[];
288
312
  /**
289
- * The locally-bundled app icon.
313
+ * Disable devTools on all app windows
290
314
  */
291
- bundledIcon?: string;
315
+ disableDevTools: boolean;
292
316
  /**
293
- * Details concerning how the app icon should be handled across ToDesktop services
317
+ * Disable error reporting (Sentry)
294
318
  */
295
- iconAssetDetails?: AppIconAssetDetails;
319
+ disableErrorTracking?: boolean;
296
320
  /**
297
- * Instead of using one icon for every platform, use a separate icon for different platforms
321
+ * Enables NEW push notifications uses `@cuj1559/electron-push-receiver`
298
322
  */
299
- useSeparateIcons?: boolean;
300
- windowsIcon?: string;
301
- windowsIconAssetDetails?: AppIconAssetDetails;
302
- macOSIcon?: string;
303
- macOSIconAssetDetails?: AppIconAssetDetails;
304
- linuxIcon?: string;
305
- linuxIconAssetDetails?: AppIconAssetDetails;
323
+ enableNewPushNotifications?: boolean;
306
324
  /**
307
- * The name of the company that the app belongs to
325
+ * Enables push notifications uses `electron-push-receiver`
308
326
  */
309
- companyName?: string;
327
+ enablePushNotifications?: boolean;
310
328
  /**
311
- * Whether the app should minimize to tray when all windows are closed. Requires at least one tray.
329
+ * File assets that get bundled with the app and are available offline
312
330
  */
313
- shouldMinimizeToTray?: boolean;
331
+ fileAssetDetailsList?: FileAssetDetails[];
314
332
  /**
315
- * This option is only available when `shouldMinimizeToTray` is `true`.
316
- * Always display the dock icon while the app is open. Even if there are no windows open.
333
+ * Opens `accounts.google.com/o/oauth` in user's default browswer not as internal url
317
334
  */
318
- shouldAlwaysDisplayDockIcon?: boolean;
335
+ googleOAuthIsExternal?: boolean;
319
336
  /**
320
- * Only allow a single instance of this app to run
337
+ * The app icon url
321
338
  */
322
- singleInstance: boolean;
339
+ icon?: string;
340
+ /**
341
+ * Details concerning how the app icon should be handled across ToDesktop services
342
+ */
343
+ iconAssetDetails?: AppIconAssetDetails;
344
+ /**
345
+ * App identifier
346
+ */
347
+ id: string;
348
+ /**
349
+ * Disables the same-origin policy
350
+ */
351
+ insecure?: boolean;
323
352
  /**
324
353
  * Regex patterns for internal app urls
325
354
  */
@@ -330,29 +359,49 @@ export interface DesktopifyApp2<Plugin = DesktopAppPlugin> {
330
359
  */
331
360
  isNativeWindowOpenDisabled?: boolean;
332
361
  /**
333
- * Specifys the app's user agent
362
+ * Whether the app is secure i.e. using valid code signing certificates.
363
+ * Note: This value is not persisted in firestore, and is instead written locally at build time.
364
+ * @default false
334
365
  */
335
- userAgent: ISwitchableValue<string>;
366
+ isSecure?: boolean;
336
367
  /**
337
- * Disable devTools on all app windows
368
+ * Last todesktop builder version that was used to update the app
338
369
  */
339
- disableDevTools: boolean;
370
+ lastUsedBuilderVersion?: string;
340
371
  /**
341
- * Registers an app protocol. Format should be `{APP_PROTOCOL}://` e.g. `example://`
372
+ * Last desktopify version that was used to update the app
342
373
  */
343
- appProtocol: ISwitchableValue<string>;
374
+ lastUsedDesktopifyVersion?: string;
375
+ linuxIcon?: string;
376
+ linuxIconAssetDetails?: AppIconAssetDetails;
377
+ macOSIcon?: string;
378
+ macOSIconAssetDetails?: AppIconAssetDetails;
344
379
  /**
345
- * Disables the same-origin policy
380
+ * The app's menus
346
381
  */
347
- insecure?: boolean;
382
+ menus: DesktopifyAppMenu[];
348
383
  /**
349
- * Opens `accounts.google.com/o/oauth` in user's default browswer not as internal url
384
+ * The name of the app
350
385
  */
351
- googleOAuthIsExternal?: boolean;
386
+ name: string;
352
387
  /**
353
- * Removes electron from userAgent
388
+ * Sets whether an offline screen will be displayed if the internet is disconnected
389
+ * on initial page load. The color of the re-connect button that is shown is customizable.
354
390
  */
355
- shouldUseRealUserAgent?: boolean;
391
+ offlineScreen?: {
392
+ buttonBackgroundColor: string;
393
+ buttonTextColor: string;
394
+ enabled: boolean;
395
+ };
396
+ /**
397
+ * An array of plugin modules. Can work with semver specificity
398
+ */
399
+ plugins?: (Plugin | string)[];
400
+ /**
401
+ * Unused currently
402
+ * @unused
403
+ */
404
+ pollForAppUpdatesEveryXMinutes?: number;
356
405
  /**
357
406
  * Runtime environment variables
358
407
  */
@@ -360,20 +409,27 @@ export interface DesktopifyApp2<Plugin = DesktopAppPlugin> {
360
409
  [key: string]: string;
361
410
  };
362
411
  /**
363
- * Command line switches
364
- * Learn more {@link https://www.electronjs.org/docs/api/command-line-switches}
365
- * @example
366
- * {
367
- * 'remote-debugging-port': '8315'
368
- * }
412
+ * This option is only available when `shouldMinimizeToTray` is `true`.
413
+ * Always display the dock icon while the app is open. Even if there are no windows open.
369
414
  */
370
- commandLineSwitches?: {
371
- [key: string]: string;
372
- };
415
+ shouldAlwaysDisplayDockIcon?: boolean;
416
+ /**
417
+ * Whether the app should have full access to Electron APIs
418
+ * @default false
419
+ */
420
+ shouldHaveFullAccessToElectronAPIs?: boolean;
373
421
  /**
374
422
  * Launch App at startup
375
423
  */
376
424
  shouldLaunchAtStartupByDefault?: boolean;
425
+ /**
426
+ * Open same domain links in user's default browser
427
+ */
428
+ shouldMakeSameDomainAnExternalLink?: boolean;
429
+ /**
430
+ * Whether the app should minimize to tray when all windows are closed. Requires at least one tray.
431
+ */
432
+ shouldMinimizeToTray?: boolean;
377
433
  /**
378
434
  * If `true` the app will prevent app from opening any protocols that are not
379
435
  * already in a maybeAllowList or allowList (see `protocolLists.ts` in desktopify).
@@ -383,114 +439,58 @@ export interface DesktopifyApp2<Plugin = DesktopAppPlugin> {
383
439
  * Disables non-essential logs
384
440
  */
385
441
  shouldOnlySendAbsolutelyNecessaryRequests?: boolean;
442
+ /**
443
+ * Prevents the window contents from being captured by other apps.
444
+ */
445
+ shouldProtectContent?: boolean;
386
446
  /**
387
447
  * Disables electron overrides which ensure renderer process are restarted on each navigation.
388
448
  * Learn more {@link https://github.com/electron/electron/issues/18397}
389
449
  */
390
450
  shouldReuseRendererProcess?: boolean;
391
451
  /**
392
- * Open same domain links in user's default browser
393
- */
394
- shouldMakeSameDomainAnExternalLink?: boolean;
395
- /**
396
- * Enables push notifications — uses `electron-push-receiver`
397
- */
398
- enablePushNotifications?: boolean;
399
- /**
400
- * Enables NEW push notifications — uses `@cuj1559/electron-push-receiver`
452
+ * Removes electron from userAgent
401
453
  */
402
- enableNewPushNotifications?: boolean;
454
+ shouldUseRealUserAgent?: boolean;
403
455
  /**
404
- * Disable error reporting (Sentry)
456
+ * Only allow a single instance of this app to run
405
457
  */
406
- disableErrorTracking?: boolean;
458
+ singleInstance: boolean;
407
459
  /**
408
460
  * Sets theme for Electron UI elements and css.
409
461
  *
410
462
  * See {@link https://www.electronjs.org/docs/api/native-theme#nativethemethemesource}
411
463
  */
412
- themeSource?: 'system' | 'light' | 'dark';
464
+ themeSource?: 'dark' | 'light' | 'system';
413
465
  /**
414
466
  * Sets theme source for only mac
415
467
  *
416
468
  * See {@link https://www.electronjs.org/docs/api/native-theme#nativethemethemesource}
417
469
  */
418
- themeSourceMac?: 'system' | 'light' | 'dark';
419
- /**
420
- * URL that crash reports will be POSTed to
421
- */
422
- crashReporter?: string;
423
- /**
424
- * Unused currently
425
- * @unused
426
- */
427
- pollForAppUpdatesEveryXMinutes?: number;
428
- /**
429
- * An array of plugin modules. Can work with semver specificity
430
- */
431
- plugins?: (Plugin | string)[];
432
- /**
433
- * Metadata about plugins that were manually linked into the app
434
- */
435
- customPlugins?: CustomPlugin[];
436
- /**
437
- * The app's windows
438
- */
439
- windows: DesktopifyAppWindow[];
470
+ themeSourceMac?: 'dark' | 'light' | 'system';
440
471
  /**
441
472
  * The app's trays
442
473
  */
443
474
  trays: DesktopifyAppTray[];
444
475
  /**
445
- * The app's menus
476
+ * Specifys the app's user agent
446
477
  */
447
- menus: DesktopifyAppMenu[];
478
+ userAgent: ISwitchableValue<string>;
448
479
  /**
449
480
  * Prevents a potential vulnerability in URL matching in Electron
450
481
  * https://linear.app/todesktop/issue/TD-1428/html-injection-due-to-regular-expression-bypass
451
482
  */
452
483
  useSafeInternalUrlMatcher?: boolean;
453
484
  /**
454
- * Sets whether the window menu bar should hide itself automatically.
455
- * Once set the menu bar will only show when users press the single Alt key.
456
- */
457
- autoHideMenuBar?: boolean;
458
- /**
459
- * Sets whether an offline screen will be displayed if the internet is disconnected
460
- * on initial page load. The color of the re-connect button that is shown is customizable.
461
- */
462
- offlineScreen?: {
463
- enabled: boolean;
464
- buttonBackgroundColor: string;
465
- buttonTextColor: string;
466
- };
467
- /**
468
- * Sets strings to be used in the app UI. Currently only supports English
469
- */
470
- appStrings?: {
471
- [key in ValidTranslationKeys]?: {
472
- [lang in ValidTranslationLanguages]?: string;
473
- };
474
- };
475
- /**
476
- * File assets that get bundled with the app and are available offline
477
- */
478
- fileAssetDetailsList?: FileAssetDetails[];
479
- /**
480
- * Whether the app should have full access to Electron APIs
481
- * @default false
482
- */
483
- shouldHaveFullAccessToElectronAPIs?: boolean;
484
- /**
485
- * Whether the app is secure i.e. using valid code signing certificates.
486
- * Note: This value is not persisted in firestore, and is instead written locally at build time.
487
- * @default false
485
+ * Instead of using one icon for every platform, use a separate icon for different platforms
488
486
  */
489
- isSecure?: boolean;
487
+ useSeparateIcons?: boolean;
490
488
  /**
491
- * Prevents the window contents from being captured by other apps.
489
+ * The app's windows
492
490
  */
493
- shouldProtectContent?: boolean;
491
+ windows: DesktopifyAppWindow[];
492
+ windowsIcon?: string;
493
+ windowsIconAssetDetails?: AppIconAssetDetails;
494
494
  }
495
495
  export type FindInPagePlacement = {
496
496
  offset: number;