This commit is contained in:
midoks
2022-11-19 12:33:42 +08:00
parent dfad621845
commit 6df4bbdb68
4 changed files with 45 additions and 7 deletions
+12
View File
@@ -158,6 +158,18 @@ class config_api:
mw.setHostAddr(host_ip)
return mw.returnJson(True, 'IP保存成功!')
def setWwwDirApi(self):
sites_path = request.form.get('sites_path', '')
if sites_path != mw.getWwwDir():
mw.setWwwDir(sites_path)
return mw.returnJson(True, '修改默认建站目录成功!')
def setBackupDirApi(self):
backup_path = request.form.get('backup_path', '')
if backup_path != mw.getBackupDir():
mw.setBackupDir(backup_path)
return mw.returnJson(True, '修改默认备份目录成功!')
def setApi(self):
webname = request.form.get('webname', '')
port = request.form.get('port', '')
+7 -4
View File
@@ -88,10 +88,6 @@ def getLogsDir():
return getRootDir() + '/wwwlogs'
def getBackupDir():
return getRootDir() + '/backup'
def getWwwDir():
file = getRunDir() + '/data/site.pl'
if os.path.exists(file):
@@ -104,6 +100,13 @@ def setWwwDir(wdir):
return writeFile(file, wdir)
def getBackupDir():
file = getRunDir() + '/data/backup.pl'
if os.path.exists(file):
return readFile(file).strip()
return getRootDir() + '/backup'
def setBackupDir(bdir):
file = getRunDir() + '/data/backup.pl'
return writeFile(file, bdir)
+21
View File
@@ -49,6 +49,27 @@ $('input[name="port"]').change(function(){
});
});
$('input[name="sites_path"]').change(function(){
var sites_path = $(this).val();
$('.btn_sites_path').removeAttr('disabled');
$('.btn_sites_path').unbind().click(function(){
$.post('/config/set_www_dir','sites_path='+sites_path, function(rdata){
showMsg(rdata.msg,function(){window.location.reload();},{icon:rdata.status?1:2},2000);
},'json');
});
});
$('input[name="backup_path"]').change(function(){
var backup_path = $(this).val();
$('.backup_path').removeAttr('disabled');
$('.btn_sites_path').unbind().click(function(){
$.post('/config/set_backup_dir','backup_path='+backup_path, function(rdata){
showMsg(rdata.msg,function(){window.location.reload();},{icon:rdata.status?1:2},2000);
},'json');
});
});
/** op **/
+5 -3
View File
@@ -64,14 +64,14 @@
<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>
<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">
<button type="button" class="btn btn-success btn-sm ml5 btn_port" disabled>设置</button>
<button type="button" class="btn btn-success btn-sm ml5 btn_port" disabled>保存</button>
<span class="set-info c7">建议端口范围7200 - 65535</span>
</p>
@@ -93,12 +93,14 @@
<p class="mtb15">
<span class="set-tit text-right" title="默认建站目录">默认建站目录</span>
<input name="sites_path" class="inputtxt bt-input-text" type="text" value="{{data['site_path']}}">
<button type="button" class="btn btn-success btn-sm ml5 btn_sites_path" disabled>保存</button>
<span class="set-info c7">新创建的站点,默认将保存到该目录的下级目录!</span>
</p>
<p class="mtb15">
<span class="set-tit text-right" title="默认建站目录">默认备份目录</span>
<input name="backup_path" class="inputtxt bt-input-text" type="text" value="{{data['backup_path']}}">
<button type="button" class="btn btn-success btn-sm ml5 btn_backup_path" disabled>保存</button>
<span class="set-info c7">网站和数据库的备份目录!</span>
</p>
@@ -121,7 +123,7 @@
<span class="set-info c7">设置面板密码</span>
</p>
</form>
<div class="bt-submit set-submit">保存</div>
<!-- <div class="bt-submit set-submit">保存</div> -->
</div>
<div class="title c6 plr15">