Skip to content

Commit

Permalink
Merge pull request #172 from midoks/dev
Browse files Browse the repository at this point in the history
0.9.6
  • Loading branch information
midoks authored Aug 22, 2022
2 parents a1d8523 + d6799e8 commit 42edf12
Show file tree
Hide file tree
Showing 15 changed files with 185 additions and 66 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ lib/python*
bin
pyvenv.cfg
include
share
pip-selfcheck.json

scripts/mdserver-web
Expand All @@ -141,15 +142,14 @@ data/ssl.pl
data/edate.pl
data/osname.pl
data/system.db-journal
data/hook_*.json

plugins/l2tp
plugins/openlitespeed
plugins/gdrive
plugins/mtproxy
plugins/zimg
plugins/bk_demo
debug.out





17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### mdserver-web 0.9.5
### mdserver-web 0.9.6

简单的Linux面板,感谢BT.CN写出如此好的web管理软件。我一看到,就知道这是我一直想要的页面化管理方式。
复制了后台管理界面,按照自己想要的方式写了一版。
Expand Down Expand Up @@ -71,13 +71,11 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
```


### 版本更新 0.9.5
### 版本更新 0.9.6

* 页面更新优化[2].
* 修复maridb的用户管理[2].
* Gogs初始化提示更人性.
* MySQL&&MariaDB修改密码修复.
* MySQL&&MariaDB导入修复.
* 增加插件备份功能.
* supervisor增加错误日志查看.
* MariaDB安装源优化.


### JSDelivr安装地址
Expand Down Expand Up @@ -127,13 +125,12 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
```

### 微信赞助
[![截图](/route/static/img/weixin_zz.jpg)](/route/static/img/weixin_zz.jpg)
[![截图](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/img/weixin_zz.jpg)](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/img/weixin_zz.jpg)


### 无图不真相

[![截图](/route/static/mdw.jpg)](/route/static/mdw.jpg)

[![截图](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/mdw.jpg)](https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/mdw.jpg)


### Stargazers over time
Expand Down
29 changes: 18 additions & 11 deletions class/core/crontab_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,18 @@ def delLogsApi(self):
# 取数据列表
def getDataListApi(self):
stype = request.form.get('type', '')

bak_data = []

if stype == 'sites' or stype == 'databases':
hookPath = mw.getPanelDataDir() + "/hook_backup.json"
if os.path.exists(hookPath):
t = mw.readFile(hookPath)
bak_data = json.loads(t)

if stype == 'databases':
db_list = {}
db_list['orderOpt'] = []
db_list['orderOpt'] = bak_data
path = mw.getServerDir() + '/mysql'
if not os.path.exists(path + '/mysql.db'):
db_list['data'] = []
Expand All @@ -307,8 +316,9 @@ def getDataListApi(self):
return mw.getJson(db_list)

data = {}
data['orderOpt'] = bak_data

data['data'] = mw.M(stype).field('name,ps').select()
data['orderOpt'] = []
return mw.getJson(data)
##### ----- start ----- ###

Expand Down Expand Up @@ -411,16 +421,13 @@ def getShell(self, param):
'rememory': head + "/bin/bash " + script_dir + '/rememory.sh'
}
if param['backup_to'] != 'localhost':
cfile = mw.getServerDir() + "/mdserver-web/plugin/" + \
param['backup_to'] + "/" + param['backup_to'] + "_main.py"
if not os.path.exists(cfile):
cfile = script_dir + "/backup_" + \
param['backup_to'] + ".py"
cfile = mw.getPluginDir() + "/" + \
param['backup_to'] + "/index.py"
wheres = {
'path': head + "python " + cfile + " path " + param['sname'] + " " + str(param['save']),
'site': head + "python " + cfile + " site " + param['sname'] + " " + str(param['save']),
'database': head + "python " + cfile + " database " + param['sname'] + " " + str(param['save']),
'logs': head + "python " + script_dir + "/logs_backup.py " + param['sname'] + log + " " + str(param['save']),
'path': head + "python3 " + cfile + " path " + param['sname'] + " " + str(param['save']),
'site': head + "python3 " + cfile + " site " + param['sname'] + " " + str(param['save']),
'database': head + "python3 " + cfile + " database " + param['sname'] + " " + str(param['save']),
'logs': head + "python3 " + script_dir + "/logs_backup.py " + param['sname'] + log + " " + str(param['save']),
'rememory': head + "/bin/bash " + script_dir + '/rememory.sh'
}
try:
Expand Down
3 changes: 1 addition & 2 deletions class/core/files_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,7 @@ def getBody(self, path):
data['encoding'] = 'utf-8'
if char['encoding'] == 'Big5':
data['encoding'] = 'BIG5'
if not char['encoding'] in ['GBK', 'utf-8',
'BIG5']:
if not char['encoding'] in ['GBK', 'utf-8', 'BIG5']:
data['encoding'] = 'utf-8'
try:
if sys.version_info[0] == 2:
Expand Down
20 changes: 12 additions & 8 deletions class/core/mw.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,22 @@ def getPluginDir():
return getRunDir() + '/plugins'


