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/provider.d.cts
CHANGED
|
@@ -1,37 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { d as defaultIsLowerVersion, U as UpdateJSON, a as UpdateInfo } from './version-CemSHimT.cjs';
|
|
2
|
+
import { I as IProvider, D as DownloadingInfo, U as URLHandler, O as OnDownloading } from './types-Tequ_V2o.cjs';
|
|
3
|
+
import { e as defaultVerify, d as defaultUnzipFile } from './unzip-JjYLjJkH.cjs';
|
|
4
4
|
import '@subframe7536/type-utils';
|
|
5
5
|
|
|
6
|
+
declare abstract class BaseProvider implements IProvider {
|
|
7
|
+
name: string;
|
|
8
|
+
isLowerVersion: typeof defaultIsLowerVersion;
|
|
9
|
+
verifySignaure: typeof defaultVerify;
|
|
10
|
+
unzipFile: typeof defaultUnzipFile;
|
|
11
|
+
abstract downloadJSON(versionPath: string): Promise<UpdateJSON>;
|
|
12
|
+
abstract downloadAsar(name: string, info: UpdateInfo, onDownloading?: (info: DownloadingInfo) => void): Promise<Buffer>;
|
|
13
|
+
}
|
|
14
|
+
|
|
6
15
|
interface GitHubProviderOptions {
|
|
7
16
|
/**
|
|
8
17
|
* github repo root url
|
|
9
|
-
* @example 'https://github.com/electron/electron'
|
|
18
|
+
* @example 'https://github.com/electron/electron/'
|
|
10
19
|
*/
|
|
11
20
|
url: string;
|
|
21
|
+
/**
|
|
22
|
+
* extra headers
|
|
23
|
+
*/
|
|
12
24
|
extraHeaders?: Record<string, string>;
|
|
13
25
|
/**
|
|
14
26
|
* custom url handler
|
|
15
27
|
*
|
|
16
|
-
* for Github, there are some {@link https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js#
|
|
28
|
+
* for Github, there are some {@link https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js#L40 public CDN links}
|
|
29
|
+
* @example
|
|
30
|
+
* (url, isDownloadAsar) => {
|
|
31
|
+
* if (isDownloadAsar) {
|
|
32
|
+
* url.hostname = 'mirror.ghproxy.com'
|
|
33
|
+
* url.pathname = 'https://github.com' + url.pathname
|
|
34
|
+
* return url
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
17
37
|
*/
|
|
18
38
|
urlHandler?: URLHandler;
|
|
19
39
|
}
|
|
20
|
-
declare class GitHubProvider
|
|
40
|
+
declare class GitHubProvider extends BaseProvider {
|
|
21
41
|
private ua;
|
|
22
42
|
name: string;
|
|
23
43
|
urlHandler?: URLHandler;
|
|
24
44
|
private url;
|
|
25
45
|
private extraHeaders?;
|
|
46
|
+
/**
|
|
47
|
+
* Update Provider for Github repo
|
|
48
|
+
* - download update json from `https://raw.githubusercontent.com/{user}/{repo}/HEAD/{versionPath}`
|
|
49
|
+
* - download update asar from `https://github.com/{user}/{repo}/releases/download/v{version}/{name}-{version}.asar.gz`
|
|
50
|
+
*
|
|
51
|
+
* you can setup `urlHandler` in {@link GitHubProviderOptions} or `Updater` to modify url before request
|
|
52
|
+
* @param options provider options
|
|
53
|
+
*/
|
|
26
54
|
constructor(options: GitHubProviderOptions);
|
|
27
55
|
private parseURL;
|
|
28
|
-
isLowerVersion: typeof isLowerVersionDefault;
|
|
29
|
-
verifySignaure: typeof verifySignatureDefault;
|
|
30
56
|
downloadJSON(versionPath: string): Promise<UpdateJSON>;
|
|
31
|
-
|
|
57
|
+
downloadAsar(name: string, { version, size }: UpdateInfo, onDownloading?: (info: DownloadingInfo) => void): Promise<Buffer>;
|
|
32
58
|
}
|
|
33
59
|
|
|
34
|
-
declare function
|
|
35
|
-
declare function
|
|
60
|
+
declare function defaultDownloadUpdateJSON(url: string, headers: Record<string, any>): Promise<UpdateJSON>;
|
|
61
|
+
declare function defaultDownloadAsar(url: string, headers: Record<string, any>, total: number, onDownloading?: OnDownloading): Promise<Buffer>;
|
|
36
62
|
|
|
37
|
-
export { DownloadingInfo, GitHubProvider, type GitHubProviderOptions, IProvider, OnDownloading, URLHandler,
|
|
63
|
+
export { BaseProvider, DownloadingInfo, GitHubProvider, type GitHubProviderOptions, IProvider, OnDownloading, URLHandler, defaultDownloadAsar, defaultDownloadUpdateJSON };
|
package/dist/provider.d.ts
CHANGED
|
@@ -1,37 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { d as defaultIsLowerVersion, U as UpdateJSON, a as UpdateInfo } from './version-CemSHimT.js';
|
|
2
|
+
import { I as IProvider, D as DownloadingInfo, U as URLHandler, O as OnDownloading } from './types-DxhNaNgR.js';
|
|
3
|
+
import { e as defaultVerify, d as defaultUnzipFile } from './unzip-JjYLjJkH.js';
|
|
4
4
|
import '@subframe7536/type-utils';
|
|
5
5
|
|
|
6
|
+
declare abstract class BaseProvider implements IProvider {
|
|
7
|
+
name: string;
|
|
8
|
+
isLowerVersion: typeof defaultIsLowerVersion;
|
|
9
|
+
verifySignaure: typeof defaultVerify;
|
|
10
|
+
unzipFile: typeof defaultUnzipFile;
|
|
11
|
+
abstract downloadJSON(versionPath: string): Promise<UpdateJSON>;
|
|
12
|
+
abstract downloadAsar(name: string, info: UpdateInfo, onDownloading?: (info: DownloadingInfo) => void): Promise<Buffer>;
|
|
13
|
+
}
|
|
14
|
+
|
|
6
15
|
interface GitHubProviderOptions {
|
|
7
16
|
/**
|
|
8
17
|
* github repo root url
|
|
9
|
-
* @example 'https://github.com/electron/electron'
|
|
18
|
+
* @example 'https://github.com/electron/electron/'
|
|
10
19
|
*/
|
|
11
20
|
url: string;
|
|
21
|
+
/**
|
|
22
|
+
* extra headers
|
|
23
|
+
*/
|
|
12
24
|
extraHeaders?: Record<string, string>;
|
|
13
25
|
/**
|
|
14
26
|
* custom url handler
|
|
15
27
|
*
|
|
16
|
-
* for Github, there are some {@link https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js#
|
|
28
|
+
* for Github, there are some {@link https://github.com/XIU2/UserScript/blob/master/GithubEnhanced-High-Speed-Download.user.js#L40 public CDN links}
|
|
29
|
+
* @example
|
|
30
|
+
* (url, isDownloadAsar) => {
|
|
31
|
+
* if (isDownloadAsar) {
|
|
32
|
+
* url.hostname = 'mirror.ghproxy.com'
|
|
33
|
+
* url.pathname = 'https://github.com' + url.pathname
|
|
34
|
+
* return url
|
|
35
|
+
* }
|
|
36
|
+
* }
|
|
17
37
|
*/
|
|
18
38
|
urlHandler?: URLHandler;
|
|
19
39
|
}
|
|
20
|
-
declare class GitHubProvider
|
|
40
|
+
declare class GitHubProvider extends BaseProvider {
|
|
21
41
|
private ua;
|
|
22
42
|
name: string;
|
|
23
43
|
urlHandler?: URLHandler;
|
|
24
44
|
private url;
|
|
25
45
|
private extraHeaders?;
|
|
46
|
+
/**
|
|
47
|
+
* Update Provider for Github repo
|
|
48
|
+
* - download update json from `https://raw.githubusercontent.com/{user}/{repo}/HEAD/{versionPath}`
|
|
49
|
+
* - download update asar from `https://github.com/{user}/{repo}/releases/download/v{version}/{name}-{version}.asar.gz`
|
|
50
|
+
*
|
|
51
|
+
* you can setup `urlHandler` in {@link GitHubProviderOptions} or `Updater` to modify url before request
|
|
52
|
+
* @param options provider options
|
|
53
|
+
*/
|
|
26
54
|
constructor(options: GitHubProviderOptions);
|
|
27
55
|
private parseURL;
|
|
28
|
-
isLowerVersion: typeof isLowerVersionDefault;
|
|
29
|
-
verifySignaure: typeof verifySignatureDefault;
|
|
30
56
|
downloadJSON(versionPath: string): Promise<UpdateJSON>;
|
|
31
|
-
|
|
57
|
+
downloadAsar(name: string, { version, size }: UpdateInfo, onDownloading?: (info: DownloadingInfo) => void): Promise<Buffer>;
|
|
32
58
|
}
|
|
33
59
|
|
|
34
|
-
declare function
|
|
35
|
-
declare function
|
|
60
|
+
declare function defaultDownloadUpdateJSON(url: string, headers: Record<string, any>): Promise<UpdateJSON>;
|
|
61
|
+
declare function defaultDownloadAsar(url: string, headers: Record<string, any>, total: number, onDownloading?: OnDownloading): Promise<Buffer>;
|
|
36
62
|
|
|
37
|
-
export { DownloadingInfo, GitHubProvider, type GitHubProviderOptions, IProvider, OnDownloading, URLHandler,
|
|
63
|
+
export { BaseProvider, DownloadingInfo, GitHubProvider, type GitHubProviderOptions, IProvider, OnDownloading, URLHandler, defaultDownloadAsar, defaultDownloadUpdateJSON };
|
package/dist/provider.js
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
verifySignatureDefault,
|
|
5
|
-
waitAppReady
|
|
6
|
-
} from "./chunk-RSLOPAIZ.js";
|
|
1
|
+
import { defaultVerify, defaultUnzipFile } from './chunk-5WFXC5GU.js';
|
|
2
|
+
import { defaultIsLowerVersion, isUpdateJSON } from './chunk-BVFQWBLK.js';
|
|
3
|
+
import { app, net } from 'electron';
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
async function downlaodFn(url, headers, onResponse) {
|
|
11
|
-
await waitAppReady();
|
|
5
|
+
async function downloadFn(url, headers, onResponse) {
|
|
6
|
+
await app.whenReady();
|
|
12
7
|
return new Promise((resolve, reject) => {
|
|
13
8
|
const request = net.request({ url, method: "GET", redirect: "follow" });
|
|
14
9
|
Object.keys(headers).forEach((key) => request.setHeader(key, headers[key]));
|
|
@@ -21,8 +16,8 @@ async function downlaodFn(url, headers, onResponse) {
|
|
|
21
16
|
request.end();
|
|
22
17
|
});
|
|
23
18
|
}
|
|
24
|
-
async function
|
|
25
|
-
return await
|
|
19
|
+
async function defaultDownloadUpdateJSON(url, headers) {
|
|
20
|
+
return await downloadFn(url, headers, (resp, resolve, reject) => {
|
|
26
21
|
let data = "";
|
|
27
22
|
resp.on("data", (chunk) => data += chunk);
|
|
28
23
|
resp.on("end", () => {
|
|
@@ -33,66 +28,89 @@ async function downloadUpdateJSONDefault(url, headers) {
|
|
|
33
28
|
} else {
|
|
34
29
|
throw Error;
|
|
35
30
|
}
|
|
36
|
-
} catch
|
|
31
|
+
} catch {
|
|
37
32
|
reject(new Error("invalid update json"));
|
|
38
33
|
}
|
|
39
34
|
});
|
|
40
35
|
});
|
|
41
36
|
}
|
|
42
|
-
async function
|
|
43
|
-
let
|
|
44
|
-
|
|
37
|
+
async function defaultDownloadAsar(url, headers, total, onDownloading) {
|
|
38
|
+
let transferred = 0;
|
|
39
|
+
let time = Date.now();
|
|
40
|
+
return await downloadFn(url, headers, (resp, resolve) => {
|
|
45
41
|
let data = [];
|
|
46
42
|
resp.on("data", (chunk) => {
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
transferred += chunk.length;
|
|
44
|
+
const current = Date.now();
|
|
45
|
+
onDownloading?.({
|
|
46
|
+
percent: +(transferred / total).toFixed(2) * 100,
|
|
47
|
+
total,
|
|
48
|
+
transferred,
|
|
49
|
+
delta: chunk.length,
|
|
50
|
+
bps: chunk.length / ((current - time) * 1e3)
|
|
51
|
+
});
|
|
52
|
+
time = current;
|
|
49
53
|
data.push(chunk);
|
|
50
54
|
});
|
|
51
55
|
resp.on("end", () => resolve(Buffer.concat(data)));
|
|
52
56
|
});
|
|
53
57
|
}
|
|
54
58
|
|
|
59
|
+
// src/provider/base.ts
|
|
60
|
+
var BaseProvider = class {
|
|
61
|
+
name = "BaseProvider";
|
|
62
|
+
isLowerVersion = defaultIsLowerVersion;
|
|
63
|
+
verifySignaure = defaultVerify;
|
|
64
|
+
unzipFile = defaultUnzipFile;
|
|
65
|
+
};
|
|
66
|
+
|
|
55
67
|
// src/provider/github.ts
|
|
56
|
-
var GitHubProvider = class {
|
|
68
|
+
var GitHubProvider = class extends BaseProvider {
|
|
57
69
|
ua = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36";
|
|
58
70
|
name = "GithubProvider";
|
|
59
71
|
urlHandler;
|
|
60
72
|
url;
|
|
61
73
|
extraHeaders;
|
|
74
|
+
/**
|
|
75
|
+
* Update Provider for Github repo
|
|
76
|
+
* - download update json from `https://raw.githubusercontent.com/{user}/{repo}/HEAD/{versionPath}`
|
|
77
|
+
* - download update asar from `https://github.com/{user}/{repo}/releases/download/v{version}/{name}-{version}.asar.gz`
|
|
78
|
+
*
|
|
79
|
+
* you can setup `urlHandler` in {@link GitHubProviderOptions} or `Updater` to modify url before request
|
|
80
|
+
* @param options provider options
|
|
81
|
+
*/
|
|
62
82
|
constructor(options) {
|
|
63
|
-
|
|
83
|
+
super();
|
|
64
84
|
this.extraHeaders = options.extraHeaders;
|
|
65
85
|
this.urlHandler = options.urlHandler;
|
|
66
|
-
if (
|
|
86
|
+
if (!options.url.startsWith("https://github.com")) {
|
|
67
87
|
throw new Error(`${this.name}: invalid github url: ${options.url}`);
|
|
68
88
|
}
|
|
69
|
-
|
|
70
|
-
|
|
89
|
+
this.url = options.url;
|
|
90
|
+
if (!this.url.endsWith("/")) {
|
|
91
|
+
this.url += "/";
|
|
71
92
|
}
|
|
72
93
|
}
|
|
73
|
-
parseURL(isDownloadAsar,
|
|
74
|
-
const
|
|
75
|
-
|
|
94
|
+
async parseURL(isDownloadAsar, extraPath) {
|
|
95
|
+
const _url = new URL(this.url);
|
|
96
|
+
_url.hostname = isDownloadAsar ? "github.com" : "raw.githubusercontent.com";
|
|
97
|
+
_url.pathname += extraPath;
|
|
98
|
+
return (await this.urlHandler?.(_url, isDownloadAsar) || _url).toString();
|
|
76
99
|
}
|
|
77
|
-
isLowerVersion = isLowerVersionDefault;
|
|
78
|
-
verifySignaure = verifySignatureDefault;
|
|
79
100
|
async downloadJSON(versionPath) {
|
|
80
|
-
return await
|
|
81
|
-
this.parseURL(false, `HEAD/${versionPath}`),
|
|
101
|
+
return await defaultDownloadUpdateJSON(
|
|
102
|
+
await this.parseURL(false, `HEAD/${versionPath}`),
|
|
82
103
|
{ userAgent: this.ua, accept: "application/json", ...this.extraHeaders }
|
|
83
104
|
);
|
|
84
105
|
}
|
|
85
|
-
async
|
|
86
|
-
return await
|
|
87
|
-
this.parseURL(true, `releases/download/v${version}/${name}-${version}.asar.gz`),
|
|
106
|
+
async downloadAsar(name, { version, size }, onDownloading) {
|
|
107
|
+
return await defaultDownloadAsar(
|
|
108
|
+
await this.parseURL(true, `releases/download/v${version}/${name}-${version}.asar.gz`),
|
|
88
109
|
{ userAgent: this.ua, accept: "application/octet-stream", ...this.extraHeaders },
|
|
89
110
|
size,
|
|
90
111
|
onDownloading
|
|
91
112
|
);
|
|
92
113
|
}
|
|
93
114
|
};
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
downloadAsarBufferDefault,
|
|
97
|
-
downloadUpdateJSONDefault
|
|
98
|
-
};
|
|
115
|
+
|
|
116
|
+
export { BaseProvider, GitHubProvider, defaultDownloadAsar, defaultDownloadUpdateJSON };
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { Promisable } from '@subframe7536/type-utils';
|
|
2
|
-
import { U as UpdateJSON, a as UpdateInfo } from './version-
|
|
2
|
+
import { U as UpdateJSON, a as UpdateInfo } from './version-CemSHimT.js';
|
|
3
3
|
|
|
4
|
-
type URLHandler = (url:
|
|
4
|
+
type URLHandler = (url: URL, isDownloadAsar: boolean) => Promisable<URL | string | undefined | null>;
|
|
5
5
|
type OnDownloading = (progress: DownloadingInfo) => void;
|
|
6
6
|
interface DownloadingInfo {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* download delta
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
delta: number;
|
|
11
|
+
/**
|
|
12
|
+
* downloaded percent, 0 ~ 100
|
|
13
|
+
*/
|
|
14
|
+
percent: number;
|
|
11
15
|
/**
|
|
12
16
|
* total size
|
|
13
17
|
*/
|
|
@@ -15,7 +19,11 @@ interface DownloadingInfo {
|
|
|
15
19
|
/**
|
|
16
20
|
* downloaded size
|
|
17
21
|
*/
|
|
18
|
-
|
|
22
|
+
transferred: number;
|
|
23
|
+
/**
|
|
24
|
+
* download speed, bytes per second
|
|
25
|
+
*/
|
|
26
|
+
bps: number;
|
|
19
27
|
}
|
|
20
28
|
interface IProvider {
|
|
21
29
|
/**
|
|
@@ -40,14 +48,20 @@ interface IProvider {
|
|
|
40
48
|
* @param updateInfo existing update info
|
|
41
49
|
* @param onDownloading hook for on downloading
|
|
42
50
|
*/
|
|
43
|
-
|
|
51
|
+
downloadAsar: (name: string, updateInfo: UpdateInfo, onDownloading?: (info: DownloadingInfo) => void) => Promise<Buffer>;
|
|
44
52
|
/**
|
|
45
53
|
* compare version
|
|
46
54
|
* @param oldVer old version string
|
|
47
55
|
* @param newVer new version string
|
|
48
56
|
* @returns if version1 < version2
|
|
49
57
|
*/
|
|
50
|
-
isLowerVersion: (oldVer: string, newVer: string) =>
|
|
58
|
+
isLowerVersion: (oldVer: string, newVer: string) => boolean;
|
|
59
|
+
/**
|
|
60
|
+
* unzip file
|
|
61
|
+
* @param buffer source buffer
|
|
62
|
+
* @param targetFilePath target file path
|
|
63
|
+
*/
|
|
64
|
+
unzipFile: (buffer: Buffer, targetFilePath: string) => Promise<void>;
|
|
51
65
|
/**
|
|
52
66
|
* verify asar signature
|
|
53
67
|
* @param buffer file buffer
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import { Promisable } from '@subframe7536/type-utils';
|
|
2
|
-
import { U as UpdateJSON, a as UpdateInfo } from './version-
|
|
2
|
+
import { U as UpdateJSON, a as UpdateInfo } from './version-CemSHimT.cjs';
|
|
3
3
|
|
|
4
|
-
type URLHandler = (url:
|
|
4
|
+
type URLHandler = (url: URL, isDownloadAsar: boolean) => Promisable<URL | string | undefined | null>;
|
|
5
5
|
type OnDownloading = (progress: DownloadingInfo) => void;
|
|
6
6
|
interface DownloadingInfo {
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* download delta
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
delta: number;
|
|
11
|
+
/**
|
|
12
|
+
* downloaded percent, 0 ~ 100
|
|
13
|
+
*/
|
|
14
|
+
percent: number;
|
|
11
15
|
/**
|
|
12
16
|
* total size
|
|
13
17
|
*/
|
|
@@ -15,7 +19,11 @@ interface DownloadingInfo {
|
|
|
15
19
|
/**
|
|
16
20
|
* downloaded size
|
|
17
21
|
*/
|
|
18
|
-
|
|
22
|
+
transferred: number;
|
|
23
|
+
/**
|
|
24
|
+
* download speed, bytes per second
|
|
25
|
+
*/
|
|
26
|
+
bps: number;
|
|
19
27
|
}
|
|
20
28
|
interface IProvider {
|
|
21
29
|
/**
|
|
@@ -40,14 +48,20 @@ interface IProvider {
|
|
|
40
48
|
* @param updateInfo existing update info
|
|
41
49
|
* @param onDownloading hook for on downloading
|
|
42
50
|
*/
|
|
43
|
-
|
|
51
|
+
downloadAsar: (name: string, updateInfo: UpdateInfo, onDownloading?: (info: DownloadingInfo) => void) => Promise<Buffer>;
|
|
44
52
|
/**
|
|
45
53
|
* compare version
|
|
46
54
|
* @param oldVer old version string
|
|
47
55
|
* @param newVer new version string
|
|
48
56
|
* @returns if version1 < version2
|
|
49
57
|
*/
|
|
50
|
-
isLowerVersion: (oldVer: string, newVer: string) =>
|
|
58
|
+
isLowerVersion: (oldVer: string, newVer: string) => boolean;
|
|
59
|
+
/**
|
|
60
|
+
* unzip file
|
|
61
|
+
* @param buffer source buffer
|
|
62
|
+
* @param targetFilePath target file path
|
|
63
|
+
*/
|
|
64
|
+
unzipFile: (buffer: Buffer, targetFilePath: string) => Promise<void>;
|
|
51
65
|
/**
|
|
52
66
|
* verify asar signature
|
|
53
67
|
* @param buffer file buffer
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function hashBuffer(data: string | Buffer, length: number): Buffer;
|
|
2
|
+
declare function aesEncrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
3
|
+
declare function defaultSignature(buffer: Buffer, privateKey: string, cert: string, version: string): string;
|
|
4
|
+
declare function aesDecrypt(encryptedText: string, key: Buffer, iv: Buffer): string;
|
|
5
|
+
declare function defaultVerify(buffer: Buffer, signature: string, cert: string): string | undefined;
|
|
6
|
+
|
|
7
|
+
declare function defaultUnzipFile(buffer: Buffer, targetFilePath: string): Promise<void>;
|
|
8
|
+
|
|
9
|
+
export { aesEncrypt as a, defaultSignature as b, aesDecrypt as c, defaultUnzipFile as d, defaultVerify as e, hashBuffer as h };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function hashBuffer(data: string | Buffer, length: number): Buffer;
|
|
2
|
+
declare function aesEncrypt(plainText: string, key: Buffer, iv: Buffer): string;
|
|
3
|
+
declare function defaultSignature(buffer: Buffer, privateKey: string, cert: string, version: string): string;
|
|
4
|
+
declare function aesDecrypt(encryptedText: string, key: Buffer, iv: Buffer): string;
|
|
5
|
+
declare function defaultVerify(buffer: Buffer, signature: string, cert: string): string | undefined;
|
|
6
|
+
|
|
7
|
+
declare function defaultUnzipFile(buffer: Buffer, targetFilePath: string): Promise<void>;
|
|
8
|
+
|
|
9
|
+
export { aesEncrypt as a, defaultSignature as b, aesDecrypt as c, defaultUnzipFile as d, defaultVerify as e, hashBuffer as h };
|