@ircam/comote-helpers 0.1.1 → 0.2.0
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/package.json +1 -1
- package/qrcode.js +19 -4
package/package.json
CHANGED
package/qrcode.js
CHANGED
|
@@ -25,15 +25,30 @@ function formatConfigToLink(config) {
|
|
|
25
25
|
|
|
26
26
|
if (config.ws) {
|
|
27
27
|
const {
|
|
28
|
+
protocol,
|
|
28
29
|
hostname,
|
|
29
|
-
port
|
|
30
|
-
|
|
30
|
+
port,
|
|
31
|
+
pathname
|
|
32
|
+
} = config.ws; // build valid url
|
|
33
|
+
// only hostname is required
|
|
31
34
|
|
|
32
|
-
if (!hostname
|
|
35
|
+
if (!hostname) {
|
|
33
36
|
throw new Error(`Invalid WebSocket config: ${config.ws}`);
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
let url = `ws-url=`;
|
|
40
|
+
url += protocol == 'ws' || protocol == 'wss' ? `${protocol}://` : `ws://`;
|
|
41
|
+
url += hostname;
|
|
42
|
+
|
|
43
|
+
if (port) {
|
|
44
|
+
url += `:${port}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (pathname) {
|
|
48
|
+
url += pathname;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
query.push(url); // autostart
|
|
37
52
|
|
|
38
53
|
if (config.ws.autostart === true) {
|
|
39
54
|
query.push(`ws-enable=1`);
|