electron-incremental-update 2.0.0-beta.1 → 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/README.md +3 -3
- 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 +147 -196
- package/dist/index.d.cts +40 -43
- package/dist/index.d.ts +40 -43
- package/dist/index.js +124 -128
- package/dist/provider.cjs +92 -117
- package/dist/provider.d.cts +38 -12
- package/dist/provider.d.ts +38 -12
- package/dist/provider.js +56 -38
- package/dist/{types-seJf3Wbc.d.ts → types-DxhNaNgR.d.ts} +21 -7
- package/dist/{types-DxPmQmaq.d.cts → types-Tequ_V2o.d.cts} +21 -7
- package/dist/unzip-JjYLjJkH.d.cts +9 -0
- package/dist/unzip-JjYLjJkH.d.ts +9 -0
- package/dist/utils.cjs +119 -183
- 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 +135 -156
- package/package.json +10 -10
- package/dist/chunk-RSLOPAIZ.js +0 -247
- package/dist/decrypt-BNBcodiO.d.cts +0 -4
- package/dist/decrypt-BNBcodiO.d.ts +0 -4
package/dist/utils.cjs
CHANGED
|
@@ -1,168 +1,106 @@
|
|
|
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) {
|
|
37
|
+
electron.app.setAppUserModelId(id ?? `org.${electron.app.name}`);
|
|
38
|
+
}
|
|
81
39
|
}
|
|
82
40
|
function disableHWAccForWin7() {
|
|
83
|
-
if (
|
|
84
|
-
|
|
41
|
+
if (__require("os").release().startsWith("6.1")) {
|
|
42
|
+
electron.app.disableHardwareAcceleration();
|
|
85
43
|
}
|
|
86
44
|
}
|
|
87
45
|
function singleInstance(window) {
|
|
88
|
-
const result =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
window
|
|
92
|
-
|
|
93
|
-
window.
|
|
46
|
+
const result = electron.app.requestSingleInstanceLock();
|
|
47
|
+
if (result) {
|
|
48
|
+
electron.app.on("second-instance", () => {
|
|
49
|
+
if (window) {
|
|
50
|
+
window.show();
|
|
51
|
+
if (window.isMinimized()) {
|
|
52
|
+
window.restore();
|
|
53
|
+
}
|
|
54
|
+
window.focus();
|
|
94
55
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
electron.app.quit();
|
|
59
|
+
}
|
|
98
60
|
return result;
|
|
99
61
|
}
|
|
100
62
|
function setPortableAppDataPath(dirName = "data") {
|
|
101
|
-
const portablePath =
|
|
102
|
-
if (!
|
|
103
|
-
|
|
63
|
+
const portablePath = path.join(path.dirname(electron.app.getPath("exe")), dirName);
|
|
64
|
+
if (!fs.existsSync(portablePath)) {
|
|
65
|
+
fs.mkdirSync(portablePath);
|
|
104
66
|
}
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
function waitAppReady(timeout = 1e3) {
|
|
108
|
-
return import_electron.app.isReady() ? Promise.resolve() : new Promise((resolve, reject) => {
|
|
109
|
-
const _ = setTimeout(() => {
|
|
110
|
-
reject(new Error("app is not ready"));
|
|
111
|
-
}, timeout);
|
|
112
|
-
import_electron.app.whenReady().then(() => {
|
|
113
|
-
clearTimeout(_);
|
|
114
|
-
resolve();
|
|
115
|
-
});
|
|
116
|
-
});
|
|
67
|
+
electron.app.setPath("appData", portablePath);
|
|
117
68
|
}
|
|
118
69
|
function loadPage(win, htmlFilePath = "index.html") {
|
|
119
|
-
|
|
70
|
+
if (isDev) {
|
|
71
|
+
win.loadURL(process.env.VITE_DEV_SERVER_URL + htmlFilePath);
|
|
72
|
+
} else {
|
|
73
|
+
win.loadFile(getPathFromAppNameAsar("renderer", htmlFilePath));
|
|
74
|
+
}
|
|
120
75
|
}
|
|
121
76
|
function getPathFromPreload(...paths) {
|
|
122
|
-
return isDev ?
|
|
77
|
+
return isDev ? path.join(electron.app.getAppPath(), __EIU_ELECTRON_DIST_PATH__, "preload", ...paths) : getPathFromAppNameAsar("preload", ...paths);
|
|
123
78
|
}
|
|
124
79
|
function getPathFromPublic(...paths) {
|
|
125
|
-
return isDev ?
|
|
80
|
+
return isDev ? path.join(electron.app.getAppPath(), "public", ...paths) : getPathFromAppNameAsar("renderer", ...paths);
|
|
126
81
|
}
|
|
127
82
|
function getPathFromEntryAsar(...paths) {
|
|
128
|
-
return
|
|
83
|
+
return path.join(electron.app.getAppPath(), __EIU_ENTRY_DIST_PATH__, ...paths);
|
|
129
84
|
}
|
|
130
|
-
|
|
131
|
-
// src/utils/zip.ts
|
|
132
|
-
var import_node_fs2 = require("fs");
|
|
133
|
-
var import_node_zlib = require("zlib");
|
|
134
|
-
async function zipFile(filePath, targetFilePath = `${filePath}.gz`) {
|
|
135
|
-
if (!(0, import_node_fs2.existsSync)(filePath)) {
|
|
136
|
-
throw new Error(`path to be zipped not exist: ${filePath}`);
|
|
137
|
-
}
|
|
138
|
-
const buffer = (0, import_node_fs2.readFileSync)(filePath);
|
|
85
|
+
async function defaultZipFile(buffer, targetFilePath) {
|
|
139
86
|
return new Promise((resolve, reject) => {
|
|
140
|
-
|
|
87
|
+
zlib.brotliCompress(buffer, (err, buffer2) => {
|
|
141
88
|
if (err) {
|
|
142
89
|
reject(err);
|
|
143
90
|
}
|
|
144
|
-
|
|
145
|
-
resolve(
|
|
91
|
+
fs.writeFileSync(targetFilePath, buffer2);
|
|
92
|
+
resolve();
|
|
146
93
|
});
|
|
147
94
|
});
|
|
148
95
|
}
|
|
149
|
-
|
|
150
|
-
// src/utils/unzip.ts
|
|
151
|
-
var import_node_fs3 = require("fs");
|
|
152
|
-
var import_node_zlib2 = require("zlib");
|
|
153
|
-
async function unzipFile(gzipPath, targetFilePath = gzipPath.slice(0, -3)) {
|
|
154
|
-
if (!(0, import_node_fs3.existsSync)(gzipPath)) {
|
|
155
|
-
throw new Error(`path to zipped file not exist: ${gzipPath}`);
|
|
156
|
-
}
|
|
157
|
-
const compressedBuffer = (0, import_node_fs3.readFileSync)(gzipPath);
|
|
96
|
+
async function defaultUnzipFile(buffer, targetFilePath) {
|
|
158
97
|
return new Promise((resolve, reject) => {
|
|
159
|
-
|
|
160
|
-
(0, import_node_fs3.rmSync)(gzipPath);
|
|
98
|
+
zlib.brotliDecompress(buffer, (err, buffer2) => {
|
|
161
99
|
if (err) {
|
|
162
100
|
reject(err);
|
|
163
101
|
}
|
|
164
|
-
|
|
165
|
-
resolve(
|
|
102
|
+
fs.writeFileSync(targetFilePath, buffer2);
|
|
103
|
+
resolve();
|
|
166
104
|
});
|
|
167
105
|
});
|
|
168
106
|
}
|
|
@@ -195,7 +133,7 @@ function parseVersion(version) {
|
|
|
195
133
|
}
|
|
196
134
|
return ret;
|
|
197
135
|
}
|
|
198
|
-
function
|
|
136
|
+
function defaultIsLowerVersion(oldVer, newVer) {
|
|
199
137
|
const oldV = parseVersion(oldVer);
|
|
200
138
|
const newV = parseVersion(newVer);
|
|
201
139
|
function compareStrings(str1, str2) {
|
|
@@ -219,75 +157,73 @@ function isUpdateJSON(json) {
|
|
|
219
157
|
const is = (j) => !!(j && j.minimumVersion && j.signature && j.size && j.version);
|
|
220
158
|
return is(json) && is(json?.beta);
|
|
221
159
|
}
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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");
|
|
230
177
|
return Buffer.from(hash).subarray(0, length);
|
|
231
178
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
return
|
|
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");
|
|
182
|
+
}
|
|
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");
|
|
239
190
|
}
|
|
240
|
-
function
|
|
191
|
+
function defaultVerify(buffer, signature, cert) {
|
|
241
192
|
try {
|
|
242
|
-
const [sig, version] =
|
|
243
|
-
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");
|
|
244
195
|
return result ? version : void 0;
|
|
245
|
-
} catch
|
|
196
|
+
} catch {
|
|
246
197
|
return void 0;
|
|
247
198
|
}
|
|
248
199
|
}
|
|
249
200
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
isUpdateJSON,
|
|
280
|
-
isWin,
|
|
281
|
-
loadPage,
|
|
282
|
-
parseVersion,
|
|
283
|
-
requireNative,
|
|
284
|
-
restartApp,
|
|
285
|
-
setAppUserModelId,
|
|
286
|
-
setPortableAppDataPath,
|
|
287
|
-
signature,
|
|
288
|
-
singleInstance,
|
|
289
|
-
unzipFile,
|
|
290
|
-
verifySignatureDefault,
|
|
291
|
-
waitAppReady,
|
|
292
|
-
zipFile
|
|
293
|
-
});
|
|
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<unknown>;
|
|
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<unknown>;
|
|
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-RSLOPAIZ.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 };
|