- Implemented admin mode configuration in docker-compose.yml - Added AdminContext and AdminModal components for managing admin state - Integrated admin login functionality in AuthController - Updated App component to handle admin status and modal display - Enhanced ChannelList, ChannelModal, and TvPlaylistModal to support admin features - Added sensitive information handling in ChannelModal and TvPlaylistModal - Modified SocketService methods to include admin checks for channel and playlist operations
32 lines
720 B
JavaScript
32 lines
720 B
JavaScript
require('dotenv').config();
|
|
|
|
const ADMIN_ENABLED = process.env.ADMIN_ENABLED === 'true';
|
|
const ADMIN_PASSWORD = process.env.ADMIN_PASSWORD;
|
|
|
|
module.exports = {
|
|
adminLogin(req, res) {
|
|
if (!ADMIN_ENABLED || ADMIN_PASSWORD === undefined) {
|
|
return res.status(403).json({
|
|
success: false,
|
|
message: 'Admin mode is disabled on this server'
|
|
});
|
|
}
|
|
|
|
const { password } = req.body;
|
|
|
|
if (password === ADMIN_PASSWORD) {
|
|
return res.json({ success: true });
|
|
} else {
|
|
return res.status(401).json({
|
|
success: false,
|
|
message: 'Invalid password'
|
|
});
|
|
}
|
|
},
|
|
|
|
checkAdminStatus(req, res) {
|
|
res.json({
|
|
enabled: ADMIN_ENABLED
|
|
});
|
|
}
|
|
}; |