@signalk/freeboard-sk 2.19.6 → 2.19.8

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/freeboard-sk",
3
- "version": "2.19.6",
3
+ "version": "2.19.8",
4
4
  "description": "Openlayers chart plotter implementation for Signal K",
5
5
  "keywords": [
6
6
  "signalk-webapp",
@@ -42,6 +42,7 @@
42
42
  "dependencies": {
43
43
  "@signalk/server-api": "^2.9.0",
44
44
  "geolib": "^3.3.3",
45
+ "google-protobuf": "^4.0.1",
45
46
  "tslib": "^2.0.0",
46
47
  "uuid": "^11.1.0"
47
48
  },
@@ -69,6 +70,7 @@
69
70
  "@types/xml2js": "^0.4.14",
70
71
  "@typescript-eslint/eslint-plugin": "^8.46.3",
71
72
  "@typescript-eslint/parser": "^8.46.3",
73
+ "baseline-browser-mapping": "^2.9.18",
72
74
  "buffer": "^6.0.3",
73
75
  "eslint": "^9.17.0",
74
76
  "events": "^3.3.0",
@@ -80,7 +82,7 @@
80
82
  "karma-jasmine-html-reporter": "~2.1.0",
81
83
  "ng-packagr": "^21.0.0",
82
84
  "ngeohash": "^0.6.3",
83
- "ol": "^10.2.1",
85
+ "ol": "^10.7.0",
84
86
  "ol-mapbox-style": "^12.3.5",
85
87
  "pmtiles": "^2.7.0",
86
88
  "prettier": "^3.6.2",
@@ -196,7 +196,7 @@ const handleDeltaMessage = (delta) => {
196
196
  });
197
197
  });
198
198
  };
199
- const initAlarmEndpoints = () => {
199
+ const initAlarmEndpoints = async () => {
200
200
  server.debug(`** Registering Alarm Action API endpoint(s) **`);
201
201
  // list area alarms
202
202
  server.get(`${ALARM_API_PATH}/area`, async (req, res, next) => {
@@ -348,96 +348,100 @@ const initAlarmEndpoints = () => {
348
348
  });
349
349
  }
350
350
  });
