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:
@@ -22,21 +22,32 @@ async function init() {
|
||||
async function connectToServer() {
|
||||
if (isShuttingDown) return;
|
||||
|
||||
console.log('CONNECTING......')
|
||||
console.log('[REALTIME] connecting...');
|
||||
|
||||
const result = await auth.authenticate();
|
||||
console.log('AUTH RESULT:', result);
|
||||
let result;
|
||||
try {
|
||||
result = await auth.authenticate();
|
||||
} catch (err) {
|
||||
console.error('[REALTIME] auth error:', err.message);
|
||||
scheduleReconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!result) {
|
||||
scheduleReconnect();
|
||||
return;
|
||||
}
|
||||
|
||||
const connected = await socket.connect(result.socketToken, () => {
|
||||
if (!isShuttingDown) {
|
||||
scheduleReconnect();
|
||||
}
|
||||
});
|
||||
let connected = false;
|
||||
try {
|
||||
connected = await socket.connect(result.socketToken, () => {
|
||||
if (!isShuttingDown) {
|
||||
scheduleReconnect();
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('[REALTIME] socket connect error:', err.message);
|
||||
}
|
||||
|
||||
if (!connected) {
|
||||
scheduleReconnect();
|
||||
|
||||
Reference in New Issue
Block a user