const router = require('express').Router(); const express = require('express'); const path = require('path'); const fs = require('fs'); const configManager = require('../../config/configManager.js'); const kioskPath = path.join(__dirname, '../../tools/kiosk'); const htmlFile = path.join(kioskPath, 'kiosk.html'); router.use('/', express.static(kioskPath)); router.get('/', (req, res) => { const apiUrl = process.env.API_URL || 'https://api.mebboat.it'; const realtimeUrl = process.env.REALTIME_URL || 'https://realtime.mebboat.it'; const realtimeWsUrl = process.env.REALTIME_SOCKET_URL || 'wss://realtime.mebboat.it'; const sensorCode = configManager.getSensorCode(); const sensorName = configManager.getSensorName(); const esc = (s) => String(s || '').replace(/"/g, '"'); const metas = ` `; let html; try { html = fs.readFileSync(htmlFile, 'utf8'); } catch (e) { return res.status(500).send('kiosk.html not found'); } html = html.replace('', metas + ''); res.set('Content-Type', 'text/html').send(html); }); module.exports = router;