def getPanelDataDir():
return getRunDir() + '/data'


def getServerDir():
return getRootDir() + '/server'


def getLogsDir():
return getRootDir() + '/wwwlogs'


def getBackupDir():
return getRootDir() + '/backup'


def getWwwDir():
file = getRunDir() + '/data/site.pl'
if os.path.exists(file):
Expand All @@ -73,14 +85,6 @@ def setWwwDir(wdir):
return writeFile(file, wdir)


def getLogsDir():
return getRootDir() + '/wwwlogs'


def getBackupDir():
return getRootDir() + '/backup'


def setBackupDir(bdir):
file = getRunDir() + '/data/backup.pl'
return writeFile(file, bdir)
Expand Down
57 changes: 53 additions & 4 deletions class/core/plugins_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ def installApi(self):
return mw.returnJson(False, '配置文件不存在!', ())

pluginInfo = json.loads(mw.readFile(infoJsonPos))
self.hookInstall(pluginInfo)

execstr = "cd " + os.getcwd() + "/plugins/" + \
name + " && /bin/bash " + pluginInfo["shell"] \
Expand All @@ -131,6 +132,55 @@ def installApi(self):
mw.triggerTask()
return mw.returnJson(True, '已将安装任务添加到队列!')

def hookInstallFile(self, hook_name, info):
hookPath = mw.getPanelDataDir() + "/hook_" + hook_name + ".json"
data = []
if os.path.exists(hookPath):
t = mw.readFile(hookPath)
data = json.loads(t)

isNeedAdd = True
for x in range(len(data)):
if data[x]['title'] == info['title'] and data[x]['name'] == info['name']:
isNeedAdd = False

if isNeedAdd:
tmp = {}
tmp['title'] = info['title']
tmp['name'] = info['name']
data.append(tmp)
mw.writeFile(hookPath, json.dumps(data))

def hookUninstallFile(self, hook_name, info):
hookPath = mw.getPanelDataDir() + "/hook_" + hook_name + ".json"
data = []
if os.path.exists(hookPath):
t = mw.readFile(hookPath)
data = json.loads(t)

for idx in range(len(data)):
if data[idx]['title'] == info['title'] and data[idx]['name'] == info['name']:
data.remove(data[idx])
mw.writeFile(hookPath, json.dumps(data))

def hookInstall(self, info):
if 'hook' in info:
hooks = info['hook']
for x in hooks:
if x in ['backup']:
self.hookInstallFile(x, info)
return True
return False

def hookUninstall(self, info):
if 'hook' in info:
hooks = info['hook']
for x in hooks:
if x in ['backup']:
self.hookUninstallFile(x, info)
return True
return False

def uninstallOldApi(self):
rundir = mw.getRunDir()
name = request.form.get('name', '')
Expand All @@ -147,7 +197,6 @@ def uninstallOldApi(self):
return mw.returnJson(False, "配置文件不存在!", ())

pluginInfo = json.loads(mw.readFile(infoJsonPos))

execstr = "cd " + os.getcwd() + "/plugins/" + \
name + " && /bin/bash " + pluginInfo["shell"] \
+ " uninstall " + version
Expand Down Expand Up @@ -175,13 +224,13 @@ def uninstallApi(self):
return mw.returnJson(False, "配置文件不存在!", ())

pluginInfo = json.loads(mw.readFile(infoJsonPos))

