@nora-link/client 1.0.3 → 1.0.4
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 +1 -1
- package/dist/cli.js +1 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +7 -5
- package/package.json +1 -1
- package/src/cli.ts +1 -0
- package/src/client.ts +10 -5
package/README.md
CHANGED
|
@@ -30,6 +30,6 @@ You can acess the tunnel by navigating to [https://noralink.eu/home](https://nor
|
|
|
30
30
|
|
|
31
31
|
## Available subdomains
|
|
32
32
|
|
|
33
|
-
Currently only a subset of subdomains are available to use with your own tunnels, from the following: *admin, api, app, control, dashboard, home, my, nodered*.
|
|
33
|
+
Currently only a subset of subdomains are available to use with your own tunnels, from the following: *admin, api, app, control, dashboard, home, my, nodered, smarthome, test*.
|
|
34
34
|
|
|
35
35
|
If you want a new subdomain, add a request here: [Request a new subdomain thread](https://github.com/andrei-tatar/nora-link-client/issues/1).
|
package/dist/cli.js
CHANGED
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -17,11 +17,13 @@ class Client {
|
|
|
17
17
|
const qs = (0, node_querystring_1.stringify)({ s: segments });
|
|
18
18
|
this.options.logger?.info(`[nora-link] connecting`);
|
|
19
19
|
const protocol = this.options.secure ? 'wss' : 'ws';
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const headers = {
|
|
21
|
+
authorization: `Bearer ${this.options.apiKey}`,
|
|
22
|
+
...(this.options.agent ? {
|
|
23
|
+
'user-agent': this.options.agent,
|
|
24
|
+
} : {}),
|
|
25
|
+
};
|
|
26
|
+
const ws = new ws_1.default(`${protocol}://${this.options.hostname}/api/tunnel?${qs}`, { headers });
|
|
25
27
|
ws.on('open', () => {
|
|
26
28
|
this.options.logger?.info(`[nora-link] connected`);
|
|
27
29
|
observer.next(ws);
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
package/src/client.ts
CHANGED
|
@@ -17,6 +17,7 @@ export interface TunnelOptions {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export interface ClientConnectionOptions {
|
|
20
|
+
agent?: string;
|
|
20
21
|
hostname: string;
|
|
21
22
|
secure?: boolean;
|
|
22
23
|
apiKey: string;
|
|
@@ -33,11 +34,15 @@ export class Client {
|
|
|
33
34
|
const qs = querystringStringify({ s: segments });
|
|
34
35
|
this.options.logger?.info(`[nora-link] connecting`);
|
|
35
36
|
const protocol = this.options.secure ? 'wss' : 'ws';
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
|
|
38
|
+
const headers = {
|
|
39
|
+
authorization: `Bearer ${this.options.apiKey}`,
|
|
40
|
+
...(this.options.agent ? {
|
|
41
|
+
'user-agent': this.options.agent,
|
|
42
|
+
} : {}),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const ws = new WebSocket(`${protocol}://${this.options.hostname}/api/tunnel?${qs}`, { headers });
|
|
41
46
|
|
|
42
47
|
ws.on('open', () => {
|
|
43
48
|
this.options.logger?.info(`[nora-link] connected`);
|