feat: Implement rulesets and layout management for kiosk plugin

- Added rulesets manager to handle various data types and updates via HTTP and WebSocket.
- Introduced layout store for managing kiosk layouts with caching and server synchronization.
- Enhanced dashboard and data routes to support new layout and ruleset features.
- Updated kiosk HTML and JavaScript to utilize new layout rendering and data binding.
- Removed obsolete map route and integrated map functionality into the new tile renderer.
- Improved Telegram commands to reflect changes in data structure and logging.
- Refactored weather fetching intervals to prevent multiple instances.
- Added SSE stream for real-time layout updates in the kiosk.
This commit is contained in:
Giuseppe Raffa
2026-05-12 10:17:54 +02:00
parent bb8d267cd4
commit c2c1598226
27 changed files with 1061 additions and 326 deletions

View File

@@ -8,10 +8,10 @@ const REALTIME_URL = process.env.REALTIME_URL;
*/
async function authenticate() {
const SENSOR_CODE = configManager.getSensorCode();
const SENSOR_NAME = configManager.getSensorName();
const SENSOR_ID = configManager.getSensorId();
if (!REALTIME_URL || !SENSOR_CODE || !SENSOR_NAME) {
console.error('[REALTIME|AUTH] REALTIME_URL, SENSOR_CODE o SENSOR_NAME non configurati');
if (!REALTIME_URL || !SENSOR_CODE || !SENSOR_ID) {
console.error('[REALTIME|AUTH] REALTIME_URL, SENSOR_CODE o SENSOR_ID non configurati');
return null;
}
@@ -20,7 +20,7 @@ async function authenticate() {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
name: SENSOR_NAME,
id: SENSOR_ID,
code: SENSOR_CODE
})
});
@@ -38,8 +38,8 @@ async function authenticate() {
return null;
}
console.log(`[REALTIME|AUTH] Autenticato: ${SENSOR_NAME}, token valido 5s`);
return { socketToken: data.t };
console.log(`[REALTIME|AUTH] Autenticato: ${SENSOR_ID}`);
return { socketToken: data.t, sensorId: SENSOR_ID };
} catch (error) {
console.error(`[REALTIME|AUTH] error: ${error.message}`);