@tauri-apps/plugin-updater 3.0.0-alpha.2 → 3.0.0-alpha.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-js/index.cjs +13 -11
- package/dist-js/index.js +13 -11
- package/package.json +2 -2
package/dist-js/index.cjs
CHANGED
|
@@ -65,7 +65,6 @@ class Update extends core.Resource {
|
|
|
65
65
|
* @param options The headers and the timeout to use for the download request.
|
|
66
66
|
*/
|
|
67
67
|
async download(onEvent, options) {
|
|
68
|
-
convertToRustHeaders(options);
|
|
69
68
|
const channel = new core.Channel();
|
|
70
69
|
if (onEvent) {
|
|
71
70
|
channel.onmessage = onEvent;
|
|
@@ -73,8 +72,12 @@ class Update extends core.Resource {
|
|
|
73
72
|
const downloadedBytesRid = await core.invoke('plugin:updater|download', {
|
|
74
73
|
onEvent: channel,
|
|
75
74
|
rid: this.rid,
|
|
76
|
-
...options
|
|
75
|
+
...options,
|
|
76
|
+
headers: toRustHeaders(options?.headers)
|
|
77
77
|
});
|
|
78
|
+
// release the bytes of a previous download, which would otherwise be kept
|
|
79
|
+
// in memory until the webview is destroyed
|
|
80
|
+
await this.downloadedBytes?.close().catch(() => { });
|
|
78
81
|
this.downloadedBytes = new core.Resource(downloadedBytesRid);
|
|
79
82
|
}
|
|
80
83
|
/**
|
|
@@ -134,7 +137,6 @@ class Update extends core.Resource {
|
|
|
134
137
|
* @param options The headers and the timeout to use for the download request, and the installation options.
|
|
135
138
|
*/
|
|
136
139
|
async downloadAndInstall(onEvent, options) {
|
|
137
|
-
convertToRustHeaders(options);
|
|
138
140
|
const channel = new core.Channel();
|
|
139
141
|
if (onEvent) {
|
|
140
142
|
channel.onmessage = onEvent;
|
|
@@ -142,7 +144,8 @@ class Update extends core.Resource {
|
|
|
142
144
|
await core.invoke('plugin:updater|download_and_install', {
|
|
143
145
|
onEvent: channel,
|
|
144
146
|
rid: this.rid,
|
|
145
|
-
...options
|
|
147
|
+
...options,
|
|
148
|
+
headers: toRustHeaders(options?.headers)
|
|
146
149
|
});
|
|
147
150
|
}
|
|
148
151
|
/**
|
|
@@ -184,19 +187,18 @@ class Update extends core.Resource {
|
|
|
184
187
|
* @since 2.0.0
|
|
185
188
|
*/
|
|
186
189
|
async function check(options) {
|
|
187
|
-
convertToRustHeaders(options);
|
|
188
190
|
const metadata = await core.invoke('plugin:updater|check', {
|
|
189
|
-
...options
|
|
191
|
+
...options,
|
|
192
|
+
headers: toRustHeaders(options?.headers)
|
|
190
193
|
});
|
|
191
194
|
return metadata ? new Update(metadata) : null;
|
|
192
195
|
}
|
|
193
196
|
/**
|
|
194
|
-
* Converts
|
|
197
|
+
* Converts headers to an {@linkcode Array<[string, string]>}, which is what the Rust side expects,
|
|
198
|
+
* without modifying the caller's options.
|
|
195
199
|
*/
|
|
196
|
-
function
|
|
197
|
-
|
|
198
|
-
options.headers = Array.from(new Headers(options.headers).entries());
|
|
199
|
-
}
|
|
200
|
+
function toRustHeaders(headers) {
|
|
201
|
+
return headers ? Array.from(new Headers(headers).entries()) : undefined;
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
exports.Update = Update;
|
package/dist-js/index.js
CHANGED
|
@@ -63,7 +63,6 @@ class Update extends Resource {
|
|
|
63
63
|
* @param options The headers and the timeout to use for the download request.
|
|
64
64
|
*/
|
|
65
65
|
async download(onEvent, options) {
|
|
66
|
-
convertToRustHeaders(options);
|
|
67
66
|
const channel = new Channel();
|
|
68
67
|
if (onEvent) {
|
|
69
68
|
channel.onmessage = onEvent;
|
|
@@ -71,8 +70,12 @@ class Update extends Resource {
|
|
|
71
70
|
const downloadedBytesRid = await invoke('plugin:updater|download', {
|
|
72
71
|
onEvent: channel,
|
|
73
72
|
rid: this.rid,
|
|
74
|
-
...options
|
|
73
|
+
...options,
|
|
74
|
+
headers: toRustHeaders(options?.headers)
|
|
75
75
|
});
|
|
76
|
+
// release the bytes of a previous download, which would otherwise be kept
|
|
77
|
+
// in memory until the webview is destroyed
|
|
78
|
+
await this.downloadedBytes?.close().catch(() => { });
|
|
76
79
|
this.downloadedBytes = new Resource(downloadedBytesRid);
|
|
77
80
|
}
|
|
78
81
|
/**
|
|
@@ -132,7 +135,6 @@ class Update extends Resource {
|
|
|
132
135
|
* @param options The headers and the timeout to use for the download request, and the installation options.
|
|
133
136
|
*/
|
|
134
137
|
async downloadAndInstall(onEvent, options) {
|
|
135
|
-
convertToRustHeaders(options);
|
|
136
138
|
const channel = new Channel();
|
|
137
139
|
if (onEvent) {
|
|
138
140
|
channel.onmessage = onEvent;
|
|
@@ -140,7 +142,8 @@ class Update extends Resource {
|
|
|
140
142
|
await invoke('plugin:updater|download_and_install', {
|
|
141
143
|
onEvent: channel,
|
|
142
144
|
rid: this.rid,
|
|
143
|
-
...options
|
|
145
|
+
...options,
|
|
146
|
+
headers: toRustHeaders(options?.headers)
|
|
144
147
|
});
|
|
145
148
|
}
|
|
146
149
|
/**
|
|
@@ -182,19 +185,18 @@ class Update extends Resource {
|
|
|
182
185
|
* @since 2.0.0
|
|
183
186
|
*/
|
|
184
187
|
async function check(options) {
|
|
185
|
-
convertToRustHeaders(options);
|
|
186
188
|
const metadata = await invoke('plugin:updater|check', {
|
|
187
|
-
...options
|
|
189
|
+
...options,
|
|
190
|
+
headers: toRustHeaders(options?.headers)
|
|
188
191
|
});
|
|
189
192
|
return metadata ? new Update(metadata) : null;
|
|
190
193
|
}
|
|
191
194
|
/**
|
|
192
|
-
* Converts
|
|
195
|
+
* Converts headers to an {@linkcode Array<[string, string]>}, which is what the Rust side expects,
|
|
196
|
+
* without modifying the caller's options.
|
|
193
197
|
*/
|
|
194
|
-
function
|
|
195
|
-
|
|
196
|
-
options.headers = Array.from(new Headers(options.headers).entries());
|
|
197
|
-
}
|
|
198
|
+
function toRustHeaders(headers) {
|
|
199
|
+
return headers ? Array.from(new Headers(headers).entries()) : undefined;
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
export { Update, check };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-updater",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.3",
|
|
4
4
|
"license": "MIT OR Apache-2.0",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Tauri Programme within The Commons Conservancy"
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
"LICENSE"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tauri-apps/api": "^3.0.0-alpha.
|
|
27
|
+
"@tauri-apps/api": "^3.0.0-alpha.2"
|
|
28
28
|
}
|
|
29
29
|
}
|