fix(backup): ignore some important configure items in browser source code

//ignore backup settings
  cfg.backup = undefined;
  //ignore ircAnnounce settings
  cfg.ircAnnounce = undefined;
  //ignore password settings
  cfg.password = undefined;
  //ignore trace settings
  cfg.trace = undefined;
  //ignore tmdbConfig.key settings
  cfg.tmdbConfig.key = undefined;

  #20
This commit is contained in:
OldHawk
2017-12-04 15:18:49 +08:00
parent d18bb29ca1
commit 2caa625f0e
2 changed files with 27 additions and 4 deletions

View File

@@ -14,7 +14,6 @@
vm.user = Authentication.user;
vm.DLS = DownloadService;
vm.itemsPerPageConfig = MeanTorrentConfig.meanTorrentConfig.itemsPerPage;
vm.backupConfig = MeanTorrentConfig.meanTorrentConfig.backup;
vm.deleteList = [];

View File

@@ -18,7 +18,7 @@ exports.renderIndex = function (req, res) {
res.render('modules/core/server/views/index', {
user: JSON.stringify(safeUserObject),
sharedConfig: JSON.stringify(config.shared),
meanTorrentConfig: JSON.stringify(config.meanTorrentConfig)
meanTorrentConfig: JSON.stringify(getSafeMeanTorrentConfig(config.meanTorrentConfig)),
});
};
@@ -31,7 +31,7 @@ exports.renderServerError = function (req, res) {
res.status(500).render('modules/core/server/views/500', {
user: JSON.stringify(safeUserObject),
sharedConfig: JSON.stringify(config.shared),
meanTorrentConfig: JSON.stringify(config.meanTorrentConfig),
meanTorrentConfig: JSON.stringify(getSafeMeanTorrentConfig(config.meanTorrentConfig)),
error: 'Oops! Something went wrong...'
});
};
@@ -48,7 +48,7 @@ exports.renderNotFound = function (req, res) {
res.render('modules/core/server/views/404', {
user: JSON.stringify(safeUserObject),
sharedConfig: JSON.stringify(config.shared),
meanTorrentConfig: JSON.stringify(config.meanTorrentConfig),
meanTorrentConfig: JSON.stringify(getSafeMeanTorrentConfig(config.meanTorrentConfig)),
url: req.originalUrl
});
},
@@ -62,3 +62,27 @@ exports.renderNotFound = function (req, res) {
}
});
};
/**
* getSafeMeanTorrentConfig
* @param cfg
* @returns {*}
*/
function getSafeMeanTorrentConfig(cfg){
//ignore backup settings
cfg.backup = undefined;
//ignore ircAnnounce settings
cfg.ircAnnounce = undefined;
//ignore password settings
cfg.password = undefined;
//ignore trace settings
cfg.trace = undefined;
//ignore tmdbConfig.key settings
cfg.tmdbConfig.key = undefined;
return cfg;
};