@sailingrotevista/rotevista-dash 4.0.17 → 4.0.18

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.
Files changed (3) hide show
  1. package/app.js +3 -3
  2. package/index.js +27 -7
  3. package/package.json +1 -1
package/app.js CHANGED
@@ -670,16 +670,16 @@ function drawGraph(d, id, min, max, isTws, isHercules) {
670
670
 
671
671
  // Assegnazione specifica di Opacità e Spessore Linea
672
672
  let fillOpacity = "0.15"; // Default per valori base
673
- let strokeWidth = "1.5";
673
+ let strokeWidth = "1";
674
674
 
675
675
  if (color === "#ff3b30") {
676
676
  // ROSSO (Danger / Reef 2): Molto solido
677
677
  fillOpacity = "0.85";
678
- strokeWidth = "2.5";
678
+ strokeWidth = "1.5";
679
679
  } else if (color === "#ff9800") {
680
680
  // ARANCIONE (Warning / Reef 1): Più trasparente (Velo)
681
681
  fillOpacity = "0.45";
682
- strokeWidth = "2.5"; // Manteniamo la linea spessa per leggerla bene
682
+ strokeWidth = "1"; // Manteniamo la linea spessa per leggerla bene
683
683
  }
684
684
 
685
685
  // GRADIENTE: Due stop alla stessa percentuale per creare uno stacco di colore netto (no sfumature)
package/index.js CHANGED
@@ -12,20 +12,40 @@ module.exports = function (app) {
12
12
  plugin.name = 'Rotevista Dash Configuration';
13
13
  plugin.description = 'Configure boat-specific tactical and safety parameters for the Dashboard';
14
14
 
15
+ let currentConfig = {};
16
+ let routeRegistered = false;
17
+
15
18
  /**
16
- * plugin.start: Inizializza il plugin e crea la rotta API per la Dashboard.
19
+ * plugin.start: Inizializza il plugin.
20
+ * Viene chiamato all'avvio e OGNI VOLTA che clicchi "Save" nelle impostazioni.
17
21
  */
18
22
  plugin.start = function (options) {
19
- // Esponiamo i settings su un endpoint dedicato per bypassare i blocchi 401.
20
- app.get('/rotevista-config', (req, res) => {
21
- res.json(options);
22
- });
23
+ // 1. Aggiorna la configurazione in memoria (per l'endpoint pubblico)
24
+ currentConfig = options;
25
+
26
+ // 2. Log di debug nel server Signal K
27
+ app.debug(`${plugin.name} started/updated with new options`);
23
28
 
24
- app.debug('Rotevista Dashboard Config Endpoint active at /rotevista-config');
29
+ // 3. Registra la rotta API solo la prima volta
30
+ if (!routeRegistered) {
31
+ app.get('/rotevista-config', (req, res) => {
32
+ res.json(currentConfig);
33
+ });
34
+ routeRegistered = true;
35
+ app.debug('Public API endpoint registered at /rotevista-config');
36
+ }
25
37
  };
26
38
 
39
+ /**
40
+ * plugin.stop: Chiamato quando il plugin viene disattivato o prima di un aggiornamento.
41
+ */
27
42
  plugin.stop = function () {
28
- // Pulizia risorse allo spegnimento del plugin.
43
+ app.debug(`${plugin.name} stopped`);
44
+ };
45
+
46
+ // Se desideri avere una funzione plugin.debug personalizzata (opzionale)
47
+ plugin.debug = function(msg) {
48
+ app.debug(msg);
29
49
  };
30
50
 
31
51
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sailingrotevista/rotevista-dash",
3
- "version": "4.0.17",
3
+ "version": "4.0.18",
4
4
  "description": "Public Wind Dashboard with navigation and course aids",
5
5
  "main": "index.js",
6
6
  "publishConfig": {