mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 14:19:25 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7589c14f81 | ||
|
|
4344d774c1 | ||
|
|
4859792096 | ||
|
|
e55c40e973 | ||
|
|
103beb62a4 | ||
|
|
76a34578ad | ||
|
|
f82fdbf939 | ||
|
|
4eaf9eb36c | ||
|
|
9c9f9fc42c | ||
|
|
8301ad6f62 | ||
|
|
d42fb48749 | ||
|
|
fa49a3dbeb | ||
|
|
dd1147c891 | ||
|
|
67b015a50b | ||
|
|
57831168a3 | ||
|
|
f6f7cabddc | ||
|
|
dfec241c3f | ||
|
|
8a78dff571 | ||
|
|
a9486d4fbe | ||
|
|
78d3a091cd | ||
|
|
314005e478 | ||
|
|
55fa911485 | ||
|
|
a72046462c | ||
|
|
0b8fe15b65 | ||
|
|
34f5d12ad9 | ||
|
|
e88544d290 | ||
|
|
a211746de7 | ||
|
|
c417b02844 | ||
|
|
034aaedf48 | ||
|
|
af0ec79072 | ||
|
|
195ccf409e | ||
|
|
7cec26b8a3 | ||
|
|
aacb816b11 |
@@ -92,14 +92,15 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.10.0
|
||||
### 版本更新 0.10.1
|
||||
|
||||
* OP防火墙优化。
|
||||
* OP防火墙-添加URL白名单功能。
|
||||
* 网站统计优化。
|
||||
* 添加`FTP存储空间`插件。
|
||||
* 初始安装IPv6安装。
|
||||
* phpMyAdmin优化。
|
||||
* MySQL添加外部导入功能。
|
||||
* OpenResty添加性能调整功能。
|
||||
* 优化ubuntu22.04安装过程。
|
||||
* Debian9友好,【SSH终端 1.0】无法使用。
|
||||
* phpMyAdmin优化,需要卸载重装。
|
||||
* 文件管理解压直接覆盖FIX。
|
||||
* 优化文件多选的BUG。
|
||||
|
||||
|
||||
### JSDelivr安装地址
|
||||
@@ -116,6 +117,12 @@ curl -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/instal
|
||||
curl -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/update.sh | bash
|
||||
```
|
||||
|
||||
- 卸载脚本
|
||||
|
||||
```
|
||||
curl -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/uninstall.sh | bash
|
||||
```
|
||||
|
||||
### 备用地址
|
||||
|
||||
- 初始安装
|
||||
@@ -131,6 +138,12 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash
|
||||
```
|
||||
|
||||
- 卸载脚本
|
||||
|
||||
```
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/uninstall.sh | bash
|
||||
```
|
||||
|
||||
|
||||
### 通用软件安装[命令行安装]
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ from flask import request
|
||||
|
||||
class config_api:
|
||||
|
||||
__version = '0.10.0'
|
||||
__version = '0.10.1'
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@@ -758,7 +758,7 @@ class files_api:
|
||||
try:
|
||||
tmps = mw.getRunDir() + '/tmp/panelExec.log'
|
||||
if stype == 'zip':
|
||||
os.system("cd " + path + " && unzip -d '" + dfile +
|
||||
os.system("cd " + path + " && unzip -o -d '" + dfile +
|
||||
"' '" + sfile + "' > " + tmps + " 2>&1 &")
|
||||
else:
|
||||
sfiles = ''
|
||||
|
||||
+6
-4
@@ -411,7 +411,7 @@ def writeFile(filename, str):
|
||||
return False
|
||||
|
||||
|
||||
def backFile(self, file, act=None):
|
||||
def backFile(file, act=None):
|
||||
"""
|
||||
@name 备份配置文件
|
||||
@param file 需要备份的文件
|
||||
@@ -420,10 +420,12 @@ def backFile(self, file, act=None):
|
||||
file_type = "_bak"
|
||||
if act:
|
||||
file_type = "_def"
|
||||
execShell("/usr/bin/cp -p {0} {1}".format(file, file + file_type))
|
||||
|
||||
# print("cp -p {0} {1}".format(file, file + file_type))
|
||||
execShell("cp -p {0} {1}".format(file, file + file_type))
|
||||
|
||||
|
||||
def restoreFile(self, file, act=None):
|
||||
def restoreFile(file, act=None):
|
||||
"""
|
||||
@name 还原配置文件
|
||||
@param file 需要还原的文件
|
||||
@@ -432,7 +434,7 @@ def restoreFile(self, file, act=None):
|
||||
file_type = "_bak"
|
||||
if act:
|
||||
file_type = "_def"
|
||||
execShell("/usr/bin/cp -p {1} {0}".format(file, file + file_type))
|
||||
execShell("cp -p {1} {0}".format(file, file + file_type))
|
||||
|
||||
|
||||
def HttpGet(url, timeout=10):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
server
|
||||
{
|
||||
listen {$PORT};
|
||||
listen [::]:{$PORT};
|
||||
server_name {$SERVER_NAME};
|
||||
index index.php index.html index.htm default.php default.htm default.html;
|
||||
root {$ROOT_DIR};
|
||||
|
||||
+107
-3
@@ -827,6 +827,69 @@ def setDbBackup():
|
||||
return mw.returnJson(True, 'ok')
|
||||
|
||||
|
||||
def importDbExternal():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file', 'name'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
import_dir = mw.getRootDir() + '/backup/import/'
|
||||
|
||||
file_path = import_dir + file
|
||||
if not os.path.exists(file_path):
|
||||
return mw.returnJson(False, '文件突然消失?')
|
||||
|
||||
exts = ['sql', 'gz', 'zip']
|
||||
tmp = file.split('.')
|
||||
ext = tmp[len(tmp) - 1]
|
||||
if ext not in exts:
|
||||
return mw.returnJson(False, '导入数据库格式不对!')
|
||||
|
||||
tmp = file.split('/')
|
||||
tmpFile = tmp[len(tmp) - 1]
|
||||
tmpFile = tmpFile.replace('.sql.' + ext, '.sql')
|
||||
tmpFile = tmpFile.replace('.' + ext, '.sql')
|
||||
tmpFile = tmpFile.replace('tar.', '')
|
||||
|
||||
# print(tmpFile)
|
||||
import_sql = ""
|
||||
if file.find("sql.gz") > -1:
|
||||
cmd = 'cd ' + import_dir + ' && gzip -dc ' + \
|
||||
file + " > " + import_dir + tmpFile
|
||||
info = mw.execShell(cmd)
|
||||
if info[1] == "":
|
||||
import_sql = import_dir + tmpFile
|
||||
|
||||
if file.find(".zip") > -1:
|
||||
cmd = 'cd ' + import_dir + ' && unzip -o ' + file
|
||||
mw.execShell(cmd)
|
||||
import_sql = import_dir + tmpFile
|
||||
|
||||
if file.find("tar.gz") > -1:
|
||||
cmd = 'cd ' + import_dir + ' && tar -zxvf ' + file
|
||||
mw.execShell(cmd)
|
||||
import_sql = import_dir + tmpFile
|
||||
|
||||
if import_sql == "":
|
||||
return mw.returnJson(False, '未找SQL文件')
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
|
||||
sock = getSocketFile()
|
||||
|
||||
os.environ["MYSQL_PWD"] = pwd
|
||||
mysql_cmd = getServerDir() + '/bin/mysql -S ' + sock + ' -uroot -p' + \
|
||||
pwd + ' ' + name + ' < ' + import_sql
|
||||
|
||||
# print(mysql_cmd)
|
||||
os.system(mysql_cmd)
|
||||
os.remove(import_sql)
|
||||
|
||||
return mw.returnJson(True, 'ok')
|
||||
|
||||
|
||||
def importDbBackup():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['file', 'name'])
|
||||
@@ -855,13 +918,17 @@ def importDbBackup():
|
||||
|
||||
def deleteDbBackup():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['filename'])
|
||||
data = checkArgs(args, ['filename', 'path'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
path = args['path']
|
||||
full_file = ""
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
|
||||
os.remove(bkDir + '/' + args['filename'])
|
||||
full_file = bkDir + '/' + args['filename']
|
||||
if path != "":
|
||||
full_file = path + "/" + args['filename']
|
||||
os.remove(full_file)
|
||||
return mw.returnJson(True, 'ok')
|
||||
|
||||
|
||||
@@ -893,6 +960,39 @@ def getDbBackupList():
|
||||
return mw.returnJson(True, 'ok', rr)
|
||||
|
||||
|
||||
def getDbBackupImportList():
|
||||
|
||||
bkImportDir = mw.getRootDir() + '/backup/import'
|
||||
if not os.path.exists(bkImportDir):
|
||||
os.mkdir(bkImportDir)
|
||||
|
||||
blist = os.listdir(bkImportDir)
|
||||
|
||||
rr = []
|
||||
for x in range(0, len(blist)):
|
||||
name = blist[x]
|
||||
p = bkImportDir + '/' + name
|
||||
data = {}
|
||||
data['name'] = name
|
||||
|
||||
rsize = os.path.getsize(p)
|
||||
data['size'] = mw.toSize(rsize)
|
||||
|
||||
t = os.path.getctime(p)
|
||||
t = time.localtime(t)
|
||||
|
||||
data['time'] = time.strftime('%Y-%m-%d %H:%M:%S', t)
|
||||
rr.append(data)
|
||||
|
||||
data['file'] = p
|
||||
|
||||
rdata = {
|
||||
"list": rr,
|
||||
"upload_dir": bkImportDir,
|
||||
}
|
||||
return mw.returnJson(True, 'ok', rdata)
|
||||
|
||||
|
||||
def getDbList():
|
||||
args = getArgs()
|
||||
page = 1
|
||||
@@ -2427,10 +2527,14 @@ if __name__ == "__main__":
|
||||
print(setDbBackup())
|
||||
elif func == 'import_db_backup':
|
||||
print(importDbBackup())
|
||||
elif func == 'import_db_external':
|
||||
print(importDbExternal())
|
||||
elif func == 'delete_db_backup':
|
||||
print(deleteDbBackup())
|
||||
elif func == 'get_db_backup_list':
|
||||
print(getDbBackupList())
|
||||
elif func == 'get_db_backup_import_list':
|
||||
print(getDbBackupImportList())
|
||||
elif func == 'add_db':
|
||||
print(addDb())
|
||||
elif func == 'del_db':
|
||||
|
||||
+190
-75
@@ -1,18 +1,9 @@
|
||||
function str2Obj(str){
|
||||
var data = {};
|
||||
kv = str.split('&');
|
||||
for(i in kv){
|
||||
v = kv[i].split('=');
|
||||
data[v[0]] = v[1];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
function myPost(method,args,callback, title){
|
||||
|
||||
var _args = null;
|
||||
if (typeof(args) == 'string'){
|
||||
_args = JSON.stringify(str2Obj(args));
|
||||
_args = JSON.stringify(toArrayObject(args));
|
||||
} else {
|
||||
_args = JSON.stringify(args);
|
||||
}
|
||||
@@ -40,7 +31,7 @@ function myPostN(method,args,callback, title){
|
||||
|
||||
var _args = null;
|
||||
if (typeof(args) == 'string'){
|
||||
_args = JSON.stringify(str2Obj(args));
|
||||
_args = JSON.stringify(toArrayObject(args));
|
||||
} else {
|
||||
_args = JSON.stringify(args);
|
||||
}
|
||||
@@ -59,7 +50,7 @@ function myPostN(method,args,callback, title){
|
||||
function myAsyncPost(method,args){
|
||||
var _args = null;
|
||||
if (typeof(args) == 'string'){
|
||||
_args = JSON.stringify(str2Obj(args));
|
||||
_args = JSON.stringify(toArrayObject(args));
|
||||
} else {
|
||||
_args = JSON.stringify(args);
|
||||
}
|
||||
@@ -606,7 +597,7 @@ function setDbAccess(username){
|
||||
yes:function(index){
|
||||
var data = $("#set_db_access").serialize();
|
||||
data = decodeURIComponent(data);
|
||||
var dataObj = str2Obj(data);
|
||||
var dataObj = toArrayObject(data);
|
||||
if(!dataObj['access']){
|
||||
dataObj['access'] = dataObj['dataAccess'];
|
||||
if ( dataObj['dataAccess'] == 'ip'){
|
||||
@@ -672,33 +663,15 @@ function setDbPass(id, username, password){
|
||||
}
|
||||
|
||||
function addDatabase(type){
|
||||
if (type==1){
|
||||
var data = $("#add_db").serialize();
|
||||
data = decodeURIComponent(data);
|
||||
var dataObj = str2Obj(data);
|
||||
if(!dataObj['address']){
|
||||
dataObj['address'] = dataObj['dataAccess'];
|
||||
}
|
||||
myPost('add_db', dataObj, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
if (rdata.status){
|
||||
dbList();
|
||||
}
|
||||
$('.layui-layer-close1').click();
|
||||
},{icon: rdata.status ? 1 : 2},600);
|
||||
});
|
||||
return;
|
||||
}
|
||||
var index = layer.open({
|
||||
layer.open({
|
||||
type: 1,
|
||||
skin: 'demo-class',
|
||||
area: '500px',
|
||||
title: '添加数据库',
|
||||
closeBtn: 1,
|
||||
shift: 5,
|
||||
shadeClose: true,
|
||||
content: "<form class='bt-form pd20 pb70' id='add_db'>\
|
||||
btn:["提交","关闭"],
|
||||
content: "<form class='bt-form pd20' id='add_db'>\
|
||||
<div class='line'>\
|
||||
<span class='tname'>数据库名</span>\
|
||||
<div class='info-r'><input name='name' class='bt-input-text mr5' placeholder='新的数据库名称' type='text' style='width:65%' value=''>\
|
||||
@@ -726,28 +699,39 @@ function addDatabase(type){
|
||||
</div>\
|
||||
</div>\
|
||||
<input type='hidden' name='ps' value='' />\
|
||||
<div class='bt-form-submit-btn'>\
|
||||
<button id='my_mod_close' type='button' class='btn btn-danger btn-sm btn-title'>关闭</button>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-title' onclick=\"addDatabase(1)\" >提交</button>\
|
||||
</div>\
|
||||
</form>",
|
||||
});
|
||||
success:function(){
|
||||
$("input[name='name']").keyup(function(){
|
||||
var v = $(this).val();
|
||||
$("input[name='db_user']").val(v);
|
||||
$("input[name='ps']").val(v);
|
||||
});
|
||||
|
||||
$("input[name='name']").keyup(function(){
|
||||
var v = $(this).val();
|
||||
$("input[name='db_user']").val(v);
|
||||
$("input[name='ps']").val(v);
|
||||
});
|
||||
|
||||
$('#my_mod_close').click(function(){
|
||||
$('.layui-layer-close1').click();
|
||||
});
|
||||
$('select[name="dataAccess"]').change(function(){
|
||||
var v = $(this).val();
|
||||
if (v == 'ip'){
|
||||
$(this).after("<input id='dataAccess_subid' class='bt-input-text mr5' type='text' name='address' placeholder='多个IP使用逗号(,)分隔' style='width: 230px; display: inline-block;'>");
|
||||
} else {
|
||||
$('#dataAccess_subid').remove();
|
||||
$('select[name="dataAccess"]').change(function(){
|
||||
var v = $(this).val();
|
||||
if (v == 'ip'){
|
||||
$(this).after("<input id='dataAccess_subid' class='bt-input-text mr5' type='text' name='address' placeholder='多个IP使用逗号(,)分隔' style='width: 230px; display: inline-block;'>");
|
||||
} else {
|
||||
$('#dataAccess_subid').remove();
|
||||
}
|
||||
});
|
||||
},
|
||||
yes:function(index) {
|
||||
var data = $("#add_db").serialize();
|
||||
data = decodeURIComponent(data);
|
||||
var dataObj = toArrayObject(data);
|
||||
if(!dataObj['address']){
|
||||
dataObj['address'] = dataObj['dataAccess'];
|
||||
}
|
||||
myPost('add_db', dataObj, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
if (rdata.status){
|
||||
layer.close(index);
|
||||
dbList();
|
||||
}
|
||||
},{icon: rdata.status ? 1 : 2},600);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -759,7 +743,6 @@ function delDb(id, name){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
dbList();
|
||||
$('.layui-layer-close1').click();
|
||||
},{icon: rdata.status ? 1 : 2}, 600);
|
||||
});
|
||||
});
|
||||
@@ -881,8 +864,11 @@ function openPhpmyadmin(name,username,password){
|
||||
}
|
||||
}
|
||||
|
||||
function delBackup(filename,name){
|
||||
myPost('delete_db_backup',{filename:filename},function(){
|
||||
function delBackup(filename,name,path){
|
||||
if(typeof(path) == "undefined"){
|
||||
path = "";
|
||||
}
|
||||
myPost('delete_db_backup',{filename:filename,path:path},function(){
|
||||
layer.msg('执行成功!');
|
||||
setTimeout(function(){
|
||||
$('.layui-layer-close2').click();
|
||||
@@ -902,6 +888,132 @@ function importBackup(file,name){
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function importDbExternal(file,name){
|
||||
myPost('import_db_external',{file:file,name:name}, function(data){
|
||||
layer.msg('执行成功!');
|
||||
});
|
||||
}
|
||||
|
||||
function setLocalImport(db_name){
|
||||
|
||||
//上传文件
|
||||
function uploadDbFiles(upload_dir){
|
||||
var up_db = layer.open({
|
||||
type:1,
|
||||
closeBtn: 1,
|
||||
title:"上传导入文件["+upload_dir+']',
|
||||
area: ['500px','300px'],
|
||||
shadeClose:false,
|
||||
content:'<div class="fileUploadDiv">\
|
||||
<input type="hidden" id="input-val" value="'+upload_dir+'" />\
|
||||
<input type="file" id="file_input" multiple="true" autocomplete="off" />\
|
||||
<button type="button" id="opt" autocomplete="off">添加文件</button>\
|
||||
<button type="button" id="up" autocomplete="off" >开始上传</button>\
|
||||
<span id="totalProgress" style="position: absolute;top: 7px;right: 147px;"></span>\
|
||||
<span style="float:right;margin-top: 9px;">\
|
||||
<font>文件编码:</font>\
|
||||
<select id="fileCodeing" >\
|
||||
<option value="byte">二进制</option>\
|
||||
<option value="utf-8">UTF-8</option>\
|
||||
<option value="gb18030">GB2312</option>\
|
||||
</select>\
|
||||
</span>\
|
||||
<button type="button" id="filesClose" autocomplete="off">关闭</button>\
|
||||
<ul id="up_box"></ul>\
|
||||
</div>',
|
||||
success:function(){
|
||||
$('#filesClose').click(function(){
|
||||
layer.close(up_db);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
uploadStart(function(){
|
||||
getList();
|
||||
});
|
||||
}
|
||||
|
||||
function getList(){
|
||||
myPost('get_db_backup_import_list',{}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
|
||||
var file_list = rdata.data.list;
|
||||
var upload_dir = rdata.data.upload_dir;
|
||||
|
||||
var tbody = '';
|
||||
for (var i = 0; i < file_list.length; i++) {
|
||||
tbody += '<tr>\
|
||||
<td><span> ' + file_list[i]['name'] + '</span></td>\
|
||||
<td><span> ' + file_list[i]['size'] + '</span></td>\
|
||||
<td><span> ' + file_list[i]['time'] + '</span></td>\
|
||||
<td style="text-align: right;">\
|
||||
<a class="btlink" onclick="importDbExternal(\'' + file_list[i]['name'] + '\',\'' +db_name+ '\')">导入</a> | \
|
||||
<a class="btlink del" index="'+i+'">删除</a>\
|
||||
</td>\
|
||||
</tr>';
|
||||
}
|
||||
|
||||
$('#import_db_file_list').html(tbody);
|
||||
$('input[name="upload_dir"]').val(upload_dir);
|
||||
|
||||
$("#import_db_file_list .del").on('click',function(){
|
||||
var index = $(this).attr('index');
|
||||
var filename = file_list[index]["name"];
|
||||
myPost('delete_db_backup',{filename:filename,path:upload_dir},function(){
|
||||
showMsg('执行成功!', function(){
|
||||
getList();
|
||||
},{icon:1},2000);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var layerIndex = layer.open({
|
||||
type: 1,
|
||||
title: "从文件导入数据",
|
||||
area: ['600px', '380px'],
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
content: '<div class="pd15">\
|
||||
<div class="db_list">\
|
||||
<button id="btn_file_upload" class="btn btn-success btn-sm" type="button">从本地上传</button>\
|
||||
</div >\
|
||||
<div class="divtable">\
|
||||
<input type="hidden" name="upload_dir" value=""> \
|
||||
<div id="database_fix" style="height:150px;overflow:auto;border:#ddd 1px solid">\
|
||||
<table class="table table-hover "style="border:none">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th>文件名称</th>\
|
||||
<th>文件大小</th>\
|
||||
<th>备份时间</th>\
|
||||
<th style="text-align: right;">操作</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody id="import_db_file_list" class="gztr"></tbody>\
|
||||
</table>\
|
||||
</div>\
|
||||
<ul class="help-info-text c7">\
|
||||
<li>仅支持sql、zip、sql.gz、(tar.gz|gz|tgz)</li>\
|
||||
<li>zip、tar.gz压缩包结构:test.zip或test.tar.gz压缩包内,必需包含test.sql</li>\
|
||||
<li>若文件过大,您还可以使用SFTP工具,将数据库文件上传到/www/backup/import</li>\
|
||||
</ul>\
|
||||
</div>\
|
||||
</div>',
|
||||
success:function(index){
|
||||
$('#btn_file_upload').click(function(){
|
||||
var upload_dir = $('input[name="upload_dir"]').val();
|
||||
uploadDbFiles(upload_dir);
|
||||
});
|
||||
|
||||
getList();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
function setBackup(db_name,obj){
|
||||
myPost('get_db_backup_list', {name:db_name}, function(data){
|
||||
|
||||
@@ -914,21 +1026,21 @@ function setBackup(db_name,obj){
|
||||
<td><span> ' + rdata.data[i]['time'] + '</span></td>\
|
||||
<td style="text-align: right;">\
|
||||
<a class="btlink" onclick="importBackup(\'' + rdata.data[i]['name'] + '\',\'' +db_name+ '\')">导入</a> | \
|
||||
<a class="btlink" onclick="downloadBackup(\'' + rdata.data[i]['file'] + '\')">下载</a> | \
|
||||
<a class="btlink" onclick="delBackup(\'' + rdata.data[i]['name'] + '\',\'' +db_name+ '\')">删除</a>\
|
||||
</td>\
|
||||
</tr> ';
|
||||
}
|
||||
|
||||
var s = layer.open({
|
||||
var layerIndex = layer.open({
|
||||
type: 1,
|
||||
title: "数据库备份详情",
|
||||
area: ['600px', '280px'],
|
||||
closeBtn: 2,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
content: '<div class="pd15">\
|
||||
<div class="db_list">\
|
||||
<button id="btn_backup" class="btn btn-success btn-sm" type="button">备份</button>\
|
||||
<button id="btn_local_import" class="btn btn-success btn-sm" type="button">外部导入</button>\
|
||||
</div >\
|
||||
<div class="divtable">\
|
||||
<div id="database_fix" style="height:150px;overflow:auto;border:#ddd 1px solid">\
|
||||
@@ -945,18 +1057,21 @@ function setBackup(db_name,obj){
|
||||
</table>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>'
|
||||
});
|
||||
</div>',
|
||||
success:function(index){
|
||||
$('#btn_backup').click(function(){
|
||||
myPost('set_db_backup',{name:db_name}, function(data){
|
||||
showMsg('执行成功!', function(){
|
||||
layer.close(layerIndex);
|
||||
setBackup(db_name,obj);
|
||||
}, {icon:1}, 2000);
|
||||
});
|
||||
});
|
||||
|
||||
$('#btn_backup').click(function(){
|
||||
myPost('set_db_backup',{name:db_name}, function(data){
|
||||
layer.msg('执行成功!');
|
||||
|
||||
setTimeout(function(){
|
||||
layer.close(s);
|
||||
setBackup(db_name,obj);
|
||||
},2000);
|
||||
});
|
||||
$('#btn_local_import').click(function(){
|
||||
setLocalImport(db_name);
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1237,7 +1352,7 @@ function repTools(db_name, res){
|
||||
type: 1,
|
||||
title: "MySQL工具箱【" + db_name + "】",
|
||||
area: ['780px', '580px'],
|
||||
closeBtn: 2,
|
||||
closeBtn: 1,
|
||||
shadeClose: false,
|
||||
content: '<div class="pd15">\
|
||||
<div class="db_list">\
|
||||
@@ -1332,7 +1447,7 @@ function addMasterRepSlaveUser(){
|
||||
yes:function(index){
|
||||
var data = $("#add_master").serialize();
|
||||
data = decodeURIComponent(data);
|
||||
var dataObj = str2Obj(data);
|
||||
var dataObj = toArrayObject(data);
|
||||
if(!dataObj['address']){
|
||||
dataObj['address'] = dataObj['dataAccess'];
|
||||
}
|
||||
@@ -1377,7 +1492,7 @@ function updateMasterRepSlaveUser(username){
|
||||
$('#submit_update_master').click(function(){
|
||||
var data = $("#update_master").serialize();
|
||||
data = decodeURIComponent(data);
|
||||
var dataObj = str2Obj(data);
|
||||
var dataObj = toArrayObject(data);
|
||||
myPost('update_master_rep_slave_user', data, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
showMsg(rdata.msg,function(){
|
||||
@@ -1488,7 +1603,7 @@ function setDbMasterAccess(username){
|
||||
yes:function(index){
|
||||
var data = $("#set_db_access").serialize();
|
||||
data = decodeURIComponent(data);
|
||||
var dataObj = str2Obj(data);
|
||||
var dataObj = toArrayObject(data);
|
||||
if(!dataObj['access']){
|
||||
dataObj['access'] = dataObj['dataAccess'];
|
||||
if ( dataObj['dataAccess'] == 'ip'){
|
||||
|
||||
@@ -64,6 +64,7 @@ http
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name 127.0.0.1;
|
||||
allow 127.0.0.1;
|
||||
location /nginx_status {
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
<p class="bgw" onclick="orPluginService('openresty');">服务</p>
|
||||
<p onclick="pluginInitD('openresty');">自启动</p>
|
||||
<p onclick="pluginConfig('openresty');">配置修改</p>
|
||||
<p onclick="getOpenrestyStatus();">负载状态</p>
|
||||
<p onclick="getOpStatus();">负载状态</p>
|
||||
<p onclick="setOpCfg();">性能调整</p>
|
||||
<p onclick="pluginLogs('openresty');">错误日志</p>
|
||||
</div>
|
||||
<div class="bt-w-con pd15">
|
||||
@@ -14,9 +15,7 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <script type="text/javascript" src="/plugins/file?name=openresty&f=js/openresty.js"></script> -->
|
||||
<script type="text/javascript">
|
||||
|
||||
$.getScript( "/plugins/file?name=openresty&f=js/openresty.js", function(){
|
||||
orPluginService('openresty');
|
||||
});
|
||||
|
||||
+121
-3
@@ -6,6 +6,7 @@ import os
|
||||
import time
|
||||
import threading
|
||||
import subprocess
|
||||
import re
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
import mw
|
||||
@@ -52,6 +53,13 @@ def getArgs():
|
||||
return tmp
|
||||
|
||||
|
||||
def checkArgs(data, ck=[]):
|
||||
for i in range(len(ck)):
|
||||
if not ck[i] in data:
|
||||
return (False, mw.returnJson(False, '参数:(' + ck[i] + ')没有!'))
|
||||
return (True, mw.returnJson(True, 'ok'))
|
||||
|
||||
|
||||
def clearTemp():
|
||||
path_bin = getServerDir() + "/nginx"
|
||||
mw.execShell('rm -rf ' + path_bin + '/client_body_temp')
|
||||
@@ -232,7 +240,7 @@ def restyOp_restart():
|
||||
check = getServerDir() + "/bin/openresty -t"
|
||||
check_data = mw.execShell(check)
|
||||
if not check_data[1].find('test is successful') > -1:
|
||||
return check_data[1]
|
||||
return 'ERROR: 配置出错<br><a style="color:red;">' + check_data[1].replace("\n", '<br>') + '</a>'
|
||||
|
||||
if not mw.isAppleSystem():
|
||||
threading.Timer(2, op_submit_systemctl_restart, args=()).start()
|
||||
@@ -291,7 +299,7 @@ def initdUinstall():
|
||||
def runInfo():
|
||||
# 取Openresty负载状态
|
||||
try:
|
||||
url = 'http://' + mw.getHostAddr() + '/nginx_status'
|
||||
url = 'http://127.0.0.1/nginx_status'
|
||||
result = mw.httpGet(url)
|
||||
tmp = result.split()
|
||||
data = {}
|
||||
@@ -304,7 +312,8 @@ def runInfo():
|
||||
data['Waiting'] = tmp[15]
|
||||
return mw.getJson(data)
|
||||
except Exception as e:
|
||||
url = 'http://127.0.0.1/nginx_status'
|
||||
|
||||
url = 'http://' + mw.getHostAddr() + '/nginx_status'
|
||||
result = mw.httpGet(url)
|
||||
tmp = result.split()
|
||||
data = {}
|
||||
@@ -324,6 +333,111 @@ def errorLogPath():
|
||||
return getServerDir() + '/nginx/logs/error.log'
|
||||
|
||||
|
||||
def getCfg():
|
||||
cfg = getConf()
|
||||
content = mw.readFile(cfg)
|
||||
|
||||
unitrep = "[kmgKMG]"
|
||||
cfg_args = [
|
||||
{"name": "worker_processes", "ps": "处理进程,auto表示自动,数字表示进程数", 'type': 2},
|
||||
{"name": "worker_connections", "ps": "最大并发链接数", 'type': 2},
|
||||
{"name": "keepalive_timeout", "ps": "连接超时时间", 'type': 2},
|
||||
{"name": "gzip", "ps": "是否开启压缩传输", 'type': 1},
|
||||
{"name": "gzip_min_length", "ps": "最小压缩文件", 'type': 2},
|
||||
{"name": "gzip_comp_level", "ps": "压缩率", 'type': 2},
|
||||
{"name": "client_max_body_size", "ps": "最大上传文件", 'type': 2},
|
||||
{"name": "server_names_hash_bucket_size",
|
||||
"ps": "服务器名字的hash表大小", 'type': 2},
|
||||
{"name": "client_header_buffer_size", "ps": "客户端请求头buffer大小", 'type': 2},
|
||||
]
|
||||
|
||||
# {"name": "client_body_buffer_size", "ps": "请求主体缓冲区"}
|
||||
rdata = []
|
||||
for i in cfg_args:
|
||||
rep = "(%s)\s+(\w+)" % i["name"]
|
||||
k = re.search(rep, content)
|
||||
if not k:
|
||||
return mw.returnJson(False, "获取 key {} 失败".format(k))
|
||||
k = k.group(1)
|
||||
v = re.search(rep, content)
|
||||
if not v:
|
||||
return mw.returnJson(False, "获取 value {} 失败".format(v))
|
||||
v = v.group(2)
|
||||
|
||||
if re.search(unitrep, v):
|
||||
u = str.upper(v[-1])
|
||||
v = v[:-1]
|
||||
if len(u) == 1:
|
||||
psstr = u + "B," + i["ps"]
|
||||
else:
|
||||
psstr = u + "," + i["ps"]
|
||||
else:
|
||||
u = ""
|
||||
|
||||
kv = {"name": k, "value": v, "unit": u,
|
||||
"ps": i["ps"], "type": i["type"]}
|
||||
rdata.append(kv)
|
||||
|
||||
return mw.returnJson(True, "ok", rdata)
|
||||
|
||||
|
||||
def setCfg():
|
||||
|
||||
args = getArgs()
|
||||
data = checkArgs(args, [
|
||||
'worker_processes', 'worker_connections', 'keepalive_timeout',
|
||||
'gzip', 'gzip_min_length', 'gzip_comp_level', 'client_max_body_size',
|
||||
'server_names_hash_bucket_size', 'client_header_buffer_size'
|
||||
])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
cfg = getConf()
|
||||
mw.backFile(cfg)
|
||||
content = mw.readFile(cfg)
|
||||
|
||||
unitrep = "[kmgKMG]"
|
||||
cfg_args = [
|
||||
{"name": "worker_processes", "ps": "处理进程,auto表示自动,数字表示进程数", 'type': 2},
|
||||
{"name": "worker_connections", "ps": "最大并发链接数", 'type': 2},
|
||||
{"name": "keepalive_timeout", "ps": "连接超时时间", 'type': 2},
|
||||
{"name": "gzip", "ps": "是否开启压缩传输", 'type': 1},
|
||||
{"name": "gzip_min_length", "ps": "最小压缩文件", 'type': 2},
|
||||
{"name": "gzip_comp_level", "ps": "压缩率", 'type': 2},
|
||||
{"name": "client_max_body_size", "ps": "最大上传文件", 'type': 2},
|
||||
{"name": "server_names_hash_bucket_size",
|
||||
"ps": "服务器名字的hash表大小", 'type': 2},
|
||||
{"name": "client_header_buffer_size", "ps": "客户端请求头buffer大小", 'type': 2},
|
||||
]
|
||||
|
||||
# print(args)
|
||||
for k, v in args.items():
|
||||
# print(k, v)
|
||||
rep = "%s\s+[^kKmMgG\;\n]+" % k
|
||||
if k == "worker_processes" or k == "gzip":
|
||||
if not re.search("auto|on|off|\d+", v):
|
||||
return mw.returnJson(False, '参数值错误')
|
||||
else:
|
||||
if not re.search("\d+", v):
|
||||
return mw.returnJson(False, '参数值错误,请输入数字整数')
|
||||
|
||||
if re.search(rep, content):
|
||||
newconf = "%s %s" % (k, v)
|
||||
content = re.sub(rep, newconf, content)
|
||||
elif re.search(rep, content):
|
||||
newconf = "%s %s" % (k, v)
|
||||
content = re.sub(rep, newconf, content)
|
||||
|
||||
mw.writeFile(cfg, content)
|
||||
isError = mw.checkWebConfig()
|
||||
if (isError != True):
|
||||
mw.restoreFile(cfg)
|
||||
return mw.returnJson(False, 'ERROR: 配置出错<br><a style="color:red;">' + isError.replace("\n", '<br>') + '</a>')
|
||||
|
||||
mw.restartWeb()
|
||||
return mw.returnJson(True, '设置成功')
|
||||
|
||||
|
||||
def installPreInspection():
|
||||
return 'ok'
|
||||
|
||||
@@ -356,5 +470,9 @@ if __name__ == "__main__":
|
||||
print(runInfo())
|
||||
elif func == 'error_log':
|
||||
print(errorLogPath())
|
||||
elif func == 'get_cfg':
|
||||
print(getCfg())
|
||||
elif func == 'set_cfg':
|
||||
print(setCfg())
|
||||
else:
|
||||
print('error')
|
||||
|
||||
@@ -59,6 +59,7 @@ Install_openresty()
|
||||
cd ${openrestyDir}/openresty-${VERSION} && ./configure \
|
||||
--prefix=$serverPath/openresty \
|
||||
--with-ipv6 \
|
||||
--with-stream \
|
||||
--with-http_v2_module \
|
||||
--with-http_ssl_module \
|
||||
--with-http_slice_module \
|
||||
|
||||
@@ -111,8 +111,10 @@ function orPluginOpServiceOp(a,b,c,d,a,v,request_callback){
|
||||
|
||||
|
||||
//查看Nginx负载状态
|
||||
function getOpenrestyStatus() {
|
||||
function getOpStatus() {
|
||||
var loadT = layer.msg('正在处理,请稍后...', { icon: 16, time: 0, shade: 0.3 });
|
||||
$.post('/plugins/run', {name:'openresty', func:'run_info'}, function(data) {
|
||||
layer.close(loadT);
|
||||
if (!data.status){
|
||||
showMsg(data.msg, function(){}, null,3000);
|
||||
return;
|
||||
@@ -134,3 +136,78 @@ function getOpenrestyStatus() {
|
||||
}
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
function setOpCfg(){
|
||||
orPost('get_cfg', {}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
var rdata = rdata.data;
|
||||
console.log(rdata);
|
||||
|
||||
var mlist = '';
|
||||
for (var i = 0; i < rdata.length; i++) {
|
||||
var w = '70'
|
||||
var ibody = '<input style="width: ' + w + 'px;" class="bt-input-text mr5" name="' + rdata[i].name + '" value="' + rdata[i].value + '" type="text" >';
|
||||
switch (rdata[i].type) {
|
||||
case 0:
|
||||
var selected_1 = (rdata[i].value == 1) ? 'selected' : '';
|
||||
var selected_0 = (rdata[i].value == 0) ? 'selected' : '';
|
||||
ibody = '<select class="bt-input-text mr5" name="' + rdata[i].name + '" style="width: ' + w + 'px;">\
|
||||
<option value="1" ' + selected_1 + '>开启</option>\
|
||||
<option value="0" ' + selected_0 + '>关闭</option>\
|
||||
</select>';
|
||||
break;
|
||||
case 1:
|
||||
var selected_1 = (rdata[i].value == 'on') ? 'selected' : '';
|
||||
var selected_0 = (rdata[i].value == 'off') ? 'selected' : '';
|
||||
ibody = '<select class="bt-input-text mr5" name="' + rdata[i].name + '" style="width: ' + w + 'px;">\
|
||||
<option value="on" ' + selected_1 + '>开启</option>\
|
||||
<option value="off" ' + selected_0 + '>关闭</option>\
|
||||
</select>';
|
||||
break;
|
||||
}
|
||||
mlist += '<p style="margin-top:15px;"><span>' + rdata[i].name + '</span>' + ibody + "<b class='unit c9'>"+rdata[i].unit+"</b>" +', <font class="c9">' + rdata[i].ps + '</font></p>';
|
||||
}
|
||||
var con = '<style>.conf_p p{margin-bottom: 2px}</style><div class="conf_p" style="margin-bottom:0">\
|
||||
' + mlist + '\
|
||||
<div style="margin-top:10px; padding-right:15px" class="text-right">\
|
||||
<button class="btn btn-success btn-sm mr5" onclick="setOpCfg()">刷新</button>\
|
||||
<button class="btn btn-success btn-sm" onclick="submitConf()">保存</button>\
|
||||
</div>\
|
||||
</div>'
|
||||
$(".soft-man-con").html(con);
|
||||
});
|
||||
}
|
||||
|
||||
function submitConf() {
|
||||
var data = {
|
||||
worker_processes: $("input[name='worker_processes']").val(),
|
||||
worker_connections: $("input[name='worker_connections']").val(),
|
||||
keepalive_timeout: $("input[name='keepalive_timeout']").val(),
|
||||
gzip: $("select[name='gzip']").val() || 'on',
|
||||
gzip_min_length: $("input[name='gzip_min_length']").val(),
|
||||
gzip_comp_level: $("input[name='gzip_comp_level']").val(),
|
||||
client_max_body_size: $("input[name='client_max_body_size']").val(),
|
||||
server_names_hash_bucket_size: $("input[name='server_names_hash_bucket_size']").val(),
|
||||
client_header_buffer_size: $("input[name='client_header_buffer_size']").val(),
|
||||
};
|
||||
|
||||
// console.log(data);
|
||||
orPost('set_cfg', data, function(rdata){
|
||||
var rdata = $.parseJSON(rdata.data);
|
||||
console.log(rdata);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -81,7 +81,10 @@ function phpSetConfig(version) {
|
||||
}
|
||||
var phpCon = '<style>.conf_p p{margin-bottom: 2px}</style><div class="conf_p" style="margin-bottom:0">\
|
||||
' + mlist + '\
|
||||
<div style="margin-top:10px; padding-right:15px" class="text-right"><button class="btn btn-success btn-sm mr5" onclick="phpSetConfig(' + version + ')">刷新</button><button class="btn btn-success btn-sm" onclick="submitConf(' + version + ')">保存</button></div>\
|
||||
<div style="margin-top:10px; padding-right:15px" class="text-right">\
|
||||
<button class="btn btn-success btn-sm mr5" onclick="phpSetConfig(' + version + ')">刷新</button>\
|
||||
<button class="btn btn-success btn-sm" onclick="submitConf(' + version + ')">保存</button>\
|
||||
</div>\
|
||||
</div>'
|
||||
$(".soft-man-con").html(phpCon);
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ def getConf():
|
||||
|
||||
|
||||
def getConfInc():
|
||||
return getServerDir() + '/phpmyadmin/config.inc.php'
|
||||
return getServerDir() + "/" + getCfg()['path'] + '/config.inc.php'
|
||||
|
||||
|
||||
def getPort():
|
||||
@@ -74,7 +74,8 @@ def getHomePage():
|
||||
ip = '127.0.0.1'
|
||||
if not mw.isAppleSystem():
|
||||
ip = mw.getLocalIp()
|
||||
url = 'http://' + ip + ':' + port + '/phpmyadmin/index.php'
|
||||
url = 'http://' + ip + ':' + port + \
|
||||
'/' + getCfg()['path'] + '/index.php'
|
||||
return mw.returnJson(True, 'OK', url)
|
||||
except Exception as e:
|
||||
return mw.returnJson(False, '插件未启动!')
|
||||
@@ -124,6 +125,8 @@ def contentReplace(content):
|
||||
content = content.replace('{$CHOOSE_DB}', 'MariaDB')
|
||||
content = content.replace('{$CHOOSE_DB_DIR}', 'mariadb')
|
||||
|
||||
content = content.replace('{$PMA_PATH}', cfg['path'])
|
||||
|
||||
port = cfg["port"]
|
||||
rep = 'listen\s*(.*);'
|
||||
content = re.sub(rep, "listen " + port + ';', content)
|
||||
@@ -137,6 +140,7 @@ def initCfg():
|
||||
data = {}
|
||||
data['port'] = '888'
|
||||
data['choose'] = ''
|
||||
data['path'] = ''
|
||||
data['username'] = 'admin'
|
||||
data['password'] = 'admin'
|
||||
mw.writeFile(cfg, json.dumps(data))
|
||||
@@ -165,7 +169,7 @@ def returnCfg():
|
||||
|
||||
def status():
|
||||
conf = getConf()
|
||||
conf_inc = getServerDir() + '/phpmyadmin/config.inc.php'
|
||||
conf_inc = getServerDir() + "/" + getCfg()["path"] + '/config.inc.php'
|
||||
# 两个文件都在,才算启动成功
|
||||
if os.path.exists(conf) and os.path.exists(conf_inc):
|
||||
return 'start'
|
||||
@@ -175,9 +179,16 @@ def status():
|
||||
def start():
|
||||
initCfg()
|
||||
|
||||
pma_dir = getServerDir() + "/phpmyadmin"
|
||||
if os.path.exists(pma_dir):
|
||||
rand_str = mw.getRandomString(6)
|
||||
rand_str = rand_str.lower()
|
||||
pma_dir_dst = pma_dir + "_" + rand_str
|
||||
mw.execShell("mv " + pma_dir + " " + pma_dir_dst)
|
||||
setCfg('path', 'phpmyadmin_' + rand_str)
|
||||
|
||||
file_tpl = getPluginDir() + '/conf/phpmyadmin.conf'
|
||||
file_run = getConf()
|
||||
|
||||
if not os.path.exists(file_run):
|
||||
centent = mw.readFile(file_tpl)
|
||||
centent = contentReplace(centent)
|
||||
@@ -191,11 +202,12 @@ def start():
|
||||
setCfg('password', username)
|
||||
mw.writeFile(pma_path, pass_cmd)
|
||||
|
||||
tmp = getServerDir() + '/phpmyadmin/tmp'
|
||||
tmp = getServerDir() + "/" + getCfg()["path"] + '/tmp'
|
||||
if not os.path.exists(tmp):
|
||||
os.mkdir(tmp)
|
||||
mw.execShell("chown -R www:www " + tmp)
|
||||
|
||||
conf_run = getServerDir() + '/phpmyadmin/config.inc.php'
|
||||
conf_run = getServerDir() + "/" + getCfg()["path"] + '/config.inc.php'
|
||||
if not os.path.exists(conf_run):
|
||||
conf_tpl = getPluginDir() + '/conf/config.inc.php'
|
||||
centent = mw.readFile(conf_tpl)
|
||||
@@ -227,6 +239,12 @@ def restart():
|
||||
|
||||
|
||||
def reload():
|
||||
file_tpl = getPluginDir() + '/conf/phpmyadmin.conf'
|
||||
file_run = getConf()
|
||||
if os.path.exists(file_run):
|
||||
centent = mw.readFile(file_tpl)
|
||||
centent = contentReplace(centent)
|
||||
mw.writeFile(file_run, centent)
|
||||
return start()
|
||||
|
||||
|
||||
@@ -351,6 +369,25 @@ def setPmaPassword():
|
||||
return mw.returnJson(True, '修改成功!')
|
||||
|
||||
|
||||
def setPmaPath():
|
||||
args = getArgs()
|
||||
data = checkArgs(args, ['path'])
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
path = args['path']
|
||||
|
||||
if len(path) < 5:
|
||||
return mw.returnJson(False, '不能小于5位!')
|
||||
|
||||
old_path = getServerDir() + "/" + getCfg()['path']
|
||||
new_path = getServerDir() + "/" + path
|
||||
|
||||
mw.execShell("mv " + old_path + " " + new_path)
|
||||
setCfg('path', path)
|
||||
return mw.returnJson(True, '修改成功!')
|
||||
|
||||
|
||||
def accessLog():
|
||||
return getServerDir() + '/access.log'
|
||||
|
||||
@@ -401,6 +438,8 @@ if __name__ == "__main__":
|
||||
print(setPmaUsername())
|
||||
elif func == 'set_pma_password':
|
||||
print(setPmaPassword())
|
||||
elif func == 'set_pma_path':
|
||||
print(setPmaPath())
|
||||
elif func == 'access_log':
|
||||
print(accessLog())
|
||||
elif func == 'error_log':
|
||||
|
||||
@@ -61,13 +61,7 @@ Install_phpmyadmin()
|
||||
|
||||
cp -r $serverPath/source/phpmyadmin/$FDIR $serverPath/phpmyadmin/
|
||||
cd $serverPath/phpmyadmin/ && mv $FDIR phpmyadmin
|
||||
|
||||
mkdir -p $serverPath/phpmyadmin/tmp
|
||||
chown -R www:www $serverPath/phpmyadmin/tmp
|
||||
|
||||
if [ "$OSNAME" != 'macos' ];then
|
||||
chown -R www:www $serverPath/phpmyadmin/tmp
|
||||
fi
|
||||
|
||||
echo "${1}" > ${serverPath}/phpmyadmin/version.pl
|
||||
echo '安装完成' > $install_tmp
|
||||
|
||||
@@ -120,6 +120,12 @@ function safeConf() {
|
||||
<span class="tname">密码</span>\
|
||||
<input style="width:110px" class="bt-input-text mr20" name="password" id="pmport" value="' + cfg['password'] + '" placeholder="密码" type="text">\
|
||||
<button class="btn btn-success btn-sm" onclick="setPmaPassword()">保存</button>\
|
||||
</div>\
|
||||
<hr/>\
|
||||
<div class="ver line">\
|
||||
<span class="tname">路径名</span>\
|
||||
<input style="width:180px" class="bt-input-text mr20" name="path" id="pmport" value="' + cfg['path'] + '" placeholder="" type="text">\
|
||||
<button class="btn btn-success btn-sm" onclick="setPmaPath()">保存</button>\
|
||||
</div>';
|
||||
$(".soft-man-con").html(con);
|
||||
});
|
||||
@@ -150,6 +156,14 @@ function setPmaPassword(){
|
||||
});
|
||||
}
|
||||
|
||||
function setPmaPath(){
|
||||
var path = $("input[name=path]").val();
|
||||
pmaPost('set_pma_path',{'path':path}, function(data){
|
||||
var rdata = $.parseJSON(data.data);
|
||||
layer.msg(rdata.msg, { icon: rdata.status ? 1 : 2 });
|
||||
});
|
||||
}
|
||||
|
||||
//修改phpmyadmin端口
|
||||
function setPamPort() {
|
||||
var pmport = $("#pmport").val();
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ chardet==3.0.4
|
||||
flask-sqlalchemy==2.3.2
|
||||
cryptography==3.3.2
|
||||
requests==2.20.0
|
||||
ConfigParser==5.2.0
|
||||
configparser==5.2.0
|
||||
python-engineio==4.3.2
|
||||
python-socketio>=4.2.0
|
||||
flask-socketio==5.2.0
|
||||
|
||||
+74
-78
@@ -329,11 +329,11 @@ function getFiles(Path) {
|
||||
var cnametext =fmp[0] + fmp[5];
|
||||
fmp[0] = fmp[0].replace(/'/,"\\'");
|
||||
if(cnametext.length>20){
|
||||
cnametext = cnametext.substring(0,20)+'...'
|
||||
cnametext = cnametext.substring(0,20) + '...';
|
||||
}
|
||||
if(isChineseChar(cnametext)){
|
||||
if(cnametext.length>10){
|
||||
cnametext = cnametext.substring(0,10)+'...'
|
||||
cnametext = cnametext.substring(0,10) + '...';
|
||||
}
|
||||
}
|
||||
var timetext ='--';
|
||||
@@ -376,11 +376,11 @@ function getFiles(Path) {
|
||||
var cnametext =fmp[0] + fmp[5];
|
||||
fmp[0] = fmp[0].replace(/'/,"\\'");
|
||||
if(cnametext.length>48){
|
||||
cnametext = cnametext.substring(0,48)+'...'
|
||||
cnametext = cnametext.substring(0,48) + '...';
|
||||
}
|
||||
if(isChineseChar(cnametext)){
|
||||
if(cnametext.length>16){
|
||||
cnametext = cnametext.substring(0,16)+'...'
|
||||
cnametext = cnametext.substring(0,16) + '...';
|
||||
}
|
||||
}
|
||||
if(displayZip != -1){
|
||||
@@ -400,52 +400,52 @@ function getFiles(Path) {
|
||||
totalSize += parseInt(fmp[1]);
|
||||
if(getCookie("rank")=="a"){
|
||||
body += "<tr class='folderBoxTr' data-path='" + rdata.PATH +"/"+ fmp[0] + "' filetype='" + fmp[0] + "'><td><input type='checkbox' name='id' value='"+fmp[0]+"'></td>\
|
||||
<td class='column-name'><span class='ico ico-"+(getExtName(fmp[0]))+"'></span><a class='text' title='" + fmp[0] + fmp[5] + "'>" + cnametext + "</a></td>\
|
||||
<td>" + (toSize(fmp[1])) + "</td>\
|
||||
<td>" + ((fmp[2].length > 11)?fmp[2]:getLocalTime(fmp[2])) + "</td>\
|
||||
<td>"+fmp[3]+"</td>\
|
||||
<td>"+fmp[4]+"</td>\
|
||||
<td class='editmenu'>\
|
||||
<span><a class='btlink' href='javascript:;' onclick=\"copyFile('" + rdata.PATH +"/"+ fmp[0] + "')\">复制</a> | \
|
||||
<a class='btlink' href='javascript:;' onclick=\"cutFile('" + rdata.PATH +"/"+ fmp[0] + "')\">剪切</a> | \
|
||||
<a class='btlink' href='javascript:;' onclick=\"reName(0,'" + fmp[0] + "')\">重命名</a> | \
|
||||
<a class='btlink' href=\"javascript:setChmod(0,'" + rdata.PATH +"/"+ fmp[0] + "');\">权限</a> | \
|
||||
<a class='btlink' href=\"javascript:zip('" + rdata.PATH +"/" +fmp[0] + "');\">压缩</a> | \
|
||||
"+bodyZip+download+"\
|
||||
<a class='btlink' href='javascript:;' onclick=\"deleteFile('" + rdata.PATH +"/"+ fmp[0] + "')\">删除</a>\
|
||||
</span></td></tr>";
|
||||
<td class='column-name'><span class='ico ico-"+(getExtName(fmp[0]))+"'></span><a class='text' title='" + fmp[0] + fmp[5] + "'>" + cnametext + "</a></td>\
|
||||
<td>" + (toSize(fmp[1])) + "</td>\
|
||||
<td>" + ((fmp[2].length > 11)?fmp[2]:getLocalTime(fmp[2])) + "</td>\
|
||||
<td>"+fmp[3]+"</td>\
|
||||
<td>"+fmp[4]+"</td>\
|
||||
<td class='editmenu'>\
|
||||
<span><a class='btlink' href='javascript:;' onclick=\"copyFile('" + rdata.PATH +"/"+ fmp[0] + "')\">复制</a> | \
|
||||
<a class='btlink' href='javascript:;' onclick=\"cutFile('" + rdata.PATH +"/"+ fmp[0] + "')\">剪切</a> | \
|
||||
<a class='btlink' href='javascript:;' onclick=\"reName(0,'" + fmp[0] + "')\">重命名</a> | \
|
||||
<a class='btlink' href=\"javascript:setChmod(0,'" + rdata.PATH +"/"+ fmp[0] + "');\">权限</a> | \
|
||||
<a class='btlink' href=\"javascript:zip('" + rdata.PATH +"/" +fmp[0] + "');\">压缩</a> | \
|
||||
"+bodyZip+download+"\
|
||||
<a class='btlink' href='javascript:;' onclick=\"deleteFile('" + rdata.PATH +"/"+ fmp[0] + "')\">删除</a>\
|
||||
</span></td>\
|
||||
</tr>";
|
||||
}
|
||||
else{
|
||||
body += "<div class='file folderBox menufile' data-path='" + rdata.PATH +"/"+ fmp[0] + "' filetype='"+fmp[0]+"' title='文件名:" + fmp[0]+" 大小:"
|
||||
+ toSize(fmp[1])+" 修改时间:"+getLocalTime(fmp[2])+" 权限:"+fmp[3]+" 所有者:"+fmp[4]+"'>\
|
||||
<input type='checkbox' name='id' value='"+fmp[0]+"'>\
|
||||
<div class='ico ico-"+(getExtName(fmp[0]))+"'></div>\
|
||||
<div class='titleBox'><span class='tname'>" + fmp[0] + "</span></div>\
|
||||
</div>";
|
||||
body += "<div class='file folderBox menufile' data-path='" + rdata.PATH +"/"+ fmp[0] + "' filetype='"+fmp[0]+"' title='文件名:" + fmp[0]+" 大小:"
|
||||
+ toSize(fmp[1])+" 修改时间:"+getLocalTime(fmp[2])+" 权限:"+fmp[3]+" 所有者:"+fmp[4]+"'>\
|
||||
<input type='checkbox' name='id' value='"+fmp[0]+"'>\
|
||||
<div class='ico ico-"+(getExtName(fmp[0]))+"'></div>\
|
||||
<div class='titleBox'><span class='tname'>" + fmp[0] + "</span></div>\
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
var dirInfo = '(共{1}个目录与{2}个文件,大小:'.replace('{1}',rdata.DIR.length+'').replace('{2}',rdata.DIR.length+'')+'<font id="pathSize">'
|
||||
+ (toSize(totalSize))+'<a class="btlink ml5" onClick="getPathSize()">获取</a></font>)';
|
||||
$("#DirInfo").html(dirInfo);
|
||||
if(getCookie('rank')=='a'){
|
||||
if( getCookie('rank') == 'a' ){
|
||||
var tablehtml = '<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table table-hover">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th width="30"><input type="checkbox" id="setBox" placeholder=""></th>\
|
||||
<th>文件名</th>\
|
||||
<th>大小</th>\
|
||||
<th>修改时间</th>\
|
||||
<th>权限</th>\
|
||||
<th>所有者</th>\
|
||||
<th style="text-align: right;" width="330">操作</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody id="filesBody" class="list-list">'+body+'</tbody>\
|
||||
</table>';
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th width="30"><input type="checkbox" id="setBox" placeholder=""></th>\
|
||||
<th>文件名</th>\
|
||||
<th>大小</th>\
|
||||
<th>修改时间</th>\
|
||||
<th>权限</th>\
|
||||
<th>所有者</th>\
|
||||
<th style="text-align: right;" width="330">操作</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
<tbody id="filesBody" class="list-list">'+body+'</tbody>\
|
||||
</table>';
|
||||
$("#fileCon").removeClass("fileList").html(tablehtml);
|
||||
$("#tipTools").width($("#fileCon").width());
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$("#fileCon").addClass("fileList").html(body);
|
||||
$("#tipTools").width($("#fileCon").width());
|
||||
}
|
||||
@@ -518,25 +518,19 @@ function getFiles(Path) {
|
||||
});
|
||||
|
||||
|
||||
// //禁用右键
|
||||
// $("#fileCon").bind("contextmenu",function(e){
|
||||
// return false;
|
||||
// });
|
||||
// bindselect();
|
||||
|
||||
//禁用右键
|
||||
$("#fileCon").bind("contextmenu",function(e){
|
||||
return false;
|
||||
});
|
||||
bindselect();
|
||||
|
||||
// //绑定右键
|
||||
// $("#fileCon").mousedown(function(e){
|
||||
// var count = totalFile();
|
||||
// if(e.which == 3) {
|
||||
// if(count>1){
|
||||
// RClickAll(e);
|
||||
// }
|
||||
// else{
|
||||
// return
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
$("#fileCon").mousedown(function(e){
|
||||
var count = totalFile();
|
||||
if(e.which == 3) {
|
||||
if(count>1){rightMenuClickAll(e);} else {return;}
|
||||
}
|
||||
});
|
||||
|
||||
$(".folderBox,.folderBoxTr").mousedown(function(e){
|
||||
// console.log(e);
|
||||
@@ -1217,7 +1211,7 @@ function zip(dirName,submits) {
|
||||
}
|
||||
|
||||
//解压目录
|
||||
function unZip(fileName,type) {
|
||||
function unZip(fileName, type) {
|
||||
var path = $("#DirPathPlace input").val();
|
||||
if(type.length ==3){
|
||||
var sfile = encodeURIComponent($("#sfile").val());
|
||||
@@ -1233,7 +1227,7 @@ function unZip(fileName,type) {
|
||||
return
|
||||
}
|
||||
|
||||
type = (type == 1) ? 'tar':'zip'
|
||||
type = (type == 1) ? 'tar':'zip';
|
||||
var umpass = '';
|
||||
if(type == 'zip'){
|
||||
umpass = '<div class="line"><span class="tname">'+lan.files.zip_pass_title+'</span><input type="text" class="bt-input-text" id="unpass" value="" placeholder="'+lan.files.zip_pass_msg+'" style="width:330px" /></div>'
|
||||
@@ -1245,19 +1239,19 @@ function unZip(fileName,type) {
|
||||
area: '490px',
|
||||
title: '解压文件',
|
||||
content: '<div class="bt-form pd20 pb70">'
|
||||
+'<div class="line unzipdiv">'
|
||||
+'<span class="tname">'+lan.files.unzip_name+'</span><input type="text" class="bt-input-text" id="sfile" value="' +fileName + '" placeholder="'+lan.files.unzip_name_title+'" style="width:330px" /></div>'
|
||||
+'<div class="line"><span class="tname">'+lan.files.unzip_to+'</span><input type="text" class="bt-input-text" id="dfile" value="'+path + '" placeholder="'+lan.files.unzip_to+'" style="width:330px" /></div>'
|
||||
+ umpass +'<div class="line"><span class="tname">'+lan.files.unzip_coding+'</span><select class="bt-input-text" name="coding">'
|
||||
+'<option value="UTF-8">UTF-8</option>'
|
||||
+'<option value="gb18030">GBK</option>'
|
||||
+'</select>'
|
||||
+'</div>'
|
||||
+'<div class="bt-form-submit-btn">'
|
||||
+'<button type="button" class="btn btn-danger btn-sm btn-title" onclick="layer.closeAll()">'+lan.public.close+'</button>'
|
||||
+'<button type="button" id="ReNameBtn" class="btn btn-success btn-sm btn-title" onclick="unZip(\'' + fileName + '\',\''+type+'\')">'+lan.files.file_menu_unzip+'</button>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
+'<div class="line unzipdiv">'
|
||||
+'<span class="tname">'+lan.files.unzip_name+'</span><input type="text" class="bt-input-text" id="sfile" value="' +fileName + '" placeholder="'+lan.files.unzip_name_title+'" style="width:330px" /></div>'
|
||||
+'<div class="line"><span class="tname">'+lan.files.unzip_to+'</span><input type="text" class="bt-input-text" id="dfile" value="'+path + '" placeholder="'+lan.files.unzip_to+'" style="width:330px" /></div>'
|
||||
+ umpass +'<div class="line"><span class="tname">'+lan.files.unzip_coding+'</span><select class="bt-input-text" name="coding">'
|
||||
+'<option value="UTF-8">UTF-8</option>'
|
||||
+'<option value="gb18030">GBK</option>'
|
||||
+'</select>'
|
||||
+'</div>'
|
||||
+'<div class="bt-form-submit-btn">'
|
||||
+'<button type="button" class="btn btn-danger btn-sm btn-title" onclick="layer.closeAll()">'+lan.public.close+'</button>'
|
||||
+'<button type="button" id="ReNameBtn" class="btn btn-success btn-sm btn-title" onclick="unZip(\'' + fileName + '\',\''+type+'\')">'+lan.files.file_menu_unzip+'</button>'
|
||||
+'</div>'
|
||||
+'</div>'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1323,7 +1317,8 @@ function uploadFiles(){
|
||||
title:lan.files.up_title,
|
||||
area: ['500px','300px'],
|
||||
shadeClose:false,
|
||||
content:'<div class="fileUploadDiv"><input type="hidden" id="input-val" value="'+path+'" />\
|
||||
content:'<div class="fileUploadDiv">\
|
||||
<input type="hidden" id="input-val" value="'+path+'" />\
|
||||
<input type="file" id="file_input" multiple="true" autocomplete="off" />\
|
||||
<button type="button" id="opt" autocomplete="off">添加文件</button>\
|
||||
<button type="button" id="up" autocomplete="off" >开始上传</button>\
|
||||
@@ -1337,7 +1332,8 @@ function uploadFiles(){
|
||||
</select>\
|
||||
</span>\
|
||||
<button type="button" id="filesClose" autocomplete="off" onClick="layer.closeAll()" >关闭</button>\
|
||||
<ul id="up_box"></ul></div>'
|
||||
<ul id="up_box"></ul>\
|
||||
</div>'
|
||||
});
|
||||
uploadStart();
|
||||
}
|
||||
@@ -1560,14 +1556,14 @@ function pathPlaceBtn(path){
|
||||
var title = '';
|
||||
var Dpath = path;
|
||||
if(path == '/'){
|
||||
html ='<li><a title="/">'+lan.files.path_root+'</a></li>';
|
||||
html = '<li><a title="/">'+lan.files.path_root+'</a></li>';
|
||||
}
|
||||
else{
|
||||
Dpath = path.split("/");
|
||||
for(var i = 0; i<Dpath.length; i++ ){
|
||||
title += Dpath[i]+'/';
|
||||
Dpath[0] = lan.files.path_root;
|
||||
html +='<li><a title="'+title+'">'+Dpath[i]+'</a></li>';
|
||||
html += '<li><a title="'+title+'">'+Dpath[i]+'</a></li>';
|
||||
}
|
||||
}
|
||||
html = '<div style="width:1200px;height:26px"><ul>'+html+'</ul></div>';
|
||||
@@ -1590,10 +1586,10 @@ function pathLeft(){
|
||||
var SpanPathWidth = $("#PathPlaceBtn").width() - 50;
|
||||
var Ml = UlWidth - SpanPathWidth;
|
||||
if(UlWidth > SpanPathWidth ){
|
||||
$("#PathPlaceBtn ul").css("left",-Ml)
|
||||
$("#PathPlaceBtn ul").css("left",-Ml);
|
||||
}
|
||||
else{
|
||||
$("#PathPlaceBtn ul").css("left",0)
|
||||
$("#PathPlaceBtn ul").css("left",0);
|
||||
}
|
||||
}
|
||||
//路径快捷点击
|
||||
|
||||
@@ -200,6 +200,8 @@ function uploadStart(d) {
|
||||
}
|
||||
if(!d) {
|
||||
getFiles(getCookie("open_dir_path"));
|
||||
} else{
|
||||
d();
|
||||
}
|
||||
},
|
||||
error: function(j) {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 9.4 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 22 KiB |
@@ -57,8 +57,6 @@
|
||||
|
||||
<script src="/static/js/jquery-ui.min.js?v={{config.version}}"></script>
|
||||
<script src="/static/js/jquery.contextify.min.js?v={{config.version}}"></script>
|
||||
<script src="/static/app/files.js?v={{config.version}}"></script>
|
||||
<script src="/static/app/upload.js?v={{config.version}}"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
setTimeout(function() {
|
||||
|
||||
@@ -14,6 +14,15 @@
|
||||
<!--[if lte IE 9]>
|
||||
<script src="/static/js/requestAnimationFrame.js"></script>
|
||||
<![endif]-->
|
||||
<!-- 统计一下用户量,让我的开发更有激情 -->
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FC74BB2RGD"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'G-FC74BB2RGD');
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -53,6 +62,8 @@
|
||||
<script src="/static/js/socket.io.min.js?v={{config.version}}"></script>
|
||||
<script src="/static/build/addons/winptyCompat/winptyCompat.js?v={{config.version}}"></script>
|
||||
<script src="/static/app/public.js?v={{config.version}}"></script>
|
||||
<script src="/static/app/upload.js?v={{config.version}}"></script>
|
||||
<script src="/static/app/files.js?v={{config.version}}"></script>
|
||||
<script src="/static/js/echarts.min.js?v={{config.version}}"></script>
|
||||
<script src="/static/js/jquery.dragsort-0.5.2.min.js?v={{config.version}}"></script>
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
PATH=/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
# export LC_ALL="en_US.UTF-8"
|
||||
|
||||
mw_path={$SERVER_PATH}
|
||||
PATH=$PATH:$mw_path/bin
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
LANG=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
|
||||
# RED='\e[1;31m' # 红色
|
||||
# GREEN='\e[1;32m' # 绿色
|
||||
@@ -112,13 +112,21 @@ apt install -y libxpm-dev
|
||||
apt install -y libwebp-dev
|
||||
apt install -y libfreetype6-dev
|
||||
|
||||
|
||||
sudo localedef -i en_US -f UTF-8 en_US.UTF-8
|
||||
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
if [ "$VERSION_ID" == "9" ];then
|
||||
sed "s/flask==2.0.3/flask==1.1.1/g" -i /www/server/mdserver-web/requirements.txt
|
||||
sed "s/cryptography==3.3.2/cryptography==2.5/g" -i /www/server/mdserver-web/requirements.txt
|
||||
sed "s/configparser==5.2.0/configparser==4.0.2/g" -i /www/server/mdserver-web/requirements.txt
|
||||
sed "s/flask-socketio==5.2.0/flask-socketio==4.2.0/g" -i /www/server/mdserver-web/requirements.txt
|
||||
sed "s/python-engineio==4.3.2/python-engineio==3.9.0/g" -i /www/server/mdserver-web/requirements.txt
|
||||
# pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
fi
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && ./cli.sh start
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
n=0
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
LANG=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
if grep -Eq "Ubuntu" /etc/*-release; then
|
||||
sudo ln -sf /bin/bash /bin/sh
|
||||
#sudo dpkg-reconfigure dash
|
||||
fi
|
||||
|
||||
|
||||
apt update -y
|
||||
apt-get update -y
|
||||
|
||||
@@ -24,6 +24,10 @@ if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
apt install -y locate
|
||||
locale-gen en_US.UTF-8
|
||||
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
|
||||
|
||||
|
||||
if [ -f /usr/sbin/ufw ];then
|
||||
|
||||
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
# LANG=en_US.UTF-8
|
||||
is64bit=`getconf LONG_BIT`
|
||||
|
||||
if [ -f /etc/motd ];then
|
||||
echo "" > /etc/motd
|
||||
fi
|
||||
|
||||
startTime=`date +%s`
|
||||
|
||||
_os=`uname`
|
||||
echo "use system: ${_os}"
|
||||
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then echo "Please run as root!"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
rm -rf /usr/bin/mw
|
||||
rm -rf /www
|
||||
|
||||
|
||||
endTime=`date +%s`
|
||||
((outTime=(${endTime}-${startTime})/60))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
|
||||
|
||||
systemctl daemon-reload
|
||||
@@ -1,13 +1,22 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
LANG=en_US.UTF-8
|
||||
export LANG=en_US.UTF-8
|
||||
|
||||
if grep -Eq "Ubuntu" /etc/*-release; then
|
||||
sudo ln -sf /bin/bash /bin/sh
|
||||
#sudo dpkg-reconfigure dash
|
||||
fi
|
||||
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
if [ "$VERSION_ID" == "9" ];then
|
||||
sed "s/flask==2.0.3/flask==1.1.1/g" -i /www/server/mdserver-web/requirements.txt
|
||||
sed "s/cryptography==3.3.2/cryptography==2.5/g" -i /www/server/mdserver-web/requirements.txt
|
||||
sed "s/configparser==5.2.0/configparser==4.0.2/g" -i /www/server/mdserver-web/requirements.txt
|
||||
sed "s/flask-socketio==5.2.0/flask-socketio==4.2.0/g" -i /www/server/mdserver-web/requirements.txt
|
||||
sed "s/python-engineio==4.3.2/python-engineio==3.9.0/g" -i /www/server/mdserver-web/requirements.txt
|
||||
# pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
fi
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
Reference in New Issue
Block a user