self.hookUninstall(pluginInfo)
execstr = "cd " + os.getcwd() + "/plugins/" + \
name + " && /bin/bash " + pluginInfo["shell"] \
+ " uninstall " + version

data = mw.execShell(execstr)
if mw.isAppleSystem():
if mw.isDebugMode():
print(execstr)
print(data[0], data[1])
self.removeIndex(name, version)
Expand Down Expand Up @@ -793,7 +842,7 @@ def getIndexList(self):
print('getIndexList:', e)

# 使用gevent模式时,无法使用多进程
#plist = self.checkStatusMProcess(plist)
# plist = self.checkStatusMProcess(plist)
plist = self.checkStatusMThreads(plist)
return plist

Expand Down
13 changes: 9 additions & 4 deletions plugins/mariadb/versions/10.6/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mariadbDir=${serverPath}/source/mariadb

MY_VER=10.6.8
MY_VER=10.6.9

Install_app()
{
Expand Down Expand Up @@ -57,10 +57,15 @@ Install_app()
fi
# ----- cpu end ------

# https://mirrors.aliyun.com/mariadb/mariadb-10.8.3/source/mariadb-10.8.3.tar.gz
if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
# https://mirrors.aliyun.com/mariadb/mariadb-10.8.3/source/mariadb-10.8.3.tar.gz
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz

fi

# https://downloads.mariadb.org/interstitial/mariadb-10.6.8/source/mariadb-10.6.8.tar.gz
if [ "$?" != "0" ];then
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
fi

if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
Expand Down
10 changes: 6 additions & 4 deletions plugins/mariadb/versions/10.7/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mariadbDir=${serverPath}/source/mariadb

MY_VER=10.7.4
MY_VER=10.7.5

Install_app()
{
Expand Down Expand Up @@ -58,14 +58,16 @@ Install_app()
# ----- cpu end ------

if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
fi

if [ "$?" != "0" ];then
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
fi

if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
cd ${mariadbDir} && tar -zxvf ${mariadbDir}/mariadb-${MY_VER}.tar.gz
fi


if [ ! -d $serverPath/mariadb ];then
cd ${mariadbDir}/mariadb-${MY_VER} && cmake \
Expand Down
9 changes: 6 additions & 3 deletions plugins/mariadb/versions/10.8/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ sysName=`uname`
install_tmp=${rootPath}/tmp/mw_install.pl
mariadbDir=${serverPath}/source/mariadb

MY_VER=10.8.3
MY_VER=10.8.4

Install_app()
{
Expand Down Expand Up @@ -58,8 +58,11 @@ Install_app()
# ----- cpu end ------

if [ ! -f ${mariadbDir}/mariadb-${MY_VER}.tar.gz ];then
wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
# wget -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://mirrors.aliyun.com/mariadb/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
fi

if [ "$?" != "0" ];then
wget --no-check-certificate -O ${mariadbDir}/mariadb-${MY_VER}.tar.gz --tries=3 https://downloads.mariadb.org/interstitial/mariadb-${MY_VER}/source/mariadb-${MY_VER}.tar.gz
fi

if [ ! -d ${mariadbDir}/mariadb-${MY_VER} ];then
Expand Down
2 changes: 1 addition & 1 deletion plugins/mysql/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
.conf_p span {
display: inline-block;
margin-right: 10px;
width: 95px;
width: 135px;
text-align: right;
}
</style>
Expand Down
6 changes: 5 additions & 1 deletion plugins/php/versions/74/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ if [ ! -d $sourcePath/php/php${PHP_VER} ];then
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
fi


if [ ! -d $sourcePath/php/php${PHP_VER} ];then
rm -rf $sourcePath/php/php-${version}.tar.xz
echo "reinstall php${version}"
exit 1
fi

cd $sourcePath/php/php${PHP_VER}

Expand Down
5 changes: 4 additions & 1 deletion plugins/rsyncd/js/rsyncd.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,10 @@ function createSendTask(name = ''){
layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']});

if (rdata.status){
setTimeout(function(){layer.close(index);},2000);
setTimeout(function(){
layer.close(index);
lsyncdSend();
},2000);
return;
}
});
Expand Down
Loading

0 comments on commit 42edf12

Please sign in to comment.