351
- // standard alarms
352
- server.post(`${ALARM_API_PATH}/:alarmType`, (req, res, next) => {
353
- server.debug(`** ${req.method} ${ALARM_API_PATH}/${req.params.alarmType}`);
354
- if (!STANDARD_ALARMS.includes(req.params.alarmType)) {
355
- next();
356
- return;
357
- }
358
- try {
359
- const id = uuid.v4();
360
- const msg = req.body.message
361
- ? req.body.message
362
- : req.params.alarmType;
363
- const r = handleAlarm('vessels.self', `notifications.${req.params.alarmType}.${id}`, Object.assign({
364
- message: msg,
365
- method: [server_api_1.ALARM_METHOD.sound, server_api_1.ALARM_METHOD.visual],
366
- state: server_api_1.ALARM_STATE.emergency
367
- }, buildAlarmData()));
368
- res.status(r.statusCode).json(Object.assign(r, { id: id }));
369
- }
370
- catch (e) {
371
- res.status(400).json({
372
- state: 'FAILED',
373
- statusCode: 400,
374
- message: e.message
375
- });
376
- }
377
- });
378
- server.post(`${ALARM_API_PATH}/:alarmType/:id/silence`, (req, res) => {
379
- server.debug(`** ${req.method} ${req.path}`);
380
- if (!STANDARD_ALARMS.includes(req.params.alarmType)) {
381
- res.status(200).json({
382
- state: 'COMPLETED',
383
- statusCode: 200,
384
- message: `Unsupported Alarm (${req.params.alarmType}).`
385
- });
386
- return;
387
- }
388
- try {
389
- const al = server.getSelfPath(`notifications.${req.params.alarmType}.${req.params.id}`);
390
- if (al && al.value) {
391
- server.debug('Alarm value....');
392
- if (al.value.method && al.value.method.includes('sound')) {
393
- server.debug('Alarm has sound... silence!!!');
394
- al.value.method = al.value.method.filter((i) => i !== 'sound');
395
- const r = handleAlarm('vessels.self', `notifications.${req.params.alarmType}.${req.params.id}`, al.value);
396
- res.status(r.statusCode).json(r);
351
+ const f = await server.getFeatures();
352
+ // test for notifications API
353
+ if (!f.apis.includes('notifications')) {
354
+ // standard alarms
355
+ server.post(`${ALARM_API_PATH}/:alarmType`, (req, res, next) => {
356
+ server.debug(`** ${req.method} ${ALARM_API_PATH}/${req.params.alarmType}`);
357
+ if (!STANDARD_ALARMS.includes(req.params.alarmType)) {
358
+ next();
359
+ return;
360
+ }
361
+ try {
362
+ const id = uuid.v4();
363
+ const msg = req.body.message
364
+ ? req.body.message
365
+ : req.params.alarmType;
366
+ const r = handleAlarm('vessels.self', `notifications.${req.params.alarmType}.${id}`, Object.assign({
367
+ message: msg,
368
+ method: [server_api_1.ALARM_METHOD.sound, server_api_1.ALARM_METHOD.visual],
369
+ state: server_api_1.ALARM_STATE.emergency
370
+ }, buildAlarmData()));
371
+ res.status(r.statusCode).json(Object.assign(r, { id: id }));
372
+ }
373
+ catch (e) {
374
+ res.status(400).json({
375
+ state: 'FAILED',
376
+ statusCode: 400,
377
+ message: e.message
378
+ });
379
+ }
380
+ });
381
+ server.post(`${ALARM_API_PATH}/:alarmType/:id/silence`, (req, res) => {
382
+ server.debug(`** ${req.method} ${req.path}`);
383
+ if (!STANDARD_ALARMS.includes(req.params.alarmType)) {
384
+ res.status(200).json({
385
+ state: 'COMPLETED',
386
+ statusCode: 200,
387
+ message: `Unsupported Alarm (${req.params.alarmType}).`
388
+ });
389
+ return;
390
+ }
391
+ try {
392
+ const al = server.getSelfPath(`notifications.${req.params.alarmType}.${req.params.id}`);
393
+ if (al && al.value) {
394
+ server.debug('Alarm value....');
395
+ if (al.value.method && al.value.method.includes('sound')) {
396
+ server.debug('Alarm has sound... silence!!!');
397
+ al.value.method = al.value.method.filter((i) => i !== 'sound');
398
+ const r = handleAlarm('vessels.self', `notifications.${req.params.alarmType}.${req.params.id}`, al.value);
399
+ res.status(r.statusCode).json(r);
400
+ }
401
+ else {
402
+ server.debug('Alarm has no sound... no action required.');
403
+ res.status(200).json({
404
+ state: 'COMPLETED',
405
+ statusCode: 200,
406
+ message: `Alarm (${req.params.alarmType}) is already silent.`
407
+ });
408
+ }
397
409
  }
398
410
  else {
399
- server.debug('Alarm has no sound... no action required.');
400
- res.status(200).json({
401
- state: 'COMPLETED',
402
- statusCode: 200,
403
- message: `Alarm (${req.params.alarmType}) is already silent.`
404
- });
411
+ throw new Error(`Alarm (${req.params.alarmType}.${req.params.id}) has no value or was not found!`);
405
412
  }
406
413
  }
407
- else {
408
- throw new Error(`Alarm (${req.params.alarmType}.${req.params.id}) has no value or was not found!`);
414
+ catch (e) {
415
+ res.status(400).json({
416
+ state: 'FAILED',
417
+ statusCode: 400,
418
+ message: e.message
419
+ });
409
420
  }
410
- }
411
- catch (e) {
412
- res.status(400).json({
413
- state: 'FAILED',
414
- statusCode: 400,
415
- message: e.message
416
- });
417
- }
418
- });
419
- server.delete(`${ALARM_API_PATH}/:alarmType/:id`, (req, res, next) => {
420
- server.debug(`** ${req.method} ${ALARM_API_PATH}/${req.params.alarmType}`);
421
- if (!STANDARD_ALARMS.includes(req.params.alarmType)) {
422
- next();
423
- return;
424
- }
425
- try {
426
- const r = handleAlarm('vessels.self', `notifications.${req.params.alarmType}.${req.params.id}`, {
427
- message: '',
428
- method: [],
429
- state: server_api_1.ALARM_STATE.normal
430
- });
431
- res.status(r.statusCode).json(r);
432
- }
433
- catch (e) {
434
- res.status(400).json({
435
- state: 'FAILED',
436
- statusCode: 400,
437
- message: e.message
438
- });
439
- }
440
- });
421
+ });
422
+ server.delete(`${ALARM_API_PATH}/:alarmType/:id`, (req, res, next) => {
423
+ server.debug(`** ${req.method} ${ALARM_API_PATH}/${req.params.alarmType}`);
424
+ if (!STANDARD_ALARMS.includes(req.params.alarmType)) {
425
+ next();
426
+ return;
427
+ }
428
+ try {
429
+ const r = handleAlarm('vessels.self', `notifications.${req.params.alarmType}.${req.params.id}`, {
430
+ message: '',
431
+ method: [],
432
+ state: server_api_1.ALARM_STATE.normal
433
+ });
434
+ res.status(r.statusCode).json(r);
435
+ }
436
+ catch (e) {
437
+ res.status(400).json({
438
+ state: 'FAILED',
439
+ statusCode: 400,
440
+ message: e.message
441
+ });
442
+ }
443
+ });
444
+ }
441
445
  };
442
446
  const handleV1PutRequest = (context, path, value, cb) => {
443
447
  cb(handleAlarm(context, path, value));
@@ -552,7 +556,8 @@ const validateAreaBody = (body) => {
552
556
  * @returns true if valid
553
557
  */
554
558
  const isValidPosition = (position) => {
555
- return 'latitude' in position &&
559
+ return position &&
560
+ 'latitude' in position &&
556
561
  'longitude' in position &&
557
562
  typeof position.latitude === 'number' &&
558
563
  position.latitude >= -90 &&
package/plugin/index.js CHANGED
@@ -49,7 +49,8 @@ module.exports = (server) => {
49
49
  settings.alarms = options.alarms ?? {
50
50
  enable: true
51
51
  };
52
- settings.alarms.enable = true;
52
+ // const f = await server.getFeatures();
53
+ settings.alarms.enable = true; //!f.apis.includes('notifications' as any);
53
54
  server.debug(`Applied config: ${JSON.stringify(settings)}`);
54
55
  if (settings.alarms.enable) {
55
56
  (0, alarms_1.initAlarms)(server, plugin.id);
@@ -1470,6 +1470,40 @@ The above copyright notice and this permission notice shall be included in all c
1470
1470
 
1471
1471
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1472
1472
 
1473
+ --------------------------------------------------------------------------------
1474
+ Package: google-protobuf
1475
+ License: "(BSD-3-Clause AND Apache-2.0)"
1476
+
1477
+ BSD 3-Clause License
1478
+
1479
+ Copyright (c) 2022, Google Inc.
1480
+ All rights reserved.
1481
+
1482
+ Redistribution and use in source and binary forms, with or without
1483
+ modification, are permitted provided that the following conditions are met:
1484
+
1485
+ 1. Redistributions of source code must retain the above copyright notice, this
1486
+ list of conditions and the following disclaimer.
1487
+
1488
+ 2. Redistributions in binary form must reproduce the above copyright notice,
1489
+ this list of conditions and the following disclaimer in the documentation
1490
+ and/or other materials provided with the distribution.
1491
+
1492
+ 3. Neither the name of the copyright holder nor the names of its
1493
+ contributors may be used to endorse or promote products derived from
1494
+ this software without specific prior written permission.
1495
+
1496
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1497
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1498
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1499
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
1500
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1501
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1502
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1503
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1504
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1505
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1506
+
1473
1507
  --------------------------------------------------------------------------------
1474
1508
  Package: zone.js
1475
1509
  License: "MIT"
@@ -569,7 +569,7 @@
569
569
  can set a destination in the following ways:
570
570
  <ol>
571
571
  <li>
572
- <b>Activate a Route:</b> Once activaed select a point along the
572
+ <b>Activate a Route:</b> Once activated, select a point along the
573
573
  route.
574
574
  </li>
575
575
  <li><b>Go To Waypoint:</b> Select a waypoint as a destination.</li>
@@ -879,9 +879,18 @@
879
879
  <div style="padding-left: 20px">
880
880
  <ul>
881
881
  <li>
882
- <b>Set the destination point:</b> If displayed route is the
883
- <i>Active Route</i>, click a point to set it as the current
884
- destination along the route.
882
+ <i class="material-icons">near_me</i
883
+ ><b>Nearest:</b> Activate the route starting at the point
884
+ nearest the vessel.
885
+ </li>
886
+ <li>
887
+ <i class="material-icons">clear_all</i
888
+ ><b>Clear:</b> De-activate the route.
889
+ </li>
890
+ <li>
891
+ <b>Start at / Set the selected point:</b>
892
+ Click <i class="material-icons">near_me</i> next to the
893
+ point to set as the current destination along the route.
885
894
  </li>
886
895
  <li>
887
896
  <b>Re-order points:</b> Use the handle to drag points to a
@@ -902,7 +911,7 @@
902
911
  can add, edit or delete notes.
903
912
  </li>
904
913
  <li>
905
- <b>Activate: </b> Clicking
914
+ <b>Start: </b> Clicking
906
915
  <i class="material-icons">near_me</i> sends a message to the
907
916
  server to set this route as the <i>Active Route</i>.<br />
908
917
  The start of the route is set as the current destination.
@@ -0,0 +1,4 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M10.278 7.84254C10.824 7.6164 11.4091 7.5 12.0001 7.5C12.591 7.5 13.1762 7.6164 13.7222 7.84254C14.5196 8.17284 15 8.5 15.7123 9.34826L13.4491 11.6115C13.5827 12.1119 13.4533 12.668 13.0607 13.0606C12.4749 13.6464 11.5251 13.6464 10.9393 13.0606C10.3536 12.4749 10.3536 11.5251 10.9393 10.9393C11.3319 10.5468 11.8879 10.4173 12.3883 10.5509L13.5236 9.41563C13.4032 9.34468 13.2778 9.28206 13.1481 9.22836C12.7842 9.0776 12.3941 9 12.0001 9C11.6061 9 11.216 9.0776 10.852 9.22836C10.4881 9.37913 10.1574 9.6001 9.87878 9.87868L8.81812 8.81802C9.23598 8.40016 9.73206 8.06869 10.278 7.84254Z" fill="#1F1F1F"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M8.5 2L2.10608 4.74025C1.7384 4.89783 1.5 5.25937 1.5 5.6594V20.4835C1.5 21.2014 2.23405 21.6854 2.89392 21.4026L8.5 19L15.5 22L21.8939 19.2597C22.2616 19.1022 22.5 18.7406 22.5 18.3406V3.32573C22.5 2.66135 21.8641 2.18169 21.2253 2.36421L15.5 4L8.5 2ZM7.75 3.95338L3 5.98909V19.7252L7.33037 17.8693C5.60552 16.4952 4.5 14.3767 4.5 12C4.5 9.43576 5.78686 7.17209 7.75 5.81955V3.95338ZM9.25 6.66591C8.6936 6.95334 8.18794 7.32527 7.75 7.76473C6.66854 8.84993 6 10.3469 6 12C6 13.6531 6.66854 15.1501 7.75 16.2353C8.18794 16.6747 8.6936 17.0467 9.25 17.3341C10.0738 17.7597 11.0088 18 12 18C12.9912 18 13.9262 17.7597 14.75 17.3341C15.3064 17.0467 15.8121 16.6747 16.25 16.2353C17.3315 15.1501 18 13.6531 18 12C18 10.3469 17.3315 8.84993 16.25 7.76473C15.8121 7.32527 15.3064 6.95334 14.75 6.66591C13.9262 6.24033 12.9912 6 12 6C11.0088 6 10.0738 6.24033 9.25 6.66591ZM11.7991 4.50264C10.9012 4.52624 10.0426 4.70767 9.25 5.0202V3.77431L11.7991 4.50264ZM16.25 5.81955C18.2131 7.17209 19.5 9.43576 19.5 12C19.5 14.5642 18.2131 16.8279 16.25 18.1804V20.0466L21 18.0109V3.98859L16.25 5.34574V5.81955ZM14.75 18.9798C14.2682 19.1698 13.762 19.3113 13.2375 19.3984L14.75 20.0466V18.9798Z" fill="#1F1F1F"/>
4
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1C18.0751 1 23 5.92487 23 12ZM21.5 12C21.5 17.2467 17.2467 21.5 12 21.5C6.75329 21.5 2.5 17.2467 2.5 12C2.5 6.75329 6.75329 2.5 12 2.5C14.3534 2.5 16.5069 3.35575 18.1664 4.77305L17.1017 5.83773C16.4879 5.32954 15.8004 4.915 15.0616 4.60896C14.091 4.20693 13.0507 4 12.0001 4C10.9495 4 9.90925 4.20693 8.93865 4.60896C7.96804 5.011 7.08613 5.60028 6.34326 6.34315L7.40392 7.40381C8.0075 6.80023 8.72406 6.32144 9.51267 5.99478C10.3013 5.66813 11.1465 5.5 12.0001 5.5C12.8537 5.5 13.6989 5.66813 14.4876 5.99478C15.0442 6.22533 15.5649 6.53167 16.0353 6.90417L14.9652 7.97423C14.6406 7.73512 14.2875 7.5356 13.9133 7.3806C13.3067 7.12933 12.6565 7 11.9999 7C11.3433 7 10.6931 7.12933 10.0865 7.3806C9.47984 7.63188 8.92865 8.00017 8.46436 8.46447L9.52502 9.52513C9.85002 9.20012 10.2359 8.94231 10.6605 8.76642C11.0851 8.59053 11.5403 8.5 11.9999 8.5C12.4595 8.5 12.9146 8.59053 13.3393 8.76642C13.5304 8.84559 13.7137 8.94135 13.8871 9.05237L12.7812 10.1583C12.5412 10.0564 12.2772 10 12 10C10.8954 10 10 10.8954 10 12C10 13.1046 10.8954 14 12 14C13.1046 14 14 13.1046 14 12C14 11.7229 13.9436 11.459 13.8418 11.219L19.2271 5.83372C20.6443 7.49317 21.5 9.64666 21.5 12Z" fill="#1F1F1F"/>
3
+ </svg>
package/public/index.html CHANGED
@@ -10,11 +10,6 @@
10
10
  <meta name="description" content="Freeboard for Signal K">
11
11
  <meta name="keywords" content="signal k, signalk, freeboard, signalk webapp">
12
12
 
13
- <!-- ******************* Cache control ********************** -->
14
- <meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate">
15
- <meta http-equiv="Pragma" content="no-cache">
16
- <meta http-equiv="Expires" content="0">
17
-
18
13
  <!-- ******************* PWA ********************** -->
19
14
  <meta name="theme-color" content="#333333">
20
15
  <link rel="manifest" href="./manifest.json">
@@ -59,5 +54,5 @@
59
54
  </div>
60
55
  </div>
61
56
  </app-root>
62
- <link rel="modulepreload" href="chunk-FDERIQAA.js"><script src="polyfills-5CFQRCPP.js" type="module"></script><script src="main-HJRTSPY2.js" type="module"></script></body>
57
+ <link rel="modulepreload" href="chunk-FDERIQAA.js"><script src="polyfills-5CFQRCPP.js" type="module"></script><script src="main-3CX2DAQ4.js" type="module"></script></body>
63
58
  </html>