mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-07-07 16:41:39 +02:00
feat(core): server config online
This commit is contained in:
@@ -23,7 +23,35 @@ var serverNoticeConfig = config.meanTorrentConfig.serverNotice;
|
||||
*/
|
||||
exports.getSystemConfig = function (req, res) {
|
||||
var config = shell.cat(path.resolve('./config/env/torrents.js'));
|
||||
res.json({
|
||||
configContent: config
|
||||
});
|
||||
|
||||
if (req.user.isAdmin) {
|
||||
res.json({
|
||||
configContent: config
|
||||
});
|
||||
} else {
|
||||
return res.status(403).json({
|
||||
message: 'SERVER.USER_IS_NOT_AUTHORIZED'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* setSystemConfig
|
||||
* @param req
|
||||
* @param res
|
||||
*/
|
||||
exports.setSystemConfig = function (req, res) {
|
||||
// eslint-disable-next-line new-cap
|
||||
var cc = shell.ShellString(req.body.content);
|
||||
|
||||
if (req.user.isAdmin) {
|
||||
cc.to('./config/env/torrents.js');
|
||||
res.json({
|
||||
message: 'SERVER.TORRENT_CONFIG_SAVE_SUCCESSFULLY'
|
||||
});
|
||||
} else {
|
||||
return res.status(403).json({
|
||||
message: 'SERVER.USER_IS_NOT_AUTHORIZED'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user