部分配置修改
This commit is contained in:
parent
b677b1a73b
commit
dfad621845
|
|
@ -122,6 +122,42 @@ class config_api:
|
|||
session['username'] = name1
|
||||
return mw.returnJson(True, '用户修改成功!')
|
||||
|
||||
def setWebnameApi(self):
|
||||
webname = request.form.get('webname', '')
|
||||
if webname != mw.getConfig('title'):
|
||||
mw.setConfig('title', webname)
|
||||
return mw.returnJson(True, '面板别名保存成功!')
|
||||
|
||||
def setPortApi(self):
|
||||
port = request.form.get('port', '')
|
||||
if port != mw.getHostPort():
|
||||
import system_api
|
||||
import firewall_api
|
||||
|
||||
if os.path.exists("/lib/systemd/system/firewalld.service"):
|
||||
if not firewall_api.firewall_api().getFwStatus():
|
||||
return mw.returnJson(False, 'firewalld必须先启动!')
|
||||
|
||||
mw.setHostPort(port)
|
||||
|
||||
msg = mw.getInfo('放行端口[{1}]成功', (port,))
|
||||
mw.writeLog("防火墙管理", msg)
|
||||
addtime = time.strftime('%Y-%m-%d %X', time.localtime())
|
||||
mw.M('firewall').add('port,ps,addtime', (port, "配置修改", addtime))
|
||||
|
||||
firewall_api.firewall_api().addAcceptPort(port)
|
||||
firewall_api.firewall_api().firewallReload()
|
||||
|
||||
system_api.system_api().restartMw()
|
||||
|
||||
return mw.returnJson(True, '端口保存成功!')
|
||||
|
||||
def setIpApi(self):
|
||||
host_ip = request.form.get('host_ip', '')
|
||||
if host_ip != mw.getHostAddr():
|
||||
mw.setHostAddr(host_ip)
|
||||
return mw.returnJson(True, 'IP保存成功!')
|
||||
|
||||
def setApi(self):
|
||||
webname = request.form.get('webname', '')
|
||||
port = request.form.get('port', '')
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
// console.log(rdata);
|
||||
// },'json');
|
||||
|
||||
|
||||
/** op **/
|
||||
$(".set-submit").click(function(){
|
||||
var data = $("#set_config").serialize();
|
||||
layer.msg('正在保存配置...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
|
|
@ -18,6 +18,41 @@ $(".set-submit").click(function(){
|
|||
},'json');
|
||||
});
|
||||
|
||||
$('input[name="webname"]').change(function(){
|
||||
var webname = $(this).val();
|
||||
$('.btn_webname').removeAttr('disabled');
|
||||
$('.btn_webname').unbind().click(function(){
|
||||
$.post('/config/set_webname','webname='+webname, function(rdata){
|
||||
showMsg(rdata.msg,function(){window.location.reload();},{icon:rdata.status?1:2},2000);
|
||||
},'json');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$('input[name="host_ip"]').change(function(){
|
||||
var host_ip = $(this).val();
|
||||
$('.btn_host_ip').removeAttr('disabled');
|
||||
$('.btn_host_ip').unbind().click(function(){
|
||||
$.post('/config/set_ip','host_ip='+host_ip, function(rdata){
|
||||
showMsg(rdata.msg,function(){window.location.reload();},{icon:rdata.status?1:2},2000);
|
||||
},'json');
|
||||
});
|
||||
});
|
||||
|
||||
$('input[name="port"]').change(function(){
|
||||
var port = $(this).val();
|
||||
$('.btn_port').removeAttr('disabled');
|
||||
$('.btn_port').unbind().click(function(){
|
||||
$.post('/config/set_port','port='+port, function(rdata){
|
||||
showMsg(rdata.msg,function(){window.location.reload();},{icon:rdata.status?1:2},2000);
|
||||
},'json');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
/** op **/
|
||||
|
||||
|
||||
//关闭面板
|
||||
function closePanel(){
|
||||
|
|
|
|||
|
|
@ -56,11 +56,23 @@
|
|||
<form id="set_config">
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right">别名</span>
|
||||
<input id="webname" name="webname" class="inputtxt bt-input-text" type="text" value="{{data['title']}}" ><span class="set-info c7">面板名称</span>
|
||||
<input id="webname" name="webname" class="inputtxt bt-input-text" type="text" value="{{data['title']}}">
|
||||
<button type="button" class="btn btn-success btn-sm ml5 btn_webname" disabled>保存</button>
|
||||
<span class="set-info c7">面板名称</span>
|
||||
</p>
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="服务器IP">服务器IP</span>
|
||||
<input name="host_ip" class="inputtxt bt-input-text" type="text" value="{{data['ip']}}">
|
||||
<button type="button" class="btn btn-success btn-sm ml5 btn_host_ip" disabled>设置</button>
|
||||
<span class="set-info c7">默认为外网IP,若您在本地虚拟机测试,请填写虚拟机内网IP!</span>
|
||||
</p>
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right">面板端口</span>
|
||||
<input id="banport" name="port" class="inputtxt bt-input-text" type="numner" value="{{data['port']}}" maxlength="5"><span class="set-info c7">建议端口范围7200 - 65535</span>
|
||||
<input id="banport" name="port" class="inputtxt bt-input-text" type="numner" value="{{data['port']}}" maxlength="5">
|
||||
<button type="button" class="btn btn-success btn-sm ml5 btn_port" disabled>设置</button>
|
||||
<span class="set-info c7">建议端口范围7200 - 65535</span>
|
||||
</p>
|
||||
|
||||
<p class="mtb15">
|
||||
|
|
@ -91,12 +103,6 @@
|
|||
</p>
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="服务器IP">服务器IP</span>
|
||||
<input name="host_ip" class="inputtxt bt-input-text" type="text" value="{{data['ip']}}">
|
||||
<span class="set-info c7">默认为外网IP,若您在本地虚拟机测试,请填写虚拟机内网IP!</span>
|
||||
</p>
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="服务器时间">服务器时间</span>
|
||||
<input id="systemdate" name="systemdate" class="inputtxt bt-input-text disable" type="text" value="{{data['systemdate']}}">
|
||||
<button type="button" class="btn btn-success btn-sm ml5" onclick="syncDate()">同步</button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue