electron-incremental-update 2.0.0-beta.2 → 2.0.0-beta.3
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/dist/chunk-5WFXC5GU.js +43 -0
- package/dist/chunk-BVFQWBLK.js +76 -0
- package/dist/chunk-PNYRQYFC.js +77 -0
- package/dist/index.cjs +81 -144
- package/dist/index.d.cts +23 -18
- package/dist/index.d.ts +23 -18
- package/dist/index.js +56 -74
- package/dist/provider.cjs +78 -112
- package/dist/provider.d.cts +37 -11
- package/dist/provider.d.ts +37 -11
- package/dist/provider.js +42 -33
- package/dist/{types-CPq1MrYZ.d.ts → types-DxhNaNgR.d.ts} +8 -2
- package/dist/{types-COqp44eg.d.cts → types-Tequ_V2o.d.cts} +8 -2
- package/dist/unzip-JjYLjJkH.d.cts +9 -0
- package/dist/unzip-JjYLjJkH.d.ts +9 -0
- package/dist/utils.cjs +99 -173
- package/dist/utils.d.cts +4 -16
- package/dist/utils.d.ts +4 -16
- package/dist/utils.js +19 -62
- package/dist/{version-CffZWDhZ.d.cts → version-CemSHimT.d.cts} +3 -2
- package/dist/{version-CffZWDhZ.d.ts → version-CemSHimT.d.ts} +3 -2
- package/dist/vite.js +106 -139
- package/package.json +6 -6
- package/dist/chunk-BG22XZAB.js +0 -257
- package/dist/decrypt-D9WdXYjH.d.cts +0 -4
- package/dist/decrypt-D9WdXYjH.d.ts +0 -4
package/dist/utils.cjs
CHANGED
|
@@ -1,95 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
'use strict';
|
|
19
2
|
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
encrypt: () => encrypt,
|
|
26
|
-
getAppVersion: () => getAppVersion,
|
|
27
|
-
getEntryVersion: () => getEntryVersion,
|
|
28
|
-
getPathFromAppNameAsar: () => getPathFromAppNameAsar,
|
|
29
|
-
getPathFromEntryAsar: () => getPathFromEntryAsar,
|
|
30
|
-
getPathFromPreload: () => getPathFromPreload,
|
|
31
|
-
getPathFromPublic: () => getPathFromPublic,
|
|
32
|
-
handleUnexpectedErrors: () => handleUnexpectedErrors,
|
|
33
|
-
hashString: () => hashString,
|
|
34
|
-
isDev: () => isDev,
|
|
35
|
-
isLinux: () => isLinux,
|
|
36
|
-
isLowerVersionDefault: () => isLowerVersionDefault,
|
|
37
|
-
isMac: () => isMac,
|
|
38
|
-
isUpdateJSON: () => isUpdateJSON,
|
|
39
|
-
isWin: () => isWin,
|
|
40
|
-
loadPage: () => loadPage,
|
|
41
|
-
parseVersion: () => parseVersion,
|
|
42
|
-
requireNative: () => requireNative,
|
|
43
|
-
restartApp: () => restartApp,
|
|
44
|
-
setAppUserModelId: () => setAppUserModelId,
|
|
45
|
-
setPortableAppDataPath: () => setPortableAppDataPath,
|
|
46
|
-
signature: () => signature,
|
|
47
|
-
singleInstance: () => singleInstance,
|
|
48
|
-
unzipFile: () => unzipFile,
|
|
49
|
-
verifySignatureDefault: () => verifySignatureDefault,
|
|
50
|
-
waitAppReady: () => waitAppReady,
|
|
51
|
-
zipFile: () => zipFile
|
|
52
|
-
});
|
|
53
|
-
module.exports = __toCommonJS(utils_exports);
|
|
3
|
+
var fs = require('fs');
|
|
4
|
+
var path = require('path');
|
|
5
|
+
var electron = require('electron');
|
|
6
|
+
var zlib = require('zlib');
|
|
7
|
+
var crypto = require('crypto');
|
|
54
8
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
9
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
10
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
11
|
+
}) : x)(function(x) {
|
|
12
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
13
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
14
|
+
});
|
|
59
15
|
var isDev = __EIU_IS_DEV__;
|
|
60
16
|
var isWin = process.platform === "win32";
|
|
61
17
|
var isMac = process.platform === "darwin";
|
|
62
18
|
var isLinux = process.platform === "linux";
|
|
63
|
-
function getPathFromAppNameAsar(...path) {
|
|
64
|
-
return isDev ? "DEV.asar" :
|
|
19
|
+
function getPathFromAppNameAsar(...path$1) {
|
|
20
|
+
return isDev ? "DEV.asar" : path.join(path.dirname(electron.app.getAppPath()), `${electron.app.name}.asar`, ...path$1);
|
|
65
21
|
}
|
|
66
22
|
function getAppVersion() {
|
|
67
|
-
return isDev ? getEntryVersion() :
|
|
23
|
+
return isDev ? getEntryVersion() : fs.readFileSync(getPathFromAppNameAsar("version"), "utf-8");
|
|
68
24
|
}
|
|
69
25
|
function getEntryVersion() {
|
|
70
|
-
return
|
|
26
|
+
return electron.app.getVersion();
|
|
71
27
|
}
|
|
72
28
|
function requireNative(moduleName) {
|
|
73
|
-
return
|
|
29
|
+
return __require(path.join(electron.app.getAppPath(), __EIU_ENTRY_DIST_PATH__, moduleName));
|
|
74
30
|
}
|
|
75
31
|
function restartApp() {
|
|
76
|
-
|
|
77
|
-
|
|
32
|
+
electron.app.relaunch();
|
|
33
|
+
electron.app.quit();
|
|
78
34
|
}
|
|
79
35
|
function setAppUserModelId(id) {
|
|
80
36
|
if (isWin) {
|
|
81
|
-
|
|
37
|
+
electron.app.setAppUserModelId(id ?? `org.${electron.app.name}`);
|
|
82
38
|
}
|
|
83
39
|
}
|
|
84
40
|
function disableHWAccForWin7() {
|
|
85
|
-
if (
|
|
86
|
-
|
|
41
|
+
if (__require("os").release().startsWith("6.1")) {
|
|
42
|
+
electron.app.disableHardwareAcceleration();
|
|
87
43
|
}
|
|
88
44
|
}
|
|
89
45
|
function singleInstance(window) {
|
|
90
|
-
const result =
|
|
46
|
+
const result = electron.app.requestSingleInstanceLock();
|
|
91
47
|
if (result) {
|
|
92
|
-
|
|
48
|
+
electron.app.on("second-instance", () => {
|
|
93
49
|
if (window) {
|
|
94
50
|
window.show();
|
|
95
51
|
if (window.isMinimized()) {
|
|
@@ -99,27 +55,16 @@ function singleInstance(window) {
|
|
|
99
55
|
}
|
|
100
56
|
});
|
|
101
57
|
} else {
|
|
102
|
-
|
|
58
|
+
electron.app.quit();
|
|
103
59
|
}
|
|
104
60
|
return result;
|
|
105
61
|
}
|
|
106
62
|
function setPortableAppDataPath(dirName = "data") {
|
|
107
|
-
const portablePath =
|
|
108
|
-
if (!
|
|
109
|
-
|
|
63
|
+
const portablePath = path.join(path.dirname(electron.app.getPath("exe")), dirName);
|
|
64
|
+
if (!fs.existsSync(portablePath)) {
|
|
65
|
+
fs.mkdirSync(portablePath);
|
|
110
66
|
}
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
function waitAppReady(timeout = 1e3) {
|
|
114
|
-
return import_electron.app.isReady() ? Promise.resolve() : new Promise((resolve, reject) => {
|
|
115
|
-
const _ = setTimeout(() => {
|
|
116
|
-
reject(new Error("app is not ready"));
|
|
117
|
-
}, timeout);
|
|
118
|
-
import_electron.app.whenReady().then(() => {
|
|
119
|
-
clearTimeout(_);
|
|
120
|
-
resolve();
|
|
121
|
-
});
|
|
122
|
-
});
|
|
67
|
+
electron.app.setPath("appData", portablePath);
|
|
123
68
|
}
|
|
124
69
|
function loadPage(win, htmlFilePath = "index.html") {
|
|
125
70
|
if (isDev) {
|
|
@@ -129,49 +74,32 @@ function loadPage(win, htmlFilePath = "index.html") {
|
|
|
129
74
|
}
|
|
130
75
|
}
|
|
131
76
|
function getPathFromPreload(...paths) {
|
|
132
|
-
return isDev ?
|
|
77
|
+
return isDev ? path.join(electron.app.getAppPath(), __EIU_ELECTRON_DIST_PATH__, "preload", ...paths) : getPathFromAppNameAsar("preload", ...paths);
|
|
133
78
|
}
|
|
134
79
|
function getPathFromPublic(...paths) {
|
|
135
|
-
return isDev ?
|
|
80
|
+
return isDev ? path.join(electron.app.getAppPath(), "public", ...paths) : getPathFromAppNameAsar("renderer", ...paths);
|
|
136
81
|
}
|
|
137
82
|
function getPathFromEntryAsar(...paths) {
|
|
138
|
-
return
|
|
83
|
+
return path.join(electron.app.getAppPath(), __EIU_ENTRY_DIST_PATH__, ...paths);
|
|
139
84
|
}
|
|
140
|
-
|
|
141
|
-
// src/utils/zip.ts
|
|
142
|
-
var import_node_fs2 = require("fs");
|
|
143
|
-
var import_node_zlib = require("zlib");
|
|
144
|
-
async function zipFile(filePath, targetFilePath = `${filePath}.gz`) {
|
|
145
|
-
if (!(0, import_node_fs2.existsSync)(filePath)) {
|
|
146
|
-
throw new Error(`path to be zipped not exist: ${filePath}`);
|
|
147
|
-
}
|
|
148
|
-
const buffer = (0, import_node_fs2.readFileSync)(filePath);
|
|
85
|
+
async function defaultZipFile(buffer, targetFilePath) {
|
|
149
86
|
return new Promise((resolve, reject) => {
|
|
150
|
-
|
|
87
|
+
zlib.brotliCompress(buffer, (err, buffer2) => {
|
|
151
88
|
if (err) {
|
|
152
89
|
reject(err);
|
|
153
90
|
}
|
|
154
|
-
|
|
91
|
+
fs.writeFileSync(targetFilePath, buffer2);
|
|
155
92
|
resolve();
|
|
156
93
|
});
|
|
157
94
|
});
|
|
158
95
|
}
|
|
159
|
-
|
|
160
|
-
// src/utils/unzip.ts
|
|
161
|
-
var import_node_fs3 = require("fs");
|
|
162
|
-
var import_node_zlib2 = require("zlib");
|
|
163
|
-
async function unzipFile(gzipPath, targetFilePath = gzipPath.slice(0, -3)) {
|
|
164
|
-
if (!(0, import_node_fs3.existsSync)(gzipPath)) {
|
|
165
|
-
throw new Error(`path to zipped file not exist: ${gzipPath}`);
|
|
166
|
-
}
|
|
167
|
-
const compressedBuffer = (0, import_node_fs3.readFileSync)(gzipPath);
|
|
96
|
+
async function defaultUnzipFile(buffer, targetFilePath) {
|
|
168
97
|
return new Promise((resolve, reject) => {
|
|
169
|
-
|
|
170
|
-
(0, import_node_fs3.rmSync)(gzipPath);
|
|
98
|
+
zlib.brotliDecompress(buffer, (err, buffer2) => {
|
|
171
99
|
if (err) {
|
|
172
100
|
reject(err);
|
|
173
101
|
}
|
|
174
|
-
|
|
102
|
+
fs.writeFileSync(targetFilePath, buffer2);
|
|
175
103
|
resolve();
|
|
176
104
|
});
|
|
177
105
|
});
|
|
@@ -205,7 +133,7 @@ function parseVersion(version) {
|
|
|
205
133
|
}
|
|
206
134
|
return ret;
|
|
207
135
|
}
|
|
208
|
-
function
|
|
136
|
+
function defaultIsLowerVersion(oldVer, newVer) {
|
|
209
137
|
const oldV = parseVersion(oldVer);
|
|
210
138
|
const newV = parseVersion(newVer);
|
|
211
139
|
function compareStrings(str1, str2) {
|
|
@@ -229,75 +157,73 @@ function isUpdateJSON(json) {
|
|
|
229
157
|
const is = (j) => !!(j && j.minimumVersion && j.signature && j.size && j.version);
|
|
230
158
|
return is(json) && is(json?.beta);
|
|
231
159
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
160
|
+
function defaultVersionJsonGenerator(existingJson, buffer, signature, version, minimumVersion) {
|
|
161
|
+
existingJson.beta = {
|
|
162
|
+
version,
|
|
163
|
+
minimumVersion,
|
|
164
|
+
signature,
|
|
165
|
+
size: buffer.length
|
|
166
|
+
};
|
|
167
|
+
if (!parseVersion(version).stage) {
|
|
168
|
+
existingJson.version = version;
|
|
169
|
+
existingJson.minimumVersion = minimumVersion;
|
|
170
|
+
existingJson.signature = signature;
|
|
171
|
+
existingJson.size = buffer.length;
|
|
172
|
+
}
|
|
173
|
+
return existingJson;
|
|
174
|
+
}
|
|
175
|
+
function hashBuffer(data, length) {
|
|
176
|
+
const hash = crypto.createHash("SHA256").update(data).digest("binary");
|
|
240
177
|
return Buffer.from(hash).subarray(0, length);
|
|
241
178
|
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
const decipher = (0, import_node_crypto2.createDecipheriv)("aes-256-cbc", key, iv);
|
|
246
|
-
let decrypted = decipher.update(encryptedText, "base64url", "utf8");
|
|
247
|
-
decrypted += decipher.final("utf8");
|
|
248
|
-
return decrypted;
|
|
179
|
+
function aesEncrypt(plainText, key, iv) {
|
|
180
|
+
const cipher = crypto.createCipheriv("aes-256-cbc", key, iv);
|
|
181
|
+
return cipher.update(plainText, "utf8", "base64url") + cipher.final("base64url");
|
|
249
182
|
}
|
|
250
|
-
function
|
|
183
|
+
function defaultSignature(buffer, privateKey, cert, version) {
|
|
184
|
+
const sig = crypto.createSign("RSA-SHA256").update(buffer).sign(crypto.createPrivateKey(privateKey), "base64");
|
|
185
|
+
return aesEncrypt(`${sig}%${version}`, hashBuffer(cert, 32), hashBuffer(buffer, 16));
|
|
186
|
+
}
|
|
187
|
+
function aesDecrypt(encryptedText, key, iv) {
|
|
188
|
+
const decipher = crypto.createDecipheriv("aes-256-cbc", key, iv);
|
|
189
|
+
return decipher.update(encryptedText, "base64url", "utf8") + decipher.final("utf8");
|
|
190
|
+
}
|
|
191
|
+
function defaultVerify(buffer, signature, cert) {
|
|
251
192
|
try {
|
|
252
|
-
const [sig, version] =
|
|
253
|
-
const result =
|
|
193
|
+
const [sig, version] = aesDecrypt(signature, hashBuffer(cert, 32), hashBuffer(buffer, 16)).split("%");
|
|
194
|
+
const result = crypto.createVerify("RSA-SHA256").update(buffer).verify(cert, sig, "base64");
|
|
254
195
|
return result ? version : void 0;
|
|
255
196
|
} catch {
|
|
256
197
|
return void 0;
|
|
257
198
|
}
|
|
258
199
|
}
|
|
259
200
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
isUpdateJSON,
|
|
290
|
-
isWin,
|
|
291
|
-
loadPage,
|
|
292
|
-
parseVersion,
|
|
293
|
-
requireNative,
|
|
294
|
-
restartApp,
|
|
295
|
-
setAppUserModelId,
|
|
296
|
-
setPortableAppDataPath,
|
|
297
|
-
signature,
|
|
298
|
-
singleInstance,
|
|
299
|
-
unzipFile,
|
|
300
|
-
verifySignatureDefault,
|
|
301
|
-
waitAppReady,
|
|
302
|
-
zipFile
|
|
303
|
-
});
|
|
201
|
+
exports.aesDecrypt = aesDecrypt;
|
|
202
|
+
exports.aesEncrypt = aesEncrypt;
|
|
203
|
+
exports.defaultIsLowerVersion = defaultIsLowerVersion;
|
|
204
|
+
exports.defaultSignature = defaultSignature;
|
|
205
|
+
exports.defaultUnzipFile = defaultUnzipFile;
|
|
206
|
+
exports.defaultVerify = defaultVerify;
|
|
207
|
+
exports.defaultVersionJsonGenerator = defaultVersionJsonGenerator;
|
|
208
|
+
exports.defaultZipFile = defaultZipFile;
|
|
209
|
+
exports.disableHWAccForWin7 = disableHWAccForWin7;
|
|
210
|
+
exports.getAppVersion = getAppVersion;
|
|
211
|
+
exports.getEntryVersion = getEntryVersion;
|
|
212
|
+
exports.getPathFromAppNameAsar = getPathFromAppNameAsar;
|
|
213
|
+
exports.getPathFromEntryAsar = getPathFromEntryAsar;
|
|
214
|
+
exports.getPathFromPreload = getPathFromPreload;
|
|
215
|
+
exports.getPathFromPublic = getPathFromPublic;
|
|
216
|
+
exports.handleUnexpectedErrors = handleUnexpectedErrors;
|
|
217
|
+
exports.hashBuffer = hashBuffer;
|
|
218
|
+
exports.isDev = isDev;
|
|
219
|
+
exports.isLinux = isLinux;
|
|
220
|
+
exports.isMac = isMac;
|
|
221
|
+
exports.isUpdateJSON = isUpdateJSON;
|
|
222
|
+
exports.isWin = isWin;
|
|
223
|
+
exports.loadPage = loadPage;
|
|
224
|
+
exports.parseVersion = parseVersion;
|
|
225
|
+
exports.requireNative = requireNative;
|
|
226
|
+
exports.restartApp = restartApp;
|
|
227
|
+
exports.setAppUserModelId = setAppUserModelId;
|
|
228
|
+
exports.setPortableAppDataPath = setPortableAppDataPath;
|
|
229
|
+
exports.singleInstance = singleInstance;
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BrowserWindow } from 'electron';
|
|
2
|
-
export {
|
|
3
|
-
export { d as
|
|
2
|
+
export { c as aesDecrypt, a as aesEncrypt, b as defaultSignature, d as defaultUnzipFile, e as defaultVerify, h as hashBuffer } from './unzip-JjYLjJkH.cjs';
|
|
3
|
+
export { a as UpdateInfo, U as UpdateJSON, V as Version, d as defaultIsLowerVersion, b as defaultVersionJsonGenerator, h as handleUnexpectedErrors, i as isUpdateJSON, p as parseVersion } from './version-CemSHimT.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* compile time dev check
|
|
@@ -54,11 +54,6 @@ declare function singleInstance(window?: BrowserWindow): boolean;
|
|
|
54
54
|
* @param dirName dir name, default to `data`
|
|
55
55
|
*/
|
|
56
56
|
declare function setPortableAppDataPath(dirName?: string): void;
|
|
57
|
-
/**
|
|
58
|
-
* ensure app is ready.
|
|
59
|
-
* @param timeout wait timeout, @default 1000
|
|
60
|
-
*/
|
|
61
|
-
declare function waitAppReady(timeout?: number): Promise<void>;
|
|
62
57
|
/**
|
|
63
58
|
* load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
|
|
64
59
|
* @param win window
|
|
@@ -69,13 +64,6 @@ declare function getPathFromPreload(...paths: string[]): string;
|
|
|
69
64
|
declare function getPathFromPublic(...paths: string[]): string;
|
|
70
65
|
declare function getPathFromEntryAsar(...paths: string[]): string;
|
|
71
66
|
|
|
72
|
-
declare function
|
|
73
|
-
|
|
74
|
-
declare function unzipFile(gzipPath: string, targetFilePath?: string): Promise<void>;
|
|
75
|
-
|
|
76
|
-
declare function encrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
77
|
-
declare function signature(buffer: Buffer, privateKey: string, cert: string, version: string): string;
|
|
78
|
-
|
|
79
|
-
declare function hashString(data: string | Buffer, length: number): Buffer;
|
|
67
|
+
declare function defaultZipFile(buffer: Buffer, targetFilePath: string): Promise<void>;
|
|
80
68
|
|
|
81
|
-
export {
|
|
69
|
+
export { defaultZipFile, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromPreload, getPathFromPublic, isDev, isLinux, isMac, isWin, loadPage, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BrowserWindow } from 'electron';
|
|
2
|
-
export {
|
|
3
|
-
export { d as
|
|
2
|
+
export { c as aesDecrypt, a as aesEncrypt, b as defaultSignature, d as defaultUnzipFile, e as defaultVerify, h as hashBuffer } from './unzip-JjYLjJkH.js';
|
|
3
|
+
export { a as UpdateInfo, U as UpdateJSON, V as Version, d as defaultIsLowerVersion, b as defaultVersionJsonGenerator, h as handleUnexpectedErrors, i as isUpdateJSON, p as parseVersion } from './version-CemSHimT.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* compile time dev check
|
|
@@ -54,11 +54,6 @@ declare function singleInstance(window?: BrowserWindow): boolean;
|
|
|
54
54
|
* @param dirName dir name, default to `data`
|
|
55
55
|
*/
|
|
56
56
|
declare function setPortableAppDataPath(dirName?: string): void;
|
|
57
|
-
/**
|
|
58
|
-
* ensure app is ready.
|
|
59
|
-
* @param timeout wait timeout, @default 1000
|
|
60
|
-
*/
|
|
61
|
-
declare function waitAppReady(timeout?: number): Promise<void>;
|
|
62
57
|
/**
|
|
63
58
|
* load `process.env.VITE_DEV_SERVER_URL` when dev, else load html file
|
|
64
59
|
* @param win window
|
|
@@ -69,13 +64,6 @@ declare function getPathFromPreload(...paths: string[]): string;
|
|
|
69
64
|
declare function getPathFromPublic(...paths: string[]): string;
|
|
70
65
|
declare function getPathFromEntryAsar(...paths: string[]): string;
|
|
71
66
|
|
|
72
|
-
declare function
|
|
73
|
-
|
|
74
|
-
declare function unzipFile(gzipPath: string, targetFilePath?: string): Promise<void>;
|
|
75
|
-
|
|
76
|
-
declare function encrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
77
|
-
declare function signature(buffer: Buffer, privateKey: string, cert: string, version: string): string;
|
|
78
|
-
|
|
79
|
-
declare function hashString(data: string | Buffer, length: number): Buffer;
|
|
67
|
+
declare function defaultZipFile(buffer: Buffer, targetFilePath: string): Promise<void>;
|
|
80
68
|
|
|
81
|
-
export {
|
|
69
|
+
export { defaultZipFile, disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromPreload, getPathFromPublic, isDev, isLinux, isMac, isWin, loadPage, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance };
|
package/dist/utils.js
CHANGED
|
@@ -1,62 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
parseVersion,
|
|
21
|
-
requireNative,
|
|
22
|
-
restartApp,
|
|
23
|
-
setAppUserModelId,
|
|
24
|
-
setPortableAppDataPath,
|
|
25
|
-
signature,
|
|
26
|
-
singleInstance,
|
|
27
|
-
unzipFile,
|
|
28
|
-
verifySignatureDefault,
|
|
29
|
-
waitAppReady,
|
|
30
|
-
zipFile
|
|
31
|
-
} from "./chunk-BG22XZAB.js";
|
|
32
|
-
export {
|
|
33
|
-
decrypt,
|
|
34
|
-
disableHWAccForWin7,
|
|
35
|
-
encrypt,
|
|
36
|
-
getAppVersion,
|
|
37
|
-
getEntryVersion,
|
|
38
|
-
getPathFromAppNameAsar,
|
|
39
|
-
getPathFromEntryAsar,
|
|
40
|
-
getPathFromPreload,
|
|
41
|
-
getPathFromPublic,
|
|
42
|
-
handleUnexpectedErrors,
|
|
43
|
-
hashString,
|
|
44
|
-
isDev,
|
|
45
|
-
isLinux,
|
|
46
|
-
isLowerVersionDefault,
|
|
47
|
-
isMac,
|
|
48
|
-
isUpdateJSON,
|
|
49
|
-
isWin,
|
|
50
|
-
loadPage,
|
|
51
|
-
parseVersion,
|
|
52
|
-
requireNative,
|
|
53
|
-
restartApp,
|
|
54
|
-
setAppUserModelId,
|
|
55
|
-
setPortableAppDataPath,
|
|
56
|
-
signature,
|
|
57
|
-
singleInstance,
|
|
58
|
-
unzipFile,
|
|
59
|
-
verifySignatureDefault,
|
|
60
|
-
waitAppReady,
|
|
61
|
-
zipFile
|
|
62
|
-
};
|
|
1
|
+
export { disableHWAccForWin7, getAppVersion, getEntryVersion, getPathFromAppNameAsar, getPathFromEntryAsar, getPathFromPreload, getPathFromPublic, isDev, isLinux, isMac, isWin, loadPage, requireNative, restartApp, setAppUserModelId, setPortableAppDataPath, singleInstance } from './chunk-PNYRQYFC.js';
|
|
2
|
+
export { aesDecrypt, aesEncrypt, defaultSignature, defaultUnzipFile, defaultVerify, hashBuffer } from './chunk-5WFXC5GU.js';
|
|
3
|
+
export { defaultIsLowerVersion, defaultVersionJsonGenerator, handleUnexpectedErrors, isUpdateJSON, parseVersion } from './chunk-BVFQWBLK.js';
|
|
4
|
+
import { writeFileSync } from 'node:fs';
|
|
5
|
+
import { brotliCompress } from 'node:zlib';
|
|
6
|
+
|
|
7
|
+
async function defaultZipFile(buffer, targetFilePath) {
|
|
8
|
+
return new Promise((resolve, reject) => {
|
|
9
|
+
brotliCompress(buffer, (err, buffer2) => {
|
|
10
|
+
if (err) {
|
|
11
|
+
reject(err);
|
|
12
|
+
}
|
|
13
|
+
writeFileSync(targetFilePath, buffer2);
|
|
14
|
+
resolve();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { defaultZipFile };
|
|
@@ -11,7 +11,7 @@ interface Version {
|
|
|
11
11
|
stageVersion: number;
|
|
12
12
|
}
|
|
13
13
|
declare function parseVersion(version: string): Version;
|
|
14
|
-
declare function
|
|
14
|
+
declare function defaultIsLowerVersion(oldVer: string, newVer: string): boolean;
|
|
15
15
|
/**
|
|
16
16
|
* update info json
|
|
17
17
|
*/
|
|
@@ -28,5 +28,6 @@ type UpdateJSON = UpdateInfo & {
|
|
|
28
28
|
beta: UpdateInfo;
|
|
29
29
|
};
|
|
30
30
|
declare function isUpdateJSON(json: any): json is UpdateJSON;
|
|
31
|
+
declare function defaultVersionJsonGenerator(existingJson: UpdateJSON, buffer: Buffer, signature: string, version: string, minimumVersion: string): UpdateJSON;
|
|
31
32
|
|
|
32
|
-
export { type UpdateJSON as U, type Version as V, type UpdateInfo as a,
|
|
33
|
+
export { type UpdateJSON as U, type Version as V, type UpdateInfo as a, defaultVersionJsonGenerator as b, defaultIsLowerVersion as d, handleUnexpectedErrors as h, isUpdateJSON as i, parseVersion as p };
|
|
@@ -11,7 +11,7 @@ interface Version {
|
|
|
11
11
|
stageVersion: number;
|
|
12
12
|
}
|
|
13
13
|
declare function parseVersion(version: string): Version;
|
|
14
|
-
declare function
|
|
14
|
+
declare function defaultIsLowerVersion(oldVer: string, newVer: string): boolean;
|
|
15
15
|
/**
|
|
16
16
|
* update info json
|
|
17
17
|
*/
|
|
@@ -28,5 +28,6 @@ type UpdateJSON = UpdateInfo & {
|
|
|
28
28
|
beta: UpdateInfo;
|
|
29
29
|
};
|
|
30
30
|
declare function isUpdateJSON(json: any): json is UpdateJSON;
|
|
31
|
+
declare function defaultVersionJsonGenerator(existingJson: UpdateJSON, buffer: Buffer, signature: string, version: string, minimumVersion: string): UpdateJSON;
|
|
31
32
|
|
|
32
|
-
export { type UpdateJSON as U, type Version as V, type UpdateInfo as a,
|
|
33
|
+
export { type UpdateJSON as U, type Version as V, type UpdateInfo as a, defaultVersionJsonGenerator as b, defaultIsLowerVersion as d, handleUnexpectedErrors as h, isUpdateJSON as i, parseVersion as p };
|