@meri-imperiumi/signalk-passage-briefing 0.2.0 → 0.2.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/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/public/components/passage-outlook.js +10 -1
- package/public/route-sim.mjs +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.2.1] - 2026-09-28
|
|
6
|
+
|
|
5
7
|
## [0.2.0] - 2026-09-28
|
|
6
8
|
|
|
7
9
|
### Fixed
|
|
8
10
|
|
|
11
|
+
- The route simulation crashed with `startTime.getTime is not a
|
|
12
|
+
function` when the caller passed the payload's ISO timestamp
|
|
13
|
+
string instead of a Date — simulatePassage now accepts both.
|
|
14
|
+
|
|
9
15
|
- The plotter widget HTML and JS are cache-busted with the plugin
|
|
10
16
|
version, so widget updates actually reach the host's iframe —
|
|
11
17
|
a stale cached copy was showing a removed Open button.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meri-imperiumi/signalk-passage-briefing",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Offshore passage daily briefing webapp for Signal K",
|
|
5
5
|
"main": "plugin/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
16
|
"signalk-node-server-plugin",
|
|
17
|
-
"signalk-category-
|
|
17
|
+
"signalk-category-weather",
|
|
18
18
|
"signalk-webapp"
|
|
19
19
|
],
|
|
20
20
|
"author": "Henri Bergius <henri.bergius@iki.fi>",
|
|
@@ -187,7 +187,16 @@ class PassageOutlook extends HTMLElement {
|
|
|
187
187
|
try {
|
|
188
188
|
this._briefing = await fetchJson(`${PLUGIN_API}/briefing${query}`);
|
|
189
189
|
if (!this._briefing.payload) {
|
|
190
|
-
//
|
|
190
|
+
// A never-briefed route: fetch it once automatically (online)
|
|
191
|
+
// instead of requiring the button — but only once per route,
|
|
192
|
+
// so an unreachable route can't loop
|
|
193
|
+
const key = this._briefing.routeId ?? "here";
|
|
194
|
+
this._autoFetched ??= new Set();
|
|
195
|
+
if (this._briefing.mode === "route" && !this._autoFetched.has(key)) {
|
|
196
|
+
this._autoFetched.add(key);
|
|
197
|
+
await this.refreshBriefing();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
191
200
|
this._briefing = null;
|
|
192
201
|
this.renderStale(true);
|
|
193
202
|
return;
|
package/public/route-sim.mjs
CHANGED
|
@@ -657,6 +657,12 @@ export function simulatePassage({
|
|
|
657
657
|
energyHourly,
|
|
658
658
|
startTime = new Date(),
|
|
659
659
|
}) {
|
|
660
|
+
// Accept an ISO string (the payload stores fetchedAt as text) or a
|
|
661
|
+
// Date — callers on the wire pass strings
|
|
662
|
+
startTime = new Date(startTime);
|
|
663
|
+
if (Number.isNaN(startTime.getTime())) {
|
|
664
|
+
startTime = new Date();
|
|
665
|
+
}
|
|
660
666
|
const runs = ETA_FACTORS.map((twsFactor) =>
|
|
661
667
|
simulateRun({
|
|
662
668
|
payload,
|