@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 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
@@ -49,6 +49,7 @@ if (Array.isArray(options.forward)) {
49
49
  });
50
50
  }
51
51
  new client_1.Client({
52
+ agent: `${name}@${version}`,
52
53
  hostname: options.host,
53
54
  secure: !options.nonSecure,
54
55
  tunnels,
package/dist/client.d.ts CHANGED
@@ -7,6 +7,7 @@ export interface TunnelOptions {
7
7
  removeHostHeader?: boolean;
8
8
  }
9
9
  export interface ClientConnectionOptions {
10
+ agent?: string;
10
11
  hostname: string;
11
12
  secure?: boolean;
12
13
  apiKey: string;
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 ws = new ws_1.default(`${protocol}://${this.options.hostname}/api/tunnel?${qs}`, {
21
- headers: {
22
- authorization: `Bearer ${this.options.apiKey}`,
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nora-link/client",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "noralink.eu client",
5
5
  "bin": {
6
6
  "noralink": "dist/cli.js"
package/src/cli.ts CHANGED
@@ -54,6 +54,7 @@ if (Array.isArray(options.forward)) {
54
54
  }
55
55
 
56
56
  new Client({
57
+ agent: `${name}@${version}`,
57
58
  hostname: options.host,
58
59
  secure: !options.nonSecure,
59
60
  tunnels,
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
- const ws = new WebSocket(`${protocol}://${this.options.hostname}/api/tunnel?${qs}`, {
37
- headers: {
38
- authorization: `Bearer ${this.options.apiKey}`,
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`);