signalk-siparu 0.2.5 → 0.2.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-siparu",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Kept aboard, proven ashore. An impartial, timestamped record of every voyage: position, wind, depth and logbook, written on the boat and readable from anywhere. A read-only Signal K plugin with a built-in dashboard.",
5
5
  "keywords": [
6
6
  "signalk-node-server-plugin",
@@ -29,6 +29,7 @@ export declare class Uplink {
29
29
  private lastSentTs;
30
30
  private failures;
31
31
  private rejected;
32
+ private unentitled;
32
33
  private lastError;
33
34
  constructor(deps: UplinkDeps);
34
35
  start(): void;
@@ -44,6 +44,7 @@ class Uplink {
44
44
  lastSentTs = null;
45
45
  failures = 0;
46
46
  rejected = false;
47
+ unentitled = false;
47
48
  lastError = null;
48
49
  constructor(deps) {
49
50
  this.deps = deps;
@@ -69,7 +70,7 @@ class Uplink {
69
70
  lastSentTs: this.lastSentTs,
70
71
  failures: this.failures,
71
72
  rejected: this.rejected,
72
- unentitled: false,
73
+ unentitled: this.unentitled,
73
74
  lastError: this.lastError
74
75
  };
75
76
  }
@@ -77,6 +78,7 @@ class Uplink {
77
78
  this.lastSentTs = null;
78
79
  this.failures = 0;
79
80
  this.rejected = false;
81
+ this.unentitled = false;
80
82
  this.lastError = null;
81
83
  }
82
84
  schedule(delayMs) {
@@ -126,14 +128,18 @@ class Uplink {
126
128
  this.lastSentTs = Date.now();
127
129
  this.failures = 0;
128
130
  this.rejected = false;
131
+ this.unentitled = false;
129
132
  this.lastError = null;
130
133
  return;
131
134
  }
132
135
  this.failures++;
133
136
  this.rejected = res.status === 401;
137
+ this.unentitled = res.status === 403;
134
138
  this.lastError = this.rejected
135
139
  ? 'Siparu no longer recognises this boat. Pair her again.'
136
- : `Relay refused the frame (${res.status}).`;
140
+ : this.unentitled
141
+ ? 'Remote watching is not active on this account. She is recording as usual, and starts sending again when it is.'
142
+ : `Relay refused the frame (${res.status}).`;
137
143
  this.deps.debug(`uplink: ${this.lastError}`);
138
144
  }
139
145
  catch (e) {