feat(core): timely replace configure variable value in template content when edit it online

This commit is contained in:
OldHawk
2018-03-17 10:00:01 +08:00
parent 848fa20011
commit 619f40df97
2 changed files with 30 additions and 4 deletions

View File

@@ -53,8 +53,14 @@
vm.getTemplateMarkedContent = function () {
var tmp = $filter('fmt')(vm.templateFileContent, {
appConfig: vm.appConfig,
announceConfig: vm.announce,
scoreConfig: vm.scoreConfig,
requestsConfig: vm.requestsConfig
rssConfig: vm.rssConfig,
ircConfig: vm.ircConfig,
signConfig: vm.signConfig,
inviteConfig: vm.inviteConfig,
requestsConfig: vm.requestsConfig,
hnrConfig: vm.hnrConfig
});
return marked(tmp, {sanitize: false});
};

View File

@@ -6,14 +6,23 @@
.controller('SystemConfigController', SystemConfigController);
SystemConfigController.$inject = ['$scope', '$state', '$timeout', '$translate', 'Authentication', 'SystemsService', 'ModalConfirmService', 'NotifycationService', 'marked',
'DebugConsoleService', 'MeanTorrentConfig'];
'DebugConsoleService', 'MeanTorrentConfig', '$filter'];
function SystemConfigController($scope, $state, $timeout, $translate, Authentication, SystemsService, ModalConfirmService, NotifycationService, marked,
mtDebug, MeanTorrentConfig) {
mtDebug, MeanTorrentConfig, $filter) {
var vm = this;
vm.user = Authentication.user;
vm.selectedFilename = 'null';
vm.shellCommandConfig = MeanTorrentConfig.meanTorrentConfig.shellCommand;
vm.appConfig = MeanTorrentConfig.meanTorrentConfig.app;
vm.scoreConfig = MeanTorrentConfig.meanTorrentConfig.score;
vm.announce = MeanTorrentConfig.meanTorrentConfig.announce;
vm.rssConfig = MeanTorrentConfig.meanTorrentConfig.rss;
vm.ircConfig = MeanTorrentConfig.meanTorrentConfig.ircAnnounce;
vm.signConfig = MeanTorrentConfig.meanTorrentConfig.sign;
vm.inviteConfig = MeanTorrentConfig.meanTorrentConfig.invite;
vm.requestsConfig = MeanTorrentConfig.meanTorrentConfig.requests;
vm.hnrConfig = MeanTorrentConfig.meanTorrentConfig.hitAndRun;
/**
* cmOption
@@ -215,7 +224,18 @@
* @returns {*}
*/
vm.getMarkedConfigContent = function () {
return marked(vm.systemConfigContentValue, {sanitize: true});
var tmp = $filter('fmt')(vm.systemConfigContentValue, {
appConfig: vm.appConfig,
announceConfig: vm.announce,
scoreConfig: vm.scoreConfig,
rssConfig: vm.rssConfig,
ircConfig: vm.ircConfig,
signConfig: vm.signConfig,
inviteConfig: vm.inviteConfig,
requestsConfig: vm.requestsConfig,
hnrConfig: vm.hnrConfig
});
return marked(tmp, {sanitize: true});
};
/**