INNER CODE UNIT · JavaScript
totalOnline
ClickDevTech/CELERITY-panel · index.js:350
const totalOnline = nodes.reduce((sum, n) => sum + (n.onlineUsers || 0), 0);
res.json({
users: { total: usersTotal, enabled: usersEnabled },
nodes: { total: nodesTotal, online: nodesOnline },
onlineUsers: totalOnline,
nodesList: nodes.map(n => ({ name: n.name, online: n.onlineUsers })),
lastSync: syncService.lastSyncTime,
});
} catch (error) {
res.status(500).json({ error: error.message });
}
});
app.post('/api/sync', requireAuth, requireScope('sync:write'), async (req, res) => {
if (syncService.isSyncing) {
return res.status(409).json({ error: 'Sync already in progress' });
}