Sync upstream

pull/299/head^2
hiCasper 2 years ago
parent 482d9bdd86
commit 0093af2661
  1. 19
      README.md
  2. 155
      class/core/config_api.py
  3. 11
      class/core/files_api.py
  4. 15
      class/core/mw.py
  5. 4
      class/core/site_api.py
  6. 21
      data/tpl/nginx_panel.conf
  7. 12
      plugins/php/install.sh
  8. 5
      plugins/php/versions/82/install.sh
  9. 19
      plugins/php/versions/common/fileinfo.sh
  10. 4
      plugins/php/versions/common/phalcon.sh
  11. 2
      plugins/php/versions/common/redis.sh
  12. 5
      plugins/php/versions/common/yaf.sh
  13. 6
      plugins/php/versions/common/yar.sh
  14. 6
      plugins/php/versions/phplib.conf
  15. 16
      rewrite/nginx/sub.conf.tpl
  16. 8
      route/static/app/files.js
  17. 13
      route/static/app/public.js
  18. 3
      scripts/init.d/mw.tpl
  19. 2
      scripts/install.sh
  20. 2
      scripts/install_dev.sh
  21. 3
      setting.py
  22. 18
      tools.py

@ -2,6 +2,7 @@
<img alt="logo" src="https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/logo.png" height="140" /> <img alt="logo" src="https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/route/static/logo.png" height="140" />
<h3 align="center">mdserver-web</h3> <h3 align="center">mdserver-web</h3>
<p align="center">一款简单Linux面板服务</p> <p align="center">一款简单Linux面板服务</p>
<p align="center">强烈推荐系统:debian</p>
</p> </p>
### 简介 ### 简介
@ -10,10 +11,11 @@
复制了后台管理界面,按照自己想要的方式写了一版。 复制了后台管理界面,按照自己想要的方式写了一版。
![CentOS](https://img.shields.io/badge/LINUX-CentOS-blue?style=for-the-badge&logo=CentOS)
![Ubuntu](https://img.shields.io/badge/LINUX-Ubuntu-blue?style=for-the-badge&logo=Ubuntu)
![Debian](https://img.shields.io/badge/LINUX-Debian-blue?style=for-the-badge&logo=Debian) ![Debian](https://img.shields.io/badge/LINUX-Debian-blue?style=for-the-badge&logo=Debian)
![Ubuntu](https://img.shields.io/badge/LINUX-Ubuntu-blue?style=for-the-badge&logo=Ubuntu)
![Fedora](https://img.shields.io/badge/LINUX-Fedora-blue?style=for-the-badge&logo=Fedora) ![Fedora](https://img.shields.io/badge/LINUX-Fedora-blue?style=for-the-badge&logo=Fedora)
![CentOS](https://img.shields.io/badge/LINUX-CentOS-blue?style=for-the-badge&logo=CentOS)
[![Wiki](https://img.shields.io/badge/MW-Wiki-red?style=for-the-badge&logo=wiki)](https://github.com/midoks/mdserver-web/wiki) [![Wiki](https://img.shields.io/badge/MW-Wiki-red?style=for-the-badge&logo=wiki)](https://github.com/midoks/mdserver-web/wiki)
[![](https://data.jsdelivr.com/v1/package/gh/midoks/mdserver-web/badge?style=for-the-badge)](https://www.jsdelivr.com/package/gh/midoks/mdserver-web) [![](https://data.jsdelivr.com/v1/package/gh/midoks/mdserver-web/badge?style=for-the-badge)](https://www.jsdelivr.com/package/gh/midoks/mdserver-web)
@ -90,15 +92,12 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
``` ```
### 版本更新 0.11.2 ### 版本更新 0.11.4
* redis安全强化。 * PHP82正式释出。
* 添加php命令行设置。 * PHP-fileinfo扩展优化。
* 域名绑定。 * 删除任务时删除日志。
* Gitea优化。 * 优化修改密码后的显示问题(#288)。
* 网站统计优化。
* centos9下php-gd安装优化。
* php82rc7测试版。
### JSDelivr安装地址 ### JSDelivr安装地址

@ -27,7 +27,7 @@ from flask import request
class config_api: class config_api:
__version = '0.11.2' __version = '0.11.4'
__api_addr = 'data/api.json' __api_addr = 'data/api.json'
def __init__(self): def __init__(self):
@ -89,21 +89,6 @@ class config_api:
return mw.returnJson(True, '修改成功!') return mw.returnJson(True, '修改成功!')
return mw.returnJson(False, '修改失败!') return mw.returnJson(False, '修改失败!')
def setPanelDomainApi(self):
domain = request.form.get('domain', '')
cfg_domain = 'data/bind_domain.pl'
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): def syncDateApi(self):
if mw.isAppleSystem(): if mw.isAppleSystem():
return mw.returnJson(True, '开发系统不必同步时间!') return mw.returnJson(True, '开发系统不必同步时间!')
@ -150,7 +135,8 @@ class config_api:
import system_api import system_api
import firewall_api import firewall_api
if os.path.exists("/lib/systemd/system/firewalld.service"): sysCfgDir = mw.systemdCfgDir()
if os.path.exists(sysCfgDir + "/firewalld.service"):
if not firewall_api.firewall_api().getFwStatus(): if not firewall_api.firewall_api().getFwStatus():
return mw.returnJson(False, 'firewalld必须先启动!') return mw.returnJson(False, 'firewalld必须先启动!')
@ -257,7 +243,8 @@ class config_api:
import system_api import system_api
import firewall_api import firewall_api
if os.path.exists("/lib/systemd/system/firewalld.service"): sysCfgDir = mw.systemdCfgDir()
if os.path.exists(sysCfgDir + "/firewalld.service"):
if not firewall_api.firewall_api().getFwStatus(): if not firewall_api.firewall_api().getFwStatus():
return mw.returnJson(False, 'firewalld必须先启动!') return mw.returnJson(False, 'firewalld必须先启动!')
@ -355,24 +342,32 @@ class config_api:
def getPanelSslApi(self): def getPanelSslApi(self):
cert = {} cert = {}
if not os.path.exists('ssl/certificate.pem'): keyPath = 'ssl/private.pem'
certPath = 'ssl/cert.pem'
if not os.path.exists(certPath):
mw.createSSL() mw.createSSL()
cert['privateKey'] = mw.readFile('ssl/privateKey.pem') cert['privateKey'] = mw.readFile(keyPath)
cert['certPem'] = mw.readFile('ssl/certificate.pem') cert['certPem'] = mw.readFile(certPath)
cert['rep'] = os.path.exists('ssl/input.pl') cert['rep'] = os.path.exists('ssl/input.pl')
cert['info'] = mw.getCertName('ssl/certificate.pem') cert['info'] = mw.getCertName(certPath)
return mw.getJson(cert) return mw.getJson(cert)
# 保存面板证书 # 保存面板证书
def savePanelSslApi(self): def savePanelSslApi(self):
keyPath = 'ssl/privateKey.pem' keyPath = 'ssl/private.pem'
certPath = 'ssl/certificate.pem' certPath = 'ssl/cert.pem'
checkCert = '/tmp/cert.pl' checkCert = '/tmp/cert.pl'
certPem = request.form.get('certPem', '').strip() certPem = request.form.get('certPem', '').strip()
privateKey = request.form.get('privateKey', '').strip() privateKey = request.form.get('privateKey', '').strip()
if(privateKey.find('KEY') == -1):
return mw.returnJson(False, '秘钥错误,请检查!')
if(certPem.find('CERTIFICATE') == -1):
return mw.returnJson(False, '证书错误,请检查!')
mw.writeFile(checkCert, certPem) mw.writeFile(checkCert, certPem)
if privateKey: if privateKey:
mw.writeFile(keyPath, privateKey) mw.writeFile(keyPath, privateKey)
@ -383,22 +378,128 @@ class config_api:
mw.writeFile('ssl/input.pl', 'True') mw.writeFile('ssl/input.pl', 'True')
return mw.returnJson(True, '证书已保存!') return mw.returnJson(True, '证书已保存!')
def setPanelDomainApi(self):
domain = request.form.get('domain', '')
panel_tpl = mw.getRunDir() + "/data/tpl/nginx_panel.conf"
dst_panel_path = mw.getServerDir() + "/web_conf/nginx/vhost/panel.conf"
cfg_domain = 'data/bind_domain.pl'
if domain == '':
os.remove(cfg_domain)
os.remove(dst_panel_path)
mw.restartWeb()
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, '主域名格式不正确')
op_dir = mw.getServerDir() + "/openresty"
if not os.path.exists(op_dir):
return mw.returnJson(False, '依赖OpenResty,先安装启动它!')
content = mw.readFile(panel_tpl)
content = content.replace("{$PORT}", "80")
content = content.replace("{$SERVER_NAME}", domain)
content = content.replace("{$PANAL_PORT}", mw.readFile('data/port.pl'))
content = content.replace("{$LOGPATH}", mw.getRunDir() + '/logs')
content = content.replace("{$PANAL_ADDR}", mw.getRunDir())
mw.writeFile(dst_panel_path, content)
mw.restartWeb()
mw.writeFile(cfg_domain, domain)
return mw.returnJson(True, '设置域名成功!')
# 设置面板SSL # 设置面板SSL
def setPanelSslApi(self): def setPanelSslApi(self):
sslConf = mw.getRunDir() + '/data/ssl.pl' sslConf = mw.getRunDir() + '/data/ssl.pl'
panel_tpl = mw.getRunDir() + "/data/tpl/nginx_panel.conf"
dst_panel_path = mw.getServerDir() + "/web_conf/nginx/vhost/panel.conf"
if os.path.exists(sslConf): if os.path.exists(sslConf):
os.system('rm -f ' + sslConf) os.system('rm -f ' + sslConf)
mw.restartMw()
conf = mw.readFile(dst_panel_path)
if conf:
rep = "\s+ssl_certificate\s+.+;\s+ssl_certificate_key\s+.+;"
conf = re.sub(rep, '', conf)
rep = "\s+ssl_protocols\s+.+;\n"
conf = re.sub(rep, '', conf)
rep = "\s+ssl_ciphers\s+.+;\n"
conf = re.sub(rep, '', conf)
rep = "\s+ssl_prefer_server_ciphers\s+.+;\n"
conf = re.sub(rep, '', conf)
rep = "\s+ssl_session_cache\s+.+;\n"
conf = re.sub(rep, '', conf)
rep = "\s+ssl_session_timeout\s+.+;\n"
conf = re.sub(rep, '', conf)
rep = "\s+ssl_ecdh_curve\s+.+;\n"
conf = re.sub(rep, '', conf)
rep = "\s+ssl_session_tickets\s+.+;\n"
conf = re.sub(rep, '', conf)
rep = "\s+ssl_stapling\s+.+;\n"
conf = re.sub(rep, '', conf)
rep = "\s+ssl_stapling_verify\s+.+;\n"
conf = re.sub(rep, '', conf)
rep = "\s+ssl\s+on;"
conf = re.sub(rep, '', conf)
rep = "\s+error_page\s497.+;"
conf = re.sub(rep, '', conf)
rep = "\s+if.+server_port.+\n.+\n\s+\s*}"
conf = re.sub(rep, '', conf)
rep = "\s+listen\s+443.*;"
conf = re.sub(rep, '', conf)
rep = "\s+listen\s+\[\:\:\]\:443.*;"
conf = re.sub(rep, '', conf)
mw.writeFile(dst_panel_path, conf)
mw.writeLog('面板配置', '面板SSL关闭成功!')
mw.restartWeb()
return mw.returnJson(True, 'SSL已关闭,请使用http协议访问面板!') return mw.returnJson(True, 'SSL已关闭,请使用http协议访问面板!')
else: else:
try: try:
if not os.path.exists('ssl/input.ssl'): if not os.path.exists('ssl/input.ssl'):
mw.createSSL() mw.createSSL()
mw.writeFile(sslConf, 'True') mw.writeFile(sslConf, 'True')
keyPath = mw.getRunDir() + '/ssl/private.pem'
certPath = mw.getRunDir() + '/ssl/cert.pem'
conf = mw.readFile(dst_panel_path)
if conf:
if conf.find('ssl_certificate') == -1:
sslStr = """#error_page 404/404.html;
ssl_certificate %s;
ssl_certificate_key %s;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
error_page 497 https://$host$request_uri;""" % (certPath, keyPath)
if(conf.find('ssl_certificate') != -1):
return mw.returnJson(True, 'SSL开启成功!')
conf = conf.replace('#error_page 404/404.html;', sslStr)
rep = "listen\s+([0-9]+)\s*[default_server]*;"
tmp = re.findall(rep, conf)
if not mw.inArray(tmp, '443'):
listen = re.search(rep, conf).group()
http_ssl = "\n\tlisten 443 ssl http2;"
http_ssl = http_ssl + "\n\tlisten [::]:443 ssl http2;"
conf = conf.replace(listen, listen + http_ssl)
mw.backFile(dst_panel_path)
mw.writeFile(dst_panel_path, conf)
isError = mw.checkWebConfig()
if(isError != True):
mw.restoreFile(dst_panel_path)
return mw.returnJson(False, '证书错误: <br><a style="color:red;">' + isError.replace("\n", '<br>') + '</a>')
except Exception as ex: except Exception as ex:
return mw.returnJson(False, '开启失败:' + str(ex)) return mw.returnJson(False, '开启失败:' + str(ex))
mw.restartWeb()
mw.restartMw()
return mw.returnJson(True, '开启成功,请使用https协议访问面板!') return mw.returnJson(True, '开启成功,请使用https协议访问面板!')
def getApi(self): def getApi(self):

@ -97,11 +97,11 @@ class files_api:
import shutil import shutil
try: try:
shutil.move(sfile, dfile) shutil.move(sfile, dfile)
msg = mw.getInfo('移动文件或目录[{1}]到[{2}]成功!', (sfile, dfile,)) msg = mw.getInfo('移动或重名命文件[{1}]到[{2}]成功!', (sfile, dfile,))
mw.writeLog('文件管理', msg) mw.writeLog('文件管理', msg)
return mw.returnJson(True, '移动文件或目录成功!') return mw.returnJson(True, '移动或重名命文件成功!')
except: except:
return mw.returnJson(False, '移动文件或目录失败!') return mw.returnJson(False, '移动或重名命文件失败!')
def deleteApi(self): def deleteApi(self):
path = request.form.get('path', '') path = request.form.get('path', '')
@ -240,6 +240,11 @@ class files_api:
system_api.system_api().restartTask() system_api.system_api().restartTask()
except: except:
system_api.system_api().restartTask() system_api.system_api().restartTask()
# 删除日志
task_log = mw.getRunDir() + "/tmp/panelTask.pl"
if os.path.exists(task_log):
os.remove(task_log)
return mw.returnJson(True, '任务已删除!') return mw.returnJson(True, '任务已删除!')
# 上传文件 # 上传文件

@ -920,13 +920,22 @@ def checkDomainPanel():
tmp = getHost() tmp = getHost()
domain = readFile('data/bind_domain.pl') domain = readFile('data/bind_domain.pl')
port = readFile('data/port.pl').strip() port = readFile('data/port.pl').strip()
npid = getServerDir() + "/openresty/nginx/logs/nginx.pid"
if not os.path.exists(npid):
return False
nconf = getServerDir() + "/web_conf/nginx/vhost/panel.conf"
if os.path.exists(nconf):
port = "80"
if domain: if domain:
client_ip = getClientIp() client_ip = getClientIp()
if client_ip in ['127.0.0.1', 'localhost', '::1']: if client_ip in ['127.0.0.1', 'localhost', '::1']:
return False return False
if tmp.strip().lower() != domain.strip().lower(): if tmp.strip().lower() != domain.strip().lower():
from flask import Flask, redirect, request, url_for from flask import Flask, redirect, request, url_for
to = "http://" + domain + ":" + port to = "http://" + domain + ":" + str(port)
return redirect(to, code=302) return redirect(to, code=302)
return False return False
@ -1371,8 +1380,8 @@ def createSSL():
private_key = OpenSSL.crypto.dump_privatekey( private_key = OpenSSL.crypto.dump_privatekey(
OpenSSL.crypto.FILETYPE_PEM, key) OpenSSL.crypto.FILETYPE_PEM, key)
if len(cert_ca) > 100 and len(private_key) > 100: if len(cert_ca) > 100 and len(private_key) > 100:
writeFile('ssl/certificate.pem', cert_ca, 'wb+') writeFile('ssl/cert.pem', cert_ca, 'wb+')
writeFile('ssl/privateKey.pem', private_key, 'wb+') writeFile('ssl/private.pem', private_key, 'wb+')
return True return True
return False return False

@ -140,6 +140,10 @@ class site_api:
return mw.getJson(data) return mw.getJson(data)
def getCliPhpVersionApi(self): def getCliPhpVersionApi(self):
php_dir = mw.getServerDir() + '/php'
if not os.path.exists(php_dir):
return mw.returnJson(False, '未安装PHP,无法设置')
php_bin = '/usr/bin/php' php_bin = '/usr/bin/php'
php_versions = self.getPhpVersion() php_versions = self.getPhpVersion()
php_versions = php_versions[1:] php_versions = php_versions[1:]

@ -2,27 +2,22 @@ server
{ {
listen {$PORT}; listen {$PORT};
listen [::]:{$PORT}; listen [::]:{$PORT};
server_name {$SERVER_NAME}; server_name {$SERVER_NAME};
index index.php index.html index.htm default.php default.htm default.html; index index.php index.html index.htm default.php default.htm default.html;
root {$ROOT_DIR};
#SSL-START #SSL-START
#error_page 404/404.html; #error_page 404/404.html;
#SSL-END #SSL-END
#PROXY-START
#禁止访问的文件或目录 location ^~ / {
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md) proxy_pass http://0.0.0.0:{$PANAL_PORT}/;
{ proxy_http_version 1.1;
return 404; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
} }
#PROXY-END
#一键申请SSL证书验证目录相关设置
location ~ \.well-known{
allow all;
}
access_log {$LOGPATH}/{$SERVER_NAME}.log main;
error_log {$LOGPATH}/{$SERVER_NAME}.error.log; error_log {$LOGPATH}/{$SERVER_NAME}.error.log;
} }

@ -32,9 +32,9 @@ if [ ! -d $curPath/versions/$2 ];then
fi fi
if [ "${action}" == "install" ] && [ -d $serverPath/php/${type} ];then # if [ "${action}" == "install" ] && [ -d $serverPath/php/${type} ];then
exit 0 # exit 0
fi # fi
if [ "${action}" == "uninstall" ];then if [ "${action}" == "uninstall" ];then
@ -71,6 +71,12 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php/${type} ];then
cd ${rootPath}/plugins/php/versions/common && bash gettext.sh install ${type} cd ${rootPath}/plugins/php/versions/common && bash gettext.sh install ${type}
cd ${rootPath}/plugins/php/versions/common && bash redis.sh install ${type} cd ${rootPath}/plugins/php/versions/common && bash redis.sh install ${type}
cd ${rootPath}/plugins/php/versions/common && bash memcached.sh install ${type} cd ${rootPath}/plugins/php/versions/common && bash memcached.sh install ${type}
cd ${rootPath}/plugins/php/versions/common && bash zlib.sh install ${type}
if [ "${type}" -gt "72" ];then
cd ${rootPath}/plugins/php/versions/common && bash zip.sh install ${type}
fi
echo "install PHP${type} extend end" echo "install PHP${type} extend end"
fi fi

@ -16,7 +16,7 @@ function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)"
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; } function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
version=8.2.0RC7 version=8.2.0
PHP_VER=82 PHP_VER=82
Install_php() Install_php()
{ {
@ -32,8 +32,7 @@ cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
if [ ! -d $sourcePath/php/php${PHP_VER} ];then if [ ! -d $sourcePath/php/php${PHP_VER} ];then
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
# wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://downloads.php.net/~pierrick/php-${version}.tar.xz wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://www.php.net/distributions/php-${version}.tar.xz
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://downloads.php.net/~pierrick/php-${version}.tar.xz
fi fi
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz

@ -49,6 +49,7 @@ Install_lib()
if [ ! -f "$extFile" ];then if [ ! -f "$extFile" ];then
if [ ! -d $sourcePath/php${version}/ext ];then if [ ! -d $sourcePath/php${version}/ext ];then
echo "cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}"
cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version} cd ${rootPath}/plugins/php && /bin/bash install.sh install ${version}
fi fi
@ -57,9 +58,23 @@ Install_lib()
$serverPath/php/$version/bin/phpize $serverPath/php/$version/bin/phpize
./configure --with-php-config=$serverPath/php/$version/bin/php-config ./configure --with-php-config=$serverPath/php/$version/bin/php-config
# It is considered as a temporary bug
if [ "$version" == "81" ] || [ "$version" == "82" ];then
bash ${rootPath}/scripts/getos.sh
OSNAME=`cat ${rootPath}/data/osname.pl`
if [ "$OSNAME" == 'centos' ];then
FILE_softmagic=$sourcePath/php${version}/ext/${LIBNAME}/libmagic/softmagic.c
FIND_UNDEF_STRNDUP=`cat $FILE_softmagic|grep '#undef strndup'`
if [ "$version" -gt "74" ] && [ "$FIND_UNDEF_STRNDUP" == "" ];then
sed -i $BAK "s/char \*strndup/#undef strndup\nchar \*strndup/g" $FILE_softmagic
fi
fi
fi
FIND_C99=`cat Makefile|grep c99` FIND_C99=`cat Makefile|grep c99`
if [ "$FIND_C99" == "" ];then if [ "$version" -gt "74" ] && [ "$FIND_C99" == "" ];then
sed -i $BAK 's/CFLAGS \=/CFLAGS \= -std=c99/g' Makefile sed -i $BAK 's/CFLAGS \=/CFLAGS \= -std=gnu99/g' Makefile
fi fi
make clean && make && make install && make clean make clean && make && make install && make clean

@ -20,12 +20,10 @@ LIBV=4.1.2
if [ "$version" -lt "73" ];then if [ "$version" -lt "73" ];then
echo "not support!" echo "not support!"
exit 1 exit 1
else fi
if [ "$version" -gt "74" ];then if [ "$version" -gt "74" ];then
LIBV=5.1.2 LIBV=5.1.2
else
echo "not support!"
fi fi
LIB_PATH_NAME=lib/php LIB_PATH_NAME=lib/php

@ -21,6 +21,8 @@ if [ "$version" == "52" ];then
LIBV=2.2.7 LIBV=2.2.7
elif [ "$version" -lt "70" ];then elif [ "$version" -lt "70" ];then
LIBV=4.2.0 LIBV=4.2.0
elif [ "$version" -gt "74" ];then
LIBV=5.3.5
else else
echo 'ok' echo 'ok'
fi fi

@ -31,11 +31,6 @@ if [ "$version" -eq "72" ] || [ "$version" -eq "73" ];then
LIBV=3.2.5 LIBV=3.2.5
fi fi
if [ "$version" -eq "82" ];then
echo "not need"
exit 1
fi
LIB_PATH_NAME=lib/php LIB_PATH_NAME=lib/php
if [ -d $serverPath/php/${version}/lib64 ];then if [ -d $serverPath/php/${version}/lib64 ];then

@ -21,12 +21,6 @@ if [ "$version" -lt "70" ];then
LIBV=1.2.5 LIBV=1.2.5
fi fi
if [ "$version" -eq "82" ];then
echo "wait php82 release"
exit 0
fi
LIB_PATH_NAME=lib/php LIB_PATH_NAME=lib/php
if [ -d $serverPath/php/${version}/lib64 ];then if [ -d $serverPath/php/${version}/lib64 ];then
LIB_PATH_NAME=lib64 LIB_PATH_NAME=lib64

@ -520,8 +520,7 @@
"73", "73",
"74", "74",
"80", "80",
"81", "81"
"82"
], ],
"type": "框架", "type": "框架",
"msg": "Yaf是一个C语言编写的PHP框架", "msg": "Yaf是一个C语言编写的PHP框架",
@ -541,8 +540,7 @@
"73", "73",
"74", "74",
"80", "80",
"81", "81"
"82"
], ],
"type": "框架", "type": "框架",
"msg": "Yar是一个RPC框架", "msg": "Yar是一个RPC框架",

@ -0,0 +1,16 @@
location / {
set $replace 'tmplate_replace';
set $spider_request '0';
if ($http_user_agent ~* '(baiduspider|360sipder|Sogou Orion spider|Sogou News Spider|Sogou blog|Sogou spider2|Sogou inst spider|Sogou web spider|Sogou spider|trendiction|Yahoo|semrush|Toutiao|Google|qihoobot|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|MSNBot|ia_archiver|Tomato Bot)') {
set $spider_request '1';
}
if ($spider_request = '0' ) {
set $replace 'tmplate_replace';
}
sub_filter 'tmplate_replace' $replace;
sub_filter_once on;
sub_filter_types *;
}

@ -1103,7 +1103,7 @@ function reName(type, fileName) {
closeBtn: 1, closeBtn: 1,
area: '320px', area: '320px',
title: '重命名', title: '重命名',
btn:["确定","保存"], btn:["确定","取消"],
content: '<div class="bt-form pd20">\ content: '<div class="bt-form pd20">\
<div class="line">\ <div class="line">\
<input type="text" class="bt-input-text" name="Name" id="newFileName" value="' + fileName + '" placeholder="文件名" style="width:100%" />\ <input type="text" class="bt-input-text" name="Name" id="newFileName" value="' + fileName + '" placeholder="文件名" style="width:100%" />\
@ -1615,10 +1615,13 @@ function getPathSize(){
$("body").not(".def-log").click(function(){ $("body").not(".def-log").click(function(){
$("#rmenu").hide() $("#rmenu").hide()
}); });
//指定路径 //指定路径
$("#DirPathPlace input").keyup(function(e){ $("#DirPathPlace input").keyup(function(e){
if(e.keyCode == 13) { if(e.keyCode == 13) {
getFiles($(this).val()); var fpath = $(this).val();
fpath = filterPath(fpath);
getFiles(fpath);
} }
}); });
@ -1662,6 +1665,7 @@ function pathLeft(){
$("#PathPlaceBtn ul").css("left",0); $("#PathPlaceBtn ul").css("left",0);
} }
} }
//路径快捷点击 //路径快捷点击
$("#PathPlaceBtn").on("click", function(e){ $("#PathPlaceBtn").on("click", function(e){
if($("#DirPathPlace").is(":hidden")){ if($("#DirPathPlace").is(":hidden")){

@ -100,6 +100,19 @@ function isContains(str, substr) {
return str.indexOf(substr) >= 0; return str.indexOf(substr) >= 0;
} }
function filterPath(path){
var path_arr = path.split('/');
var path_new = [];
for (var i = 0; i < path_arr.length; i++) {
if (path_arr[i]!=''){
path_new.push(path_arr[i]);
}
}
var rdata = "/"+path_new.join('/');
return rdata;
}
function msgTpl(msg, args){ function msgTpl(msg, args){
if (typeof args == 'string'){ if (typeof args == 'string'){
return msg.replace('{1}', args); return msg.replace('{1}', args);

@ -331,7 +331,8 @@ case "$1" in
echo -e "==================================================================" echo -e "=================================================================="
echo -e "$address" echo -e "$address"
echo -e `python3 $mw_path/tools.py username` echo -e `python3 $mw_path/tools.py username`
echo -e "password: $password" echo -e `python3 $mw_path/tools.py password`
# echo -e "password: $password"
echo -e "\033[33mWarning:\033[0m" echo -e "\033[33mWarning:\033[0m"
echo -e "\033[33mIf you cannot access the panel. \033[0m" echo -e "\033[33mIf you cannot access the panel. \033[0m"
echo -e "\033[33mrelease the following port (${show_panel_ip}888|80|443|22) in the security group.\033[0m" echo -e "\033[33mrelease the following port (${show_panel_ip}888|80|443|22) in the security group.\033[0m"

@ -48,7 +48,7 @@ elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/os-release; then
apt update -y apt update -y
apt install -y wget curl zip unzip tar cron apt install -y wget curl zip unzip tar cron
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/os-release; then elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/os-release; then
OSNAME='debian' OSNAME='ubuntu'
apt update -y apt update -y
apt install -y wget curl zip unzip tar cron apt install -y wget curl zip unzip tar cron
else else

@ -47,7 +47,7 @@ elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
apt install -y devscripts apt install -y devscripts
apt install -y wget zip unzip apt install -y wget zip unzip
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
OSNAME='debian' OSNAME='ubuntu'
apt install -y wget zip unzip apt install -y wget zip unzip
else else
OSNAME='unknow' OSNAME='unknow'

@ -82,6 +82,3 @@ loglevel = 'info'
errorlog = log_dir + '/error.log' errorlog = log_dir + '/error.log'
accesslog = log_dir + '/access.log' accesslog = log_dir + '/access.log'
pidfile = log_dir + '/mw.pid' pidfile = log_dir + '/mw.pid'
# if os.path.exists(os.getcwd() + '/data/ssl.pl'):
# certfile = 'ssl/certificate.pem'
# keyfile = 'ssl/privateKey.pem'

@ -132,6 +132,22 @@ def set_panel_pwd(password, ncli=False):
print(username) print(username)
def show_panel_pwd():
# 设置面板密码
import db
sql = db.Sql()
password = sql.table('users').where('id=?', (1,)).getField('password')
file_pwd = ''
if os.path.exists('data/default.pl'):
file_pwd = mw.readFile('data/default.pl').strip()
if mw.md5(file_pwd) == password:
print('password: ' + file_pwd)
return
print("the password has been changed!")
def set_panel_username(username=None): def set_panel_username(username=None):
# 随机面板用户名 # 随机面板用户名
import db import db
@ -171,6 +187,8 @@ if __name__ == "__main__":
set_panel_username(sys.argv[2]) set_panel_username(sys.argv[2])
else: else:
set_panel_username() set_panel_username()
elif method == 'password':
show_panel_pwd()
elif method == 'getServerIp': elif method == 'getServerIp':
getServerIp() getServerIp()
elif method == "cli": elif method == "cli":

Loading…
Cancel
Save