Release 3.0: Nuovo design Soft UI, Fleet Status centrato e fix vari

This commit is contained in:
2026-10-24 12:25:27 +02:00
parent 000ac4f530
commit 951396563a
3 changed files with 369 additions and 463 deletions
+3
View File
@@ -1,3 +1,6 @@
import gevent.monkey
gevent.monkey.patch_all()
from flask import Flask, render_template, request, session, jsonify, send_from_directory from flask import Flask, render_template, request, session, jsonify, send_from_directory
from paho.mqtt import client as mqtt_client from paho.mqtt import client as mqtt_client
from werkzeug.security import generate_password_hash, check_password_hash from werkzeug.security import generate_password_hash, check_password_hash
+1 -9
View File
@@ -1,4 +1,4 @@
const CACHE_NAME = 'fleet-c2-v3'; // incrementare a ogni modifica degli asset precaricati const CACHE_NAME = 'fleet-c2-v5';
const PRECACHE_URLS = [ const PRECACHE_URLS = [
'/', '/',
'/manifest.json', '/manifest.json',
@@ -6,8 +6,6 @@ const PRECACHE_URLS = [
]; ];
// --- 1. INSTALL: precache "best effort" ------------------------------------- // --- 1. INSTALL: precache "best effort" -------------------------------------
// Se un file manca (es. icona non ancora caricata) l'installazione NON fallisce:
// un SW che non si installa significa niente notifiche push.
self.addEventListener('install', event => { self.addEventListener('install', event => {
event.waitUntil( event.waitUntil(
caches.open(CACHE_NAME) caches.open(CACHE_NAME)
@@ -26,8 +24,6 @@ self.addEventListener('activate', event => {
}); });
// --- 3. FETCH: network-first, cache come ripiego offline --------------------- // --- 3. FETCH: network-first, cache come ripiego offline ---------------------
// Gestiamo solo le GET della nostra origine. API e WebSocket (socket.io) passano
// sempre direttamente dalla rete: i dati della flotta non vanno mai serviti "vecchi".
self.addEventListener('fetch', event => { self.addEventListener('fetch', event => {
const req = event.request; const req = event.request;
if (req.method !== 'GET') return; if (req.method !== 'GET') return;
@@ -80,8 +76,6 @@ self.addEventListener('push', event => {
icon: '/icon-512.png', icon: '/icon-512.png',
badge: '/icon-512.png', badge: '/icon-512.png',
vibrate: [200, 100, 200], vibrate: [200, 100, 200],
// Stesso tag = la nuova notifica dello stesso nodo sostituisce la precedente
// (invece di accumulare 10 notifiche) e rifà vibrare/suonare.
tag: data.tag || 'fleet-alert', tag: data.tag || 'fleet-alert',
renotify: true, renotify: true,
data: { data: {
@@ -100,8 +94,6 @@ self.addEventListener('push', event => {
}); });
// --- 5. CLICK SULLA NOTIFICA ------------------------------------------------- // --- 5. CLICK SULLA NOTIFICA -------------------------------------------------
// Click sul corpo O su "Apri Dashboard": porta in primo piano la finestra già aperta,
// altrimenti ne apre una nuova. "Chiudi" chiude soltanto.
self.addEventListener('notificationclick', event => { self.addEventListener('notificationclick', event => {
event.notification.close(); event.notification.close();
if (event.action === 'close') return; if (event.action === 'close') return;
+343 -432
View File
File diff suppressed because it is too large Load Diff