域名配置
This commit is contained in:
parent
e7f74a482f
commit
e4e1945ea5
|
|
@ -89,6 +89,21 @@ class config_api:
|
|||
return mw.returnJson(True, '修改成功!')
|
||||
return mw.returnJson(False, '修改失败!')
|
||||
|
||||
def setPanelDomainApi(self):
|
||||
domain = request.form.get('domain', '')
|
||||
|
||||
cfg_domain = 'data/domain.conf'
|
||||
if domain == '':
|
||||
os.remove(cfg_domain)
|
||||
return mw.returnJson(True, '清空域名成功!')
|
||||
|
||||
reg = r"^([\w\-\*]{1,100}\.){1,4}(\w{1,10}|\w{1,10}\.\w{1,10})$"
|
||||
if not re.match(reg, domain):
|
||||
return mw.returnJson(False, '主域名格式不正确')
|
||||
|
||||
mw.writeFile(cfg_domain, domain)
|
||||
return mw.returnJson(True, '设置域名成功!')
|
||||
|
||||
def syncDateApi(self):
|
||||
if mw.isAppleSystem():
|
||||
return mw.returnJson(True, '开发系统不必同步时间!')
|
||||
|
|
|
|||
|
|
@ -66,6 +66,16 @@ $('input[name="backup_path"]').change(function(){
|
|||
});
|
||||
|
||||
|
||||
$('input[name="bind_domain"]').change(function(){
|
||||
var domain = $(this).val();
|
||||
console.log(domain);
|
||||
$('.btn_bind_domain').removeAttr('disabled');
|
||||
$('.btn_bind_domain').unbind().click(function(){
|
||||
$.post('/config/set_panel_domain','domain='+domain, function(rdata){
|
||||
showMsg(rdata.msg,function(){window.location.reload();},{icon:rdata.status?1:2},2000);
|
||||
},'json');
|
||||
});
|
||||
});
|
||||
|
||||
/** op **/
|
||||
|
||||
|
|
@ -734,4 +744,3 @@ function setPanelApi(){
|
|||
} ,{icon:rdata.status?1:2}, 1000);
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,6 +132,13 @@
|
|||
<div class="setting-con pd15">
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="绑定域名" style="float: left;">绑定域名</span>
|
||||
<input name="bind_domain" class="inputtxt bt-input-text" type="text" value="{{data['bind_domain']}}">
|
||||
<button type="button" class="btn btn-success btn-sm ml5 btn_bind_domain" disabled>保存</button>
|
||||
<span class="set-info c7">为面板绑定一个访问域名,<b style="color: red;">注意:一旦绑定域名,只能通过域名访问面板</b></span>
|
||||
</p>
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="BasicAuth认证" style="float: left;">BasicAuth认证</span>
|
||||
<input class="btswitch btswitch-ios" id="cfg_basic_auth" type="checkbox" {{data['basic_auth']}}/>
|
||||
<label class="btswitch-btn ml5" for="cfg_basic_auth" style="float: left;margin-top:4px;" onclick="setBasicAuth()"></label>
|
||||
|
|
|
|||
Loading…
Reference in New Issue