diff --git a/plugins/keepalived/index.html b/plugins/keepalived/index.html
index 3743d47af..8634d5ca0 100755
--- a/plugins/keepalived/index.html
+++ b/plugins/keepalived/index.html
@@ -6,7 +6,7 @@
diff --git a/plugins/keepalived/index.py b/plugins/keepalived/index.py
index 3c17abe97..d1d3a2d24 100755
--- a/plugins/keepalived/index.py
+++ b/plugins/keepalived/index.py
@@ -144,12 +144,18 @@ def copyScripts():
src_scripts_path = getPluginDir() + '/scripts'
dst_scripts_path = getServerDir() + '/scripts'
if not os.path.exists(dst_scripts_path):
- cmd = 'cp -rf ' +src_scripts_path+' '+dst_scripts_path
- t = mw.execShell(cmd)
- acl_cmd = 'chmod +x '+dst_scripts_path+'/*.sh'
- # print(acl_cmd)
- mw.execShell(acl_cmd)
- # print(t)
+ mw.execShell('mkdir -p ' + dst_scripts_path)
+ olist = os.listdir(src_scripts_path)
+ for o in range(len(olist)):
+ src_file = src_scripts_path+'/'+olist[o]
+ dst_file = dst_scripts_path+'/'+olist[o]
+
+ content = mw.readFile(src_file)
+ content = contentReplace(content)
+ mw.writeFile(dst_file, content)
+
+ cmd = 'chmod +x ' + dst_file
+ mw.execShell(cmd)
return True
return False
diff --git a/route/static/app/public.js b/route/static/app/public.js
index 5e272d260..35c2ab71c 100755
--- a/route/static/app/public.js
+++ b/route/static/app/public.js
@@ -2356,6 +2356,125 @@ function pluginConfigTpl(_name, version, func, config_tpl_func, read_config_tpl_
},'json');
}
+//配置模版列表 --- start
+function pluginConfigListTpl(_name, version, config_tpl_func, read_config_tpl_func){
+ if ( typeof(version) == 'undefined' ){
+ version = '';
+ }
+
+ var _config_tpl_func = 'config_tpl';
+ if ( typeof(config_tpl_func) != 'undefined' ){
+ _config_tpl_func = config_tpl_func;
+ }
+
+ var _read_config_tpl_func = 'read_config_tpl';
+ if ( typeof(read_config_tpl_func) != 'undefined' ){
+ _read_config_tpl_func = read_config_tpl_func;
+ }
+
+
+ var con = '
提示:Ctrl+F 搜索关键字,Ctrl+G 查找下一个,Ctrl+S 保存,Ctrl+Shift+R 查找替换!
\
+
\
+
\
+
\
+
\
+ - 此处为'+ _name + version +'主配置文件,若您不了解配置规则,请勿随意修改。
\
+
';
+ $(".soft-man-con").html(con);
+
+ function getFileName(file){
+ var list = file.split('/');
+ var f = list[list.length-1];
+ return f
+ }
+
+ function loadTextBody(fileName){
+ $.post('/files/get_body', 'path=' + fileName, function(rdata) {
+ if (!rdata.status){
+ layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
+ return;
+ }
+ $("#textBody").empty().text(rdata.data.data);
+ $(".CodeMirror").remove();
+ var editor = CodeMirror.fromTextArea(document.getElementById("textBody"), {
+ extraKeys: {
+ "Ctrl-Space": "autocomplete",
+ "Ctrl-F": "findPersistent",
+ "Ctrl-H": "replaceAll",
+ "Ctrl-S": function() {
+ $("#textBody").text(editor.getValue());
+ pluginConfigSave(fileName);
+ }
+ },
+ lineNumbers: true,
+ matchBrackets:true,
+ });
+ editor.focus();
+ $(".CodeMirror-scroll").css({"height":"300px","margin":0,"padding":0});
+ $("#onlineEditFileBtn").click(function(){
+ $("#textBody").text(editor.getValue());
+ pluginConfigSave(fileName);
+ });
+ },'json');
+ }
+
+
+
+ var fileName = '';
+ $.post('/plugins/run',{name:_name, func:_config_tpl_func,version:version}, function(data){
+ var rdata = $.parseJSON(data.data);
+ for (var i = 0; i < rdata.length; i++) {
+ $('#config_tpl').append('
');
+ }
+
+ if (rdata.length>0){
+ loadTextBody(rdata[0]);
+ }
+
+ $('#config_tpl').change(function(){
+ var selected = $(this).val();
+ fileName = selected;
+
+ var loadT = layer.msg('配置模版获取中...',{icon:16,time:0,shade: [0.3, '#000']});
+
+ var _args = JSON.stringify({file:selected});
+ $.post('/plugins/run', {name:_name, func:_read_config_tpl_func,version:version,args:_args}, function(data){
+ layer.close(loadT);
+ var rdata = $.parseJSON(data.data);
+ if (!rdata.status){
+ layer.msg(rdata.msg,{icon:0,time:2000,shade: [0.3, '#000']});
+ return;
+ }
+
+ $("#textBody").empty().text(rdata.data);
+ $(".CodeMirror").remove();
+ var editor = CodeMirror.fromTextArea(document.getElementById("textBody"), {
+ extraKeys: {
+ "Ctrl-Space": "autocomplete",
+ "Ctrl-F": "findPersistent",
+ "Ctrl-H": "replaceAll",
+ "Ctrl-S": function() {
+ $("#textBody").text(editor.getValue());
+ pluginConfigSave(fileName);
+ }
+ },
+ lineNumbers: true,
+ matchBrackets:true,
+ });
+ editor.focus();
+ $(".CodeMirror-scroll").css({"height":"300px","margin":0,"padding":0});
+ $("#onlineEditFileBtn").unbind('click');
+ $("#onlineEditFileBtn").click(function(){
+ $("#textBody").text(editor.getValue());
+ pluginConfigSave(fileName);
+ });
+ },'json');
+
+ });
+
+ },'json');
+}
+
//配置保存
function pluginConfigSave(fileName) {