signalk-pelora 0.3.0 → 0.3.1

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
@@ -18,7 +18,7 @@ nothing is sent anywhere but that address.
18
18
  2. On the Signal K server: **App Store** → search `signalk-pelora` → install →
19
19
  restart the server.
20
20
  3. **Server → Plugin Config → Pelora**: paste the Pelora URL (for example
21
- `https://yourcompany.signalnav.io`), the beacon id and the secret. Enable
21
+ `https://yourcompany.signalnav.io`, the address only), the beacon id and the secret. Enable
22
22
  and submit.
23
23
  4. Back in Pelora, the Engines & data page shows the device as seen within a
24
24
  minute, and engine hours after the first counters upload (one minute).
package/index.js CHANGED
@@ -19,7 +19,7 @@ module.exports = function (app) {
19
19
  properties: {
20
20
  peloraUrl: {
21
21
  type: 'string', title: 'Pelora URL',
22
- description: 'Your Pelora address, for example https://yourcompany.signalnav.io',
22
+ description: 'Your Pelora address only, for example https://yourcompany.signalnav.io (no /api/v1 on the end)',
23
23
  },
24
24
  beaconId: {
25
25
  type: 'string', title: 'Beacon id',
package/lib/transport.js CHANGED
@@ -27,7 +27,9 @@ function httpRequest(url, { method, headers, body, timeoutMs }) {
27
27
 
28
28
  class Transport {
29
29
  constructor(options) {
30
- this.baseUrl = String(options.baseUrl || '').replace(/\/+$/, '');
30
+ // The site address only. A URL pasted with /api/v1 on the end used to
31
+ // post to /api/v1/api/v1/..., which 404s and drops every batch.
32
+ this.baseUrl = String(options.baseUrl || '').trim().replace(/\/+$/, '').replace(/\/api\/v1$/i, '');
31
33
  this.beaconId = options.beaconId;
32
34
  this.secret = options.secret;
33
35
  this.timeoutMs = options.timeoutMs || 10000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signalk-pelora",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Sends engine hours, engine alarms, position and conditions from a Signal K server to Pelora, the fleet and yacht maintenance platform by SignalNav.",
5
5
  "main": "index.js",
6
6
  "scripts": {