refactor: remove unused /api/config endpoint and update WebSocket connection logic

This commit is contained in:
simos
2025-11-12 23:23:01 +01:00
parent 2fb1e1cfb0
commit ed65399dfb
4 changed files with 35 additions and 80 deletions

View File

@@ -270,17 +270,8 @@ app.use(express.static(path.join(__dirname, '../dist'), {
}));
// API Routes (protected)
app.get('/api/config', authenticateToken, (req, res) => {
const host = req.headers.host || `${req.hostname}:${PORT}`;
const protocol = req.protocol === 'https' || req.get('x-forwarded-proto') === 'https' ? 'wss' : 'ws';
console.log('Config API called - Returning host:', host, 'Protocol:', protocol);
res.json({
serverPort: PORT,
wsUrl: `${protocol}://${host}`
});
});
// /api/config endpoint removed - no longer needed
// Frontend now uses window.location for WebSocket URLs
// System update endpoint
app.post('/api/system/update', authenticateToken, async (req, res) => {