feat: role-aware presence bar, WebSocket logging fixes
- findAdminByKey returns role from admins.json (defaults to 'admin') - JWT includes config-defined role instead of hardcoded 'admin' - PresenceBar split into "who's here?" (page admins) and "connected" (bot/utility services with icon+color badges) - Bot/utility roles appear in presence on all pages when connected - usePresence hook uses refs to avoid WS reconnect on navigation - WS auth log prints admin name instead of generic 'admin' - WS connection log reads X-Forwarded-For for real client IP - AuthContext stores adminRole from login response - Uncomment admins.json Docker volume mount, add SELinux :z flags Made-with: Cursor
This commit is contained in:
@@ -18,7 +18,7 @@ router.post('/login', (req, res) => {
|
||||
}
|
||||
|
||||
const token = jwt.sign(
|
||||
{ role: 'admin', name: admin.name, timestamp: Date.now() },
|
||||
{ role: admin.role, name: admin.name, timestamp: Date.now() },
|
||||
JWT_SECRET,
|
||||
{ expiresIn: '24h' }
|
||||
);
|
||||
@@ -26,6 +26,7 @@ router.post('/login', (req, res) => {
|
||||
res.json({
|
||||
token,
|
||||
name: admin.name,
|
||||
role: admin.role,
|
||||
message: 'Authentication successful',
|
||||
expiresIn: '24h'
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user