- 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.
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
const router = require('express').Router();
|
|
const db = require('../../config/skFlow')
|
|
|
|
const config = require('../../config/configManager.js')
|
|
|
|
router.get('/', (req, res) => {
|
|
const { path, source } = req.query;
|
|
if (source) {
|
|
return res.json(db.getBySource(source));
|
|
}
|
|
res.json(db.get(path));
|
|
});
|
|
|
|
const maskToken = (t) => {
|
|
if (!t) return null;
|
|
const s = String(t);
|
|
return s.length > 8 ? `${s.slice(0, 5)}…${s.slice(-3)}` : '***';
|
|
};
|
|
|
|
router.get('/info', (req, res) => {
|
|
const info = {
|
|
telegram_configured: Boolean(config.getTelegramToken()),
|
|
telegram_token_preview: maskToken(config.getTelegramToken()),
|
|
|
|
sensor: {
|
|
name: config.getSensorName(),
|
|
code: config.getSensorCode()
|
|
},
|
|
|
|
other: {
|
|
api_url: process.env.API_URL,
|
|
realtime_url: process.env.REALTIME_URL,
|
|
realtime_socket_url: process.env.REALTIME_SOCKET_URL,
|
|
reconnect_delay: config.getReconnectDelay()
|
|
}
|
|
}
|
|
res.json(info);
|
|
});
|
|
|
|
module.exports = router; |