Skip to content

Commit

Permalink
fix(updater): Use escaped installer path to start the nsis updater (#…
Browse files Browse the repository at this point in the history
…727)

Port of v1 change: tauri-apps/tauri#7956

Committed via a GitHub action: https://github.com/tauri-apps/plugins-workspace/actions/runs/6877612128

Co-authored-by: amrbashir <[email protected]>
  • Loading branch information
2 people authored and tauri-bot committed Nov 15, 2023
1 parent f193547 commit 78d3202
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 181 deletions.
61 changes: 61 additions & 0 deletions dist-js/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
'use strict';

var primitives = require('@tauri-apps/api/primitives');

// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
class WebSocket {
constructor(id, listeners) {
this.id = id;
this.listeners = listeners;
}
static async connect(url, config) {
const listeners = [];
const onMessage = new primitives.Channel();
onMessage.onmessage = (message) => {
listeners.forEach((l) => l(message));
};
if (config?.headers) {
config.headers = Array.from(new Headers(config.headers).entries());
}
return await primitives.invoke("plugin:websocket|connect", {
url,
onMessage,
config,
}).then((id) => new WebSocket(id, listeners));
}
addListener(cb) {
this.listeners.push(cb);
}
async send(message) {
let m;
if (typeof message === "string") {
m = { type: "Text", data: message };
}
else if (typeof message === "object" && "type" in message) {
m = message;
}
else if (Array.isArray(message)) {
m = { type: "Binary", data: message };
}
else {
throw new Error("invalid `message` type, expected a `{ type: string, data: any }` object, a string or a numeric array");
}
return await primitives.invoke("plugin:websocket|send", {
id: this.id,
message: m,
});
}
async disconnect() {
return await this.send({
type: "Close",
data: {
code: 1000,
reason: "Disconnected by client",
},
});
}
}

module.exports = WebSocket;
3 changes: 1 addition & 2 deletions dist-js/index.mjs → dist-js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class WebSocket {
onMessage.onmessage = (message) => {
listeners.forEach((l) => l(message));
};
if (config === null || config === void 0 ? void 0 : config.headers) {
if (config?.headers) {
config.headers = Array.from(new Headers(config.headers).entries());
}
return await invoke("plugin:websocket|connect", {
Expand Down Expand Up @@ -57,4 +57,3 @@ class WebSocket {
}

export { WebSocket as default };
//# sourceMappingURL=index.mjs.map
155 changes: 0 additions & 155 deletions dist-js/index.min.js

This file was deleted.

1 change: 0 additions & 1 deletion dist-js/index.min.js.map

This file was deleted.

Loading

0 comments on commit 78d3202

Please sign in to comment.