@todesktop/shared 7.55.0 → 7.58.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.
- package/lib/desktopify.d.ts +0 -53
- package/lib/desktopify.js +0 -1
- package/lib/desktopify2.d.ts +258 -0
- package/lib/desktopify2.js +78 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +3 -3
- package/src/desktopify.ts +0 -78
- package/src/desktopify2.ts +365 -0
- package/src/index.ts +2 -0
package/lib/desktopify.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { IApp } from "./toDesktop";
|
|
3
2
|
import { Configuration, PackagerOptions, PublishOptions } from "app-builder-lib";
|
|
4
|
-
import { MenuItemConstructorOptions, BrowserWindowConstructorOptions } from "@todesktop/client-electron-types";
|
|
5
3
|
declare type appBuilderLib = PackagerOptions & PublishOptions;
|
|
6
4
|
export interface IAppBuilderLib extends appBuilderLib {
|
|
7
5
|
config: Configuration;
|
|
@@ -139,53 +137,6 @@ export declare const isPlatformBuildRunning: (platformBuild: PlatformBuild) => b
|
|
|
139
137
|
export declare const isCiBuildRunning: (build: Build) => boolean;
|
|
140
138
|
export declare const isBuildRunning: (build: Build) => boolean;
|
|
141
139
|
export declare const isBuildCancellable: (build: Build) => boolean;
|
|
142
|
-
declare type todesktopRoles = "todesktop:launch-at-startup" | "todesktop:check-for-updates" | "todesktop:quit" | "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";
|
|
143
|
-
export interface DesktopifyMenuItemConstructorOptions extends Omit<MenuItemConstructorOptions, "role" | "submenu"> {
|
|
144
|
-
platforms?: NodeJS.Platform[];
|
|
145
|
-
submenu?: DesktopifyMenuItemConstructorOptions[];
|
|
146
|
-
role?: MenuItemConstructorOptions["role"] | todesktopRoles;
|
|
147
|
-
}
|
|
148
|
-
export interface DesktopifyAppWindow {
|
|
149
|
-
id: string;
|
|
150
|
-
name: string;
|
|
151
|
-
url: string;
|
|
152
|
-
fullScreen: boolean;
|
|
153
|
-
height: number;
|
|
154
|
-
minHeight?: number;
|
|
155
|
-
maxHeight?: number;
|
|
156
|
-
hasMinHeight?: boolean;
|
|
157
|
-
hasMaxHeight?: boolean;
|
|
158
|
-
width: number;
|
|
159
|
-
minWidth?: number;
|
|
160
|
-
maxWidth?: number;
|
|
161
|
-
hasMinWidth?: boolean;
|
|
162
|
-
hasMaxWidth?: boolean;
|
|
163
|
-
isResizable: boolean;
|
|
164
|
-
titleBarStyle?: "hidden" | "hiddenInset" | "customButtonsOnHover";
|
|
165
|
-
alwaysOnTop: boolean;
|
|
166
|
-
visibility: "visible" | "hidden" | "show-when-contents-loaded";
|
|
167
|
-
isMain: boolean;
|
|
168
|
-
applicationMenu: DesktopifyMenuItemConstructorOptions[];
|
|
169
|
-
type: "menubar" | "app";
|
|
170
|
-
transparentTitlebar: boolean;
|
|
171
|
-
shouldResetDimensions?: boolean;
|
|
172
|
-
vibrancy?: BrowserWindowConstructorOptions["vibrancy"];
|
|
173
|
-
toggleVisibilityKeyboardShortcut?: string;
|
|
174
|
-
}
|
|
175
|
-
export declare type DesktopifyAppTrayToggleWindowAction = {
|
|
176
|
-
role: "toggleWindow";
|
|
177
|
-
windowId: string;
|
|
178
|
-
};
|
|
179
|
-
export declare type DesktopifyAppTrayToggleMenuAction = {
|
|
180
|
-
role: "toggleMenu";
|
|
181
|
-
menu: DesktopifyMenuItemConstructorOptions[];
|
|
182
|
-
};
|
|
183
|
-
export declare type DesktopifyAppTrayAction = DesktopifyAppTrayToggleMenuAction | DesktopifyAppTrayToggleWindowAction;
|
|
184
|
-
export interface DesktopifyAppTray {
|
|
185
|
-
icon: string;
|
|
186
|
-
rightClick?: DesktopifyAppTrayAction;
|
|
187
|
-
leftClick?: DesktopifyAppTrayAction;
|
|
188
|
-
}
|
|
189
140
|
export interface DesktopifyApp {
|
|
190
141
|
name: string;
|
|
191
142
|
targetUrl: string;
|
|
@@ -231,8 +182,4 @@ export interface DesktopifyApp {
|
|
|
231
182
|
companyName?: string;
|
|
232
183
|
pollForAppUpdatesEveryXMinutes?: number;
|
|
233
184
|
}
|
|
234
|
-
export interface DesktopifyApp2 extends DesktopifyApp {
|
|
235
|
-
windows: DesktopifyAppWindow[];
|
|
236
|
-
trays: DesktopifyAppTray[];
|
|
237
|
-
}
|
|
238
185
|
export {};
|
package/lib/desktopify.js
CHANGED
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { IApp, ISwitchableValue } from "./toDesktop";
|
|
3
|
+
import { MenuItemConstructorOptions, BrowserWindowConstructorOptions, WebPreferences } from "@todesktop/client-electron-types";
|
|
4
|
+
/**
|
|
5
|
+
* Custom ToDesktop Roles for Application & Tray Menus
|
|
6
|
+
*/
|
|
7
|
+
declare type todesktopRoles = "todesktop:launch-at-startup" | "todesktop:check-for-updates" | "todesktop:quit" | "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";
|
|
8
|
+
export interface DesktopifyMenuItemConstructorOptions extends Omit<MenuItemConstructorOptions, "role" | "submenu"> {
|
|
9
|
+
platforms?: NodeJS.Platform;
|
|
10
|
+
submenu?: DesktopifyMenuItemConstructorOptions[];
|
|
11
|
+
role?: MenuItemConstructorOptions["role"] | todesktopRoles;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Toggle Window Tray Action
|
|
15
|
+
*
|
|
16
|
+
* @param windowId - The id of the window to toggle
|
|
17
|
+
*/
|
|
18
|
+
export declare type DesktopifyAppTrayToggleWindowAction = {
|
|
19
|
+
role: "toggleWindow";
|
|
20
|
+
windowId: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Toggle Menu Tray Action
|
|
24
|
+
*
|
|
25
|
+
* @param menu - The menu to show when action triggered
|
|
26
|
+
*/
|
|
27
|
+
export declare type DesktopifyAppTrayToggleMenuAction = {
|
|
28
|
+
role: "toggleMenu";
|
|
29
|
+
menu: DesktopifyMenuItemConstructorOptions[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* No Action Tray Action
|
|
33
|
+
*/
|
|
34
|
+
export declare type DesktopifyAppTrayNoAction = {
|
|
35
|
+
role: "noAction";
|
|
36
|
+
};
|
|
37
|
+
export declare type DesktopifyAppTrayAction = DesktopifyAppTrayToggleMenuAction | DesktopifyAppTrayToggleWindowAction | DesktopifyAppTrayNoAction;
|
|
38
|
+
export interface DesktopifyAppTray {
|
|
39
|
+
id: string;
|
|
40
|
+
icon: string;
|
|
41
|
+
rightClick: DesktopifyAppTrayAction;
|
|
42
|
+
leftClick: DesktopifyAppTrayAction;
|
|
43
|
+
}
|
|
44
|
+
export declare type DesktopifyAppMenu = DesktopifyMenuItemConstructorOptions[];
|
|
45
|
+
/**
|
|
46
|
+
* Whitelist of allowed DesktopifyWindow Options.
|
|
47
|
+
* These attrs (if set) are passed to the `BrowserWindow` constructor
|
|
48
|
+
* when the window is created
|
|
49
|
+
*/
|
|
50
|
+
export declare const allowedBrowserWindowConstructorOptions: Readonly<(keyof BrowserWindowConstructorOptions)[]>;
|
|
51
|
+
export declare type whitelistedBrowserWindowConstructorOptions = typeof allowedBrowserWindowConstructorOptions[number];
|
|
52
|
+
/**
|
|
53
|
+
* Whitelist of allowed DesktopifyWindow Web Preferences Options.
|
|
54
|
+
* These attrs (if set) are passed to the webPreferences object in the `BrowserWindow` constructor
|
|
55
|
+
* when the window is created
|
|
56
|
+
*/
|
|
57
|
+
export declare const allowedWebPreferencesOptions: Readonly<(keyof WebPreferences)[]>;
|
|
58
|
+
export declare type whitelistedWebPreferencesOptions = typeof allowedWebPreferencesOptions[number];
|
|
59
|
+
/**
|
|
60
|
+
* Interface for ToDesktop App Windows
|
|
61
|
+
*/
|
|
62
|
+
export interface DesktopifyAppWindow {
|
|
63
|
+
/**
|
|
64
|
+
* A unique window id
|
|
65
|
+
*/
|
|
66
|
+
id: string;
|
|
67
|
+
/**
|
|
68
|
+
* The window name. Only visible to developer
|
|
69
|
+
*/
|
|
70
|
+
name: string;
|
|
71
|
+
/**
|
|
72
|
+
* The window's url
|
|
73
|
+
*/
|
|
74
|
+
url: string;
|
|
75
|
+
/**
|
|
76
|
+
* Whether this is the main window. The main window handles deeplinks
|
|
77
|
+
*/
|
|
78
|
+
isMain: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* The type of window
|
|
81
|
+
*/
|
|
82
|
+
type: "menubar" | "app";
|
|
83
|
+
/**
|
|
84
|
+
* The window's application menu
|
|
85
|
+
*/
|
|
86
|
+
applicationMenu: DesktopifyAppMenu[];
|
|
87
|
+
/**
|
|
88
|
+
* Keyboard shortcut to toggle window visibility
|
|
89
|
+
*/
|
|
90
|
+
toggleVisibilityKeyboardShortcut?: string;
|
|
91
|
+
/**
|
|
92
|
+
* By default ToDesktop remembers window width & height between sessions.
|
|
93
|
+
* Setting to `true` disables behaviour
|
|
94
|
+
*/
|
|
95
|
+
shouldResetDimensions?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* If `true` prevents the native window's title from changing when the document title changes
|
|
98
|
+
*/
|
|
99
|
+
isTitleStatic?: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Disables default rightClick menu
|
|
102
|
+
*/
|
|
103
|
+
disableContextMenu: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Allows user to `Cmd+F` or `Edit>Find` to search for text on page
|
|
106
|
+
*/
|
|
107
|
+
isFindInPageEnabled?: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Inital visibility of window
|
|
110
|
+
*/
|
|
111
|
+
visibility: "visible" | "hidden" | "show-when-contents-loaded";
|
|
112
|
+
/**
|
|
113
|
+
* Does the window have a minimum width. Default is `false`
|
|
114
|
+
*/
|
|
115
|
+
hasMinWidth: boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Does the window have a maximum width. Default is `false`
|
|
118
|
+
*/
|
|
119
|
+
hasMaxWidth: boolean;
|
|
120
|
+
/**
|
|
121
|
+
* Does the window have a minimum height. Default is `false`
|
|
122
|
+
*/
|
|
123
|
+
hasMinHeight: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Does the window have a maximum height. Default is `false`
|
|
126
|
+
*/
|
|
127
|
+
hasMaxHeight: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* BrowserWindow Constructor Options
|
|
130
|
+
*/
|
|
131
|
+
options: Pick<BrowserWindowConstructorOptions, whitelistedBrowserWindowConstructorOptions> & {
|
|
132
|
+
/**
|
|
133
|
+
* Settings of web page's features.
|
|
134
|
+
*/
|
|
135
|
+
webPreferences?: Pick<WebPreferences, whitelistedWebPreferencesOptions>;
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
export interface DesktopifyApp2 {
|
|
139
|
+
/**
|
|
140
|
+
* The name of the app
|
|
141
|
+
*/
|
|
142
|
+
name: string;
|
|
143
|
+
/**
|
|
144
|
+
* A unique app id
|
|
145
|
+
*/
|
|
146
|
+
id: string;
|
|
147
|
+
/**
|
|
148
|
+
* The app icon
|
|
149
|
+
*/
|
|
150
|
+
icon?: string;
|
|
151
|
+
/**
|
|
152
|
+
* The name of the company that the app belongs to
|
|
153
|
+
*/
|
|
154
|
+
companyName?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Only allow a single instance of this app to run
|
|
157
|
+
*/
|
|
158
|
+
singleInstance: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Regex patterns for internal app urls
|
|
161
|
+
*/
|
|
162
|
+
internalUrls?: ISwitchableValue<string>;
|
|
163
|
+
/**
|
|
164
|
+
* By default ToDesktop uses native `window.open` to support Firebase social login.
|
|
165
|
+
* This makes the app use electron's `window.open`.
|
|
166
|
+
*/
|
|
167
|
+
isNativeWindowOpenDisabled?: boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Specifys the app's user agent
|
|
170
|
+
*/
|
|
171
|
+
userAgent?: ISwitchableValue<string>;
|
|
172
|
+
/**
|
|
173
|
+
* Disable devTools on all app windows
|
|
174
|
+
*/
|
|
175
|
+
disableDevTools: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Registers an app protocol. Format should be `{APP_PROTOCOL}://` e.g. `example://`
|
|
178
|
+
*/
|
|
179
|
+
appProtocol?: ISwitchableValue<string>;
|
|
180
|
+
/**
|
|
181
|
+
* Disables the same-origin policy
|
|
182
|
+
*/
|
|
183
|
+
insecure?: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Opens `accounts.google.com/o/oauth` in user's default browswer not as internal url
|
|
186
|
+
*/
|
|
187
|
+
googleOAuthIsExternal?: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Removes electron from userAgent
|
|
190
|
+
*/
|
|
191
|
+
shouldUseRealUserAgent?: boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Runtime environment variables
|
|
194
|
+
*/
|
|
195
|
+
runtimeEnvs?: {
|
|
196
|
+
[key: string]: string;
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Launch App at startup
|
|
200
|
+
*/
|
|
201
|
+
shouldLaunchAtStartupByDefault?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Disables non-essential logs
|
|
204
|
+
*/
|
|
205
|
+
shouldOnlySendAbsolutelyNecessaryRequests?: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Disables electron overrides which ensure renderer process are restarted on each navigation.
|
|
208
|
+
* Learn more {@link https://github.com/electron/electron/issues/18397}
|
|
209
|
+
*/
|
|
210
|
+
shouldReuseRendererProcess?: boolean;
|
|
211
|
+
/**
|
|
212
|
+
* Open same domain links in user's default browser
|
|
213
|
+
*/
|
|
214
|
+
shouldMakeSameDomainAnExternalLink?: boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Enables push notifications
|
|
217
|
+
*/
|
|
218
|
+
enablePushNotifications?: boolean;
|
|
219
|
+
/**
|
|
220
|
+
* Sets theme for Electron UI elements and css.
|
|
221
|
+
*
|
|
222
|
+
* See {@link https://www.electronjs.org/docs/api/native-theme#nativethemethemesource}
|
|
223
|
+
*/
|
|
224
|
+
themeSource?: "system" | "light" | "dark";
|
|
225
|
+
/**
|
|
226
|
+
* Sets theme source for only mac
|
|
227
|
+
*
|
|
228
|
+
* See {@link https://www.electronjs.org/docs/api/native-theme#nativethemethemesource}
|
|
229
|
+
*/
|
|
230
|
+
themeSourceMac?: "system" | "light" | "dark";
|
|
231
|
+
/**
|
|
232
|
+
* URL that crash reports will be POSTed to
|
|
233
|
+
*/
|
|
234
|
+
crashReporter?: string;
|
|
235
|
+
/**
|
|
236
|
+
* Unused currently
|
|
237
|
+
* @unused
|
|
238
|
+
*/
|
|
239
|
+
pollForAppUpdatesEveryXMinutes?: number;
|
|
240
|
+
/**
|
|
241
|
+
* The app's windows
|
|
242
|
+
*/
|
|
243
|
+
windows: DesktopifyAppWindow[];
|
|
244
|
+
/**
|
|
245
|
+
* The app's trays
|
|
246
|
+
*/
|
|
247
|
+
trays: DesktopifyAppTray[];
|
|
248
|
+
/**
|
|
249
|
+
* The app's menus
|
|
250
|
+
*/
|
|
251
|
+
menus: DesktopifyAppMenu[];
|
|
252
|
+
}
|
|
253
|
+
export interface IApp2 extends IApp {
|
|
254
|
+
windows: DesktopifyAppWindow[];
|
|
255
|
+
trays: DesktopifyAppTray[];
|
|
256
|
+
menus: DesktopifyAppMenu[];
|
|
257
|
+
}
|
|
258
|
+
export {};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/**
|
|
4
|
+
* Whitelist of allowed DesktopifyWindow Options.
|
|
5
|
+
* These attrs (if set) are passed to the `BrowserWindow` constructor
|
|
6
|
+
* when the window is created
|
|
7
|
+
*/
|
|
8
|
+
exports.allowedBrowserWindowConstructorOptions = [
|
|
9
|
+
"width",
|
|
10
|
+
"height",
|
|
11
|
+
// "x",
|
|
12
|
+
// "y",
|
|
13
|
+
"useContentSize",
|
|
14
|
+
"center",
|
|
15
|
+
"minWidth",
|
|
16
|
+
"minHeight",
|
|
17
|
+
"maxWidth",
|
|
18
|
+
"maxHeight",
|
|
19
|
+
"resizable",
|
|
20
|
+
"movable",
|
|
21
|
+
"minimizable",
|
|
22
|
+
"maximizable",
|
|
23
|
+
"closable",
|
|
24
|
+
"focusable",
|
|
25
|
+
"alwaysOnTop",
|
|
26
|
+
"fullscreen",
|
|
27
|
+
"fullscreenable",
|
|
28
|
+
"simpleFullscreen",
|
|
29
|
+
"skipTaskbar",
|
|
30
|
+
"kiosk",
|
|
31
|
+
"icon",
|
|
32
|
+
"paintWhenInitiallyHidden",
|
|
33
|
+
"frame",
|
|
34
|
+
"acceptFirstMouse",
|
|
35
|
+
"disableAutoHideCursor",
|
|
36
|
+
"autoHideMenuBar",
|
|
37
|
+
"enableLargerThanScreen",
|
|
38
|
+
"backgroundColor",
|
|
39
|
+
"hasShadow",
|
|
40
|
+
"opacity",
|
|
41
|
+
"darkTheme",
|
|
42
|
+
"transparent",
|
|
43
|
+
"visualEffectState",
|
|
44
|
+
"titleBarStyle",
|
|
45
|
+
"trafficLightPosition",
|
|
46
|
+
"roundedCorners",
|
|
47
|
+
"fullscreenWindowTitle",
|
|
48
|
+
"thickFrame",
|
|
49
|
+
"type",
|
|
50
|
+
"vibrancy",
|
|
51
|
+
"zoomToPageWidth",
|
|
52
|
+
"tabbingIdentifier",
|
|
53
|
+
];
|
|
54
|
+
/**
|
|
55
|
+
* Whitelist of allowed DesktopifyWindow Web Preferences Options.
|
|
56
|
+
* These attrs (if set) are passed to the webPreferences object in the `BrowserWindow` constructor
|
|
57
|
+
* when the window is created
|
|
58
|
+
*/
|
|
59
|
+
exports.allowedWebPreferencesOptions = [
|
|
60
|
+
"devTools",
|
|
61
|
+
"zoomFactor",
|
|
62
|
+
"textAreasAreResizable",
|
|
63
|
+
"scrollBounce",
|
|
64
|
+
"defaultFontFamily",
|
|
65
|
+
"defaultFontSize",
|
|
66
|
+
"defaultMonospaceFontSize",
|
|
67
|
+
"minimumFontSize",
|
|
68
|
+
"defaultEncoding",
|
|
69
|
+
"backgroundThrottling",
|
|
70
|
+
"offscreen",
|
|
71
|
+
"safeDialogs",
|
|
72
|
+
"safeDialogsMessage",
|
|
73
|
+
"navigateOnDragDrop",
|
|
74
|
+
"autoplayPolicy",
|
|
75
|
+
"disableHtmlFullscreenWindowResize",
|
|
76
|
+
"accessibleTitle",
|
|
77
|
+
"spellcheck",
|
|
78
|
+
];
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -8,5 +8,6 @@ __export(require("./toDesktop"));
|
|
|
8
8
|
__export(require("./desktopify"));
|
|
9
9
|
__export(require("./validations"));
|
|
10
10
|
__export(require("./plans"));
|
|
11
|
+
__export(require("./desktopify2"));
|
|
11
12
|
const schemaVersion = package_json_1.version;
|
|
12
13
|
exports.schemaVersion = schemaVersion;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@todesktop/shared",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.58.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"author": "Dave Jeffery <dave@davejeffery.com>",
|
|
15
15
|
"license": "UNLICENSED",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@todesktop/client-electron-types": "^
|
|
17
|
+
"@todesktop/client-electron-types": "^13.1.8",
|
|
18
18
|
"@types/debug": "^4.1.1",
|
|
19
|
-
"@types/node": "^
|
|
19
|
+
"@types/node": "^16.4.12",
|
|
20
20
|
"@types/yup": "^0.26.9",
|
|
21
21
|
"is-regex": "^1.0.4",
|
|
22
22
|
"yup": "^0.26.10"
|
package/src/desktopify.ts
CHANGED
|
@@ -254,79 +254,6 @@ export const isBuildRunning = (build: Build): boolean => {
|
|
|
254
254
|
export const isBuildCancellable = (build: Build): boolean =>
|
|
255
255
|
hasBuildKickedOff(build) && isBuildRunning(build);
|
|
256
256
|
|
|
257
|
-
type todesktopRoles =
|
|
258
|
-
| "todesktop:launch-at-startup"
|
|
259
|
-
| "todesktop:check-for-updates"
|
|
260
|
-
| "todesktop:quit"
|
|
261
|
-
| "todesktop:new-window"
|
|
262
|
-
| "todesktop:new-tab"
|
|
263
|
-
| "todesktop:check-for-updates"
|
|
264
|
-
| "todesktop:history-home"
|
|
265
|
-
| "todesktop:history-back"
|
|
266
|
-
| "todesktop:history-forward"
|
|
267
|
-
| "todesktop:show-window"
|
|
268
|
-
| "todesktop:hide-window";
|
|
269
|
-
|
|
270
|
-
let s: MenuItemConstructorOptions;
|
|
271
|
-
|
|
272
|
-
export interface DesktopifyMenuItemConstructorOptions
|
|
273
|
-
extends Omit<MenuItemConstructorOptions, "role" | "submenu"> {
|
|
274
|
-
platforms?: NodeJS.Platform[];
|
|
275
|
-
submenu?: DesktopifyMenuItemConstructorOptions[];
|
|
276
|
-
role?: MenuItemConstructorOptions["role"] | todesktopRoles;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
export interface DesktopifyAppWindow {
|
|
280
|
-
id: string;
|
|
281
|
-
name: string;
|
|
282
|
-
url: string;
|
|
283
|
-
fullScreen: boolean;
|
|
284
|
-
|
|
285
|
-
height: number;
|
|
286
|
-
minHeight?: number;
|
|
287
|
-
maxHeight?: number;
|
|
288
|
-
hasMinHeight?: boolean;
|
|
289
|
-
hasMaxHeight?: boolean;
|
|
290
|
-
|
|
291
|
-
width: number;
|
|
292
|
-
minWidth?: number;
|
|
293
|
-
maxWidth?: number;
|
|
294
|
-
hasMinWidth?: boolean;
|
|
295
|
-
hasMaxWidth?: boolean;
|
|
296
|
-
|
|
297
|
-
isResizable: boolean;
|
|
298
|
-
titleBarStyle?: "hidden" | "hiddenInset" | "customButtonsOnHover";
|
|
299
|
-
alwaysOnTop: boolean;
|
|
300
|
-
visibility: "visible" | "hidden" | "show-when-contents-loaded";
|
|
301
|
-
isMain: boolean;
|
|
302
|
-
applicationMenu: DesktopifyMenuItemConstructorOptions[];
|
|
303
|
-
type: "menubar" | "app";
|
|
304
|
-
transparentTitlebar: boolean;
|
|
305
|
-
shouldResetDimensions?: boolean;
|
|
306
|
-
vibrancy?: BrowserWindowConstructorOptions["vibrancy"];
|
|
307
|
-
toggleVisibilityKeyboardShortcut?: string;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export type DesktopifyAppTrayToggleWindowAction = {
|
|
311
|
-
role: "toggleWindow";
|
|
312
|
-
windowId: string;
|
|
313
|
-
};
|
|
314
|
-
|
|
315
|
-
export type DesktopifyAppTrayToggleMenuAction = {
|
|
316
|
-
role: "toggleMenu";
|
|
317
|
-
menu: DesktopifyMenuItemConstructorOptions[];
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
export type DesktopifyAppTrayAction =
|
|
321
|
-
| DesktopifyAppTrayToggleMenuAction
|
|
322
|
-
| DesktopifyAppTrayToggleWindowAction;
|
|
323
|
-
|
|
324
|
-
export interface DesktopifyAppTray {
|
|
325
|
-
icon: string;
|
|
326
|
-
rightClick?: DesktopifyAppTrayAction;
|
|
327
|
-
leftClick?: DesktopifyAppTrayAction;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
257
|
export interface DesktopifyApp {
|
|
331
258
|
name: string;
|
|
332
259
|
targetUrl: string;
|
|
@@ -372,8 +299,3 @@ export interface DesktopifyApp {
|
|
|
372
299
|
companyName?: string;
|
|
373
300
|
pollForAppUpdatesEveryXMinutes?: number;
|
|
374
301
|
}
|
|
375
|
-
|
|
376
|
-
export interface DesktopifyApp2 extends DesktopifyApp {
|
|
377
|
-
windows: DesktopifyAppWindow[];
|
|
378
|
-
trays: DesktopifyAppTray[];
|
|
379
|
-
}
|
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
import { IApp, ISwitchableValue } from "./toDesktop";
|
|
2
|
+
import {
|
|
3
|
+
MenuItemConstructorOptions,
|
|
4
|
+
BrowserWindowConstructorOptions,
|
|
5
|
+
WebPreferences,
|
|
6
|
+
} from "@todesktop/client-electron-types";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Custom ToDesktop Roles for Application & Tray Menus
|
|
10
|
+
*/
|
|
11
|
+
type todesktopRoles =
|
|
12
|
+
| "todesktop:launch-at-startup"
|
|
13
|
+
| "todesktop:check-for-updates"
|
|
14
|
+
| "todesktop:quit"
|
|
15
|
+
| "todesktop:new-window"
|
|
16
|
+
| "todesktop:new-tab"
|
|
17
|
+
| "todesktop:check-for-updates"
|
|
18
|
+
| "todesktop:history-home"
|
|
19
|
+
| "todesktop:history-back"
|
|
20
|
+
| "todesktop:history-forward"
|
|
21
|
+
| "todesktop:show-window"
|
|
22
|
+
| "todesktop:hide-window";
|
|
23
|
+
|
|
24
|
+
export interface DesktopifyMenuItemConstructorOptions
|
|
25
|
+
extends Omit<MenuItemConstructorOptions, "role" | "submenu"> {
|
|
26
|
+
platforms?: NodeJS.Platform;
|
|
27
|
+
submenu?: DesktopifyMenuItemConstructorOptions[];
|
|
28
|
+
role?: MenuItemConstructorOptions["role"] | todesktopRoles;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Toggle Window Tray Action
|
|
33
|
+
*
|
|
34
|
+
* @param windowId - The id of the window to toggle
|
|
35
|
+
*/
|
|
36
|
+
export type DesktopifyAppTrayToggleWindowAction = {
|
|
37
|
+
role: "toggleWindow";
|
|
38
|
+
windowId: string;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Toggle Menu Tray Action
|
|
43
|
+
*
|
|
44
|
+
* @param menu - The menu to show when action triggered
|
|
45
|
+
*/
|
|
46
|
+
export type DesktopifyAppTrayToggleMenuAction = {
|
|
47
|
+
role: "toggleMenu";
|
|
48
|
+
menu: DesktopifyMenuItemConstructorOptions[];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* No Action Tray Action
|
|
53
|
+
*/
|
|
54
|
+
export type DesktopifyAppTrayNoAction = {
|
|
55
|
+
role: "noAction";
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type DesktopifyAppTrayAction =
|
|
59
|
+
| DesktopifyAppTrayToggleMenuAction
|
|
60
|
+
| DesktopifyAppTrayToggleWindowAction
|
|
61
|
+
| DesktopifyAppTrayNoAction;
|
|
62
|
+
|
|
63
|
+
export interface DesktopifyAppTray {
|
|
64
|
+
id: string;
|
|
65
|
+
icon: string;
|
|
66
|
+
rightClick: DesktopifyAppTrayAction;
|
|
67
|
+
leftClick: DesktopifyAppTrayAction;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type DesktopifyAppMenu = DesktopifyMenuItemConstructorOptions[];
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Whitelist of allowed DesktopifyWindow Options.
|
|
74
|
+
* These attrs (if set) are passed to the `BrowserWindow` constructor
|
|
75
|
+
* when the window is created
|
|
76
|
+
*/
|
|
77
|
+
export const allowedBrowserWindowConstructorOptions: Readonly<
|
|
78
|
+
(keyof BrowserWindowConstructorOptions)[]
|
|
79
|
+
> = [
|
|
80
|
+
"width",
|
|
81
|
+
"height",
|
|
82
|
+
// "x",
|
|
83
|
+
// "y",
|
|
84
|
+
"useContentSize",
|
|
85
|
+
"center",
|
|
86
|
+
"minWidth",
|
|
87
|
+
"minHeight",
|
|
88
|
+
"maxWidth",
|
|
89
|
+
"maxHeight",
|
|
90
|
+
"resizable",
|
|
91
|
+
"movable",
|
|
92
|
+
"minimizable",
|
|
93
|
+
"maximizable",
|
|
94
|
+
"closable",
|
|
95
|
+
"focusable",
|
|
96
|
+
"alwaysOnTop",
|
|
97
|
+
"fullscreen",
|
|
98
|
+
"fullscreenable",
|
|
99
|
+
"simpleFullscreen",
|
|
100
|
+
"skipTaskbar",
|
|
101
|
+
"kiosk",
|
|
102
|
+
"icon",
|
|
103
|
+
"paintWhenInitiallyHidden",
|
|
104
|
+
"frame",
|
|
105
|
+
"acceptFirstMouse",
|
|
106
|
+
"disableAutoHideCursor",
|
|
107
|
+
"autoHideMenuBar",
|
|
108
|
+
"enableLargerThanScreen",
|
|
109
|
+
"backgroundColor",
|
|
110
|
+
"hasShadow",
|
|
111
|
+
"opacity",
|
|
112
|
+
"darkTheme",
|
|
113
|
+
"transparent",
|
|
114
|
+
"visualEffectState",
|
|
115
|
+
"titleBarStyle",
|
|
116
|
+
"trafficLightPosition",
|
|
117
|
+
"roundedCorners",
|
|
118
|
+
"fullscreenWindowTitle",
|
|
119
|
+
"thickFrame",
|
|
120
|
+
"type",
|
|
121
|
+
"vibrancy",
|
|
122
|
+
"zoomToPageWidth",
|
|
123
|
+
"tabbingIdentifier",
|
|
124
|
+
] as const;
|
|
125
|
+
|
|
126
|
+
// Make type from all numbered index values
|
|
127
|
+
export type whitelistedBrowserWindowConstructorOptions =
|
|
128
|
+
typeof allowedBrowserWindowConstructorOptions[number];
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Whitelist of allowed DesktopifyWindow Web Preferences Options.
|
|
132
|
+
* These attrs (if set) are passed to the webPreferences object in the `BrowserWindow` constructor
|
|
133
|
+
* when the window is created
|
|
134
|
+
*/
|
|
135
|
+
export const allowedWebPreferencesOptions: Readonly<(keyof WebPreferences)[]> =
|
|
136
|
+
[
|
|
137
|
+
"devTools",
|
|
138
|
+
"zoomFactor",
|
|
139
|
+
"textAreasAreResizable",
|
|
140
|
+
"scrollBounce",
|
|
141
|
+
"defaultFontFamily",
|
|
142
|
+
"defaultFontSize",
|
|
143
|
+
"defaultMonospaceFontSize",
|
|
144
|
+
"minimumFontSize",
|
|
145
|
+
"defaultEncoding",
|
|
146
|
+
"backgroundThrottling",
|
|
147
|
+
"offscreen",
|
|
148
|
+
"safeDialogs",
|
|
149
|
+
"safeDialogsMessage",
|
|
150
|
+
"navigateOnDragDrop",
|
|
151
|
+
"autoplayPolicy",
|
|
152
|
+
"disableHtmlFullscreenWindowResize",
|
|
153
|
+
"accessibleTitle",
|
|
154
|
+
"spellcheck",
|
|
155
|
+
] as const;
|
|
156
|
+
|
|
157
|
+
// Make type from all numbered index values
|
|
158
|
+
export type whitelistedWebPreferencesOptions =
|
|
159
|
+
typeof allowedWebPreferencesOptions[number];
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Interface for ToDesktop App Windows
|
|
163
|
+
*/
|
|
164
|
+
export interface DesktopifyAppWindow {
|
|
165
|
+
/**
|
|
166
|
+
* A unique window id
|
|
167
|
+
*/
|
|
168
|
+
id: string;
|
|
169
|
+
/**
|
|
170
|
+
* The window name. Only visible to developer
|
|
171
|
+
*/
|
|
172
|
+
name: string;
|
|
173
|
+
/**
|
|
174
|
+
* The window's url
|
|
175
|
+
*/
|
|
176
|
+
url: string;
|
|
177
|
+
/**
|
|
178
|
+
* Whether this is the main window. The main window handles deeplinks
|
|
179
|
+
*/
|
|
180
|
+
isMain: boolean;
|
|
181
|
+
/**
|
|
182
|
+
* The type of window
|
|
183
|
+
*/
|
|
184
|
+
type: "menubar" | "app";
|
|
185
|
+
/**
|
|
186
|
+
* The window's application menu
|
|
187
|
+
*/
|
|
188
|
+
applicationMenu: DesktopifyAppMenu[];
|
|
189
|
+
/**
|
|
190
|
+
* Keyboard shortcut to toggle window visibility
|
|
191
|
+
*/
|
|
192
|
+
toggleVisibilityKeyboardShortcut?: string;
|
|
193
|
+
/**
|
|
194
|
+
* By default ToDesktop remembers window width & height between sessions.
|
|
195
|
+
* Setting to `true` disables behaviour
|
|
196
|
+
*/
|
|
197
|
+
shouldResetDimensions?: boolean;
|
|
198
|
+
/**
|
|
199
|
+
* If `true` prevents the native window's title from changing when the document title changes
|
|
200
|
+
*/
|
|
201
|
+
isTitleStatic?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Disables default rightClick menu
|
|
204
|
+
*/
|
|
205
|
+
disableContextMenu: boolean;
|
|
206
|
+
/**
|
|
207
|
+
* Allows user to `Cmd+F` or `Edit>Find` to search for text on page
|
|
208
|
+
*/
|
|
209
|
+
isFindInPageEnabled?: boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Inital visibility of window
|
|
212
|
+
*/
|
|
213
|
+
visibility: "visible" | "hidden" | "show-when-contents-loaded";
|
|
214
|
+
/**
|
|
215
|
+
* Does the window have a minimum width. Default is `false`
|
|
216
|
+
*/
|
|
217
|
+
hasMinWidth: boolean;
|
|
218
|
+
/**
|
|
219
|
+
* Does the window have a maximum width. Default is `false`
|
|
220
|
+
*/
|
|
221
|
+
hasMaxWidth: boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Does the window have a minimum height. Default is `false`
|
|
224
|
+
*/
|
|
225
|
+
hasMinHeight: boolean;
|
|
226
|
+
/**
|
|
227
|
+
* Does the window have a maximum height. Default is `false`
|
|
228
|
+
*/
|
|
229
|
+
hasMaxHeight: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* BrowserWindow Constructor Options
|
|
232
|
+
*/
|
|
233
|
+
options: Pick<
|
|
234
|
+
BrowserWindowConstructorOptions,
|
|
235
|
+
whitelistedBrowserWindowConstructorOptions
|
|
236
|
+
> & {
|
|
237
|
+
/**
|
|
238
|
+
* Settings of web page's features.
|
|
239
|
+
*/
|
|
240
|
+
webPreferences?: Pick<WebPreferences, whitelistedWebPreferencesOptions>;
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
// TODO: Look into hasMinHeight, etc
|
|
244
|
+
|
|
245
|
+
export interface DesktopifyApp2 {
|
|
246
|
+
/**
|
|
247
|
+
* The name of the app
|
|
248
|
+
*/
|
|
249
|
+
name: string;
|
|
250
|
+
/**
|
|
251
|
+
* A unique app id
|
|
252
|
+
*/
|
|
253
|
+
id: string;
|
|
254
|
+
/**
|
|
255
|
+
* The app icon
|
|
256
|
+
*/
|
|
257
|
+
icon?: string;
|
|
258
|
+
/**
|
|
259
|
+
* The name of the company that the app belongs to
|
|
260
|
+
*/
|
|
261
|
+
companyName?: string;
|
|
262
|
+
/**
|
|
263
|
+
* Only allow a single instance of this app to run
|
|
264
|
+
*/
|
|
265
|
+
singleInstance: boolean;
|
|
266
|
+
/**
|
|
267
|
+
* Regex patterns for internal app urls
|
|
268
|
+
*/
|
|
269
|
+
internalUrls?: ISwitchableValue<string>;
|
|
270
|
+
/**
|
|
271
|
+
* By default ToDesktop uses native `window.open` to support Firebase social login.
|
|
272
|
+
* This makes the app use electron's `window.open`.
|
|
273
|
+
*/
|
|
274
|
+
isNativeWindowOpenDisabled?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Specifys the app's user agent
|
|
277
|
+
*/
|
|
278
|
+
userAgent?: ISwitchableValue<string>;
|
|
279
|
+
/**
|
|
280
|
+
* Disable devTools on all app windows
|
|
281
|
+
*/
|
|
282
|
+
disableDevTools: boolean;
|
|
283
|
+
/**
|
|
284
|
+
* Registers an app protocol. Format should be `{APP_PROTOCOL}://` e.g. `example://`
|
|
285
|
+
*/
|
|
286
|
+
appProtocol?: ISwitchableValue<string>;
|
|
287
|
+
/**
|
|
288
|
+
* Disables the same-origin policy
|
|
289
|
+
*/
|
|
290
|
+
insecure?: boolean;
|
|
291
|
+
/**
|
|
292
|
+
* Opens `accounts.google.com/o/oauth` in user's default browswer not as internal url
|
|
293
|
+
*/
|
|
294
|
+
googleOAuthIsExternal?: boolean;
|
|
295
|
+
/**
|
|
296
|
+
* Removes electron from userAgent
|
|
297
|
+
*/
|
|
298
|
+
shouldUseRealUserAgent?: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Runtime environment variables
|
|
301
|
+
*/
|
|
302
|
+
runtimeEnvs?: {
|
|
303
|
+
[key: string]: string;
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Launch App at startup
|
|
307
|
+
*/
|
|
308
|
+
shouldLaunchAtStartupByDefault?: boolean;
|
|
309
|
+
/**
|
|
310
|
+
* Disables non-essential logs
|
|
311
|
+
*/
|
|
312
|
+
shouldOnlySendAbsolutelyNecessaryRequests?: boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Disables electron overrides which ensure renderer process are restarted on each navigation.
|
|
315
|
+
* Learn more {@link https://github.com/electron/electron/issues/18397}
|
|
316
|
+
*/
|
|
317
|
+
shouldReuseRendererProcess?: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Open same domain links in user's default browser
|
|
320
|
+
*/
|
|
321
|
+
shouldMakeSameDomainAnExternalLink?: boolean;
|
|
322
|
+
/**
|
|
323
|
+
* Enables push notifications
|
|
324
|
+
*/
|
|
325
|
+
enablePushNotifications?: boolean;
|
|
326
|
+
/**
|
|
327
|
+
* Sets theme for Electron UI elements and css.
|
|
328
|
+
*
|
|
329
|
+
* See {@link https://www.electronjs.org/docs/api/native-theme#nativethemethemesource}
|
|
330
|
+
*/
|
|
331
|
+
themeSource?: "system" | "light" | "dark";
|
|
332
|
+
/**
|
|
333
|
+
* Sets theme source for only mac
|
|
334
|
+
*
|
|
335
|
+
* See {@link https://www.electronjs.org/docs/api/native-theme#nativethemethemesource}
|
|
336
|
+
*/
|
|
337
|
+
themeSourceMac?: "system" | "light" | "dark";
|
|
338
|
+
/**
|
|
339
|
+
* URL that crash reports will be POSTed to
|
|
340
|
+
*/
|
|
341
|
+
crashReporter?: string;
|
|
342
|
+
/**
|
|
343
|
+
* Unused currently
|
|
344
|
+
* @unused
|
|
345
|
+
*/
|
|
346
|
+
pollForAppUpdatesEveryXMinutes?: number;
|
|
347
|
+
/**
|
|
348
|
+
* The app's windows
|
|
349
|
+
*/
|
|
350
|
+
windows: DesktopifyAppWindow[];
|
|
351
|
+
/**
|
|
352
|
+
* The app's trays
|
|
353
|
+
*/
|
|
354
|
+
trays: DesktopifyAppTray[];
|
|
355
|
+
/**
|
|
356
|
+
* The app's menus
|
|
357
|
+
*/
|
|
358
|
+
menus: DesktopifyAppMenu[];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface IApp2 extends IApp {
|
|
362
|
+
windows: DesktopifyAppWindow[];
|
|
363
|
+
trays: DesktopifyAppTray[];
|
|
364
|
+
menus: DesktopifyAppMenu[];
|
|
365
|
+
}
|