mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-10 13:59:26 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
975cb988f7 | ||
|
|
5a11d1bff9 | ||
|
|
bab3501722 | ||
|
|
872d68e0f1 | ||
|
|
9a5878a90c | ||
|
|
e5e226b57a | ||
|
|
5d12218a3e | ||
|
|
7b3bbc8bdd | ||
|
|
67030e91f6 | ||
|
|
c03eb0aa40 | ||
|
|
2b5aaba0b7 | ||
|
|
c7a01b8c52 | ||
|
|
9bfb72ada5 | ||
|
|
5ab8936f6b | ||
|
|
43c5161085 | ||
|
|
7d90a6e99f | ||
|
|
9ba8028944 | ||
|
|
36fa3d7630 | ||
|
|
b6a2d7e3e8 | ||
|
|
99e73d1bda | ||
|
|
1083b46078 | ||
|
|
8bd081804d | ||
|
|
2536a79481 | ||
|
|
eab11680e5 | ||
|
|
651b7d6d1b | ||
|
|
75e181116e | ||
|
|
c0a981b5a1 | ||
|
|
61dc601d48 | ||
|
|
415a2a1f8f | ||
|
|
7c06a85ac7 | ||
|
|
7c8329bb78 | ||
|
|
5c8a50429f | ||
|
|
300bdc1eb1 | ||
|
|
a8a9e9033e | ||
|
|
77425dfc48 | ||
|
|
52eae4625f | ||
|
|
dafcf60633 | ||
|
|
79c1e81d2c | ||
|
|
b779a18de6 | ||
|
|
45f22d239a | ||
|
|
f7b688d6bf | ||
|
|
6f069c715a | ||
|
|
98ed286b50 | ||
|
|
e931fa526f | ||
|
|
ff17610732 | ||
|
|
13bbe07ac5 | ||
|
|
5380cd805c | ||
|
|
c0b056c18d | ||
|
|
e287086b36 | ||
|
|
8647300e16 | ||
|
|
636f7af8ef | ||
|
|
87cf208dfc | ||
|
|
579a84c6f1 | ||
|
|
54b90f4484 | ||
|
|
ebdaf5d395 | ||
|
|
1e5ecabbd1 | ||
|
|
0596dc243e | ||
|
|
7fa6ec7cd3 | ||
|
|
c21d8eed8b | ||
|
|
326f9f0e6b | ||
|
|
60c94f120e | ||
|
|
55c08a8916 | ||
|
|
cf944fb976 | ||
|
|
cda1ea93a8 | ||
|
|
46f02cae0d | ||
|
|
034d00a262 | ||
|
|
fe1a68208b | ||
|
|
f364cc4e2d | ||
|
|
5b35b5f38c | ||
|
|
2151b2c597 | ||
|
|
4f8e95210f | ||
|
|
b31297b47f | ||
|
|
e492a87160 | ||
|
|
47d6eb7993 | ||
|
|
3ddccea897 | ||
|
|
069d594e49 | ||
|
|
7c49609a2b | ||
|
|
70d260dd5a | ||
|
|
58503722c0 | ||
|
|
0a98b4dc09 | ||
|
|
5ab0f493e4 | ||
|
|
30580874fd | ||
|
|
26327d958c | ||
|
|
522eddd393 | ||
|
|
935df8d4d1 | ||
|
|
15b4ba9cbb | ||
|
|
c005e1f56d | ||
|
|
edbca430ee | ||
|
|
f8fedb8285 | ||
|
|
d9472709fd | ||
|
|
79bf1eae07 | ||
|
|
fab6df7097 | ||
|
|
b9416d58f9 | ||
|
|
96d86ce49e | ||
|
|
46f2d9f029 | ||
|
|
9d5fb77123 | ||
|
|
d0c903bf11 | ||
|
|
3c1b0e6708 | ||
|
|
340b72591a | ||
|
|
8f6a194a02 | ||
|
|
7e65993978 | ||
|
|
ca27a2d49d | ||
|
|
b941c9c71b | ||
|
|
e68c7b0346 | ||
|
|
c7c3d8fdb9 | ||
|
|
de383e0584 | ||
|
|
048463cf9d | ||
|
|
0c118613d5 | ||
|
|
aa8e9f173b | ||
|
|
c21c54198c | ||
|
|
e8ad9995d7 | ||
|
|
7a0b6be401 | ||
|
|
8b2a127ceb | ||
|
|
8a23fb18ff | ||
|
|
234eca3729 | ||
|
|
9c74eb6a77 | ||
|
|
0093af2661 | ||
|
|
482d9bdd86 | ||
|
|
d8f9b179ad | ||
|
|
d179328976 | ||
|
|
9aaa5e2a65 | ||
|
|
821a9ce2d1 | ||
|
|
7b39b28dcd | ||
|
|
c881ad7d18 | ||
|
|
82da5c2649 | ||
|
|
315ba990ec | ||
|
|
992fcb7e6f | ||
|
|
d7337239f5 | ||
|
|
224b91fe0b | ||
|
|
589dfe6da2 | ||
|
|
b1b47c3c38 | ||
|
|
106f5d897d | ||
|
|
c856d09b3b | ||
|
|
6bf8792bb6 | ||
|
|
75edb074b2 | ||
|
|
4a5df99f06 | ||
|
|
2c7536a138 | ||
|
|
a758fc2264 | ||
|
|
0d94fe2d26 | ||
|
|
630bdd5f96 | ||
|
|
411fc670fc | ||
|
|
cab35c7c28 | ||
|
|
b3c8a6365f | ||
|
|
b64f02ff2f | ||
|
|
7e9df9640e | ||
|
|
6c478be4df | ||
|
|
e919fac1d5 | ||
|
|
4854142f9a | ||
|
|
f37de275ba | ||
|
|
0c8f777452 | ||
|
|
9235affadf | ||
|
|
2001a3b5dc | ||
|
|
6ba1e4c19c | ||
|
|
231048a4a3 | ||
|
|
6b9aab3759 | ||
|
|
e8a152b1a3 | ||
|
|
1cf8e4ecb7 | ||
|
|
aa04235446 | ||
|
|
3acbc36297 | ||
|
|
85aba4f1ce | ||
|
|
f33f80cf34 | ||
|
|
1868b3197d | ||
|
|
b8e1fb2ca2 | ||
|
|
9aa9c4f799 | ||
|
|
344603f1b2 | ||
|
|
71b43e9f2f | ||
|
|
adba50bfc1 | ||
|
|
d917fa76f6 | ||
|
|
32971ccead | ||
|
|
c7a3481b95 | ||
|
|
8915b672e5 | ||
|
|
e472d104d1 | ||
|
|
48ee5574c7 | ||
|
|
706afbd681 | ||
|
|
70ca6d0459 | ||
|
|
f344a32fa7 | ||
|
|
e6123000ac | ||
|
|
b94361c59f | ||
|
|
4a7efb67d4 | ||
|
|
536b7ac997 | ||
|
|
0f5b055aeb | ||
|
|
7d81a59c8f | ||
|
|
2540cd1308 | ||
|
|
5358cd2d38 | ||
|
|
c4bb20ed54 | ||
|
|
7f2f307131 | ||
|
|
7a8ef9fe00 | ||
|
|
e1abc66179 | ||
|
|
8bda20c3d0 | ||
|
|
3c01838df1 | ||
|
|
3b459e0349 | ||
|
|
d3e7684f04 | ||
|
|
b2e6e7f256 | ||
|
|
ca6812561a | ||
|
|
44e8079db6 | ||
|
|
9bd063cc1d | ||
|
|
1b0044e28a | ||
|
|
9b752cf24f | ||
|
|
cf5f98958c | ||
|
|
c46872dab5 | ||
|
|
b57edb7b87 | ||
|
|
595cc30c6f | ||
|
|
4b6f5a5f4e | ||
|
|
741da10906 | ||
|
|
9965786976 | ||
|
|
f083696131 | ||
|
|
dd2105d9ab | ||
|
|
c1574f3430 | ||
|
|
6394ead5b8 |
@@ -11,8 +11,7 @@ Debian x, Centos x, Centos x stream, Ubuntu x?
|
||||
|
||||
Ex:
|
||||
```bash
|
||||
................start mw success
|
||||
bash: line 149: ./scripts/init.d/mw: No such file or directory
|
||||
一个issue,一个问题。多余问题,视情况而答。
|
||||
```
|
||||
|
||||
## 错误截图 ?
|
||||
|
||||
+4
-1
@@ -106,6 +106,7 @@ venv.bak/
|
||||
.idea/*.iml
|
||||
tmp/*
|
||||
*.swp
|
||||
*.pem
|
||||
*.zip
|
||||
logs/*
|
||||
data/*.db
|
||||
@@ -116,13 +117,15 @@ data/json/config.json
|
||||
data/site.pl
|
||||
data/admin_path.pl
|
||||
data/close.pl
|
||||
ssl/input.pl
|
||||
data/datadir.pl
|
||||
data/502Task.pl
|
||||
data/default.pl
|
||||
data/backup.pl
|
||||
data/debug.pl
|
||||
data/default_site.pl
|
||||
|
||||
ssl/input.pl
|
||||
|
||||
lib/python*
|
||||
|
||||
bin
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<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>
|
||||
<p align="center">一款简单Linux面板服务</p>
|
||||
<p align="center">强烈推荐系统:debian</p>
|
||||
</p>
|
||||
|
||||
### 简介
|
||||
@@ -10,10 +11,11 @@
|
||||
复制了后台管理界面,按照自己想要的方式写了一版。
|
||||
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
|
||||
[](https://github.com/midoks/mdserver-web/wiki)
|
||||
[](https://www.jsdelivr.com/package/gh/midoks/mdserver-web)
|
||||
@@ -90,15 +92,15 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
||||
```
|
||||
|
||||
|
||||
### 版本更新 0.11.2
|
||||
### 版本更新 0.12.0
|
||||
|
||||
* redis安全强化。
|
||||
* 添加php命令行设置。
|
||||
* 域名绑定。
|
||||
* Gitea优化。
|
||||
* 网站统计优化。
|
||||
* centos9下php-gd安装优化。
|
||||
* php82rc7测试版。
|
||||
此次版本:默认面板名为【大圣面板】。
|
||||
由于#309问题。先注释。提前发版。
|
||||
|
||||
* 安装脚本优化 @hiCasper。
|
||||
* 数据库[pg/apt/yum/mariadb]计划任务备份ok。
|
||||
* php源码加入sodium扩展。
|
||||
* 站点分类问题 #300。
|
||||
|
||||
|
||||
### JSDelivr安装地址
|
||||
@@ -160,7 +162,9 @@ curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/up
|
||||
|
||||
wget -O uninstall.sh https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/uninstall.sh && bash uninstall.sh
|
||||
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install_dev.sh | bash
|
||||
curl -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/quick/debug.sh | bash
|
||||
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/install_dev.sh | bash
|
||||
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/update_dev.sh | bash
|
||||
```
|
||||
|
||||
@@ -168,6 +172,8 @@ curl -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/update_dev.sh |
|
||||
|
||||
TVbNgrpeGBGZVm5gTLa21ADP7RpnPFhjya
|
||||
|
||||
日行一善,以后必定大富大贵
|
||||
|
||||
|
||||
### 微信赞助
|
||||
|
||||
|
||||
+143
-54
@@ -27,7 +27,7 @@ from flask import request
|
||||
|
||||
class config_api:
|
||||
|
||||
__version = '0.11.2'
|
||||
__version = '0.12.0'
|
||||
__api_addr = 'data/api.json'
|
||||
|
||||
def __init__(self):
|
||||
@@ -89,21 +89,6 @@ class config_api:
|
||||
return mw.returnJson(True, '修改成功!')
|
||||
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):
|
||||
if mw.isAppleSystem():
|
||||
return mw.returnJson(True, '开发系统不必同步时间!')
|
||||
@@ -150,7 +135,8 @@ class config_api:
|
||||
import system_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():
|
||||
return mw.returnJson(False, 'firewalld必须先启动!')
|
||||
|
||||
@@ -257,7 +243,8 @@ class config_api:
|
||||
import system_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():
|
||||
return mw.returnJson(False, 'firewalld必须先启动!')
|
||||
|
||||
@@ -354,20 +341,33 @@ class config_api:
|
||||
# 获取面板证书
|
||||
def getPanelSslApi(self):
|
||||
cert = {}
|
||||
cert['privateKey'] = mw.readFile('ssl/privateKey.pem')
|
||||
cert['certPem'] = mw.readFile('ssl/certificate.pem')
|
||||
|
||||
keyPath = 'ssl/private.pem'
|
||||
certPath = 'ssl/cert.pem'
|
||||
|
||||
if not os.path.exists(certPath):
|
||||
mw.createSSL()
|
||||
|
||||
cert['privateKey'] = mw.readFile(keyPath)
|
||||
cert['certPem'] = mw.readFile(certPath)
|
||||
cert['rep'] = os.path.exists('ssl/input.pl')
|
||||
cert['info'] = mw.getCertName(certPath)
|
||||
return mw.getJson(cert)
|
||||
|
||||
# 保存面板证书
|
||||
def savePanelSslApi(self):
|
||||
keyPath = 'ssl/privateKey.pem'
|
||||
certPath = 'ssl/certificate.pem'
|
||||
keyPath = 'ssl/private.pem'
|
||||
certPath = 'ssl/cert.pem'
|
||||
checkCert = '/tmp/cert.pl'
|
||||
|
||||
certPem = request.form.get('certPem', '').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)
|
||||
if privateKey:
|
||||
mw.writeFile(keyPath, privateKey)
|
||||
@@ -378,22 +378,128 @@ class config_api:
|
||||
mw.writeFile('ssl/input.pl', '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
|
||||
def setPanelSslApi(self):
|
||||
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):
|
||||
os.system('rm -f ' + sslConf)
|
||||
|
||||
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协议访问面板!')
|
||||
else:
|
||||
os.system('pip install cffi==1.10')
|
||||
os.system('pip install cryptography==2.1')
|
||||
os.system('pip install pyOpenSSL==16.2')
|
||||
try:
|
||||
if not self.createSSL():
|
||||
return mw.returnJson(False, '开启失败,无法自动安装pyOpenSSL组件!<p>请尝试手动安装: pip install pyOpenSSL</p>')
|
||||
if not os.path.exists('ssl/input.ssl'):
|
||||
mw.createSSL()
|
||||
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:
|
||||
return mw.returnJson(False, '开启失败,无法自动安装pyOpenSSL组件!<p>请尝试手动安装: pip install pyOpenSSL</p>')
|
||||
return mw.returnJson(False, '开启失败:' + str(ex))
|
||||
mw.restartWeb()
|
||||
return mw.returnJson(True, '开启成功,请使用https协议访问面板!')
|
||||
|
||||
def getApi(self):
|
||||
@@ -401,32 +507,6 @@ class config_api:
|
||||
return mw.getJson(data)
|
||||
##### ----- end ----- ###
|
||||
|
||||
# 自签证书
|
||||
def createSSL(self):
|
||||
if os.path.exists('ssl/input.pl'):
|
||||
return True
|
||||
import OpenSSL
|
||||
key = OpenSSL.crypto.PKey()
|
||||
key.generate_key(OpenSSL.crypto.TYPE_RSA, 2048)
|
||||
cert = OpenSSL.crypto.X509()
|
||||
cert.set_serial_number(0)
|
||||
cert.get_subject().CN = mw.getLocalIp()
|
||||
cert.set_issuer(cert.get_subject())
|
||||
cert.gmtime_adj_notBefore(0)
|
||||
cert.gmtime_adj_notAfter(86400 * 3650)
|
||||
cert.set_pubkey(key)
|
||||
cert.sign(key, 'md5')
|
||||
cert_ca = OpenSSL.crypto.dump_certificate(
|
||||
OpenSSL.crypto.FILETYPE_PEM, cert)
|
||||
private_key = OpenSSL.crypto.dump_privatekey(
|
||||
OpenSSL.crypto.FILETYPE_PEM, key)
|
||||
if len(cert_ca) > 100 and len(private_key) > 100:
|
||||
mw.writeFile('ssl/certificate.pem', cert_ca)
|
||||
mw.writeFile('ssl/privateKey.pem', private_key)
|
||||
print(cert_ca, private_key)
|
||||
return True
|
||||
return False
|
||||
|
||||
# 获取临时登录列表
|
||||
def getTempLoginApi(self):
|
||||
if 'tmp_login_expire' in session:
|
||||
@@ -650,4 +730,13 @@ class config_api:
|
||||
data['username'] = mw.M('users').where(
|
||||
"id=?", (1,)).getField('username')
|
||||
|
||||
# databases hook 获取
|
||||
database_file = 'data/hook_database.json'
|
||||
if os.path.exists(database_file):
|
||||
df = mw.readFile(database_file)
|
||||
df = json.loads(df)
|
||||
data['hook_database'] = df
|
||||
else:
|
||||
data['hook_database'] = []
|
||||
|
||||
return data
|
||||
|
||||
+47
-22
@@ -94,7 +94,7 @@ class crontab_api:
|
||||
rdata['list'] = mw.getPage(_page)
|
||||
rdata['p'] = p
|
||||
|
||||
# backup hock
|
||||
# backup hook
|
||||
bh_file = mw.getPanelDataDir() + "/hook_backup.json"
|
||||
if os.path.exists(bh_file):
|
||||
hb_data = mw.readFile(bh_file)
|
||||
@@ -131,7 +131,7 @@ class crontab_api:
|
||||
# 参数校验
|
||||
def cronCheck(self, params):
|
||||
|
||||
if params['stype'] == 'site' or params['stype'] == 'database' or params['stype'] == 'logs':
|
||||
if params['stype'] == 'site' or params['stype'] == 'database' or params['stype'].find('database_') > -1 or params['stype'] == 'logs' or params['stype'] == 'path':
|
||||
if params['save'] == '':
|
||||
return False, '保留份数不能为空!'
|
||||
|
||||
@@ -230,8 +230,8 @@ class crontab_api:
|
||||
cronInfo['sbody'] = get['sbody']
|
||||
cronInfo['urladdress'] = get['urladdress']
|
||||
|
||||
addData = mw.M('crontab').where('id=?', (sid,)).save('name,type,where1,where_hour,where_minute,save,backup_to,sbody,urladdress', (get[
|
||||
'name'], field_type, get['where1'], get['hour'], get['minute'], get['save'], get['backup_to'], get['sbody'], get['urladdress']))
|
||||
addData = mw.M('crontab').where('id=?', (sid,)).save('name,type,where1,where_hour,where_minute,save,backup_to, sname, sbody,urladdress',
|
||||
(iname, field_type, get['where1'], get['hour'], get['minute'], get['save'], get['backup_to'], sname, get['sbody'], get['urladdress']))
|
||||
self.removeForCrond(cronInfo['echo'])
|
||||
self.syncToCrond(cronInfo)
|
||||
mw.writeLog('计划任务', '修改计划任务[' + cronInfo['name'] + ']成功')
|
||||
@@ -377,28 +377,46 @@ class crontab_api:
|
||||
stype = request.form.get('type', '')
|
||||
|
||||
bak_data = []
|
||||
|
||||
if stype == 'sites' or stype == 'databases':
|
||||
if stype == 'site' or stype == 'sites' or stype == 'database' or stype.find('database_') > -1 or stype == 'path':
|
||||
hookPath = mw.getPanelDataDir() + "/hook_backup.json"
|
||||
if os.path.exists(hookPath):
|
||||
t = mw.readFile(hookPath)
|
||||
bak_data = json.loads(t)
|
||||
|
||||
if stype == 'databases':
|
||||
if stype == 'database' or stype.find('database_') > -1:
|
||||
sqlite3_name = 'mysql'
|
||||
path = mw.getServerDir() + '/mysql'
|
||||
if stype != 'database':
|
||||
soft_name = stype.replace('database_', '')
|
||||
path = mw.getServerDir() + '/' + soft_name
|
||||
|
||||
if soft_name == 'postgresql':
|
||||
sqlite3_name = 'pgsql'
|
||||
|
||||
db_list = {}
|
||||
db_list['orderOpt'] = bak_data
|
||||
path = mw.getServerDir() + '/mysql'
|
||||
if not os.path.exists(path + '/mysql.db'):
|
||||
|
||||
if not os.path.exists(path + '/' + sqlite3_name + '.db'):
|
||||
db_list['data'] = []
|
||||
else:
|
||||
db_list['data'] = mw.M('databases').dbPos(
|
||||
path, 'mysql').field('name,ps').select()
|
||||
path, sqlite3_name).field('name,ps').select()
|
||||
return mw.getJson(db_list)
|
||||
|
||||
if stype == 'path':
|
||||
db_list = {}
|
||||
db_list['data'] = [{"name": mw.getWwwDir(), "ps": "www"}]
|
||||
db_list['orderOpt'] = bak_data
|
||||
return mw.getJson(db_list)
|
||||
|
||||
data = {}
|
||||
data['orderOpt'] = bak_data
|
||||
|
||||
data['data'] = mw.M(stype).field('name,ps').select()
|
||||
default_db = 'sites'
|
||||
# if stype == 'site' or stype == 'logs':
|
||||
# stype == 'sites'
|
||||
|
||||
data['data'] = mw.M(default_db).field('name,ps').select()
|
||||
return mw.getJson(data)
|
||||
##### ----- start ----- ###
|
||||
|
||||
@@ -495,13 +513,19 @@ export LANG=en_US.UTF-8
|
||||
MW_PATH=%s/bin/activate
|
||||
if [ -f $MW_PATH ];then
|
||||
source $MW_PATH
|
||||
fi
|
||||
''' % (mw.getRunDir(),)
|
||||
fi''' % (mw.getRunDir(),)
|
||||
|
||||
head = head + source_bin_activate + "\n"
|
||||
log = '.log'
|
||||
|
||||
script_dir = mw.getServerDir() + "/mdserver-web/scripts"
|
||||
script_dir = mw.getRunDir() + "/scripts"
|
||||
source_stype = 'database'
|
||||
if stype.find('database_') > -1:
|
||||
plugin_name = stype.replace('database_', '')
|
||||
script_dir = mw.getRunDir() + "/plugins/" + plugin_name + "/scripts"
|
||||
|
||||
source_stype = stype
|
||||
stype = 'database'
|
||||
|
||||
wheres = {
|
||||
'path': head + "python3 " + script_dir + "/backup.py path " + param['sname'] + " " + str(param['save']),
|
||||
@@ -513,13 +537,14 @@ fi
|
||||
if param['backup_to'] != 'localhost':
|
||||
cfile = mw.getPluginDir() + "/" + \
|
||||
param['backup_to'] + "/index.py"
|
||||
wheres = {
|
||||
'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'
|
||||
}
|
||||
|
||||
wheres['path'] = head + "python3 " + cfile + \
|
||||
" path " + param['sname'] + " " + str(param['save'])
|
||||
wheres['site'] = head + "python3 " + cfile + \
|
||||
" site " + param['sname'] + " " + str(param['save'])
|
||||
wheres['database'] = head + "python3 " + cfile + " " + \
|
||||
source_stype + " " + \
|
||||
param['sname'] + " " + str(param['save'])
|
||||
try:
|
||||
shell = wheres[stype]
|
||||
except:
|
||||
@@ -583,9 +608,9 @@ echo "--------------------------------------------------------------------------
|
||||
# 重载配置
|
||||
def crondReload(self):
|
||||
if mw.isAppleSystem():
|
||||
# mw.execShell('/usr/sbin/cron restart')
|
||||
if os.path.exists('/etc/crontab'):
|
||||
pass
|
||||
# mw.execShell('/usr/sbin/cron restart')
|
||||
else:
|
||||
if os.path.exists('/etc/init.d/crond'):
|
||||
mw.execShell('/etc/init.d/crond reload')
|
||||
|
||||
+92
-27
@@ -97,11 +97,11 @@ class files_api:
|
||||
import shutil
|
||||
try:
|
||||
shutil.move(sfile, dfile)
|
||||
msg = mw.getInfo('移动文件或目录[{1}]到[{2}]成功!', (sfile, dfile,))
|
||||
msg = mw.getInfo('移动或重名命文件[{1}]到[{2}]成功!', (sfile, dfile,))
|
||||
mw.writeLog('文件管理', msg)
|
||||
return mw.returnJson(True, '移动文件或目录成功!')
|
||||
return mw.returnJson(True, '移动或重名命文件成功!')
|
||||
except:
|
||||
return mw.returnJson(False, '移动文件或目录失败!')
|
||||
return mw.returnJson(False, '移动或重名命文件失败!')
|
||||
|
||||
def deleteApi(self):
|
||||
path = request.form.get('path', '')
|
||||
@@ -148,12 +148,16 @@ class files_api:
|
||||
if not os.path.exists(path):
|
||||
path = mw.getRootDir() + "/wwwroot"
|
||||
search = request.args.get('search', '').strip().lower()
|
||||
search_all = request.args.get('all', '').strip().lower()
|
||||
page = request.args.get('p', '1').strip().lower()
|
||||
row = request.args.get('showRow', '10')
|
||||
disk = request.form.get('disk', '')
|
||||
if disk == 'True':
|
||||
row = 1000
|
||||
|
||||
# return self.getAllDir(path, int(page), int(row), "wp-inlcude")
|
||||
if search_all == 'yes' and search != '':
|
||||
return self.getAllDir(path, int(page), int(row), search)
|
||||
return self.getDir(path, int(page), int(row), search)
|
||||
|
||||
def createFileApi(self):
|
||||
@@ -236,6 +240,11 @@ class files_api:
|
||||
system_api.system_api().restartTask()
|
||||
except:
|
||||
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, '任务已删除!')
|
||||
|
||||
# 上传文件
|
||||
@@ -830,11 +839,59 @@ class files_api:
|
||||
if search:
|
||||
if name.lower().find(search) == -1:
|
||||
continue
|
||||
# if name[0:1] == '.':
|
||||
# continue
|
||||
if name == '.':
|
||||
continue
|
||||
i += 1
|
||||
return i
|
||||
|
||||
def getAllDir(self, path, page=1, page_size=10, search=None):
|
||||
# print("search:", search)
|
||||
data = {}
|
||||
dirnames = []
|
||||
filenames = []
|
||||
|
||||
count = 0
|
||||
max_limit = 3000
|
||||
|
||||
for d_list in os.walk(path):
|
||||
if count >= max_limit:
|
||||
break
|
||||
|
||||
for d in d_list[1]:
|
||||
if count >= max_limit:
|
||||
break
|
||||
if d.lower().find(search) != -1:
|
||||
filename = d_list[0] + '/' + d
|
||||
if not os.path.exists(filename):
|
||||
continue
|
||||
dirnames.append(self.__get_stats(filename, path))
|
||||
count += 1
|
||||
|
||||
for f in d_list[2]:
|
||||
if count >= max_limit:
|
||||
break
|
||||
|
||||
if f.lower().find(search) != -1:
|
||||
filename = d_list[0] + '/' + f
|
||||
if not os.path.exists(filename):
|
||||
continue
|
||||
filenames.append(self.__get_stats(filename, path))
|
||||
count += 1
|
||||
|
||||
data['DIR'] = sorted(dirnames)
|
||||
data['FILES'] = sorted(filenames)
|
||||
data['PATH'] = path.replace('//', '/')
|
||||
|
||||
info = {}
|
||||
info['count'] = len(dirnames) + len(filenames)
|
||||
info['row'] = page_size
|
||||
info['p'] = page
|
||||
info['tojs'] = 'getFiles'
|
||||
pageObj = mw.getPageObject(info, '1,2,3,4,5,6,7,8')
|
||||
data['PAGE'] = pageObj[0]
|
||||
|
||||
return mw.getJson(data)
|
||||
|
||||
def getDir(self, path, page=1, page_size=10, search=None):
|
||||
data = {}
|
||||
dirnames = []
|
||||
@@ -861,31 +918,14 @@ class files_api:
|
||||
continue
|
||||
try:
|
||||
filePath = path + '/' + filename
|
||||
link = ''
|
||||
if os.path.islink(filePath):
|
||||
filePath = os.readlink(filePath)
|
||||
link = ' -> ' + filePath
|
||||
if not os.path.exists(filePath):
|
||||
filePath = path + '/' + filePath
|
||||
if not os.path.exists(filePath):
|
||||
continue
|
||||
if not os.path.exists(filePath):
|
||||
continue
|
||||
|
||||
stat = os.stat(filePath)
|
||||
accept = str(oct(stat.st_mode)[-3:])
|
||||
mtime = str(int(stat.st_mtime))
|
||||
user = ''
|
||||
try:
|
||||
user = pwd.getpwuid(stat.st_uid).pw_name
|
||||
except Exception as ee:
|
||||
user = str(stat.st_uid)
|
||||
|
||||
size = str(stat.st_size)
|
||||
file_stats = self.__get_stats(filePath, path)
|
||||
if os.path.isdir(filePath):
|
||||
dirnames.append(filename + ';' + size + ';' +
|
||||
mtime + ';' + accept + ';' + user + ';' + link)
|
||||
dirnames.append(file_stats)
|
||||
else:
|
||||
filenames.append(filename + ';' + size + ';' +
|
||||
mtime + ';' + accept + ';' + user + ';' + link)
|
||||
filenames.append(file_stats)
|
||||
n += 1
|
||||
except Exception as e:
|
||||
continue
|
||||
@@ -894,3 +934,28 @@ class files_api:
|
||||
data['PATH'] = path.replace('//', '/')
|
||||
|
||||
return mw.getJson(data)
|
||||
|
||||
def __get_stats(self, filename, path=None):
|
||||
filename = filename.replace('//', '/')
|
||||
try:
|
||||
stat = os.stat(filename)
|
||||
accept = str(oct(stat.st_mode)[-3:])
|
||||
mtime = str(int(stat.st_mtime))
|
||||
user = ''
|
||||
try:
|
||||
user = str(pwd.getpwuid(stat.st_uid).pw_name)
|
||||
except:
|
||||
user = str(stat.st_uid)
|
||||
size = str(stat.st_size)
|
||||
link = ''
|
||||
if os.path.islink(filename):
|
||||
link = ' -> ' + os.readlink(filename)
|
||||
|
||||
if path:
|
||||
tmp_path = (path + '/').replace('//', '/')
|
||||
filename = filename.replace(tmp_path, '', 1)
|
||||
|
||||
return filename + ';' + size + ';' + mtime + ';' + accept + ';' + user + ';' + link
|
||||
except Exception as e:
|
||||
# print(e)
|
||||
return ';;;;;'
|
||||
|
||||
@@ -352,19 +352,19 @@ class firewall_api:
|
||||
elif self.__isMac:
|
||||
pass
|
||||
else:
|
||||
mw.execShell('/etc/init.d/iptables save')
|
||||
mw.execShell('/etc/init.d/iptables stop')
|
||||
mw.execShell('service iptables save')
|
||||
mw.execShell('service iptables stop')
|
||||
else:
|
||||
if self.__isUfw:
|
||||
mw.execShell("echo 'y'|sudo ufw enable")
|
||||
mw.execShell("echo 'y'| ufw enable")
|
||||
if self.__isFirewalld:
|
||||
mw.execShell('systemctl start firewalld.service')
|
||||
mw.execShell('systemctl enable firewalld.service')
|
||||
elif self.__isMac:
|
||||
pass
|
||||
else:
|
||||
mw.execShell('/etc/init.d/iptables save')
|
||||
mw.execShell('/etc/init.d/iptables restart')
|
||||
mw.execShell('service iptables save')
|
||||
mw.execShell('service iptables restart')
|
||||
|
||||
return mw.returnData(True, '设置成功!')
|
||||
|
||||
@@ -437,8 +437,8 @@ class firewall_api:
|
||||
elif self.__isMac:
|
||||
pass
|
||||
else:
|
||||
mw.execShell('/etc/init.d/iptables save')
|
||||
mw.execShell('/etc/init.d/iptables restart')
|
||||
mw.execShell('service iptables save')
|
||||
mw.execShell('service iptables restart')
|
||||
|
||||
def getFwStatus(self):
|
||||
if self.__isUfw:
|
||||
|
||||
+128
-4
@@ -920,13 +920,22 @@ def checkDomainPanel():
|
||||
tmp = getHost()
|
||||
domain = readFile('data/bind_domain.pl')
|
||||
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:
|
||||
client_ip = getClientIp()
|
||||
if client_ip in ['127.0.0.1', 'localhost', '::1']:
|
||||
return False
|
||||
if tmp.strip().lower() != domain.strip().lower():
|
||||
from flask import Flask, redirect, request, url_for
|
||||
to = "http://" + domain + ":" + port
|
||||
to = "http://" + domain + ":" + str(port)
|
||||
return redirect(to, code=302)
|
||||
return False
|
||||
|
||||
@@ -1051,7 +1060,7 @@ def makeConf():
|
||||
file = getRunDir() + '/data/json/config.json'
|
||||
if not os.path.exists(file):
|
||||
c = {}
|
||||
c['title'] = '猫王面板'
|
||||
c['title'] = '大圣面板'
|
||||
c['home'] = 'http://github/midoks/mdserver-web'
|
||||
c['recycle_bin'] = True
|
||||
c['template'] = 'default'
|
||||
@@ -1282,13 +1291,107 @@ def get_string_arr(t):
|
||||
t_arr.append(str(i) + str(j))
|
||||
return t_arr
|
||||
|
||||
# 转换时间
|
||||
|
||||
|
||||
def strfDate(sdate):
|
||||
return time.strftime('%Y-%m-%d', time.strptime(sdate, '%Y%m%d%H%M%S'))
|
||||
|
||||
|
||||
# 获取证书名称
|
||||
def getCertName(certPath):
|
||||
if not os.path.exists(certPath):
|
||||
return None
|
||||
try:
|
||||
import OpenSSL
|
||||
result = {}
|
||||
x509 = OpenSSL.crypto.load_certificate(
|
||||
OpenSSL.crypto.FILETYPE_PEM, readFile(certPath))
|
||||
# 取产品名称
|
||||
issuer = x509.get_issuer()
|
||||
result['issuer'] = ''
|
||||
if hasattr(issuer, 'CN'):
|
||||
result['issuer'] = issuer.CN
|
||||
if not result['issuer']:
|
||||
is_key = [b'0', '0']
|
||||
issue_comp = issuer.get_components()
|
||||
if len(issue_comp) == 1:
|
||||
is_key = [b'CN', 'CN']
|
||||
for iss in issue_comp:
|
||||
if iss[0] in is_key:
|
||||
result['issuer'] = iss[1].decode()
|
||||
break
|
||||
if not result['issuer']:
|
||||
if hasattr(issuer, 'O'):
|
||||
result['issuer'] = issuer.O
|
||||
# 取到期时间
|
||||
result['notAfter'] = strfDate(
|
||||
bytes.decode(x509.get_notAfter())[:-1])
|
||||
# 取申请时间
|
||||
result['notBefore'] = strfDate(
|
||||
bytes.decode(x509.get_notBefore())[:-1])
|
||||
# 取可选名称
|
||||
result['dns'] = []
|
||||
for i in range(x509.get_extension_count()):
|
||||
s_name = x509.get_extension(i)
|
||||
if s_name.get_short_name() in [b'subjectAltName', 'subjectAltName']:
|
||||
s_dns = str(s_name).split(',')
|
||||
for d in s_dns:
|
||||
result['dns'].append(d.split(':')[1])
|
||||
subject = x509.get_subject().get_components()
|
||||
# 取主要认证名称
|
||||
if len(subject) == 1:
|
||||
result['subject'] = subject[0][1].decode()
|
||||
else:
|
||||
if not result['dns']:
|
||||
for sub in subject:
|
||||
if sub[0] == b'CN':
|
||||
result['subject'] = sub[1].decode()
|
||||
break
|
||||
if 'subject' in result:
|
||||
result['dns'].append(result['subject'])
|
||||
else:
|
||||
result['subject'] = result['dns'][0]
|
||||
result['endtime'] = int(int(time.mktime(time.strptime(
|
||||
result['notAfter'], "%Y-%m-%d")) - time.time()) / 86400)
|
||||
return result
|
||||
except Exception as e:
|
||||
# print(getTracebackInfo())
|
||||
return None
|
||||
|
||||
|
||||
def createSSL():
|
||||
# 自签证书
|
||||
if os.path.exists('ssl/input.pl'):
|
||||
return True
|
||||
import OpenSSL
|
||||
key = OpenSSL.crypto.PKey()
|
||||
key.generate_key(OpenSSL.crypto.TYPE_RSA, 2048)
|
||||
cert = OpenSSL.crypto.X509()
|
||||
cert.set_serial_number(0)
|
||||
cert.get_subject().CN = getLocalIp()
|
||||
cert.set_issuer(cert.get_subject())
|
||||
cert.gmtime_adj_notBefore(0)
|
||||
cert.gmtime_adj_notAfter(86400 * 3650)
|
||||
cert.set_pubkey(key)
|
||||
cert.sign(key, 'md5')
|
||||
cert_ca = OpenSSL.crypto.dump_certificate(
|
||||
OpenSSL.crypto.FILETYPE_PEM, cert)
|
||||
private_key = OpenSSL.crypto.dump_privatekey(
|
||||
OpenSSL.crypto.FILETYPE_PEM, key)
|
||||
if len(cert_ca) > 100 and len(private_key) > 100:
|
||||
writeFile('ssl/cert.pem', cert_ca, 'wb+')
|
||||
writeFile('ssl/private.pem', private_key, 'wb+')
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def getSSHPort():
|
||||
try:
|
||||
file = '/etc/ssh/sshd_config'
|
||||
conf = readFile(file)
|
||||
rep = "#*Port\s+([0-9]+)\s*\n"
|
||||
port = re.search(rep, conf).groups(0)[0]
|
||||
rep = "(#*)?Port\s+([0-9]+)\s*\n"
|
||||
port = re.search(rep, conf).groups(0)[1]
|
||||
return int(port)
|
||||
except:
|
||||
return 22
|
||||
@@ -1350,3 +1453,24 @@ def getMyORMDb():
|
||||
import ormDb
|
||||
o = ormDb.ORM()
|
||||
return o
|
||||
|
||||
# ---------------------------------------------------------------------------------
|
||||
# 打印相关
|
||||
# ---------------------------------------------------------------------------------
|
||||
|
||||
|
||||
def echoStart(tag):
|
||||
print("=" * 90)
|
||||
print("★开始{}[{}]".format(tag, formatDate()))
|
||||
print("=" * 90)
|
||||
|
||||
|
||||
def echoEnd(tag):
|
||||
print("=" * 90)
|
||||
print("☆{}完成[{}]".format(tag, formatDate()))
|
||||
print("=" * 90)
|
||||
print("\n")
|
||||
|
||||
|
||||
def echoInfo(msg):
|
||||
print("|-{}".format(msg))
|
||||
|
||||
@@ -236,7 +236,7 @@ class plugins_api:
|
||||
if 'hook' in info:
|
||||
hooks = info['hook']
|
||||
for x in hooks:
|
||||
if x in ['backup']:
|
||||
if x in ['backup', 'database']:
|
||||
self.hookInstallFile(x, info)
|
||||
return True
|
||||
return False
|
||||
@@ -245,7 +245,7 @@ class plugins_api:
|
||||
if 'hook' in info:
|
||||
hooks = info['hook']
|
||||
for x in hooks:
|
||||
if x in ['backup']:
|
||||
if x in ['backup', 'database']:
|
||||
self.hookUninstallFile(x, info)
|
||||
return True
|
||||
return False
|
||||
|
||||
+28
-90
@@ -76,16 +76,16 @@ class site_api:
|
||||
def listApi(self):
|
||||
limit = request.form.get('limit', '10')
|
||||
p = request.form.get('p', '1')
|
||||
type_id = request.form.get('type_id', '')
|
||||
type_id = request.form.get('type_id', '0').strip()
|
||||
|
||||
start = (int(p) - 1) * (int(limit))
|
||||
|
||||
siteM = mw.M('sites')
|
||||
if type_id != '' and type_id == '-1' and type_id == '0':
|
||||
siteM.where('type_id=?', (type_id))
|
||||
siteM = mw.M('sites').field('id,name,path,status,ps,addtime,edate')
|
||||
if type_id != '' and int(type_id) >= 0:
|
||||
siteM.where('type_id=?', (type_id,))
|
||||
|
||||
_list = siteM.field('id,name,path,status,ps,addtime,edate').limit(
|
||||
(str(start)) + ',' + limit).order('id desc').select()
|
||||
_list = siteM.limit((str(start)) + ',' +
|
||||
limit).order('id desc').select()
|
||||
|
||||
for i in range(len(_list)):
|
||||
_list[i]['backup_count'] = mw.M('backup').where(
|
||||
@@ -140,6 +140,10 @@ class site_api:
|
||||
return mw.getJson(data)
|
||||
|
||||
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_versions = self.getPhpVersion()
|
||||
php_versions = php_versions[1:]
|
||||
@@ -589,7 +593,7 @@ class site_api:
|
||||
|
||||
key = mw.readFile(key_path)
|
||||
csr = mw.readFile(csr_path)
|
||||
cert_data = self.getCertName(csr_path)
|
||||
cert_data = mw.getCertName(csr_path)
|
||||
data = {
|
||||
'status': status,
|
||||
'domain': domains,
|
||||
@@ -840,18 +844,6 @@ class site_api:
|
||||
'auth_to': auth_to,
|
||||
}
|
||||
|
||||
import cert_api
|
||||
data = cert_api.cert_api().applyCertApi(to_args)
|
||||
|
||||
if not data['status']:
|
||||
msg = data['msg']
|
||||
if type(data['msg']) != str:
|
||||
msg = data['msg'][0]
|
||||
emsg = data['msg'][1]['challenges'][0]['error']
|
||||
msg = msg + '<p><span>响应状态:</span>' + str(emsg['status']) + '</p><p><span>错误类型:</span>' + emsg[
|
||||
'type'] + '</p><p><span>错误代码:</span>' + emsg['detail'] + '</p>'
|
||||
return mw.returnJson(data['status'], msg, data['msg'])
|
||||
|
||||
src_letpath = mw.getServerDir() + '/web_conf/letsencrypt/' + siteName
|
||||
src_csrpath = src_letpath + "/fullchain.pem" # 生成证书路径
|
||||
src_keypath = src_letpath + "/privkey.pem" # 密钥文件路径
|
||||
@@ -860,11 +852,22 @@ class site_api:
|
||||
dst_csrpath = dst_letpath + '/fullchain.pem'
|
||||
dst_keypath = dst_letpath + '/privkey.pem'
|
||||
|
||||
if not os.path.exists(dst_letpath):
|
||||
mw.execShell('mkdir -p ' + dst_letpath)
|
||||
mw.buildSoftLink(src_csrpath, dst_csrpath, True)
|
||||
mw.buildSoftLink(src_keypath, dst_keypath, True)
|
||||
mw.execShell('echo "lets" > "' + dst_letpath + '/README"')
|
||||
if not os.path.exists(src_letpath):
|
||||
import cert_api
|
||||
data = cert_api.cert_api().applyCertApi(to_args)
|
||||
if not data['status']:
|
||||
msg = data['msg']
|
||||
if type(data['msg']) != str:
|
||||
msg = data['msg'][0]
|
||||
emsg = data['msg'][1]['challenges'][0]['error']
|
||||
msg = msg + '<p><span>响应状态:</span>' + str(emsg['status']) + '</p><p><span>错误类型:</span>' + emsg[
|
||||
'type'] + '</p><p><span>错误代码:</span>' + emsg['detail'] + '</p>'
|
||||
return mw.returnJson(data['status'], msg, data['msg'])
|
||||
|
||||
mw.execShell('mkdir -p ' + dst_letpath)
|
||||
mw.buildSoftLink(src_csrpath, dst_csrpath, True)
|
||||
mw.buildSoftLink(src_keypath, dst_keypath, True)
|
||||
mw.execShell('echo "lets" > "' + dst_letpath + '/README"')
|
||||
|
||||
# 写入配置文件
|
||||
result = self.setSslConf(siteName)
|
||||
@@ -2582,7 +2585,6 @@ location ^~ {from} {\n\
|
||||
conf = conf.replace(listen, listen + http_ssl)
|
||||
|
||||
mw.backFile(file)
|
||||
|
||||
mw.writeFile(file, conf)
|
||||
isError = mw.checkWebConfig()
|
||||
if(isError != True):
|
||||
@@ -2599,7 +2601,7 @@ location ^~ {from} {\n\
|
||||
|
||||
def saveCert(self, keyPath, certPath):
|
||||
try:
|
||||
certInfo = self.getCertName(certPath)
|
||||
certInfo = mw.getCertName(certPath)
|
||||
if not certInfo:
|
||||
return mw.returnData(False, '证书解析失败!')
|
||||
vpath = self.sslDir + '/' + certInfo['subject'].strip()
|
||||
@@ -2612,70 +2614,6 @@ location ^~ {from} {\n\
|
||||
except Exception as e:
|
||||
return mw.returnData(False, '证书保存失败!')
|
||||
|
||||
# 转换时间
|
||||
def strfDate(self, sdate):
|
||||
return time.strftime('%Y-%m-%d', time.strptime(sdate, '%Y%m%d%H%M%S'))
|
||||
|
||||
# 获取证书名称
|
||||
def getCertName(self, certPath):
|
||||
if not os.path.exists(certPath):
|
||||
return None
|
||||
try:
|
||||
import OpenSSL
|
||||
result = {}
|
||||
x509 = OpenSSL.crypto.load_certificate(
|
||||
OpenSSL.crypto.FILETYPE_PEM, mw.readFile(certPath))
|
||||
# 取产品名称
|
||||
issuer = x509.get_issuer()
|
||||
result['issuer'] = ''
|
||||
if hasattr(issuer, 'CN'):
|
||||
result['issuer'] = issuer.CN
|
||||
if not result['issuer']:
|
||||
is_key = [b'0', '0']
|
||||
issue_comp = issuer.get_components()
|
||||
if len(issue_comp) == 1:
|
||||
is_key = [b'CN', 'CN']
|
||||
for iss in issue_comp:
|
||||
if iss[0] in is_key:
|
||||
result['issuer'] = iss[1].decode()
|
||||
break
|
||||
if not result['issuer']:
|
||||
if hasattr(issuer, 'O'):
|
||||
result['issuer'] = issuer.O
|
||||
# 取到期时间
|
||||
result['notAfter'] = self.strfDate(
|
||||
bytes.decode(x509.get_notAfter())[:-1])
|
||||
# 取申请时间
|
||||
result['notBefore'] = self.strfDate(
|
||||
bytes.decode(x509.get_notBefore())[:-1])
|
||||
# 取可选名称
|
||||
result['dns'] = []
|
||||
for i in range(x509.get_extension_count()):
|
||||
s_name = x509.get_extension(i)
|
||||
if s_name.get_short_name() in [b'subjectAltName', 'subjectAltName']:
|
||||
s_dns = str(s_name).split(',')
|
||||
for d in s_dns:
|
||||
result['dns'].append(d.split(':')[1])
|
||||
subject = x509.get_subject().get_components()
|
||||
# 取主要认证名称
|
||||
if len(subject) == 1:
|
||||
result['subject'] = subject[0][1].decode()
|
||||
else:
|
||||
if not result['dns']:
|
||||
for sub in subject:
|
||||
if sub[0] == b'CN':
|
||||
result['subject'] = sub[1].decode()
|
||||
break
|
||||
if 'subject' in result:
|
||||
result['dns'].append(result['subject'])
|
||||
else:
|
||||
result['subject'] = result['dns'][0]
|
||||
result['endtime'] = int(int(time.mktime(time.strptime(
|
||||
result['notAfter'], "%Y-%m-%d")) - time.time()) / 86400)
|
||||
return result
|
||||
except:
|
||||
return None
|
||||
|
||||
# 清除多余user.ini
|
||||
def delUserInI(self, path, up=0):
|
||||
for p1 in os.listdir(path):
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
server
|
||||
{
|
||||
listen {$PORT};
|
||||
listen [::]:{$PORT};
|
||||
|
||||
server_name {$SERVER_NAME};
|
||||
index index.php index.html index.htm default.php default.htm default.html;
|
||||
|
||||
#SSL-START
|
||||
#error_page 404/404.html;
|
||||
#SSL-END
|
||||
|
||||
#PROXY-START
|
||||
location ^~ / {
|
||||
proxy_pass http://0.0.0.0:{$PANAL_PORT}/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
}
|
||||
#PROXY-END
|
||||
|
||||
error_log {$LOGPATH}/{$SERVER_NAME}.error.log;
|
||||
}
|
||||
@@ -80,11 +80,13 @@ class FtpPSClient:
|
||||
return default_config
|
||||
|
||||
def injection_config(self, data):
|
||||
host = data["ftp_host"].strip()
|
||||
self.__host = host = data["ftp_host"].strip()
|
||||
if host.find(':') == -1:
|
||||
self.__port = self.default_port
|
||||
else:
|
||||
self.__host = host.split(':')[0]
|
||||
self.__port = host.split(':')[1]
|
||||
|
||||
self.__host = data['ftp_host'].strip()
|
||||
self.__user = data['ftp_user'].strip()
|
||||
self.__password = data['ftp_pass'].strip()
|
||||
bp = data['backup_path'].strip()
|
||||
|
||||
+21
-13
@@ -57,9 +57,8 @@ def getArgs():
|
||||
tmp[t[0]] = t[1]
|
||||
elif args_len > 1:
|
||||
for i in range(len(args)):
|
||||
t = args[i].split(':')
|
||||
t = args[i].split(':', 1)
|
||||
tmp[t[0]] = t[1]
|
||||
|
||||
return tmp
|
||||
|
||||
|
||||
@@ -180,28 +179,37 @@ def backupAllFunc(stype):
|
||||
name = sys.argv[2]
|
||||
num = sys.argv[3]
|
||||
|
||||
args = stype + " " + name + " " + num
|
||||
|
||||
cmd = 'python3 ' + mw.getRunDir() + '/scripts/backup.py ' + args
|
||||
os.system(cmd)
|
||||
|
||||
# 开始执行上传信息
|
||||
|
||||
prefix_dict = {
|
||||
"site": "web",
|
||||
"database": "db",
|
||||
"path": "path",
|
||||
}
|
||||
|
||||
find_path = mw.getBackupDir() + '/' + stype + '/' + \
|
||||
prefix_dict[stype] + '_' + name
|
||||
args = stype + " " + name + " " + num
|
||||
cmd = 'python3 ' + mw.getRunDir() + '/scripts/backup.py ' + args
|
||||
if stype.find('database_') > -1:
|
||||
plugin_name = stype.replace('database_', '')
|
||||
args = "database " + name + " " + num
|
||||
cmd = 'python3 ' + mw.getRunDir() + '/plugins/' + plugin_name + \
|
||||
'/scripts/backup.py ' + args
|
||||
|
||||
os.system(cmd)
|
||||
# 开始执行上传信息
|
||||
|
||||
bk_prefix = prefix_dict[stype]
|
||||
bk_name = stype
|
||||
if stype.find('database_') > -1:
|
||||
bk_name = 'database'
|
||||
plugin_name = stype.replace('database_', '')
|
||||
bk_prefix = plugin_name + '/db'
|
||||
|
||||
find_path = mw.getBackupDir() + '/' + bk_name + '/' + bk_prefix + '_' + name
|
||||
find_new_file = "ls " + find_path + \
|
||||
"_* | grep '.gz' | cut -d \ -f 1 | awk 'END {print}'"
|
||||
|
||||
filename = mw.execShell(find_new_file)[0].strip()
|
||||
if filename == "":
|
||||
print("not find upload file!")
|
||||
mw.echoInfo("not find upload file!")
|
||||
return False
|
||||
|
||||
ftp = FtpPSClient()
|
||||
@@ -251,7 +259,7 @@ if __name__ == "__main__":
|
||||
print(deleteDir())
|
||||
elif func == 'delete_file':
|
||||
print(deleteFile())
|
||||
elif in_array(func, ['site', 'database', 'path']):
|
||||
elif in_array(func, ['site', 'database', 'path']) or func.find('database_') > -1:
|
||||
print(backupAllFunc(func))
|
||||
else:
|
||||
print('error')
|
||||
|
||||
@@ -21,10 +21,13 @@ OSNAME_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F
|
||||
ARCH="amd64"
|
||||
|
||||
get_arch() {
|
||||
|
||||
TMP_ARCH=`arch`
|
||||
if [ "$TMP_ARCH" == "x86_64" ];then
|
||||
ARCH="amd64"
|
||||
else if [ "$TMP_ARCH" == "aarch64" ];then
|
||||
ARCH="arm64"
|
||||
else
|
||||
echo $ARCH
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,13 @@ def checkArgs(data, ck=[]):
|
||||
return (True, mw.returnJson(True, 'ok'))
|
||||
|
||||
|
||||
def getBackupDir():
|
||||
bk_path = mw.getBackupDir() + "/database/mariadb"
|
||||
if not os.path.isdir(bk_path):
|
||||
mw.execShell("mkdir -p {}".format(bk_path))
|
||||
return bk_path
|
||||
|
||||
|
||||
def getConf():
|
||||
path = getServerDir() + '/etc/my.cnf'
|
||||
return path
|
||||
@@ -675,7 +682,7 @@ def __createUser(dbname, username, password, address):
|
||||
|
||||
|
||||
def getDbBackupListFunc(dbname=''):
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
bkDir = getBackupDir()
|
||||
blist = os.listdir(bkDir)
|
||||
r = []
|
||||
|
||||
@@ -709,11 +716,11 @@ def importDbBackup():
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
file_path = mw.getRootDir() + '/backup/database/' + file
|
||||
file_path_sql = mw.getRootDir() + '/backup/database/' + file.replace('.gz', '')
|
||||
file_path = getBackupDir() + '/' + file
|
||||
file_path_sql = getBackupDir() + '/' + file.replace('.gz', '')
|
||||
|
||||
if not os.path.exists(file_path_sql):
|
||||
cmd = 'cd ' + mw.getRootDir() + '/backup/database && gzip -d ' + file
|
||||
cmd = 'cd ' + mw.getBackupDir() + '/database/mariadb && gzip -d ' + file
|
||||
mw.execShell(cmd)
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
|
||||
@@ -735,7 +742,7 @@ def importDbExternal():
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
import_dir = mw.getRootDir() + '/backup/import/'
|
||||
import_dir = mw.getBackupDir() + '/import/'
|
||||
|
||||
file_path = import_dir + file
|
||||
if not os.path.exists(file_path):
|
||||
@@ -797,7 +804,7 @@ def deleteDbBackup():
|
||||
|
||||
path = args['path']
|
||||
full_file = ""
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
bkDir = getBackupDir()
|
||||
full_file = bkDir + '/' + args['filename']
|
||||
if path != "":
|
||||
full_file = path + "/" + args['filename']
|
||||
@@ -812,7 +819,10 @@ def getDbBackupList():
|
||||
return data[1]
|
||||
|
||||
r = getDbBackupListFunc(args['name'])
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
bkDir = getBackupDir()
|
||||
if not os.path.exists(bkDir):
|
||||
os.mkdir(bkDir)
|
||||
|
||||
rr = []
|
||||
for x in range(0, len(r)):
|
||||
p = bkDir + '/' + r[x]
|
||||
@@ -835,7 +845,7 @@ def getDbBackupList():
|
||||
|
||||
def getDbBackupImportList():
|
||||
|
||||
bkImportDir = mw.getRootDir() + '/backup/import'
|
||||
bkImportDir = mw.getBackupDir() + '/import'
|
||||
if not os.path.exists(bkImportDir):
|
||||
os.mkdir(bkImportDir)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"hook":["database"],
|
||||
"title":"MariaDB",
|
||||
"tip":"soft",
|
||||
"name":"mariadb",
|
||||
|
||||
@@ -487,19 +487,6 @@ function showHidePass(obj){
|
||||
}
|
||||
}
|
||||
|
||||
function copyPass(password){
|
||||
var clipboard = new ClipboardJS('#bt_copys');
|
||||
clipboard.on('success', function (e) {
|
||||
layer.msg('复制成功',{icon:1,time:2000});
|
||||
});
|
||||
|
||||
clipboard.on('error', function (e) {
|
||||
layer.msg('复制失败,浏览器不兼容!',{icon:2,time:2000});
|
||||
});
|
||||
$("#bt_copys").attr('data-clipboard-text',password);
|
||||
$("#bt_copys").click();
|
||||
}
|
||||
|
||||
function checkSelect(){
|
||||
setTimeout(function () {
|
||||
var num = $('input[type="checkbox"].check:checked').length;
|
||||
|
||||
@@ -40,7 +40,7 @@ class backupTools:
|
||||
"----------------------------------------------------------------------------")
|
||||
return
|
||||
|
||||
backup_path = mw.getRootDir() + '/backup/database'
|
||||
backup_path = mw.getRootDir() + '/backup/database/mariadb'
|
||||
if not os.path.exists(backup_path):
|
||||
mw.execShell("mkdir -p " + backup_path)
|
||||
|
||||
|
||||
@@ -67,6 +67,13 @@ def getArgs():
|
||||
return tmp
|
||||
|
||||
|
||||
def getBackupDir():
|
||||
bk_path = mw.getBackupDir() + "/database/mysql-apt"
|
||||
if not os.path.isdir(bk_path):
|
||||
mw.execShell("mkdir -p {}".format(bk_path))
|
||||
return bk_path
|
||||
|
||||
|
||||
def checkArgs(data, ck=[]):
|
||||
for i in range(len(ck)):
|
||||
if not ck[i] in data:
|
||||
@@ -650,7 +657,11 @@ def __createUser(dbname, username, password, address):
|
||||
|
||||
|
||||
def getDbBackupListFunc(dbname=''):
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
|
||||
bkDir = getBackupDir()
|
||||
if not os.path.exists(bkDir):
|
||||
os.mkdir(bkDir)
|
||||
|
||||
blist = os.listdir(bkDir)
|
||||
r = []
|
||||
|
||||
@@ -684,7 +695,7 @@ def importDbExternal():
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
import_dir = mw.getRootDir() + '/backup/import/'
|
||||
import_dir = mw.getBackupDir() + '/import/'
|
||||
|
||||
file_path = import_dir + file
|
||||
if not os.path.exists(file_path):
|
||||
@@ -750,11 +761,11 @@ def importDbBackup():
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
file_path = mw.getRootDir() + '/backup/database/' + file
|
||||
file_path_sql = mw.getRootDir() + '/backup/database/' + file.replace('.gz', '')
|
||||
file_path = mw.getBackupDir() + '/database/' + file
|
||||
file_path_sql = mw.getBackupDir() + '/database/' + file.replace('.gz', '')
|
||||
|
||||
if not os.path.exists(file_path_sql):
|
||||
cmd = 'cd ' + mw.getRootDir() + '/backup/database && gzip -d ' + file
|
||||
cmd = 'cd ' + mw.getBackupDir() + '/database && gzip -d ' + file
|
||||
mw.execShell(cmd)
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
|
||||
@@ -775,7 +786,7 @@ def deleteDbBackup():
|
||||
|
||||
path = args['path']
|
||||
full_file = ""
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
bkDir = getBackupDir()
|
||||
full_file = bkDir + '/' + args['filename']
|
||||
if path != "":
|
||||
full_file = path + "/" + args['filename']
|
||||
@@ -790,7 +801,7 @@ def getDbBackupList():
|
||||
return data[1]
|
||||
|
||||
r = getDbBackupListFunc(args['name'])
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
bkDir = getBackupDir()
|
||||
rr = []
|
||||
for x in range(0, len(r)):
|
||||
p = bkDir + '/' + r[x]
|
||||
@@ -812,8 +823,7 @@ def getDbBackupList():
|
||||
|
||||
|
||||
def getDbBackupImportList():
|
||||
|
||||
bkImportDir = mw.getRootDir() + '/backup/import'
|
||||
bkImportDir = mw.getBackupDir() + '/import'
|
||||
if not os.path.exists(bkImportDir):
|
||||
os.mkdir(bkImportDir)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"hook":["database"],
|
||||
"title":"MySQL[APT]",
|
||||
"tip":"soft",
|
||||
"name":"mysql-apt",
|
||||
|
||||
@@ -509,19 +509,6 @@ function showHidePass(obj){
|
||||
}
|
||||
}
|
||||
|
||||
function copyPass(password){
|
||||
var clipboard = new ClipboardJS('#bt_copys');
|
||||
clipboard.on('success', function (e) {
|
||||
layer.msg('复制成功',{icon:1,time:2000});
|
||||
});
|
||||
|
||||
clipboard.on('error', function (e) {
|
||||
layer.msg('复制失败,浏览器不兼容!',{icon:2,time:2000});
|
||||
});
|
||||
$("#bt_copys").attr('data-clipboard-text',password);
|
||||
$("#bt_copys").click();
|
||||
}
|
||||
|
||||
function checkSelect(){
|
||||
setTimeout(function () {
|
||||
var num = $('input[type="checkbox"].check:checked').length;
|
||||
|
||||
@@ -44,7 +44,7 @@ class backupTools:
|
||||
"----------------------------------------------------------------------------")
|
||||
return
|
||||
|
||||
backup_path = mw.getRootDir() + '/backup/database'
|
||||
backup_path = mw.getRootDir() + '/backup/database/mysql-apt'
|
||||
if not os.path.exists(backup_path):
|
||||
mw.execShell("mkdir -p " + backup_path)
|
||||
|
||||
|
||||
@@ -65,6 +65,13 @@ def checkArgs(data, ck=[]):
|
||||
return (True, mw.returnJson(True, 'ok'))
|
||||
|
||||
|
||||
def getBackupDir():
|
||||
bk_path = mw.getBackupDir() + "/database/mysql-yum"
|
||||
if not os.path.isdir(bk_path):
|
||||
mw.execShell("mkdir -p {}".format(bk_path))
|
||||
return bk_path
|
||||
|
||||
|
||||
def getConf():
|
||||
path = getServerDir() + '/etc/my.cnf'
|
||||
return path
|
||||
@@ -629,7 +636,7 @@ def __createUser(dbname, username, password, address):
|
||||
|
||||
|
||||
def getDbBackupListFunc(dbname=''):
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
bkDir = getBackupDir()
|
||||
blist = os.listdir(bkDir)
|
||||
r = []
|
||||
|
||||
@@ -663,7 +670,7 @@ def importDbExternal():
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
import_dir = mw.getRootDir() + '/backup/import/'
|
||||
import_dir = mw.getBackupDir() + '/import/'
|
||||
|
||||
file_path = import_dir + file
|
||||
if not os.path.exists(file_path):
|
||||
@@ -729,11 +736,11 @@ def importDbBackup():
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
file_path = mw.getRootDir() + '/backup/database/' + file
|
||||
file_path_sql = mw.getRootDir() + '/backup/database/' + file.replace('.gz', '')
|
||||
file_path = getBackupDir() + '/' + file
|
||||
file_path_sql = getBackupDir() + '/' + file.replace('.gz', '')
|
||||
|
||||
if not os.path.exists(file_path_sql):
|
||||
cmd = 'cd ' + mw.getRootDir() + '/backup/database && gzip -d ' + file
|
||||
cmd = 'cd ' + mw.getBackupDir() + '/database && gzip -d ' + file
|
||||
mw.execShell(cmd)
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('mysql_root')
|
||||
@@ -754,7 +761,7 @@ def deleteDbBackup():
|
||||
|
||||
path = args['path']
|
||||
full_file = ""
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
bkDir = getBackupDir()
|
||||
full_file = bkDir + '/' + args['filename']
|
||||
if path != "":
|
||||
full_file = path + "/" + args['filename']
|
||||
@@ -769,7 +776,7 @@ def getDbBackupList():
|
||||
return data[1]
|
||||
|
||||
r = getDbBackupListFunc(args['name'])
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
bkDir = getBackupDir()
|
||||
rr = []
|
||||
for x in range(0, len(r)):
|
||||
p = bkDir + '/' + r[x]
|
||||
@@ -791,8 +798,7 @@ def getDbBackupList():
|
||||
|
||||
|
||||
def getDbBackupImportList():
|
||||
|
||||
bkImportDir = mw.getRootDir() + '/backup/import'
|
||||
bkImportDir = mw.getBackupDir() + '/import'
|
||||
if not os.path.exists(bkImportDir):
|
||||
os.mkdir(bkImportDir)
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"hook":["database"],
|
||||
"title":"MySQL[YUM]",
|
||||
"tip":"soft",
|
||||
"name":"mysql-yum",
|
||||
|
||||
@@ -509,19 +509,6 @@ function showHidePass(obj){
|
||||
}
|
||||
}
|
||||
|
||||
function copyPass(password){
|
||||
var clipboard = new ClipboardJS('#bt_copys');
|
||||
clipboard.on('success', function (e) {
|
||||
layer.msg('复制成功',{icon:1,time:2000});
|
||||
});
|
||||
|
||||
clipboard.on('error', function (e) {
|
||||
layer.msg('复制失败,浏览器不兼容!',{icon:2,time:2000});
|
||||
});
|
||||
$("#bt_copys").attr('data-clipboard-text',password);
|
||||
$("#bt_copys").click();
|
||||
}
|
||||
|
||||
function checkSelect(){
|
||||
setTimeout(function () {
|
||||
var num = $('input[type="checkbox"].check:checked').length;
|
||||
|
||||
@@ -44,7 +44,7 @@ class backupTools:
|
||||
"----------------------------------------------------------------------------")
|
||||
return
|
||||
|
||||
backup_path = mw.getRootDir() + '/backup/database'
|
||||
backup_path = mw.getRootDir() + '/backup/database/mysql-yum'
|
||||
if not os.path.exists(backup_path):
|
||||
mw.execShell("mkdir -p " + backup_path)
|
||||
|
||||
|
||||
@@ -509,19 +509,6 @@ function showHidePass(obj){
|
||||
}
|
||||
}
|
||||
|
||||
function copyPass(password){
|
||||
var clipboard = new ClipboardJS('#bt_copys');
|
||||
clipboard.on('success', function (e) {
|
||||
layer.msg('复制成功',{icon:1,time:2000});
|
||||
});
|
||||
|
||||
clipboard.on('error', function (e) {
|
||||
layer.msg('复制失败,浏览器不兼容!',{icon:2,time:2000});
|
||||
});
|
||||
$("#bt_copys").attr('data-clipboard-text',password);
|
||||
$("#bt_copys").click();
|
||||
}
|
||||
|
||||
function checkSelect(){
|
||||
setTimeout(function () {
|
||||
var num = $('input[type="checkbox"].check:checked').length;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
"name": "php-apt",
|
||||
"title": "PHP[APT]",
|
||||
"coexist": true,
|
||||
"versions": ["56","70","71","72","73","74","80","81"],
|
||||
"versions": ["56","70","71","72","73","74","80","81","82"],
|
||||
"install_pre_inspection":true,
|
||||
"tip": "soft",
|
||||
"checks": "server/php-apt/VERSION",
|
||||
|
||||
@@ -89,6 +89,12 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php-apt/${type} ];then
|
||||
cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${type:0:1}.${type:1:2} install redis
|
||||
cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${type:0:1}.${type:1:2} install memcached
|
||||
echo "install PHP-APT[${type}] extend end"
|
||||
|
||||
if [ ! -f /usr/local/bin/composer ];then
|
||||
cd /tmp
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source
|
||||
sysName=`uname`
|
||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||
|
||||
|
||||
#获取信息和版本
|
||||
# bash /www/server/mdsever-web/scripts/getos.sh
|
||||
bash ${rootPath}/scripts/getos.sh
|
||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
version=8.2
|
||||
PHP_VER=82
|
||||
|
||||
|
||||
Install_php()
|
||||
{
|
||||
#------------------------ install start ------------------------------------#
|
||||
apt -y install php${version} php${version}-fpm php${version}-dev
|
||||
if [ "$?" == "0" ];then
|
||||
mkdir -p $serverPath/php-apt/${PHP_VER}
|
||||
fi
|
||||
|
||||
#------------------------ install end ------------------------------------#
|
||||
}
|
||||
|
||||
Uninstall_php()
|
||||
{
|
||||
#------------------------ uninstall start ------------------------------------#
|
||||
apt -y remove php${version} php${version}-*
|
||||
rm -rf $serverPath/php-apt/${PHP_VER}
|
||||
echo "卸载php-${version}..." > $install_tmp
|
||||
#------------------------ uninstall start ------------------------------------#
|
||||
}
|
||||
|
||||
action=${1}
|
||||
if [ "${1}" == 'install' ];then
|
||||
Install_php
|
||||
else
|
||||
Uninstall_php
|
||||
fi
|
||||
@@ -78,6 +78,12 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php-yum/${type} ];then
|
||||
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install redis
|
||||
cd ${rootPath}/plugins/php-yum/versions && bash common.sh ${type} install memcached
|
||||
echo "install PHP-YUM[${type}] extend end"
|
||||
|
||||
if [ ! -f /usr/local/bin/composer ];then
|
||||
cd /tmp
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
+15
-3
@@ -32,9 +32,9 @@ if [ ! -d $curPath/versions/$2 ];then
|
||||
fi
|
||||
|
||||
|
||||
if [ "${action}" == "install" ] && [ -d $serverPath/php/${type} ];then
|
||||
exit 0
|
||||
fi
|
||||
# if [ "${action}" == "install" ] && [ -d $serverPath/php/${type} ];then
|
||||
# exit 0
|
||||
# fi
|
||||
|
||||
if [ "${action}" == "uninstall" ];then
|
||||
|
||||
@@ -71,7 +71,19 @@ 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 redis.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"
|
||||
|
||||
if [ ! -f /usr/local/bin/composer ];then
|
||||
cd /tmp
|
||||
curl -sS https://getcomposer.org/installer | php
|
||||
mv composer.phar /usr/local/bin/composer
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -13,10 +13,16 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
if [ ! -d ${SERVER_ROOT}/icu ];then
|
||||
|
||||
if [ ! -f ${SOURCE_ROOT}/icu4c-52_2-src.tgz ];then
|
||||
wget -O ${SOURCE_ROOT}/icu4c-52_2-src.tgz https://github.com/unicode-org/icu/releases/download/release-52-2/icu4c-52_2-src.tgz
|
||||
wget --no-check-certificate -O ${SOURCE_ROOT}/icu4c-52_2-src.tgz ${HTTP_PREFIX}github.com/unicode-org/icu/releases/download/release-52-2/icu4c-52_2-src.tgz
|
||||
fi
|
||||
|
||||
if [ ! -d ${SERVER_ROOT}/icu/52.2 ];then
|
||||
|
||||
@@ -13,9 +13,15 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
if [ ! -d ${SERVER_ROOT}/libiconv ];then
|
||||
cd $SOURCE_ROOT
|
||||
wget -O libiconv-1.15.tar.gz https://github.com/midoks/mdserver-web/releases/download/init/libiconv-1.15.tar.gz -T 5
|
||||
wget --no-check-certificate -O libiconv-1.15.tar.gz ${HTTP_PREFIX}github.com/midoks/mdserver-web/releases/download/init/libiconv-1.15.tar.gz -T 5
|
||||
tar zxvf libiconv-1.15.tar.gz
|
||||
cd libiconv-1.15
|
||||
./configure --prefix=${SERVER_ROOT}/libiconv --enable-static && make && make install
|
||||
|
||||
@@ -25,7 +25,7 @@ done
|
||||
if [ $ISFIND == "0" ];then
|
||||
cd $SOURCE_ROOT
|
||||
if [ ! -f ${SOURCE_ROOT}/libmcrypt-2.5.8.tar.gz ];then
|
||||
wget -O libmcrypt-2.5.8.tar.gz --no-check-certificate https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz -T 20
|
||||
wget --no-check-certificate -O libmcrypt-2.5.8.tar.gz https://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz -T 20
|
||||
fi
|
||||
|
||||
tar -zxvf libmcrypt-2.5.8.tar.gz
|
||||
|
||||
@@ -30,7 +30,7 @@ SOURCE_ROOT=$rootPath/source/lib
|
||||
if [ ! -d ${SERVER_ROOT}/libmemcached ];then
|
||||
cd ${SOURCE_ROOT}
|
||||
if [ ! -f ${SOURCE_ROOT}/libmemcached-1.0.18.tar.gz ];then
|
||||
wget -O libmemcached-1.0.18.tar.gz https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz -T 20
|
||||
wget --no-check-certificate -O libmemcached-1.0.18.tar.gz https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz -T 20
|
||||
fi
|
||||
tar -zxf libmemcached-1.0.18.tar.gz
|
||||
cd libmemcached-1.0.18
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
|
||||
# echo $rootPath
|
||||
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
|
||||
VERSION=1.0.18
|
||||
#----------------------------- libsodium start -------------------------#
|
||||
if [ ! -d ${SERVER_ROOT}/libsodium-stable ];then
|
||||
cd ${SOURCE_ROOT}
|
||||
if [ ! -f ${SOURCE_ROOT}/libsodium-${VERSION}-stable.tar.gz ];then
|
||||
# wget --no-check-certificate -O libsodium-1.0.18-stable.tar.gz https://download.libsodium.org/libsodium/releases/libsodium-1.0.18-stable.tar.gz -T 20
|
||||
wget --no-check-certificate -O libsodium-${VERSION}-stable.tar.gz https://download.libsodium.org/libsodium/releases/libsodium-${VERSION}-stable.tar.gz -T 20
|
||||
fi
|
||||
tar -zxvf libsodium-${VERSION}-stable.tar.gz
|
||||
cd libsodium-stable
|
||||
./configure --prefix=${SERVER_ROOT}/libsodium && make && make check && sudo make install
|
||||
fi
|
||||
#----------------------------- libsodium end -------------------------#
|
||||
@@ -17,7 +17,7 @@ if [ ! -d ${SERVER_ROOT}/libzip ];then
|
||||
|
||||
cd $SOURCE_ROOT
|
||||
if [ ! -f ${SOURCE_ROOT}/libzip-1.3.2.tar.gz ];then
|
||||
wget -O libzip-1.3.2.tar.gz --no-check-certificate https://nih.at/libzip/libzip-1.3.2.tar.gz -T 20
|
||||
wget --no-check-certificate -O libzip-1.3.2.tar.gz --no-check-certificate https://nih.at/libzip/libzip-1.3.2.tar.gz -T 20
|
||||
fi
|
||||
|
||||
tar -zxvf libzip-1.3.2.tar.gz
|
||||
|
||||
@@ -13,11 +13,17 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
which onig-config
|
||||
if [ "$?" != "0" ];then
|
||||
cd ${SOURCE_ROOT}
|
||||
if [ ! -f ${SOURCE_ROOT}/oniguruma-6.9.4.tar.gz ];then
|
||||
wget -O ${SOURCE_ROOT}/oniguruma-6.9.4.tar.gz https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz
|
||||
wget --no-check-certificate -O ${SOURCE_ROOT}/oniguruma-6.9.4.tar.gz ${HTTP_PREFIX}github.com/kkos/oniguruma/archive/v6.9.4.tar.gz
|
||||
fi
|
||||
cd ${SOURCE_ROOT} && tar -zxvf oniguruma-6.9.4.tar.gz
|
||||
cd ${SOURCE_ROOT}/oniguruma-6.9.4 && ./autogen.sh && ./configure --prefix=/usr && make && make install
|
||||
|
||||
@@ -16,7 +16,7 @@ SOURCE_ROOT=$rootPath/source/lib
|
||||
if [ ! -d ${SERVER_ROOT}/openssl ];then
|
||||
cd ${SOURCE_ROOT}
|
||||
if [ ! -f ${SOURCE_ROOT}/openssl-1.1.1p.tar.gz ];then
|
||||
wget -O ${SOURCE_ROOT}/openssl-1.1.1p.tar.gz https://www.openssl.org/source/openssl-1.1.1p.tar.gz
|
||||
wget --no-check-certificate -O ${SOURCE_ROOT}/openssl-1.1.1p.tar.gz https://www.openssl.org/source/openssl-1.1.1p.tar.gz
|
||||
fi
|
||||
tar -zxvf openssl-1.1.1p.tar.gz
|
||||
cd openssl-1.1.1p
|
||||
|
||||
@@ -13,10 +13,16 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
if [ ! -d ${SERVER_ROOT}/openssl10 ];then
|
||||
cd ${SOURCE_ROOT}
|
||||
if [ ! -f ${SOURCE_ROOT}/openssl-1.0.2q.tar.gz ];then
|
||||
wget https://github.com/midoks/mdserver-web/releases/download/init/openssl-1.0.2q.tar.gz -T 20
|
||||
wget --no-check-certificate ${HTTP_PREFIX}github.com/midoks/mdserver-web/releases/download/init/openssl-1.0.2q.tar.gz -T 20
|
||||
fi
|
||||
tar -zxf openssl-1.0.2q.tar.gz
|
||||
cd openssl-1.0.2q
|
||||
|
||||
@@ -13,11 +13,17 @@ rootPath=$(dirname "$rootPath")
|
||||
SERVER_ROOT=$rootPath/lib
|
||||
SOURCE_ROOT=$rootPath/source/lib
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
HTTP_PREFIX="https://"
|
||||
if [ ! -z "$cn" ];then
|
||||
HTTP_PREFIX="https://ghproxy.com/"
|
||||
fi
|
||||
|
||||
if [ ! -d ${SERVER_ROOT}/zlib ];then
|
||||
|
||||
cd $SOURCE_ROOT
|
||||
if [ ! -f ${SOURCE_ROOT}/zlib-1.2.11.tar.gz ];then
|
||||
wget -O zlib-1.2.11.tar.gz --no-check-certificate https://github.com/madler/zlib/archive/v1.2.11.tar.gz -T 20
|
||||
wget --no-check-certificate -O zlib-1.2.11.tar.gz ${HTTP_PREFIX}github.com/madler/zlib/archive/v1.2.11.tar.gz -T 20
|
||||
fi
|
||||
|
||||
tar -zxvf zlib-1.2.11.tar.gz
|
||||
|
||||
@@ -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"; }
|
||||
|
||||
|
||||
version=8.2.0RC7
|
||||
version=8.2.0
|
||||
PHP_VER=82
|
||||
Install_php()
|
||||
{
|
||||
@@ -32,8 +32,7 @@ cd ${rootPath}/plugins/php/lib && /bin/bash zlib.sh
|
||||
if [ ! -d $sourcePath/php/php${PHP_VER} ];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://downloads.php.net/~sergey/php-${version}.tar.xz
|
||||
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://www.php.net/distributions/php-${version}.tar.xz
|
||||
fi
|
||||
|
||||
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
|
||||
|
||||
@@ -40,7 +40,7 @@ cd $DIR
|
||||
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82)
|
||||
PHP_EXT_LIST=(ioncube ZendGuardLoader pdo mysqlnd sqlite3 openssl pcntl opcache mcrypt fileinfo \
|
||||
exif gd intl memcache memcached redis imagemagick xdebug xhprof \
|
||||
swoole yaf yar yac apc mongo mongodb solr seaslog mbstring iconv)
|
||||
swoole yaf yar yac apc mongo mongodb solr seaslog mbstring iconv phalcon)
|
||||
|
||||
for PHP_VER in ${PHP_VER_LIST[@]}; do
|
||||
echo "php${PHP_VER} -- start"
|
||||
|
||||
@@ -49,6 +49,7 @@ Install_lib()
|
||||
if [ ! -f "$extFile" ];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}
|
||||
fi
|
||||
|
||||
@@ -57,9 +58,23 @@ Install_lib()
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./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`
|
||||
if [ "$FIND_C99" == "" ];then
|
||||
sed -i $BAK 's/CFLAGS \=/CFLAGS \= -std=c99/g' Makefile
|
||||
if [ "$version" -gt "74" ] && [ "$FIND_C99" == "" ];then
|
||||
sed -i $BAK 's/CFLAGS \=/CFLAGS \= -std=gnu99/g' Makefile
|
||||
fi
|
||||
|
||||
make clean && make && make install && make clean
|
||||
|
||||
@@ -17,10 +17,13 @@ sysName=`uname`
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
if [ "$version" -gt "56" ];then
|
||||
echo "not need"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$version" -gt "56" ] && [ "$version" -lt "80" ];then
|
||||
LIBV=4.0.5.2
|
||||
fi
|
||||
|
||||
if [ "$version" -gt "74" ];then
|
||||
LIBV=8.0
|
||||
fi
|
||||
|
||||
|
||||
LIB_PATH_NAME=lib/php
|
||||
|
||||
Executable
+121
@@ -0,0 +1,121 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source/php
|
||||
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
LIBNAME=phalcon
|
||||
LIBV=4.1.2
|
||||
|
||||
if [ "$version" -lt "73" ];then
|
||||
echo "not support!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$version" -gt "74" ];then
|
||||
LIBV=5.1.2
|
||||
fi
|
||||
|
||||
LIB_PATH_NAME=lib/php
|
||||
if [ -d $serverPath/php/${version}/lib64 ];then
|
||||
LIB_PATH_NAME=lib64
|
||||
fi
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/${LIB_PATH_NAME}/extensions | grep no-debug-non-zts`
|
||||
extFile=$serverPath/php/${version}/${LIB_PATH_NAME}/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
|
||||
sysName=`uname`
|
||||
if [ "$sysName" == "Darwin" ];then
|
||||
BAK='_bak'
|
||||
else
|
||||
BAK=''
|
||||
fi
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_lib
|
||||
mkdir -p $php_lib
|
||||
|
||||
if [ ! -f $php_lib/${LIBNAME}-${LIBV}.tgz ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
|
||||
cd $php_lib
|
||||
tar xvf ${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
cd $php_lib/${LIBNAME}-${LIBV}
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config
|
||||
make clean && make && make install && make clean
|
||||
fi
|
||||
|
||||
while [[ ! -f "$extFile" ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 0.5
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
fi
|
||||
let n+=1
|
||||
if [ $n -gt 8 ];then
|
||||
echo "WAIT " $n "TIMES FAIL!"
|
||||
return;
|
||||
fi
|
||||
done
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -f $extFile
|
||||
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -21,6 +21,8 @@ if [ "$version" == "52" ];then
|
||||
LIBV=2.2.7
|
||||
elif [ "$version" -lt "70" ];then
|
||||
LIBV=4.2.0
|
||||
elif [ "$version" -gt "74" ];then
|
||||
LIBV=5.3.5
|
||||
else
|
||||
echo 'ok'
|
||||
fi
|
||||
|
||||
Executable
+106
@@ -0,0 +1,106 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
curPath=`pwd`
|
||||
|
||||
rootPath=$(dirname "$curPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
rootPath=$(dirname "$rootPath")
|
||||
serverPath=$(dirname "$rootPath")
|
||||
sourcePath=${serverPath}/source/php
|
||||
|
||||
|
||||
actionType=$1
|
||||
version=$2
|
||||
|
||||
sysName=`uname`
|
||||
LIBNAME=sodium
|
||||
LIBV=2.0.23
|
||||
|
||||
|
||||
LIB_PATH_NAME=lib/php
|
||||
if [ -d $serverPath/php/${version}/lib64 ];then
|
||||
LIB_PATH_NAME=lib64
|
||||
fi
|
||||
|
||||
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/${LIB_PATH_NAME}/extensions | grep no-debug-non-zts`
|
||||
extFile=$serverPath/php/${version}/${LIB_PATH_NAME}/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
|
||||
|
||||
if [ "$sysName" == "Darwin" ];then
|
||||
BAK='_bak'
|
||||
else
|
||||
BAK=''
|
||||
fi
|
||||
|
||||
Install_lib()
|
||||
{
|
||||
|
||||
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
|
||||
if [ "${isInstall}" != "" ];then
|
||||
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
cd ${rootPath}/plugins/php/lib && bash libsodium.sh
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
|
||||
php_lib=$sourcePath/php_lib
|
||||
mkdir -p $php_lib
|
||||
if [ ! -d $php_lib/${LIBNAME}-${LIBV} ];then
|
||||
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/lib${LIBNAME}-${LIBV}.tgz
|
||||
cd $php_lib && tar xvf ${LIBNAME}-${LIBV}.tgz
|
||||
fi
|
||||
cd $php_lib/${LIBNAME}-${LIBV}
|
||||
|
||||
$serverPath/php/$version/bin/phpize
|
||||
./configure --with-php-config=$serverPath/php/$version/bin/php-config --with-sodium=$serverPath/lib/libsodium
|
||||
make clean && make && make install && make clean
|
||||
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "ERROR!"
|
||||
return;
|
||||
fi
|
||||
|
||||
echo "" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
|
||||
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
|
||||
|
||||
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
|
||||
echo '==========================================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
Uninstall_lib()
|
||||
{
|
||||
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
|
||||
echo "php-$version 未安装,请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -f "$extFile" ];then
|
||||
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
|
||||
return
|
||||
fi
|
||||
|
||||
echo $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
|
||||
sed -i $BAK "/\[${LIBNAME}\]/d" $serverPath/php/$version/etc/php.ini
|
||||
|
||||
rm -rf $extFile
|
||||
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
|
||||
echo '==============================================='
|
||||
echo 'successful!'
|
||||
}
|
||||
|
||||
|
||||
if [ "$actionType" == 'install' ];then
|
||||
Install_lib
|
||||
elif [ "$actionType" == 'uninstall' ];then
|
||||
Uninstall_lib
|
||||
fi
|
||||
@@ -19,17 +19,14 @@ LIBV=4.8.10
|
||||
|
||||
if [ "$version" -lt "70" ];then
|
||||
LIBV=1.10.1
|
||||
elif [ "$version" == "71" ];then
|
||||
LIBV=4.5.2
|
||||
elif [ "$version" == "70" ];then
|
||||
LIBV=4.3.0
|
||||
elif [ "$version" == "71" ];then
|
||||
LIBV=4.5.2
|
||||
elif [ "$version" -gt "74" ];then
|
||||
LIBV=5.0.1
|
||||
else
|
||||
echo '72+'
|
||||
fi
|
||||
|
||||
if [ "$version" -eq "82" ];then
|
||||
echo "not need"
|
||||
exit 1
|
||||
echo 'other?'
|
||||
fi
|
||||
|
||||
LIB_PATH_NAME=lib/php
|
||||
|
||||
@@ -31,11 +31,6 @@ if [ "$version" -eq "72" ] || [ "$version" -eq "73" ];then
|
||||
LIBV=3.2.5
|
||||
fi
|
||||
|
||||
if [ "$version" -eq "82" ];then
|
||||
echo "not need"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
LIB_PATH_NAME=lib/php
|
||||
if [ -d $serverPath/php/${version}/lib64 ];then
|
||||
|
||||
@@ -21,12 +21,6 @@ if [ "$version" -lt "70" ];then
|
||||
LIBV=1.2.5
|
||||
fi
|
||||
|
||||
if [ "$version" -eq "82" ];then
|
||||
echo "wait php82 release"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
LIB_PATH_NAME=lib/php
|
||||
if [ -d $serverPath/php/${version}/lib64 ];then
|
||||
LIB_PATH_NAME=lib64
|
||||
|
||||
@@ -62,6 +62,23 @@
|
||||
"shell": "ioncube.sh",
|
||||
"check": "ioncube.so"
|
||||
},
|
||||
{
|
||||
"name": "sodium",
|
||||
"versions": [
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "加密库",
|
||||
"msg": "Sodium加密库的包装器",
|
||||
"shell": "sodium.sh",
|
||||
"check": "sodium.so"
|
||||
},
|
||||
{
|
||||
"name": "opcache",
|
||||
"versions": [
|
||||
@@ -314,7 +331,15 @@
|
||||
"53",
|
||||
"54",
|
||||
"55",
|
||||
"56"
|
||||
"56",
|
||||
"70",
|
||||
"71",
|
||||
"72",
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
],
|
||||
"type": "缓存器",
|
||||
"msg": "强大的内容缓存器,不支持集群",
|
||||
@@ -486,6 +511,19 @@
|
||||
"shell": "eaccelerator.sh",
|
||||
"check": "eaccelerator.so"
|
||||
},
|
||||
{
|
||||
"name": "phalcon",
|
||||
"versions": [
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81"
|
||||
],
|
||||
"type": "框架",
|
||||
"msg": "Phalcon是一个全栈PHP框架。",
|
||||
"shell": "phalcon.sh",
|
||||
"check": "phalcon.so"
|
||||
},
|
||||
{
|
||||
"name": "yaf",
|
||||
"versions": [
|
||||
@@ -499,8 +537,7 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
"81"
|
||||
],
|
||||
"type": "框架",
|
||||
"msg": "Yaf是一个C语言编写的PHP框架",
|
||||
@@ -520,8 +557,7 @@
|
||||
"73",
|
||||
"74",
|
||||
"80",
|
||||
"81",
|
||||
"82"
|
||||
"81"
|
||||
],
|
||||
"type": "框架",
|
||||
"msg": "Yar是一个RPC框架",
|
||||
|
||||
@@ -82,9 +82,7 @@ def getHomePage():
|
||||
|
||||
|
||||
def getPhpVer(expect=55):
|
||||
import json
|
||||
v = site_api.site_api().getPhpVersion()
|
||||
v = json.loads(v)
|
||||
is_find = False
|
||||
for i in range(len(v)):
|
||||
t = int(v[i]['version'])
|
||||
|
||||
@@ -1,3 +1,30 @@
|
||||
<style type="text/css">
|
||||
.db_list{
|
||||
padding: 0px 0 10px 0;
|
||||
font-size: 13px;
|
||||
line-height: 35px;
|
||||
height: 45px;
|
||||
}
|
||||
.db_list a{
|
||||
margin-right: 15px;
|
||||
color: #555;
|
||||
font-weight: 600;
|
||||
}
|
||||
.db_list span:nth-child(1){
|
||||
display: block;
|
||||
float: left;
|
||||
padding-left: 15px;
|
||||
background: #ececec;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#db_tools button {
|
||||
margin-right: 10px;
|
||||
}
|
||||
#db_tools button:last-child{
|
||||
margin-right: 0;
|
||||
}
|
||||
</style>
|
||||
<div class="bt-form">
|
||||
<div class='plugin_version'></div>
|
||||
<div class="bt-w-main">
|
||||
|
||||
@@ -70,12 +70,10 @@ def getArgs():
|
||||
|
||||
|
||||
def getBackupDir():
|
||||
bk_path = mw.getBackupDir() + "/pg"
|
||||
bk_path = mw.getBackupDir() + "/database/postgresql"
|
||||
if not os.path.isdir(bk_path):
|
||||
mw.execShell("mkdir -p {}/upload".format(bk_path))
|
||||
|
||||
bk_path_upload = bk_path + "/upload"
|
||||
return bk_path_upload
|
||||
mw.execShell("mkdir -p {}".format(bk_path))
|
||||
return bk_path
|
||||
|
||||
|
||||
def checkArgs(data, ck=[]):
|
||||
@@ -674,7 +672,7 @@ def setUserPwd(version=''):
|
||||
|
||||
|
||||
def getDbBackupListFunc(dbname=''):
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
bkDir = getBackupDir()
|
||||
blist = os.listdir(bkDir)
|
||||
r = []
|
||||
|
||||
@@ -708,11 +706,11 @@ def importDbBackup():
|
||||
file = args['file']
|
||||
name = args['name']
|
||||
|
||||
file_path = mw.getRootDir() + '/backup/database/' + file
|
||||
file_path_sql = mw.getRootDir() + '/backup/database/' + file.replace('.gz', '')
|
||||
file_path = getBackupDir() + '/' + file
|
||||
file_path_sql = getBackupDir() + '/' + file.replace('.gz', '')
|
||||
|
||||
if not os.path.exists(file_path_sql):
|
||||
cmd = 'cd ' + mw.getRootDir() + '/backup/database && gzip -d ' + file
|
||||
cmd = 'cd ' + getBackupDir() + ' && gzip -d ' + file
|
||||
mw.execShell(cmd)
|
||||
|
||||
pwd = pSqliteDb('config').where('id=?', (1,)).getField('pg_root')
|
||||
@@ -731,8 +729,7 @@ def deleteDbBackup():
|
||||
if not data[0]:
|
||||
return data[1]
|
||||
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
|
||||
bkDir = getBackupDir()
|
||||
os.remove(bkDir + '/' + args['filename'])
|
||||
return mw.returnJson(True, 'ok')
|
||||
|
||||
@@ -744,7 +741,7 @@ def getDbBackupList():
|
||||
return data[1]
|
||||
|
||||
r = getDbBackupListFunc(args['name'])
|
||||
bkDir = mw.getRootDir() + '/backup/database'
|
||||
bkDir = getBackupDir()
|
||||
rr = []
|
||||
for x in range(0, len(r)):
|
||||
p = bkDir + '/' + r[x]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"hook":["database"],
|
||||
"title":"PostgreSQL",
|
||||
"tip":"soft",
|
||||
"name":"postgresql",
|
||||
|
||||
@@ -259,19 +259,6 @@ function showHidePass(obj){
|
||||
}
|
||||
}
|
||||
|
||||
function copyPass(password){
|
||||
var clipboard = new ClipboardJS('#bt_copys');
|
||||
clipboard.on('success', function (e) {
|
||||
layer.msg('复制成功',{icon:1,time:2000});
|
||||
});
|
||||
|
||||
clipboard.on('error', function (e) {
|
||||
layer.msg('复制失败,浏览器不兼容!',{icon:2,time:2000});
|
||||
});
|
||||
$("#bt_copys").attr('data-clipboard-text',password);
|
||||
$("#bt_copys").click();
|
||||
}
|
||||
|
||||
function checkSelect(){
|
||||
setTimeout(function () {
|
||||
var num = $('input[type="checkbox"].check:checked').length;
|
||||
|
||||
@@ -71,7 +71,6 @@ def getHomePage():
|
||||
def getPhpVer(expect=56):
|
||||
import json
|
||||
v = site_api.site_api().getPhpVersion()
|
||||
v = json.loads(v)
|
||||
for i in range(len(v)):
|
||||
t = int(v[i]['version'])
|
||||
if (t >= expect):
|
||||
|
||||
@@ -27,3 +27,4 @@ Jinja2>=2.11.2
|
||||
flask-caching>=1.10.1
|
||||
bcrypt==3.1.3
|
||||
PyMySQL==1.0.2
|
||||
whitenoise==5.3.0
|
||||
@@ -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 *;
|
||||
}
|
||||
+11
-6
@@ -27,6 +27,8 @@ from flask import render_template_string, abort
|
||||
from flask_caching import Cache
|
||||
from flask_session import Session
|
||||
|
||||
from whitenoise import WhiteNoise
|
||||
|
||||
sys.path.append(os.getcwd() + "/class/core")
|
||||
|
||||
import db
|
||||
@@ -36,6 +38,9 @@ import config_api
|
||||
app = Flask(__name__, template_folder='templates/default')
|
||||
app.config.version = config_api.config_api().getVersion()
|
||||
|
||||
app.wsgi_app = WhiteNoise(
|
||||
app.wsgi_app, root="route/static/", prefix="static/", max_age=604800)
|
||||
|
||||
cache = Cache(config={'CACHE_TYPE': 'simple'})
|
||||
cache.init_app(app, config={'CACHE_TYPE': 'simple'})
|
||||
|
||||
@@ -186,11 +191,11 @@ def isLogined():
|
||||
|
||||
return True
|
||||
|
||||
if os.path.exists('data/api_login.txt'):
|
||||
content = mw.readFile('data/api_login.txt')
|
||||
session['login'] = True
|
||||
session['username'] = content
|
||||
os.remove('data/api_login.txt')
|
||||
# if os.path.exists('data/api_login.txt'):
|
||||
# content = mw.readFile('data/api_login.txt')
|
||||
# session['login'] = True
|
||||
# session['username'] = content
|
||||
# os.remove('data/api_login.txt')
|
||||
return False
|
||||
|
||||
|
||||
@@ -336,7 +341,7 @@ def doLogin():
|
||||
# session['overdue'] = int(time.time()) + 7
|
||||
|
||||
# fix 跳转时,数据消失,可能是跨域问题
|
||||
mw.writeFile('data/api_login.txt', userInfo['username'])
|
||||
# mw.writeFile('data/api_login.txt', userInfo['username'])
|
||||
return mw.returnJson(True, '登录成功,正在跳转...')
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ $('input[name="backup_path"]').change(function(){
|
||||
|
||||
$('input[name="bind_domain"]').change(function(){
|
||||
var domain = $(this).val();
|
||||
console.log(domain);
|
||||
$('.btn_bind_domain').removeAttr('disabled');
|
||||
$('.btn_bind_domain').unbind().click(function(){
|
||||
$.post('/config/set_panel_domain','domain='+domain, function(rdata){
|
||||
@@ -77,6 +76,13 @@ $('input[name="bind_domain"]').change(function(){
|
||||
});
|
||||
});
|
||||
|
||||
$('input[name="bind_ssl"]').click(function(){
|
||||
var open_ssl = $(this).prop("checked");
|
||||
$.post('/config/set_panel_ssl',{}, function(rdata){
|
||||
showMsg(rdata.msg,function(){window.location.reload();},{icon:rdata.status?1:2},2000);
|
||||
},'json');
|
||||
});
|
||||
|
||||
/** op **/
|
||||
|
||||
|
||||
@@ -353,13 +359,29 @@ function getPanelSSL(){
|
||||
var loadT = layer.msg('正在获取证书信息...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/config/get_panel_ssl',{},function(cert){
|
||||
layer.close(loadT);
|
||||
|
||||
|
||||
var cert_data = '';
|
||||
if (cert['info']){
|
||||
cert_data = "<div class='ssl_state_info'><div class='state_info_flex'>\
|
||||
<div class='state_item'><span>证书品牌:</span><span class='ellipsis_text'>"+cert['info']['issuer']+"</span></div>\
|
||||
<div class='state_item'><span>到期时间:</span><span class='btlink'>剩余"+cert['info']['endtime']+"天到期</span></div>\
|
||||
</div>\
|
||||
<div class='state_info_flex'>\
|
||||
<div class='state_item'><span>认证域名:</span><span class='ellipsis_text'>"+cert['info']['subject']+"</span></div>\
|
||||
</div></div>";
|
||||
}
|
||||
|
||||
var certBody = '<div class="tab-con">\
|
||||
<div class="myKeyCon ptb15">\
|
||||
<div class="ssl-con-key pull-left mr20">密钥(KEY)<br>\
|
||||
<textarea id="key" class="bt-input-text">'+cert.privateKey+'</textarea>\
|
||||
</div>\
|
||||
<div class="ssl-con-key pull-left">证书(PEM格式)<br>\
|
||||
<textarea id="csr" class="bt-input-text">'+cert.certPem+'</textarea>\
|
||||
'+cert_data+'\
|
||||
<div class="custom_certificate_info">\
|
||||
<div class="ssl-con-key pull-left mr20">密钥(KEY)<br>\
|
||||
<textarea id="key" class="bt-input-text">'+cert.privateKey+'</textarea>\
|
||||
</div>\
|
||||
<div class="ssl-con-key pull-left">证书(PEM格式)<br>\
|
||||
<textarea id="csr" class="bt-input-text">'+cert.certPem+'</textarea>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="ssl-btn pull-left mtb15" style="width:100%">\
|
||||
<button class="btn btn-success btn-sm" onclick="savePanelSSL()">保存</button>\
|
||||
|
||||
+263
-196
@@ -1,13 +1,3 @@
|
||||
function isURL(str_url){
|
||||
var strRegex = '^(https|http|ftp|rtsp|mms)?://.+';
|
||||
var re=new RegExp(strRegex);
|
||||
if (re.test(str_url)){
|
||||
return (true);
|
||||
}else{
|
||||
return (false);
|
||||
}
|
||||
}
|
||||
|
||||
var num = 0;
|
||||
//查看任务日志
|
||||
function getLogs(id){
|
||||
@@ -40,6 +30,16 @@ function getLogs(id){
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
function getBackupName(hook_data, name){
|
||||
for (var i = 0; i < hook_data.length; i++) {
|
||||
if (hook_data[i]['name'] == 'backup_ftp'){
|
||||
return hook_data[i]['title'];
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
function getCronData(page){
|
||||
var load = layer.msg(lan.public.the,{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post("/crontab/list?p="+page,'', function(rdata){
|
||||
@@ -61,10 +61,10 @@ function getCronData(page){
|
||||
}
|
||||
|
||||
var cron_backupto = '-';
|
||||
if (rdata.data[i]['stype'] == 'site' || rdata.data[i]['stype']=='database' ){
|
||||
if (rdata.data[i]['stype'] == 'site' || rdata.data[i]['stype']=='logs' || rdata.data[i]['stype']=='path' || rdata.data[i]['stype']=='database' || rdata.data[i]['stype'].indexOf('database_')>-1 ){
|
||||
cron_backupto = '本地磁盘';
|
||||
if (rdata.data[i]['backup_to'] != 'localhost'){
|
||||
cron_backupto = rdata.data[i]['backup_to'];
|
||||
cron_backupto = getBackupName(rdata['backup_hook'],rdata.data[i]['backup_to']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,19 +228,21 @@ function planAdd(){
|
||||
|
||||
var sType = $(".planjs").find("b").attr("val");
|
||||
var sBody = encodeURIComponent($("#implement textarea[name='sBody']").val());
|
||||
|
||||
if(sType == 'toFile'){
|
||||
if($("#viewfile").val() == ''){
|
||||
layer.msg('请选择脚本文件!',{icon:2});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
||||
if (sType == 'toShell'){
|
||||
if(sBody == ''){
|
||||
$("#implement textarea[name='sBody']").focus();
|
||||
layer.msg('脚本代码不能为空!',{icon:2});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(sType == 'toFile'){
|
||||
if($("#viewfile").val() == ''){
|
||||
layer.msg('请选择脚本文件!',{icon:2});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var urladdress = $("#urladdress").val();
|
||||
if(sType == 'toUrl'){
|
||||
@@ -295,7 +297,6 @@ function planAdd(){
|
||||
$("#set-Config input[name='sName']").val(sName);
|
||||
layer.msg('正在添加,请稍候...!',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
var data = $("#set-Config").serialize() + '&sBody='+sBody + '&urladdress=' + urladdress;
|
||||
// console.log(data);
|
||||
$.post('/crontab/add',data,function(rdata){
|
||||
if(!rdata.status) {
|
||||
layer.msg(rdata.msg,{icon:2, time:2000});
|
||||
@@ -413,10 +414,18 @@ function initDropdownMenu(){
|
||||
toBackup('sites');
|
||||
$(".controls").html('备份网站');
|
||||
break;
|
||||
case 'database_mariadb':
|
||||
case 'database_postgresql':
|
||||
case 'database_mysql-apt':
|
||||
case 'database_mysql-yum':
|
||||
case 'database':
|
||||
toBackup('databases');
|
||||
toBackup(type);
|
||||
$(".controls").html('备份数据库');
|
||||
break;
|
||||
case 'path':
|
||||
toBackup('path');
|
||||
$(".controls").html('备份目录');
|
||||
break;
|
||||
case 'logs':
|
||||
toBackup('logs');
|
||||
$(".controls").html('切割网站');
|
||||
@@ -438,49 +447,72 @@ function toBackup(type){
|
||||
sMsg = '备份网站';
|
||||
sType = "sites";
|
||||
break;
|
||||
case 'databases':
|
||||
case 'database_mariadb':
|
||||
case 'database_postgresql':
|
||||
case 'database_mysql-apt':
|
||||
case 'database_mysql-yum':
|
||||
case 'database':
|
||||
sMsg = '备份数据库';
|
||||
sType = "databases";
|
||||
suffix = type.replace('database','')
|
||||
if (suffix != ''){
|
||||
suffix = suffix.replace('_','')
|
||||
sMsg = '备份数据库['+suffix+']';
|
||||
}
|
||||
sType = type;
|
||||
break;
|
||||
case 'logs':
|
||||
sMsg = '切割日志';
|
||||
sType = "sites";
|
||||
sType = "logs";
|
||||
break;
|
||||
case 'path':
|
||||
sMsg = '备份目录';
|
||||
sType = "path";
|
||||
break;
|
||||
}
|
||||
var data='type='+sType
|
||||
var data = 'type='+sType;
|
||||
|
||||
$.post('/crontab/get_data_list',data,function(rdata){
|
||||
$(".planname input[name='name']").attr('readonly','true').css({"background-color":"#f6f6f6","color":"#666"});
|
||||
var sOpt = "";
|
||||
if(rdata.data.length == 0){
|
||||
layer.msg(lan.public.list_empty,{icon:2})
|
||||
return
|
||||
return;
|
||||
}
|
||||
|
||||
for(var i=0;i<rdata.data.length;i++){
|
||||
if(i==0){
|
||||
$(".planname input[name='name']").val(sMsg+'['+rdata.data[i].name+']');
|
||||
}
|
||||
sOpt += '<li><a role="menuitem" tabindex="-1" href="javascript:;" value="'+rdata.data[i].name+'">'+rdata.data[i].name+'['+rdata.data[i].ps+']</a></li>';
|
||||
}
|
||||
|
||||
|
||||
if (sType != 'path'){
|
||||
sOpt = '<li><a role="menuitem" tabindex="-1" href="javascript:;" value="backupAll">所有</a></li>' + sOpt;
|
||||
}
|
||||
|
||||
var orderOpt = '';
|
||||
for (var i=0;i<rdata.orderOpt.length;i++){
|
||||
orderOpt += '<li><a role="menuitem" tabindex="-1" href="javascript:;" value="'+rdata.orderOpt[i].name+'">'+rdata.orderOpt[i].title+'</a></li>'
|
||||
}
|
||||
|
||||
|
||||
var changeDir = '';
|
||||
if (sType == 'path'){
|
||||
changeDir = '<span class="glyphicon glyphicon-folder-open cursor mr20 changePathDir" style="float:left;line-height: 30px;"></span>';
|
||||
}
|
||||
|
||||
var sBody = '<div class="dropdown pull-left mr20">\
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="backdata" data-toggle="dropdown" style="width:auto">\
|
||||
var sBody = '<div class="dropdown pull-left mr20 check">\
|
||||
<button class="btn btn-default dropdown-toggle sname" type="button" id="backdata" data-toggle="dropdown" style="width:auto">\
|
||||
<b id="sName" val="'+rdata.data[0].name+'">'+rdata.data[0].name+'['+rdata.data[0].ps+']</b> <span class="caret"></span>\
|
||||
</button>\
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="backdata">\
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="backupAll">所有</a></li>\
|
||||
'+sOpt+'\
|
||||
</ul>\
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="backdata">'+sOpt+'</ul>\
|
||||
</div>\
|
||||
'+ changeDir +'\
|
||||
<div class="textname pull-left mr20">备份到</div>\
|
||||
<div class="dropdown planBackupTo pull-left mr20">\
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="excode" data-toggle="dropdown" style="width:auto;">\
|
||||
<b val="localhost">服务器磁盘</b> <span class="caret"></span>\
|
||||
<b val="localhost">服务器磁盘</b><span class="caret"></span>\
|
||||
</button>\
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="excode">\
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="localhost">服务器磁盘</a></li>\
|
||||
@@ -493,12 +525,22 @@ function toBackup(type){
|
||||
</div>';
|
||||
$("#implement").html(sBody);
|
||||
getselectname();
|
||||
|
||||
$('.changePathDir').click(function(){
|
||||
changePathCallback($('#sName').val(),function(select_dir){
|
||||
$(".planname input[name='name']").val('备份目录['+select_dir+']');
|
||||
$('#implement .sname b').attr('val',select_dir).text(select_dir);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(".dropdown ul li a").click(function(){
|
||||
var sName = $("#sName").attr("val");
|
||||
if(!sName) return;
|
||||
$(".planname input[name='name']").val(sMsg+'['+sName+']');
|
||||
});
|
||||
},'json');
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -531,11 +573,17 @@ function editTaskInfo(id){
|
||||
sNameArray:[],
|
||||
backupsArray:[],
|
||||
create:function(callback){
|
||||
for(var i = 0; i <obj['sTypeArray'].length; i++){
|
||||
if(obj.from['stype'] == obj['sTypeArray'][i][0]){
|
||||
sTypeName = obj['sTypeArray'][i][1];
|
||||
if (obj.from['stype'].indexOf('database_')>-1){
|
||||
name = obj.from['stype'].replace('database_','');
|
||||
sTypeName = '备份数据库['+name+']';
|
||||
sTypeDom += '<li><a role="menuitem" href="javascript:;" value="'+ obj.from['stype'] +'">'+ sTypeName +'</a></li>';
|
||||
} else {
|
||||
for(var i = 0; i <obj['sTypeArray'].length; i++){
|
||||
if(obj.from['stype'] == obj['sTypeArray'][i][0]){
|
||||
sTypeName = obj['sTypeArray'][i][1];
|
||||
}
|
||||
sTypeDom += '<li><a role="menuitem" href="javascript:;" value="'+ obj['sTypeArray'][i][0] +'">'+ obj['sTypeArray'][i][1] +'</a></li>';
|
||||
}
|
||||
sTypeDom += '<li><a role="menuitem" href="javascript:;" value="'+ obj['sTypeArray'][i][0] +'">'+ obj['sTypeArray'][i][1] +'</a></li>';
|
||||
}
|
||||
|
||||
for(var i = 0; i <obj['cycleArray'].length; i++){
|
||||
@@ -548,8 +596,8 @@ function editTaskInfo(id){
|
||||
weekDom += '<li><a role="menuitem" href="javascript:;" value="'+ obj['weekArray'][i][0] +'">'+ obj['weekArray'][i][1] +'</a></li>';
|
||||
}
|
||||
|
||||
if(obj.from.stype == 'site' || obj.from.stype == 'database' || obj.from.stype == 'path' || obj.from.stype == 'logs'){
|
||||
$.post('/crontab/get_data_list',{type:obj.from.stype == 'databases'?'database':'sites'},function(rdata){
|
||||
if(obj.from.stype == 'site' || obj.from.stype == 'database' || obj.from.stype == 'path' || obj.from.stype == 'logs' || obj.from['stype'].indexOf('database_')>-1){
|
||||
$.post('/crontab/get_data_list',{type:obj.from.stype},function(rdata){
|
||||
// console.log(rdata);
|
||||
obj.sNameArray = rdata.data;
|
||||
obj.sNameArray.unshift({name:'ALL',ps:'所有'});
|
||||
@@ -575,10 +623,16 @@ function editTaskInfo(id){
|
||||
}
|
||||
};
|
||||
obj.create(function(){
|
||||
|
||||
var changeDir = '';
|
||||
if (obj.from.stype == 'path'){
|
||||
changeDir = '<span class="glyphicon glyphicon-folder-open cursor mr20 changePathDir" style="float:left;line-height: 30px;"></span>';
|
||||
}
|
||||
|
||||
layer.open({
|
||||
type:1,
|
||||
title:'编辑计划任务-['+rdata.name+']',
|
||||
area: ['850px','450px'],
|
||||
area: ['850px','440px'],
|
||||
skin:'layer-create-content',
|
||||
shadeClose:false,
|
||||
closeBtn:1,
|
||||
@@ -622,7 +676,7 @@ function editTaskInfo(id){
|
||||
<div class="clearfix plan ptb10 site_list" style="display:none">\
|
||||
<span class="typename controls c4 pull-left f14 text-right mr20">'+ sTypeName +'</span>\
|
||||
<div style="line-height:34px"><div class="dropdown pull-left mr20 sName_btn" style="display:'+ (obj.from.sType != "path"?'block;':'none') +'">\
|
||||
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" style="width:auto" disabled="disabled">\
|
||||
<button class="btn btn-default dropdown-toggle sname" type="button" data-toggle="dropdown" style="width:auto" disabled="disabled">\
|
||||
<b id="sName" val="'+ obj.from.sname +'">'+ obj.from.sname +'</b>\
|
||||
<span class="caret"></span>\
|
||||
</button>\
|
||||
@@ -631,6 +685,7 @@ function editTaskInfo(id){
|
||||
<div class="info-r" style="float: left;margin-right: 25px;display:'+ (obj.from.sType == "path"?'block;':'none') +'">\
|
||||
<input id="inputPath" class="bt-input-text mr5 " type="text" name="path" value="'+ obj.from.sName +'" placeholder="备份目录" style="width:208px;height:33px;" disabled="disabled">\
|
||||
</div>\
|
||||
'+changeDir+'\
|
||||
<div class="textname pull-left mr20">备份到</div>\
|
||||
<div class="dropdown pull-left mr20">\
|
||||
<button class="btn btn-default dropdown-toggle backup_btn" type="button" data-toggle="dropdown" style="width:auto;">\
|
||||
@@ -660,165 +715,177 @@ function editTaskInfo(id){
|
||||
<div class="clearfix plan ptb10">\
|
||||
<div class="bt-submit plan-submits " style="margin-left: 141px;">保存编辑</div>\
|
||||
</div>\
|
||||
</div>'
|
||||
</div>',
|
||||
|
||||
success:function(){
|
||||
|
||||
$('.changePathDir').click(function(){
|
||||
changePathCallback($('#sName').val(),function(select_dir){
|
||||
$('input[name="name"]').val('备份目录['+select_dir+']');
|
||||
$('.sName_btn .sname b').attr('val',select_dir).text(select_dir);
|
||||
obj.from.sname = select_dir;
|
||||
});
|
||||
});
|
||||
|
||||
if(obj.from.stype == 'toShell'){
|
||||
$('.site_list').hide();
|
||||
} else if (obj.from.stype == 'rememory') {
|
||||
$('.site_list').hide();
|
||||
} else if ( obj.from.stype == 'toUrl'){
|
||||
$('.site_list').hide();
|
||||
} else {
|
||||
$('.site_list').show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
obj.from.minute = $('.minute_create').val();
|
||||
obj.from.hour = $('.hour_create').val();
|
||||
obj.from.where1 = $('.where1_create').val();
|
||||
|
||||
$('.sName_create').blur(function () {
|
||||
obj.from.name = $(this).val();
|
||||
});
|
||||
$('.where1_create').blur(function () {
|
||||
obj.from.where1 = $(this).val();
|
||||
});
|
||||
|
||||
$('.hour_create').blur(function () {
|
||||
obj.from.hour = $(this).val();
|
||||
});
|
||||
|
||||
$('.minute_create').blur(function () {
|
||||
obj.from.minute = $(this).val();
|
||||
});
|
||||
|
||||
$('.save_create').blur(function () {
|
||||
obj.from.save = $(this).val();
|
||||
});
|
||||
|
||||
$('.sBody_create').blur(function () {
|
||||
obj.from.sbody = $(this).val();
|
||||
});
|
||||
$('.url_create').blur(function () {
|
||||
obj.from.urladdress = $(this).val();
|
||||
});
|
||||
|
||||
$('[aria-labelledby="cycle"] a').unbind().click(function () {
|
||||
$('.cycle_btn').find('b').attr('val',$(this).attr('value')).html($(this).html());
|
||||
var type = $(this).attr('value');
|
||||
switch(type){
|
||||
case 'day':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').hide();
|
||||
$('.hour_input').show().find('input').val('1');
|
||||
$('.minute_input').show().find('input').val('30');
|
||||
obj.from.week = '';
|
||||
obj.from.type = '';
|
||||
obj.from.hour = 1;
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
case 'day-n':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').show().find('input').val('1');
|
||||
$('.hour_input').show().find('input').val('1');
|
||||
$('.minute_input').show().find('input').val('30');
|
||||
obj.from.week = '';
|
||||
obj.from.where1 = 1;
|
||||
obj.from.hour = 1;
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
case 'hour':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').hide();
|
||||
$('.hour_input').hide();
|
||||
$('.minute_input').show().find('input').val('30');
|
||||
obj.from.week = '';
|
||||
obj.from.where1 = '';
|
||||
obj.from.hour = '';
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
case 'hour-n':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').hide();
|
||||
$('.hour_input').show().find('input').val('1');
|
||||
$('.minute_input').show().find('input').val('30');
|
||||
obj.from.week = '';
|
||||
obj.from.where1 = '';
|
||||
obj.from.hour = 1;
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
case 'minute-n':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').hide();
|
||||
$('.hour_input').hide();
|
||||
$('.minute_input').show();
|
||||
obj.from.week = '';
|
||||
obj.from.where1 = '';
|
||||
obj.from.hour = '';
|
||||
obj.from.minute = 30;
|
||||
console.log(obj.from);
|
||||
break;
|
||||
case 'week':
|
||||
$('.week_btn').show();
|
||||
$('.where1_input').hide();
|
||||
$('.hour_input').show();
|
||||
$('.minute_input').show();
|
||||
obj.from.week = 1;
|
||||
obj.from.where1 = '';
|
||||
obj.from.hour = 1;
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
case 'month':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').show();
|
||||
$('.hour_input').show();
|
||||
$('.minute_input').show();
|
||||
obj.from.week = '';
|
||||
obj.from.where1 = 1;
|
||||
obj.from.hour = 1;
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
}
|
||||
obj.from.type = $(this).attr('value');
|
||||
});
|
||||
|
||||
$('[aria-labelledby="week"] a').unbind().click(function () {
|
||||
$('.week_btn').find('b').attr('val',$(this).attr('value')).html($(this).html());
|
||||
obj.from.week = $(this).attr('value');
|
||||
});
|
||||
|
||||
$('[aria-labelledby="backupTo"] a').unbind().click(function () {
|
||||
$('.backup_btn').find('b').attr('val',$(this).attr('value')).html($(this).html());
|
||||
obj.from.backup_to = $(this).attr('value');
|
||||
});
|
||||
$('.plan-submits').unbind().click(function(){
|
||||
if(obj.from.type == 'hour-n'){
|
||||
obj.from.where1 = obj.from.hour;
|
||||
obj.from.hour = '';
|
||||
} else if(obj.from.type == 'minute-n') {
|
||||
obj.from.where1 = obj.from.minute;
|
||||
obj.from.minute = '';
|
||||
}
|
||||
var loadT = layer.msg('正在保存编辑内容,请稍后...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/crontab/modify_crond',obj.from,function(rdata){
|
||||
|
||||
if (!rdata.status){
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2});
|
||||
return;
|
||||
}
|
||||
|
||||
showMsg(rdata.msg, function(){
|
||||
layer.closeAll();
|
||||
getCronData(1);
|
||||
initDropdownMenu();
|
||||
},{icon:rdata.status?1:2}, 2000);
|
||||
|
||||
},'json');
|
||||
});
|
||||
}
|
||||
,cancel: function(){
|
||||
initDropdownMenu();
|
||||
}
|
||||
});
|
||||
setTimeout(function(){
|
||||
if(obj.from.stype == 'toShell'){
|
||||
$('.site_list').hide();
|
||||
}else if(obj.from.stype == 'rememory'){
|
||||
$('.site_list').hide();
|
||||
}else if( obj.from.stype == 'toUrl'){
|
||||
$('.site_list').hide();
|
||||
}else{
|
||||
$('.site_list').show();
|
||||
}
|
||||
|
||||
obj.from.minute = $('.minute_create').val();
|
||||
obj.from.hour = $('.hour_create').val();
|
||||
obj.from.where1 = $('.where1_create').val();
|
||||
|
||||
$('.sName_create').blur(function () {
|
||||
obj.from.name = $(this).val();
|
||||
});
|
||||
$('.where1_create').blur(function () {
|
||||
obj.from.where1 = $(this).val();
|
||||
});
|
||||
|
||||
$('.hour_create').blur(function () {
|
||||
obj.from.hour = $(this).val();
|
||||
});
|
||||
|
||||
$('.minute_create').blur(function () {
|
||||
obj.from.minute = $(this).val();
|
||||
});
|
||||
|
||||
$('.save_create').blur(function () {
|
||||
obj.from.save = $(this).val();
|
||||
});
|
||||
|
||||
$('.sBody_create').blur(function () {
|
||||
obj.from.sbody = $(this).val();
|
||||
});
|
||||
$('.url_create').blur(function () {
|
||||
obj.from.urladdress = $(this).val();
|
||||
});
|
||||
|
||||
$('[aria-labelledby="cycle"] a').unbind().click(function () {
|
||||
$('.cycle_btn').find('b').attr('val',$(this).attr('value')).html($(this).html());
|
||||
var type = $(this).attr('value');
|
||||
switch(type){
|
||||
case 'day':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').hide();
|
||||
$('.hour_input').show().find('input').val('1');
|
||||
$('.minute_input').show().find('input').val('30');
|
||||
obj.from.week = '';
|
||||
obj.from.type = '';
|
||||
obj.from.hour = 1;
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
case 'day-n':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').show().find('input').val('1');
|
||||
$('.hour_input').show().find('input').val('1');
|
||||
$('.minute_input').show().find('input').val('30');
|
||||
obj.from.week = '';
|
||||
obj.from.where1 = 1;
|
||||
obj.from.hour = 1;
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
case 'hour':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').hide();
|
||||
$('.hour_input').hide();
|
||||
$('.minute_input').show().find('input').val('30');
|
||||
obj.from.week = '';
|
||||
obj.from.where1 = '';
|
||||
obj.from.hour = '';
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
case 'hour-n':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').hide();
|
||||
$('.hour_input').show().find('input').val('1');
|
||||
$('.minute_input').show().find('input').val('30');
|
||||
obj.from.week = '';
|
||||
obj.from.where1 = '';
|
||||
obj.from.hour = 1;
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
case 'minute-n':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').hide();
|
||||
$('.hour_input').hide();
|
||||
$('.minute_input').show();
|
||||
obj.from.week = '';
|
||||
obj.from.where1 = '';
|
||||
obj.from.hour = '';
|
||||
obj.from.minute = 30;
|
||||
console.log(obj.from);
|
||||
break;
|
||||
case 'week':
|
||||
$('.week_btn').show();
|
||||
$('.where1_input').hide();
|
||||
$('.hour_input').show();
|
||||
$('.minute_input').show();
|
||||
obj.from.week = 1;
|
||||
obj.from.where1 = '';
|
||||
obj.from.hour = 1;
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
case 'month':
|
||||
$('.week_btn').hide();
|
||||
$('.where1_input').show();
|
||||
$('.hour_input').show();
|
||||
$('.minute_input').show();
|
||||
obj.from.week = '';
|
||||
obj.from.where1 = 1;
|
||||
obj.from.hour = 1;
|
||||
obj.from.minute = 30;
|
||||
break;
|
||||
}
|
||||
obj.from.type = $(this).attr('value');
|
||||
});
|
||||
|
||||
$('[aria-labelledby="week"] a').unbind().click(function () {
|
||||
$('.week_btn').find('b').attr('val',$(this).attr('value')).html($(this).html());
|
||||
obj.from.week = $(this).attr('value');
|
||||
});
|
||||
|
||||
$('[aria-labelledby="backupTo"] a').unbind().click(function () {
|
||||
$('.backup_btn').find('b').attr('val',$(this).attr('value')).html($(this).html());
|
||||
obj.from.backup_to = $(this).attr('value');
|
||||
});
|
||||
$('.plan-submits').unbind().click(function(){
|
||||
if(obj.from.type == 'hour-n'){
|
||||
obj.from.where1 = obj.from.hour;
|
||||
obj.from.hour = '';
|
||||
} else if(obj.from.type == 'minute-n') {
|
||||
obj.from.where1 = obj.from.minute;
|
||||
obj.from.minute = '';
|
||||
}
|
||||
var loadT = layer.msg('正在保存编辑内容,请稍后...',{icon:16,time:0,shade: [0.3, '#000']});
|
||||
$.post('/crontab/modify_crond',obj.from,function(rdata){
|
||||
|
||||
if (!rdata.status){
|
||||
layer.msg(rdata.msg,{icon:rdata.status?1:2});
|
||||
return;
|
||||
}
|
||||
|
||||
showMsg(rdata.msg, function(){
|
||||
layer.closeAll();
|
||||
getCronData(1);
|
||||
initDropdownMenu();
|
||||
},{icon:rdata.status?1:2}, 2000);
|
||||
|
||||
},'json');
|
||||
});
|
||||
},100);
|
||||
});
|
||||
},'json');
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ function openFilename(obj){
|
||||
var ext = getSuffixName(path);
|
||||
|
||||
// console.log(path,ext);
|
||||
if (inArray(ext,['html','htm','php','txt','md','js','css','scss','json','c','h','pl','py','java','log','conf'])){
|
||||
if (inArray(ext,['html','htm','php','txt','md','js','css','scss','json','c','h','pl','py','java','log','conf','sh','json'])){
|
||||
onlineEditFile(0, path);
|
||||
}
|
||||
|
||||
@@ -317,6 +317,10 @@ function openFilename(obj){
|
||||
}
|
||||
}
|
||||
|
||||
function searchFile(p){
|
||||
getFiles(p);
|
||||
}
|
||||
|
||||
//取数据
|
||||
function getFiles(Path) {
|
||||
var searchtype = Path;
|
||||
@@ -342,7 +346,14 @@ function getFiles(Path) {
|
||||
var data = 'path=' + Path;
|
||||
var loadT = layer.load();
|
||||
var totalSize = 0;
|
||||
$.post('/files/get_dir?p=' + p + '&showRow=' + showRow + search, data, function(rdata) {
|
||||
|
||||
var search_all = '';
|
||||
var all = $('#search_all').hasClass('active');
|
||||
if(all){
|
||||
search_all = "&all=yes";
|
||||
}
|
||||
|
||||
$.post('/files/get_dir?p=' + p + '&showRow=' + showRow + search + search_all, data, function(rdata) {
|
||||
layer.close(loadT);
|
||||
|
||||
var rows = ['10','50','100','200','500','1000','2000'];
|
||||
@@ -444,8 +455,7 @@ function getFiles(Path) {
|
||||
<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:zip('" + rdata.PATH +"/" +fmp[0] + "');\">压缩</a> | "+bodyZip+download+"\
|
||||
<a class='btlink' href='javascript:;' onclick=\"deleteFile('" + rdata.PATH +"/"+ fmp[0] + "')\">删除</a>\
|
||||
</span></td>\
|
||||
</tr>";
|
||||
@@ -459,9 +469,9 @@ function getFiles(Path) {
|
||||
</div>";
|
||||
}
|
||||
}
|
||||
var dirInfo = '(共{1}个目录与{2}个文件,大小:'.replace('{1}',rdata.DIR.length+'').replace('{2}',rdata.DIR.length+'')+'<font id="pathSize">'
|
||||
var dirInfo = '(共{1}个目录与{2}个文件,大小:'.replace('{1}',rdata.DIR.length+'').replace('{2}',rdata.FILES.length+'')+'<font id="pathSize">'
|
||||
+ (toSize(totalSize))+'<a class="btlink ml5" onClick="getPathSize()">获取</a></font>)';
|
||||
$("#DirInfo").html(dirInfo);
|
||||
$("#dir_info").html(dirInfo);
|
||||
if( getCookie('rank') == 'a' ){
|
||||
var tablehtml = '<table width="100%" border="0" cellpadding="0" cellspacing="0" class="table table-hover">\
|
||||
<thead>\
|
||||
@@ -791,7 +801,7 @@ function getSuffixName(fileName){
|
||||
'gif','ico','jpeg','jpg','JPG','png','psd','webp','ape','avi','flv','mkv','mov','mp3','mp4','mpeg',
|
||||
'mpg','rm','rmvb','swf','wav','webm','wma','wmv','doc','docm','dotx','dotm','dot','rtf','docx','pdf',
|
||||
'fdf','ppt','pptm','pot','potm','pptx','txt','xls','csv','xlsm','xlsb','xlsx','7z','gz','cab','iso',
|
||||
'rar','zip','bt','file','apk','css','scss','svg','pl','py','php','md'];
|
||||
'rar','zip','bt','file','apk','css','scss','svg','pl','py','php','md','json','sh'];
|
||||
var extLastName = extArr[extArr.length - 1];
|
||||
for(var i=0; i<exts.length; i++){
|
||||
if(exts[i]==extLastName){
|
||||
@@ -1093,7 +1103,7 @@ function reName(type, fileName) {
|
||||
closeBtn: 1,
|
||||
area: '320px',
|
||||
title: '重命名',
|
||||
btn:["确定","保存"],
|
||||
btn:["确定","取消"],
|
||||
content: '<div class="bt-form pd20">\
|
||||
<div class="line">\
|
||||
<input type="text" class="bt-input-text" name="Name" id="newFileName" value="' + fileName + '" placeholder="文件名" style="width:100%" />\
|
||||
@@ -1605,10 +1615,13 @@ function getPathSize(){
|
||||
$("body").not(".def-log").click(function(){
|
||||
$("#rmenu").hide()
|
||||
});
|
||||
|
||||
//指定路径
|
||||
$("#DirPathPlace input").keyup(function(e){
|
||||
if(e.keyCode == 13) {
|
||||
getFiles($(this).val());
|
||||
var fpath = $(this).val();
|
||||
fpath = filterPath(fpath);
|
||||
getFiles(fpath);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1652,6 +1665,7 @@ function pathLeft(){
|
||||
$("#PathPlaceBtn ul").css("left",0);
|
||||
}
|
||||
}
|
||||
|
||||
//路径快捷点击
|
||||
$("#PathPlaceBtn").on("click", function(e){
|
||||
if($("#DirPathPlace").is(":hidden")){
|
||||
|
||||
@@ -100,6 +100,19 @@ function isContains(str, substr) {
|
||||
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){
|
||||
if (typeof args == 'string'){
|
||||
return msg.replace('{1}', args);
|
||||
@@ -206,6 +219,47 @@ function getFormatTime(tm, format) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
function changePathCallback(default_dir, callback) {
|
||||
|
||||
var c = layer.open({
|
||||
type: 1,
|
||||
area: "650px",
|
||||
title: '选择目录',
|
||||
closeBtn: 1,
|
||||
shift: 5,
|
||||
shadeClose: false,
|
||||
content: "<div class='changepath'><div class='path-top'><button type='button' class='btn btn-default btn-sm' onclick='backFile()'><span class='glyphicon glyphicon-share-alt'></span>返回</button>\
|
||||
<div class='place' id='PathPlace'>当前路径:<span></span></div></div><div class='path-con'><div class='path-con-left'><dl><dt id='changecomlist' onclick='backMyComputer()'>计算机</dt></dl></div>\
|
||||
<div class='path-con-right'><ul class='default' id='computerDefautl'></ul><div class='file-list divtable'>\
|
||||
<table class='table table-hover' style='border:0 none'>\
|
||||
<thead><tr class='file-list-head'><th width='40%'>文件名</th><th width='20%'>修改时间</th><th width='10%'>权限</th><th width='10%'>所有者</th><th width='10%'></th></tr></thead>\
|
||||
<tbody id='tbody' class='list-list'></tbody></table></div></div></div></div><div class='getfile-btn' style='margin-top:0'>\
|
||||
<button type='button' class='btn btn-default btn-sm pull-left' onclick='createFolder()'>新建文件夹</button>\
|
||||
<button type='button' class='btn btn-danger btn-sm mr5 btn-close'>关闭</button>\
|
||||
<button type='button' class='btn btn-success btn-sm btn-choose'>选择</button>\
|
||||
</div>",
|
||||
success:function(layero,layer_index){
|
||||
$('.btn-close').click(function(){
|
||||
layer.close(layer_index);
|
||||
});
|
||||
|
||||
$('.btn-choose').click(function(){
|
||||
var a = $("#PathPlace").find("span").text();
|
||||
a = a.replace(new RegExp(/(\\)/g), "/");
|
||||
a_len = a.length;
|
||||
if (a[a_len-1] == '/'){
|
||||
a = a.substr(0,a_len-1);
|
||||
}
|
||||
callback(a);
|
||||
layer.close(layer_index);
|
||||
});
|
||||
}
|
||||
});
|
||||
getDiskList(default_dir);
|
||||
activeDisk();
|
||||
}
|
||||
|
||||
function changePath(d) {
|
||||
setCookie('SetId', d);
|
||||
setCookie('SetName', '');
|
||||
@@ -223,11 +277,11 @@ function changePath(d) {
|
||||
<thead><tr class='file-list-head'><th width='40%'>文件名</th><th width='20%'>修改时间</th><th width='10%'>权限</th><th width='10%'>所有者</th><th width='10%'></th></tr></thead>\
|
||||
<tbody id='tbody' class='list-list'></tbody></table></div></div></div></div><div class='getfile-btn' style='margin-top:0'>\
|
||||
<button type='button' class='btn btn-default btn-sm pull-left' onclick='createFolder()'>新建文件夹</button>\
|
||||
<button type='button' class='btn btn-danger btn-sm mr5' onclick=\"layer.close(getCookie('ChangePath'))\">关闭</button>\
|
||||
<button type='button' class='btn btn-danger btn-sm mr5' onclick=\"layer.close(getCookie('changePath'))\">关闭</button>\
|
||||
<button type='button' class='btn btn-success btn-sm' onclick='getfilePath()'>选择</button>\
|
||||
</div>"
|
||||
});
|
||||
setCookie("ChangePath", c);
|
||||
setCookie("changePath", c);
|
||||
var b = $("#" + d).val();
|
||||
tmp = b.split(".");
|
||||
if(tmp[tmp.length - 1] == "gz") {
|
||||
@@ -408,7 +462,8 @@ function getfilePath() {
|
||||
}
|
||||
|
||||
$("#" + getCookie("SetId")).val(a + getCookie("SetName"));
|
||||
layer.close(getCookie("ChangePath"));
|
||||
layer.close(getCookie("changePath"));
|
||||
return a;
|
||||
}
|
||||
|
||||
function setCookie(a, c) {
|
||||
@@ -626,7 +681,7 @@ function divcenter() {
|
||||
}
|
||||
|
||||
function copyText(value) {
|
||||
var clipboard = new ClipboardJS('#bt_copys');
|
||||
var clipboard = new ClipboardJS('#mw_copys');
|
||||
clipboard.on('success', function (e) {
|
||||
layer.msg('复制成功',{icon:1,time:2000});
|
||||
});
|
||||
@@ -634,8 +689,12 @@ function copyText(value) {
|
||||
clipboard.on('error', function (e) {
|
||||
layer.msg('复制失败,浏览器不兼容!',{icon:2,time:2000});
|
||||
});
|
||||
$("#bt_copys").attr('data-clipboard-text',value);
|
||||
$("#bt_copys").click();
|
||||
$("#mw_copys").attr('data-clipboard-text',value);
|
||||
$("#mw_copys").click();
|
||||
}
|
||||
|
||||
function copyPass(value){
|
||||
copyText(value);
|
||||
}
|
||||
|
||||
function isChineseChar(b) {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
var type = '';
|
||||
if ( typeof(type_id) == 'undefined' ){
|
||||
type = '&type_id=0';
|
||||
type = '&type_id=-1';
|
||||
} else {
|
||||
type = '&type_id='+type_id;
|
||||
}
|
||||
@@ -2538,7 +2538,6 @@ function changeDefault(type){
|
||||
},'json');
|
||||
}
|
||||
|
||||
|
||||
function getClassType(){
|
||||
var select = $('.site_type > select');
|
||||
$.post('/site/get_site_types',function(rdata){
|
||||
@@ -2557,9 +2556,6 @@ function getClassType(){
|
||||
}
|
||||
getClassType();
|
||||
|
||||
|
||||
|
||||
|
||||
function setClassType(){
|
||||
$.post('/site/get_site_types',function(rdata){
|
||||
var list = '';
|
||||
|
||||
@@ -1887,33 +1887,35 @@ html .menu .menu_exit:hover {
|
||||
color: #fff;
|
||||
line-height: 24px;
|
||||
text-align: center;
|
||||
cursor: pointer
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.plan {
|
||||
padding: 10px 20px;
|
||||
margin-bottom: 10px
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.plan .typename {
|
||||
line-height: 34px;
|
||||
width: 120px
|
||||
width: 120px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.plan .textname {
|
||||
height: 34px;
|
||||
line-height: 34px;
|
||||
float: left
|
||||
float: left;
|
||||
}
|
||||
|
||||
.plan .planname input {
|
||||
height: 34px;
|
||||
width: 260px;
|
||||
padding: 0 12px
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
.plan .dropdown button b {
|
||||
font-weight: normal
|
||||
font-weight: normal;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.plan .dropdown-menu {
|
||||
@@ -4813,8 +4815,63 @@ select[disabled]{
|
||||
bottom:10px;
|
||||
right:10px;
|
||||
}
|
||||
.shell_btn_close{
|
||||
.shell_btn_close {
|
||||
margin-right:8px;
|
||||
}
|
||||
|
||||
.file_search {
|
||||
position: absolute;
|
||||
right: 58px;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
width: 85px;
|
||||
border-top: none;
|
||||
background: #fff;
|
||||
height: 8px;
|
||||
line-height: 48px;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.file_search .file_search_checked {
|
||||
position: relative;
|
||||
height: 15px;
|
||||
width: 15px;
|
||||
border-radius: 1px;
|
||||
cursor: pointer;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
vertical-align: sub;
|
||||
border:1px solid #aaa;
|
||||
border-radius: 2px;
|
||||
display: inline-block;
|
||||
font-family: 'Glyphicons Halflings';
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 1;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
.file_search .file_search_checked.active {
|
||||
background: #20a53a;
|
||||
color: #fff;
|
||||
border-color:#20a53a ;
|
||||
}
|
||||
|
||||
.file_search .file_search_checked.active:after {
|
||||
content: "\e013";
|
||||
font-size: 12px;
|
||||
transform: scale(.85);
|
||||
position: absolute;
|
||||
left: .75px;
|
||||
top: .75px;
|
||||
}
|
||||
|
||||
|
||||
.file_search label {
|
||||
position: absolute;
|
||||
right: 5px;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
|
||||
+2
File diff suppressed because one or more lines are too long
@@ -121,13 +121,13 @@
|
||||
<span class="set-info c7">为面板绑定一个访问域名,<b style="color: red;">注意:一旦绑定域名,只能通过域名访问面板</b></span>
|
||||
</p>
|
||||
|
||||
<!-- <p class="mtb15">
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="面板SSL" style="float: left;">面板SSL</span>
|
||||
<input id="cfg_ssl" name="bind_ssl" class="btswitch btswitch-ios" type="checkbox" {{data['ssl']}}>
|
||||
<label class="btswitch-btn ml5" for="cfg_ssl" style="float: left;margin-top:4px;" onclick="getPanelSSL()"></label>
|
||||
<label class="btswitch-btn ml5" for="cfg_ssl" style="float: left;margin-top:4px;"></label>
|
||||
<button ype="button" class="btn btn-default btn-xs panel_api_btn" style="vertical-align: middle; margin-left: 10px" onclick="getPanelSSL();">面板SSL配置</button>
|
||||
<span class="set-info c7">为面板设置https协议访问,提升面板访问<b style="color: red;">安全性</b></span>
|
||||
</p> -->
|
||||
</p>
|
||||
|
||||
<p class="mtb15">
|
||||
<span class="set-tit text-right" title="BasicAuth认证" style="float: left;">BasicAuth认证</span>
|
||||
|
||||
@@ -3,138 +3,142 @@
|
||||
{% block content %}
|
||||
|
||||
<div class="main-content">
|
||||
<div class="container-fluid" style="padding-bottom:54px">
|
||||
<div class="pos-box bgw mtb15">
|
||||
<div class="position f14 c9 pull-left">
|
||||
<a class="plr10 c4" href="/">首页</a>/<span class="plr10 c4">计划任务</span>
|
||||
</div>
|
||||
<div class="container-fluid" style="padding-bottom:54px">
|
||||
<div class="pos-box bgw mtb15">
|
||||
<div class="position f14 c9 pull-left">
|
||||
<a class="plr10 c4" href="/">首页</a>/<span class="plr10 c4">计划任务</span>
|
||||
</div>
|
||||
<div class="setbox bgw mtb15">
|
||||
<div class="title c6 plr15">
|
||||
<h3 class="f16">添加计划任务</h3>
|
||||
</div>
|
||||
<div class="setbox bgw mtb15">
|
||||
<div class="title c6 plr15">
|
||||
<h3 class="f16">添加计划任务</h3>
|
||||
</div>
|
||||
<div class="setting-con ptb20">
|
||||
<div class="clearfix plan">
|
||||
<span class="typename c4 pull-left f14 text-right mr20">任务类型</span>
|
||||
<div class="dropdown planjs pull-left mr20">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="excode" data-toggle="dropdown" style="width:auto">
|
||||
<b val="toShell">Shell脚本</b>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="excode">
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="toShell">Shell脚本</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="site">备份网站</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="database">备份数据库</a></li>
|
||||
{% for db in data['hook_database'] %}
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="database_{{db['name']}}">备份数据库【{{db['title']}}】</a></li>
|
||||
{% endfor %}
|
||||
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="path">备份目录</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="logs">日志切割</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="rememory">释放内存</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="toUrl">访问URL</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<span class="planSign"><i>*</i>任务类型包含以下部分:Shell脚本、备份网站、备份数据库、备份目录、日志切割、释放内存、访问URL</span>
|
||||
</div>
|
||||
<div class="setting-con ptb20">
|
||||
<div class="clearfix plan">
|
||||
<span class="typename c4 pull-left f14 text-right mr20">任务类型</span>
|
||||
<div class="dropdown planjs pull-left mr20">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="excode" data-toggle="dropdown" style="width:auto">
|
||||
<b val="toShell">Shell脚本</b>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<div class="clearfix plan">
|
||||
<span class="typename c4 pull-left f14 text-right mr20">任务名称</span>
|
||||
<div class="planname pull-left"><input type="text" name="name" class="bt-input-text"></div>
|
||||
</div>
|
||||
<div class="clearfix plan">
|
||||
<span class="typename c4 pull-left f14 text-right mr20">执行周期</span>
|
||||
<div class="dropdown plancycle pull-left mr20">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="cycle" data-toggle="dropdown" style="width:94px">
|
||||
<b val="week">每星期</b>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="cycle">
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="day">每天</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="day-n">N天</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="hour">每小时</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="hour-n">N小时</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="minute-n">N分钟</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="week">每星期</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="month">每月</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="ptime" class="pull-left">
|
||||
<div class="dropdown planweek pull-left mr20">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="excode" data-toggle="dropdown">
|
||||
<b val="1">周一</b>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="excode">
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="toShell">Shell脚本</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="site">备份网站</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="database">备份数据库</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="logs">日志切割</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="rememory">释放内存</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="toUrl">访问URL</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="1">周一</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="2">周二</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="3">周三</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="4">周四</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="5">周五</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="6">周六</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="0">周日</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<span class="planSign"><i>*</i>任务类型包含以下部分:Shell脚本、备份网站、备份数据库、日志切割、释放内存、访问URL</span>
|
||||
</div>
|
||||
<div class="clearfix plan">
|
||||
<span class="typename c4 pull-left f14 text-right mr20">任务名称</span>
|
||||
<div class="planname pull-left"><input type="text" name="name" class="bt-input-text"></div>
|
||||
</div>
|
||||
<div class="clearfix plan">
|
||||
<span class="typename c4 pull-left f14 text-right mr20">执行周期</span>
|
||||
<div class="dropdown plancycle pull-left mr20">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="cycle" data-toggle="dropdown" style="width:94px">
|
||||
<b val="week">每星期</b>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="cycle">
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="day">每天</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="day-n">N天</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="hour">每小时</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="hour-n">N小时</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="minute-n">N分钟</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="week">每星期</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="month">每月</a></li>
|
||||
</ul>
|
||||
<div class="plan_hms pull-left mr20 bt-input-text">
|
||||
<span><input type="number" name="hour" value="1" maxlength="2" max="23" min="0"></span>
|
||||
<span class="name">小时</span>
|
||||
</div>
|
||||
<div id="ptime" class="pull-left">
|
||||
<div class="dropdown planweek pull-left mr20">
|
||||
<button class="btn btn-default dropdown-toggle" type="button" id="excode" data-toggle="dropdown">
|
||||
<b val="1">周一</b>
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu" aria-labelledby="excode">
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="1">周一</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="2">周二</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="3">周三</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="4">周四</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="5">周五</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="6">周六</a></li>
|
||||
<li><a role="menuitem" tabindex="-1" href="javascript:;" value="0">周日</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="plan_hms pull-left mr20 bt-input-text">
|
||||
<span><input type="number" name="hour" value="1" maxlength="2" max="23" min="0"></span>
|
||||
<span class="name">小时</span>
|
||||
</div>
|
||||
<div class="plan_hms pull-left mr20 bt-input-text">
|
||||
<span><input type="number" name="minute" value="30" maxlength="2" max="59" min="0"></span>
|
||||
<span class="name">分钟</span>
|
||||
</div>
|
||||
<div class="plan_hms pull-left mr20 bt-input-text">
|
||||
<span><input type="number" name="minute" value="30" maxlength="2" max="59" min="0"></span>
|
||||
<span class="name">分钟</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix plan">
|
||||
<span class="typename controls c4 pull-left f14 text-right mr20">脚本内容</span>
|
||||
<div id="implement" style="line-height:34px"><textarea class="txtsjs bt-input-text" name="sBody"></textarea></div>
|
||||
</div>
|
||||
<div class="clearfix plan">
|
||||
<div class="bt-submit plan-submit" onclick="planAdd();">添加任务</div>
|
||||
</div>
|
||||
<ul class="help-info-text c7 ptb15 mlr20">
|
||||
<li>当添加完备份任务,应该手动运行一次,并检查备份包是否完整</li>
|
||||
<li>磁盘容量不够、数据库密码错误、网络不稳定等原因,可能导致数据备份不完整</li>
|
||||
</ul>
|
||||
</div>
|
||||
<form id="set-Config" action="/crontab/add" enctype="multipart/form-data" method="post" style="display: none;">
|
||||
<input type="text" name="name" value="" />
|
||||
<input type="text" name="type" value="" />
|
||||
<input type="number" name="where1" value="" />
|
||||
<input type="number" name="hour" value="" />
|
||||
<input type="number" name="minute" value="" />
|
||||
<input type="text" name="week" value="" />
|
||||
<input type="text" name="sType" value="" />
|
||||
<textarea name='sBody'></textarea>
|
||||
<input id="sFile" type="file" name="sFile" value="" />
|
||||
<input id="sName" type="text" name="sName" value="" />
|
||||
<input id="backupTo" type="text" name="backupTo" value="localhost" />
|
||||
<input id="urladdress" type="text" name="urladdress" value="" />
|
||||
<input type="number" name="save" value="" />
|
||||
<input type="submit" />
|
||||
</form>
|
||||
<div class="clearfix plan">
|
||||
<span class="typename controls c4 pull-left f14 text-right mr20">脚本内容</span>
|
||||
<div id="implement" style="line-height:34px"><textarea class="txtsjs bt-input-text" name="sBody"></textarea></div>
|
||||
</div>
|
||||
<div class="clearfix plan">
|
||||
<div class="bt-submit plan-submit" onclick="planAdd();">添加任务</div>
|
||||
</div>
|
||||
<ul class="help-info-text c7 ptb15 mlr20">
|
||||
<li>当添加完备份任务,应该手动运行一次,并检查备份包是否完整</li>
|
||||
<li>磁盘容量不够、数据库密码错误、网络不稳定等原因,可能导致数据备份不完整</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="setbox bgw mtb15">
|
||||
<div class="title c6 plr15">
|
||||
<h3 class="f16">任务列表</h3>
|
||||
<span id="allDelete" style="float: right;display: none;">
|
||||
<button onclick="allDeleteCron();" class="btn btn-default btn-sm">删除选中</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="setting-con divtable pd15">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width='30px'><input onclick="checkSelect();" type="checkbox" id="setBox"></th>
|
||||
<th>任务名称</th>
|
||||
<th>状态</th>
|
||||
<th>周期</th>
|
||||
<th>执行时机</th>
|
||||
<th>保存数量</th>
|
||||
<th>备份到</th>
|
||||
<th>添加时间</th>
|
||||
<th width="190">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="cronbody"></tbody>
|
||||
</table>
|
||||
<div class="dataTables_paginate paging_bootstrap pagination">
|
||||
<ul id="softPage" class="page"></ul>
|
||||
</div>
|
||||
<form id="set-Config" action="/crontab/add" enctype="multipart/form-data" method="post" style="display: none;">
|
||||
<input type="text" name="name" value="" />
|
||||
<input type="text" name="type" value="" />
|
||||
<input type="number" name="where1" value="" />
|
||||
<input type="number" name="hour" value="" />
|
||||
<input type="number" name="minute" value="" />
|
||||
<input type="text" name="week" value="" />
|
||||
<input type="text" name="sType" value="" />
|
||||
<textarea name='sBody'></textarea>
|
||||
<input id="sFile" type="file" name="sFile" value="" />
|
||||
<input type="text" name="sName" value="" />
|
||||
<input id="backupTo" type="text" name="backupTo" value="localhost" />
|
||||
<input id="urladdress" type="text" name="urladdress" value="" />
|
||||
<input type="number" name="save" value="" />
|
||||
<input type="submit" />
|
||||
</form>
|
||||
</div>
|
||||
<div class="setbox bgw mtb15">
|
||||
<div class="title c6 plr15">
|
||||
<h3 class="f16">任务列表</h3>
|
||||
<span id="allDelete" style="float: right;display: none;">
|
||||
<button onclick="allDeleteCron();" class="btn btn-default btn-sm">删除选中</button>
|
||||
</span>
|
||||
</div>
|
||||
<div class="setting-con divtable pd15">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width='30px'><input onclick="checkSelect();" type="checkbox" id="setBox"></th>
|
||||
<th>任务名称</th>
|
||||
<th>状态</th>
|
||||
<th>周期</th>
|
||||
<th>执行时机</th>
|
||||
<th>保存数量</th>
|
||||
<th>备份到</th>
|
||||
<th>添加时间</th>
|
||||
<th width="190">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="cronbody"></tbody>
|
||||
</table>
|
||||
<div class="dataTables_paginate paging_bootstrap pagination">
|
||||
<ul id="softPage" class="page"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,11 +13,15 @@
|
||||
<span id='DirPathPlace' class="pull-left"><input id="fileInputPath" type="text"></span>
|
||||
<span id='PathPlaceBtn' class="pull-left"></span>
|
||||
</div>
|
||||
<div class="pull-left mlr15" style="line-height:26px"><span id='DirInfo'></span></div>
|
||||
<div class="pull-left mlr15" style="line-height:26px"><span id='dir_info'></span></div>
|
||||
<div class="search pull-right" style="position: absolute; top: 6px; right: 5px;">
|
||||
<form target="hid" onsubmit='getFiles(1)'>
|
||||
<input type="text" id="SearchValue" class="ser-text pull-left" placeholder="" />
|
||||
<button type="button" class="ser-sub pull-left" onclick='getFiles(1)'></button>
|
||||
<form target="hid">
|
||||
<input type="text" id="SearchValue" class="ser-text pull-left" placeholder="搜索文件/目录" />
|
||||
<button type="button" class="ser-sub pull-left" onclick='searchFile(1)'></button>
|
||||
<div class="file_search" draggable="false">
|
||||
<div id="search_all" class="file_search_checked"></div>
|
||||
<label for="search_all">包含子目录</label>
|
||||
</div>
|
||||
</form>
|
||||
<iframe name='hid' id="hid" style="display:none"></iframe>
|
||||
</div>
|
||||
@@ -93,5 +97,10 @@ $("#set_list").click(function() {
|
||||
$(".refreshBtn").click(function() {
|
||||
getFiles(getCookie('open_dir_path'));
|
||||
})
|
||||
|
||||
|
||||
$('#search_all').click(function(){
|
||||
$(this).toggleClass('active');
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -47,7 +47,7 @@
|
||||
<div class="btpc-plus" onclick="bindPanel(0,'b')">+</div>
|
||||
</div>
|
||||
</div>
|
||||
<button style="display: none;" id="bt_copys" class="bt_copy" data-clipboard-text=""></button>
|
||||
<button style="display: none;" id="mw_copys" class="mw_copy" data-clipboard-text=""></button>
|
||||
<link rel="stylesheet" href="/static/build/xterm.css?v={{config.version}}">
|
||||
<link rel="stylesheet" href="/static/build/addons/fullscreen/fullscreen.css?v={{config.version}}">
|
||||
<script src="/static/js/jquery-1.10.2.min.js?v={{config.version}}"></script>
|
||||
|
||||
+56
-3
@@ -181,17 +181,70 @@ class backupTools:
|
||||
for database in databases:
|
||||
self.backupDatabase(database['name'], save)
|
||||
|
||||
def findPathName(self, path, filename):
|
||||
f = os.scandir(path)
|
||||
l = []
|
||||
for ff in f:
|
||||
if ff.name.find(filename) > -1:
|
||||
l.append(ff.name)
|
||||
return l
|
||||
|
||||
def backupPath(self, path, count):
|
||||
|
||||
mw.echoStart('备份')
|
||||
|
||||
backup_path = mw.getBackupDir() + '/path'
|
||||
if not os.path.exists(backup_path):
|
||||
mw.execShell("mkdir -p " + backup_path)
|
||||
|
||||
dirname = os.path.basename(path)
|
||||
fname = 'path_{}_{}.tar.gz'.format(
|
||||
dirname, mw.formatDate("%Y%m%d_%H%M%S"))
|
||||
dfile = os.path.join(backup_path, fname)
|
||||
|
||||
p_size = mw.getPathSize(path)
|
||||
stime = time.time()
|
||||
|
||||
cmd = "cd " + os.path.dirname(path) + " && tar zcvf '" + dfile + "' '" + dirname + "' 2>{err_log} 1> /dev/null".format(
|
||||
err_log='/tmp/backup_err.log')
|
||||
mw.execShell(cmd)
|
||||
|
||||
tar_size = os.path.getsize(dfile)
|
||||
|
||||
mw.echoInfo('备份目录:' + path)
|
||||
mw.echoInfo('目录已备份到:' + dfile)
|
||||
mw.echoInfo("目录大小:{}".format(mw.toSize(p_size)))
|
||||
mw.echoInfo("开始压缩文件:{}".format(mw.formatDate(times=stime)))
|
||||
mw.echoInfo("文件压缩完成,耗时{:.2f}秒,压缩包大小:{}".format(
|
||||
time.time() - stime, mw.toSize(tar_size)))
|
||||
mw.echoInfo('保留最新的备份数:' + count + '份')
|
||||
|
||||
backups = self.findPathName(backup_path, 'path_{}'.format(dirname))
|
||||
num = len(backups) - int(count)
|
||||
backups.sort()
|
||||
if num > 0:
|
||||
for backup in backups:
|
||||
abspath_bk = backup_path + "/" + backup
|
||||
mw.execShell("rm -f " + abspath_bk)
|
||||
mw.echoInfo("|---已清理过期备份文件:" + abspath_bk)
|
||||
num -= 1
|
||||
if num < 1:
|
||||
break
|
||||
|
||||
mw.echoEnd('备份')
|
||||
|
||||
if __name__ == "__main__":
|
||||
backup = backupTools()
|
||||
type = sys.argv[1]
|
||||
if type == 'site':
|
||||
stype = sys.argv[1]
|
||||
if stype == 'site':
|
||||
if sys.argv[2] == 'ALL':
|
||||
backup.backupSiteAll(sys.argv[3])
|
||||
else:
|
||||
backup.backupSite(sys.argv[2], sys.argv[3])
|
||||
elif type == 'database':
|
||||
elif stype == 'database':
|
||||
if sys.argv[2] == 'ALL':
|
||||
backup.backupDatabaseAll(sys.argv[3])
|
||||
else:
|
||||
backup.backupDatabase(sys.argv[2], sys.argv[3])
|
||||
elif stype == 'path':
|
||||
backup.backupPath(sys.argv[2], sys.argv[3])
|
||||
|
||||
+10
-1
@@ -182,6 +182,13 @@ mw_open()
|
||||
fi
|
||||
}
|
||||
|
||||
mw_unbind_domain()
|
||||
{
|
||||
if [ -f $mw_path/data/bind_domain.pl ];then
|
||||
rm -rf $mw_path/data/bind_domain.pl
|
||||
fi
|
||||
}
|
||||
|
||||
error_logs()
|
||||
{
|
||||
tail -n 100 $mw_path/logs/error.log
|
||||
@@ -271,6 +278,7 @@ case "$1" in
|
||||
'update_dev') mw_update_dev;;
|
||||
'install_app') mw_install_app;;
|
||||
'close_admin_path') mw_close_admin_path;;
|
||||
'unbind_domain') mw_unbind_domain;;
|
||||
'debug') mw_debug;;
|
||||
'default')
|
||||
cd $mw_path
|
||||
@@ -323,7 +331,8 @@ case "$1" in
|
||||
echo -e "=================================================================="
|
||||
echo -e "$address"
|
||||
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[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"
|
||||
|
||||
+42
-22
@@ -4,6 +4,8 @@ export PATH
|
||||
# LANG=en_US.UTF-8
|
||||
is64bit=`getconf LONG_BIT`
|
||||
|
||||
{
|
||||
|
||||
if [ -f /etc/motd ];then
|
||||
echo "welcome to mdserver-web panel" > /etc/motd
|
||||
fi
|
||||
@@ -18,38 +20,37 @@ if [ "$EUID" -ne 0 ]
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
elif grep -Eq "openSUSE" /etc/*-release; then
|
||||
OSNAME='opensuse'
|
||||
zypper refresh
|
||||
zypper install cron wget curl zip unzip
|
||||
elif grep -Eq "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/redhat-release; then
|
||||
OSNAME='rhel'
|
||||
yum install -y wget curl zip unzip tar crontabs
|
||||
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
|
||||
OSNAME='fedora'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
OSNAME='rocky'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='alma'
|
||||
yum install -y wget zip unzip
|
||||
yum install -y wget curl zip unzip tar crontabs
|
||||
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/redhat-release; then
|
||||
OSNAME='rhel'
|
||||
yum install -y wget curl zip unzip tar crontabs
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/redhat-release; then
|
||||
OSNAME='rhel'
|
||||
yum install -y wget curl zip unzip tar crontabs
|
||||
elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then
|
||||
OSNAME='amazon'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then
|
||||
yum install -y wget curl zip unzip tar crontabs
|
||||
elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/os-release; then
|
||||
OSNAME='debian'
|
||||
apt update -y
|
||||
apt install -y devscripts
|
||||
apt install -y wget zip unzip
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then
|
||||
apt install -y wget curl zip unzip tar cron
|
||||
elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/os-release; then
|
||||
OSNAME='ubuntu'
|
||||
apt install -y wget zip unzip
|
||||
apt update -y
|
||||
apt install -y wget curl zip unzip tar cron
|
||||
else
|
||||
OSNAME='unknow'
|
||||
fi
|
||||
@@ -69,12 +70,11 @@ if [ $OSNAME != "macos" ];then
|
||||
mkdir -p /www/backup/database
|
||||
mkdir -p /www/backup/site
|
||||
|
||||
|
||||
# https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh
|
||||
|
||||
if [ ! -d /www/server/mdserver-web ];then
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -d /www/server/mdserver-web ];then
|
||||
if [ ! -z "$cn" ];then
|
||||
curl -sSLo /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip
|
||||
else
|
||||
@@ -86,12 +86,28 @@ if [ $OSNAME != "macos" ];then
|
||||
rm -rf /tmp/master.zip
|
||||
rm -rf /tmp/mdserver-web-master
|
||||
fi
|
||||
|
||||
# install acme.sh
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
if [ ! -z "$cn" ];then
|
||||
curl -sSL -o /tmp/acme.tar.gz https://ghproxy.com/github.com/acmesh-official/acme.sh/archive/master.tar.gz
|
||||
tar xvzf /tmp/acme.tar.gz -C /tmp
|
||||
cd /tmp/acme.sh-master
|
||||
bash acme.sh install
|
||||
cd -
|
||||
fi
|
||||
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo "use system version: ${OSNAME}"
|
||||
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
|
||||
|
||||
|
||||
cd /www/server/mdserver-web && bash cli.sh start
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
n=0
|
||||
@@ -121,3 +137,7 @@ endTime=`date +%s`
|
||||
((outTime=(${endTime}-${startTime})/60))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
|
||||
} 1> >(tee mw-install.log) 2>&1
|
||||
|
||||
echo -e "\nInstall completed. If error occurs, please contact us with the log file mw-install.log ."
|
||||
echo "安装完毕,如果出现错误,请带上同目录下的安装日志 mw-install.log 联系我们反馈."
|
||||
@@ -14,13 +14,8 @@ dnf install -y python-devel
|
||||
dnf install -y crontabs
|
||||
dnf install -y mysql-devel
|
||||
|
||||
#https need
|
||||
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/iptables ];then
|
||||
if [ -f /usr/sbin/iptables ];then
|
||||
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
@@ -41,7 +36,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f /etc/init.d/iptables ];then
|
||||
if [ ! -f /usr/sbin/iptables ];then
|
||||
yum install firewalld -y
|
||||
systemctl enable firewalld
|
||||
systemctl start firewalld
|
||||
|
||||
@@ -21,14 +21,7 @@ yum install -y curl-devel libmcrypt libmcrypt-devel
|
||||
yum install -y mysql-devel
|
||||
yum install -y expect
|
||||
|
||||
|
||||
|
||||
#https need
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/iptables ];then
|
||||
if [ -f /usr/sbin/iptables ];then
|
||||
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
@@ -49,7 +42,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f /etc/init.d/iptables ];then
|
||||
if [ ! -f /usr/sbin/iptables ];then
|
||||
yum install firewalld -y
|
||||
systemctl enable firewalld
|
||||
#取消服务锁定
|
||||
|
||||
@@ -54,12 +54,7 @@ echo y | pacman -Syu icu
|
||||
|
||||
hwclock --systohc
|
||||
|
||||
#https need
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/iptables ];then
|
||||
if [ -f /usr/sbin/iptables ];then
|
||||
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
@@ -80,7 +75,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f /etc/init.d/iptables ];then
|
||||
if [ ! -f /usr/sbin/iptables ];then
|
||||
echo y | pacman -Sy firewalld
|
||||
systemctl enable firewalld
|
||||
systemctl start firewalld
|
||||
|
||||
@@ -23,13 +23,7 @@ yum install -y mysql-devel
|
||||
yum install -y expect
|
||||
|
||||
|
||||
|
||||
#https need
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/iptables ];then
|
||||
if [ -f /usr/sbin/iptables ];then
|
||||
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
@@ -50,7 +44,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f /etc/init.d/iptables ];then
|
||||
if [ ! -f /usr/sbin/iptables ];then
|
||||
yum install firewalld -y
|
||||
systemctl enable firewalld
|
||||
#取消服务锁定
|
||||
|
||||
+48
-54
@@ -2,19 +2,13 @@
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
export LANG=en_US.UTF-8
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
# RED='\e[1;31m' # 红色
|
||||
# GREEN='\e[1;32m' # 绿色
|
||||
# YELLOW='\e[1;33m' # 黄色
|
||||
# BLUE='\e[1;34m' # 蓝色
|
||||
# PURPLE='\e[1;35m' # 紫色
|
||||
# CYAN='\e[1;36m' # 蓝绿色
|
||||
# WHITE='\e[1;37m' # 白色
|
||||
# NC='\e[0m' # 没有颜色
|
||||
VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'`
|
||||
|
||||
if grep -Eq "Debian" /etc/*-release; then
|
||||
ln -sf /bin/bash /bin/sh
|
||||
fi
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
|
||||
ln -sf /bin/bash /bin/sh
|
||||
|
||||
__GET_BIT=`getconf LONG_BIT`
|
||||
if [ "$__GET_BIT" == "32" ];then
|
||||
@@ -25,26 +19,27 @@ fi
|
||||
|
||||
# synchronize time first
|
||||
apt-get install ntpdate -y
|
||||
ntpdate time.nist.gov | logger -t NTP
|
||||
|
||||
apt update -y
|
||||
apt-get update -y
|
||||
|
||||
|
||||
apt install -y wget curl lsof unzip
|
||||
apt install -y python3-pip
|
||||
apt install -y python3-dev
|
||||
apt install -y python3-venv
|
||||
apt install -y cron
|
||||
apt install -y expect
|
||||
|
||||
apt install -y locate
|
||||
locale-gen en_US.UTF-8
|
||||
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
|
||||
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
NTPHOST='time.nist.gov'
|
||||
if [ ! -z "$cn" ];then
|
||||
NTPHOST='ntp1.aliyun.com'
|
||||
fi
|
||||
ntpdate $NTPHOST | logger -t NTP
|
||||
|
||||
if [ ! -f /usr/sbin/locale-gen ];then
|
||||
apt install -y locales
|
||||
sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen
|
||||
locale-gen en_US.UTF-8
|
||||
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
|
||||
dpkg-reconfigure --frontend=noninteractive locales
|
||||
update-locale LANG=en_US.UTF-8
|
||||
else
|
||||
locale-gen en_US.UTF-8
|
||||
localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
|
||||
fi
|
||||
|
||||
apt-get update -y
|
||||
apt install -y wget curl lsof unzip tar cron expect locate
|
||||
apt install -y python3-pip python3-dev python3-venv
|
||||
|
||||
if [ -f /usr/sbin/ufw ];then
|
||||
|
||||
@@ -59,12 +54,9 @@ if [ -f /usr/sbin/ufw ];then
|
||||
fi
|
||||
|
||||
if [ -f /usr/sbin/ufw ];then
|
||||
|
||||
ufw disable
|
||||
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f /usr/sbin/ufw ];then
|
||||
apt install -y firewalld
|
||||
systemctl enable firewalld
|
||||
@@ -88,7 +80,6 @@ fi
|
||||
#安装时不开启
|
||||
systemctl stop firewalld
|
||||
|
||||
|
||||
#fix zlib1g-dev fail
|
||||
echo -e "\e[0;32mfix zlib1g-dev install question start\e[0m"
|
||||
Install_TmpFile=/tmp/debian-fix-zlib1g-dev.txt
|
||||
@@ -118,14 +109,13 @@ rm -rf ${Install_TmpFile}
|
||||
echo -e "\e[0;32mfix libunwind-dev install question end\e[0m"
|
||||
|
||||
|
||||
apt install -y libvpx-dev
|
||||
apt install -y libvpx-dev
|
||||
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
|
||||
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
|
||||
@@ -135,9 +125,10 @@ if [ "$VERSION_ID" == "9" ];then
|
||||
# pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
fi
|
||||
|
||||
apt install -y build-essential
|
||||
apt install -y devscripts
|
||||
|
||||
apt install -y net-tools
|
||||
apt install -y python3-dev
|
||||
apt install -y autoconf
|
||||
apt install -y gcc
|
||||
|
||||
@@ -164,35 +155,38 @@ apt install -y dia pkg-config
|
||||
apt install -y zlib1g-dev
|
||||
apt install -y libjpeg-dev libpng-dev
|
||||
apt install -y libfreetype6
|
||||
apt install -y libjpeg62-turbo-dev
|
||||
apt install -y libfreetype6-dev
|
||||
apt install -y libevent-dev libncurses5-dev libldap2-dev
|
||||
apt install -y libzip-dev
|
||||
apt install -y libicu-dev
|
||||
|
||||
apt install -y build-essential
|
||||
|
||||
apt install -y libcurl4-openssl-dev
|
||||
apt install -y curl libcurl4-gnutls-dev
|
||||
|
||||
# Disabled due to dependency issues
|
||||
#apt install --ignore-missing -y autoconf automake cmake curl dia gcc imagemagick libbz2-dev libcurl4-gnutls-dev\
|
||||
# libcurl4-openssl-dev libevent-dev libffi-dev libfreetype6 libfreetype6-dev libgmp-dev libgmp3-dev libicu-dev \
|
||||
# libjpeg-dev libldap2-dev libmagickwand-dev libmcrypt-dev libmemcached-dev libncurses5-dev \
|
||||
# libpcre3 libpcre3-dev libpng-dev libpspell-dev libreadline-dev librecode-dev libsasl2-dev libssl-dev \
|
||||
# libunwind-dev libwebp-dev libxml2 libxml2-dev libxpm-dev libzip-dev lzma lzma-dev make net-tools openssl \
|
||||
# pkg-config python3-dev scons webp zlib1g-dev
|
||||
|
||||
if [ "$VERSION_ID" != "9" ]; then
|
||||
apt install -y libjpeg62-turbo-dev
|
||||
fi
|
||||
|
||||
#https://blog.csdn.net/qq_36228377/article/details/123154344
|
||||
# ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
|
||||
if [ ! -d /usr/include/curl ];then
|
||||
ln -s /usr/include/x86_64-linux-gnu/curl /usr/include/curl
|
||||
fi
|
||||
|
||||
apt install -y graphviz bison re2c flex libsqlite3-dev libonig-dev perl g++ libtool libxslt1-dev
|
||||
apt install -y libmariadb-dev libmariadb-dev-compat
|
||||
|
||||
apt install -y graphviz bison re2c flex
|
||||
apt install -y libsqlite3-dev
|
||||
apt install -y libonig-dev
|
||||
|
||||
apt install -y perl g++ libtool
|
||||
apt install -y libxslt1-dev
|
||||
|
||||
apt install -y libmariadb-dev
|
||||
#apt install -y libmysqlclient-dev
|
||||
apt install -y libmariadb-dev-compat
|
||||
#apt install -y libmysqlclient-dev
|
||||
#apt install -y libmariadbclient-dev
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
@@ -17,13 +17,7 @@ yum install -y wget curl lsof unzip
|
||||
yum install -y expect
|
||||
dnf install crontabs -y
|
||||
|
||||
#https need
|
||||
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/iptables ];then
|
||||
if [ -f /usr/sbin/iptables ];then
|
||||
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
@@ -46,7 +40,7 @@ fi
|
||||
|
||||
|
||||
if [ "${isVersion}" == '' ];then
|
||||
if [ ! -f "/etc/init.d/iptables" ];then
|
||||
if [ ! -f "/usr/sbin/iptables" ];then
|
||||
yum install firewalld -y
|
||||
systemctl enable firewalld
|
||||
systemctl start firewalld
|
||||
|
||||
@@ -37,15 +37,9 @@ pkg install -y harfbuzz
|
||||
|
||||
# pkg install -y py38-cffi
|
||||
|
||||
|
||||
pkg autoremove -y
|
||||
|
||||
#https need
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/iptables ];then
|
||||
if [ -f /usr/sbin/iptables ];then
|
||||
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
@@ -66,7 +60,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f /etc/init.d/iptables ];then
|
||||
if [ ! -f /usr/sbin/iptables ];then
|
||||
pkg install -y firewalld
|
||||
systemctl enable firewalld
|
||||
systemctl start firewalld
|
||||
|
||||
@@ -51,12 +51,8 @@ zypper install -y libXpm-devel
|
||||
zypper install -y freetype2-devel
|
||||
|
||||
# zypper install -y php-config
|
||||
#https need
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/iptables ];then
|
||||
if [ -f /usr/sbin/iptables ];then
|
||||
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
@@ -77,7 +73,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f /etc/init.d/iptables ];then
|
||||
if [ ! -f /usr/sbin/iptables ];then
|
||||
zypper install -y firewalld
|
||||
systemctl enable firewalld
|
||||
systemctl start firewalld
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
LANG=C.UTF-8
|
||||
|
||||
setenforce 0
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
VERSION_ID=`grep -o -i 'release *[[:digit:]]\+\.*' /etc/redhat-release | grep -o '[[:digit:]]\+' `
|
||||
isStream=$(grep -o -i 'stream' /etc/redhat-release)
|
||||
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
|
||||
# CentOS Stream
|
||||
if [ ! -z "$stream" ];then
|
||||
yum install -y dnf dnf-plugins-core
|
||||
dnf upgrade -y libmodulemd
|
||||
fi
|
||||
|
||||
|
||||
PKGMGR='yum'
|
||||
if [ $VERSION_ID -ge 8 ];then
|
||||
PKGMGR='dnf'
|
||||
fi
|
||||
|
||||
#https need
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
if [ -f /usr/sbin/iptables ];then
|
||||
$PKGMGR install -y iptables-services
|
||||
|
||||
# iptables -nL --line-number
|
||||
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 888 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 7200 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
|
||||
# iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 30000:40000 -j ACCEPT
|
||||
service iptables save
|
||||
|
||||
iptables_status=`service iptables status | grep 'not running'`
|
||||
if [ "${iptables_status}" == '' ];then
|
||||
service iptables restart
|
||||
fi
|
||||
#安装时不开启
|
||||
service iptables stop
|
||||
fi
|
||||
|
||||
if [ ! -f /usr/sbin/iptables ];then
|
||||
$PKGMGR install firewalld -y
|
||||
systemctl enable firewalld
|
||||
#取消服务锁定
|
||||
systemctl unmask firewalld
|
||||
systemctl start firewalld
|
||||
|
||||
sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
|
||||
firewall-cmd --reload
|
||||
|
||||
# look
|
||||
# firewall-cmd --list-all
|
||||
|
||||
firewall-cmd --permanent --zone=public --add-port=22/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=80/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=443/tcp
|
||||
firewall-cmd --permanent --zone=public --add-port=888/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=7200/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||
|
||||
# sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
|
||||
firewall-cmd --reload
|
||||
|
||||
#安装时不开启
|
||||
systemctl stop firewalld
|
||||
fi
|
||||
|
||||
$PKGMGR install -y epel-release
|
||||
if [ ! -z "$cn" ];then
|
||||
sed -e 's|^metalink=|#metalink=|g' \
|
||||
-e 's|^#baseurl=|baseurl=|g' \
|
||||
-e 's|//download\.fedoraproject\.org/pub|//mirrors.tuna.tsinghua.edu.cn|g' \
|
||||
-e 's|//download\.example/pub|//mirrors.tuna.tsinghua.edu.cn|g' \
|
||||
-i.bak /etc/yum.repos.d/epel*.repo
|
||||
fi
|
||||
$PKGMGR makecache
|
||||
$PKGMGR groupinstall -y "Development Tools"
|
||||
|
||||
if [ $VERSION_ID -ge 8 ];then
|
||||
# EL8 及以上
|
||||
if [ $VERSION_ID -ge 9 ];then
|
||||
REPOS='--enablerepo=appstream,baseos,epel,extras,crb'
|
||||
else
|
||||
REPOS='--enablerepo=appstream,baseos,epel,extras,powertools'
|
||||
fi
|
||||
|
||||
for rpms in autoconf bzip2 bzip2-devel c-ares-devel \
|
||||
ca-certificates cairo-devel cmake crontabs curl curl-devel diffutils e2fsprogs e2fsprogs-devel \
|
||||
expat-devel expect file flex gcc gcc-c++ gd gd-devel gettext gettext-devel glib2 glib2-devel glibc.i686 \
|
||||
gmp-devel kernel-devel libXpm-devel libaio-devel libcap libcurl libcurl-devel libevent libevent-devel \
|
||||
libicu-devel libidn libidn-devel libmcrypt libmcrypt-devel libmemcached libmemcached-devel \
|
||||
libpng libpng-devel libstdc++.so.6 libtirpc libtirpc-devel libtool libtool-libs libwebp libwebp-devel \
|
||||
libxml2 libxml2-devel libxslt libxslt-devel lsof make mysql-devel ncurses ncurses-devel net-tools \
|
||||
oniguruma oniguruma-devel patch pcre pcre-devel perl perl-Data-Dumper perl-devel procps psmisc python3-devel \
|
||||
readline-devel rpcgen sqlite-devel tar unzip vim-minimal wget zip zlib zlib-devel ;
|
||||
do
|
||||
dnf $REPOS install -y $rpms;
|
||||
done
|
||||
else
|
||||
# CentOS 7
|
||||
for rpms in autoconf bison bzip2 bzip2-devel c-ares-devel ca-certificates cairo-devel \
|
||||
cmake cmake3 crontabs curl curl-devel diffutils e2fsprogs e2fsprogs-devel expat-devel expect file \
|
||||
flex freetype freetype-devel gcc gcc-c++ gd gd-devel gettext gettext-devel git-core glib2 glib2-devel \
|
||||
glibc.i686 gmp-devel graphviz icu kernel-devel libXpm-devel libaio-devel libcap libcurl libcurl-devel \
|
||||
libevent libevent-devel libicu-devel libidn libidn-devel libjpeg-devel libmcrypt libmcrypt-devel \
|
||||
libmemcached libmemcached-devel libpng-devel libstdc++.so.6 libtirpc libtirpc-devel libtool libtool-libs \
|
||||
libwebp libwebp-devel libxml2 libxml2-devel libxslt libxslt-devel libzip libzip-devel libzstd-devel lsof \
|
||||
make mysql-devel ncurses ncurses-devel net-tools oniguruma oniguruma-devel openldap openldap-devel \
|
||||
openssl openssl-devel patch pcre pcre-devel perl perl-Data-Dumper perl-devel psmisc python-devel \
|
||||
python3-devel python3-pip re2c readline-devel rpcgen sqlite-devel tar unzip vim-minimal vixie-cron \
|
||||
wget zip zlib zlib-devel ImageMagick ImageMagick-devel ;
|
||||
do
|
||||
yum install -y $rpms;
|
||||
done
|
||||
fi
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
@@ -18,13 +18,8 @@ yum install -y python3-devel
|
||||
yum install -y crontabs
|
||||
yum install -y expect
|
||||
yum install -y curl curl-devel libcurl libcurl-devel
|
||||
#https need
|
||||
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
|
||||
if [ -f /etc/init.d/iptables ];then
|
||||
if [ -f /usr/sbin/iptables ];then
|
||||
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
|
||||
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
|
||||
@@ -45,7 +40,7 @@ if [ -f /etc/init.d/iptables ];then
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -f /etc/init.d/iptables ];then
|
||||
if [ ! -f /usr/sbin/iptables ];then
|
||||
yum install firewalld -y
|
||||
systemctl enable firewalld
|
||||
systemctl start firewalld
|
||||
|
||||
@@ -20,10 +20,6 @@ apt install -y expect
|
||||
|
||||
apt install -y cron
|
||||
|
||||
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
|
||||
|
||||
+29
-3
@@ -4,6 +4,12 @@ export PATH
|
||||
# LANG=en_US.UTF-8
|
||||
is64bit=`getconf LONG_BIT`
|
||||
|
||||
echo -e "您正在安装的是\033[31mmdserver-web测试版\033[0m,非开发测试用途请使用正式版 install.sh !"
|
||||
echo -e "You are installing\033[31mmdserver-web dev version\033[0m, normally use install.sh for production.\n"
|
||||
sleep 2
|
||||
|
||||
{
|
||||
|
||||
if [ -f /etc/motd ];then
|
||||
echo "welcome to mdserver-web panel" > /etc/motd
|
||||
fi
|
||||
@@ -27,16 +33,16 @@ elif grep -Eq "openSUSE" /etc/*-release; then
|
||||
elif grep -Eq "FreeBSD" /etc/*-release; then
|
||||
OSNAME='freebsd'
|
||||
elif grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then
|
||||
OSNAME='centos'
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then
|
||||
OSNAME='fedora'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Rocky" /etc/issue || grep -Eq "Rocky" /etc/*-release; then
|
||||
OSNAME='rocky'
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "AlmaLinux" /etc/issue || grep -Eq "AlmaLinux" /etc/*-release; then
|
||||
OSNAME='alma'
|
||||
OSNAME='rhel'
|
||||
yum install -y wget zip unzip
|
||||
elif grep -Eqi "Amazon Linux" /etc/issue || grep -Eq "Amazon Linux" /etc/*-release; then
|
||||
OSNAME='amazon'
|
||||
@@ -68,6 +74,21 @@ if [ $OSNAME != "macos" ];then
|
||||
rm -rf /tmp/dev.zip
|
||||
rm -rf /tmp/mdserver-web-dev
|
||||
fi
|
||||
|
||||
# install acme.sh
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
if [ ! -z "$cn" ];then
|
||||
curl -sSL -o /tmp/acme.tar.gz https://ghproxy.com/github.com/acmesh-official/acme.sh/archive/master.tar.gz
|
||||
tar xvzf /tmp/acme.tar.gz -C /tmp
|
||||
cd /tmp/acme.sh-master
|
||||
bash acme.sh install
|
||||
cd -
|
||||
fi
|
||||
|
||||
if [ ! -d /root/.acme.sh ];then
|
||||
curl https://get.acme.sh | sh
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "use system version: ${OSNAME}"
|
||||
@@ -101,3 +122,8 @@ fi
|
||||
endTime=`date +%s`
|
||||
((outTime=(${endTime}-${startTime})/60))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
|
||||
} 1> >(tee mw-install.log) 2>&1
|
||||
|
||||
echo -e "\nInstall completed. If error occurs, please contact us with the log file mw-install.log ."
|
||||
echo "安装完毕,如果出现错误,请带上同目录下的安装日志 mw-install.log 联系我们反馈."
|
||||
+15
-15
@@ -47,24 +47,24 @@ else
|
||||
echo "OK"
|
||||
fi
|
||||
|
||||
#面板需要的库
|
||||
if [ ! -f /usr/local/bin/pip3 ];then
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
if [ ! -z "$cn" ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://mirrors.aliyun.com/pypi/simple
|
||||
else
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i https://pypi.python.org/pypi
|
||||
fi
|
||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||
PIPSRC="https://pypi.python.org/simple"
|
||||
if [ ! -z "$cn" ];then
|
||||
PIPSRC="https://pypi.tuna.tsinghua.edu.cn/simple"
|
||||
fi
|
||||
|
||||
which pip && pip install --upgrade pip
|
||||
pip3 install --upgrade setuptools
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
#面板需要的库
|
||||
if [ ! -f /usr/local/bin/pip3 ] && [ ! -f /usr/bin/pip3 ];then
|
||||
python3 -m pip install --upgrade pip setuptools wheel -i $PIPSRC
|
||||
fi
|
||||
|
||||
which pip && pip install --upgrade pip -i $PIPSRC
|
||||
pip3 install --upgrade pip setuptools wheel -i $PIPSRC
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -i $PIPSRC
|
||||
|
||||
# pip3 install flask-caching==1.10.1
|
||||
# pip3 install mysqlclient
|
||||
|
||||
|
||||
if [ ! -f /www/server/mdserver-web/bin/activate ];then
|
||||
cd /www/server/mdserver-web && python3 -m venv .
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
@@ -72,9 +72,9 @@ else
|
||||
cd /www/server/mdserver-web && source /www/server/mdserver-web/bin/activate
|
||||
fi
|
||||
|
||||
pip install --upgrade pip
|
||||
pip3 install --upgrade setuptools
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt
|
||||
pip install --upgrade pip -i $PIPSRC
|
||||
pip3 install --upgrade setuptools -i $PIPSRC
|
||||
cd /www/server/mdserver-web && pip3 install -r /www/server/mdserver-web/requirements.txt -i $PIPSRC
|
||||
|
||||
echo "lib ok!"
|
||||
# pip3 install flask-caching==1.10.1
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
if [ ! -d /www/server/mdserver-web/logs ]; then
|
||||
mkdir -p /www/server/mdserver-web/logs
|
||||
fi
|
||||
|
||||
{
|
||||
|
||||
echo "welcome to mdserver-web panel"
|
||||
|
||||
startTime=`date +%s`
|
||||
@@ -60,3 +66,4 @@ endTime=`date +%s`
|
||||
((outTime=(${endTime}-${startTime})/60))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
|
||||
} 1> >(tee /www/server/mdserver-web/logs/mw-app.log) 2>&1
|
||||
@@ -2,6 +2,12 @@
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
|
||||
if [ ! -d /www/server/mdserver-web/logs ]; then
|
||||
mkdir -p /www/server/mdserver-web/logs
|
||||
fi
|
||||
|
||||
{
|
||||
|
||||
echo "welcome to mdserver-web panel"
|
||||
|
||||
startTime=`date +%s`
|
||||
@@ -23,8 +29,7 @@ fi
|
||||
# fi
|
||||
|
||||
|
||||
|
||||
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81)
|
||||
PHP_VER_LIST=(53 54 55 56 70 71 72 73 74 80 81 82)
|
||||
# PHP_VER_LIST=(81)
|
||||
for PHP_VER in ${PHP_VER_LIST[@]}; do
|
||||
echo "php${PHP_VER} -- start"
|
||||
@@ -51,3 +56,4 @@ endTime=`date +%s`
|
||||
((outTime=(${endTime}-${startTime})/60))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
|
||||
} 1> >(tee /www/server/mdserver-web/logs/mw-debug.log) 2>&1
|
||||
+8
-1
@@ -14,6 +14,11 @@ if [ "$EUID" -ne 0 ]
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ${_os} != "Darwin" ] && [ ! -d /www/server/mdserver-web/logs ]; then
|
||||
mkdir -p /www/server/mdserver-web/logs
|
||||
fi
|
||||
|
||||
{
|
||||
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
@@ -87,4 +92,6 @@ fi
|
||||
|
||||
endTime=`date +%s`
|
||||
((outTime=($endTime-$startTime)/60))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
|
||||
} 1> >(tee /www/server/mdserver-web/logs/mw-update.log) 2>&1
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
|
||||
export PATH
|
||||
export LANG=en_US.UTF-8
|
||||
|
||||
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
|
||||
|
||||
VERSION_ID=`grep -o -i 'release *[[:digit:]]\+\.*' /etc/redhat-release | grep -o '[[:digit:]]\+' `
|
||||
|
||||
if [ $VERSION_ID == '7' ]; then
|
||||
yum install -y curl-devel libmcrypt libmcrypt-devel python3-devel
|
||||
elif [ $VERSION_ID == '8' ]; then
|
||||
dnf install -y curl-devel libmcrypt libmcrypt-devel python36-devel
|
||||
fi
|
||||
|
||||
cd /www/server/mdserver-web/scripts && bash lib.sh
|
||||
chmod 755 /www/server/mdserver-web/data
|
||||
|
||||
echo -e "stop mw"
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
|
||||
port=7200
|
||||
if [ -f /www/server/mdserver-web/data/port.pl ]; then
|
||||
port=$(cat /www/server/mdserver-web/data/port.pl)
|
||||
fi
|
||||
|
||||
n=0
|
||||
while [[ "$isStart" != "" ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 0.5
|
||||
isStart=$(lsof -n -P -i:$port|grep LISTEN|grep -v grep|awk '{print $2}'|xargs)
|
||||
let n+=1
|
||||
if [ $n -gt 15 ];then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
echo -e "start mw"
|
||||
cd /www/server/mdserver-web && bash cli.sh start
|
||||
isStart=`ps -ef|grep 'gunicorn -c setting.py app:app' |grep -v grep|awk '{print $2}'`
|
||||
n=0
|
||||
while [[ ! -f /etc/rc.d/init.d/mw ]];
|
||||
do
|
||||
echo -e ".\c"
|
||||
sleep 1
|
||||
let n+=1
|
||||
if [ $n -gt 20 ];then
|
||||
echo -e "start mw fail"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo -e "start mw success"
|
||||
@@ -14,6 +14,11 @@ if [ "$EUID" -ne 0 ]
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ${_os} != "Darwin" ] && [ ! -d /www/server/mdserver-web/logs ]; then
|
||||
mkdir -p /www/server/mdserver-web/logs
|
||||
fi
|
||||
|
||||
{
|
||||
|
||||
if [ ${_os} == "Darwin" ]; then
|
||||
OSNAME='macos'
|
||||
@@ -85,4 +90,6 @@ fi
|
||||
|
||||
endTime=`date +%s`
|
||||
((outTime=($endTime-$startTime)/60))
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
echo -e "Time consumed:\033[32m $outTime \033[0mMinute!"
|
||||
|
||||
} 1> >(tee /www/server/mdserver-web/logs/mw-update.log) 2>&1
|
||||
@@ -82,6 +82,3 @@ loglevel = 'info'
|
||||
errorlog = log_dir + '/error.log'
|
||||
accesslog = log_dir + '/access.log'
|
||||
pidfile = log_dir + '/mw.pid'
|
||||
if os.path.exists(os.getcwd() + '/data/ssl.pl'):
|
||||
certfile = 'ssl/certificate.pem'
|
||||
keyfile = 'ssl/privateKey.pem'
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# 自动生成
|
||||
|
||||
certificate.pem - 证书信息
|
||||
privateKey.pem - 私钥
|
||||
@@ -1,17 +0,0 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICojCCAYoCAQAwDQYJKoZIhvcNAQEEBQAwFzEVMBMGA1UEAwwMMTIwLjI3LjI3
|
||||
Ljk4MB4XDTE5MDIyMjA2MDg1MVoXDTI5MDIxOTA2MDg1MVowFzEVMBMGA1UEAwwM
|
||||
MTIwLjI3LjI3Ljk4MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3P5X
|
||||
4ROFaVpHNoI+a4+epK5gcfRRxyAjdroryjT/HdSQU9CnE28l5zrUsPx7JZcqbnNN
|
||||
/S6gJcsIDSqglKRLBgBPab65/MwJvHKoowfuG75144DsgY5bMvoCqSTGX77Ado1W
|
||||
vcEjwsYolxiDcnSp9A8VZX/qjTgWHe8/Si2saDa2zJ473n4qa0q/DvGXIQDviZcy
|
||||
cxkPJgoRpFw03oJmdZsJGJ34+TN0AN9XiZ0XgOQIKIq8QXc7By+YUryfecz4GYQT
|
||||
9f0K9sfY3W0bkkZ6LW9tauZU3N3/nr5fuOU7ia+IhPop7ly+9E6lyGHViwqcufbz
|
||||
95wBQJR9AEwbJJdtRQIDAQABMA0GCSqGSIb3DQEBBAUAA4IBAQAQtFdCabM+Ybog
|
||||
Z8xAbikeokOXr+X3UnUehXr3/FSJ+0/aWCzmNn8gXskYLyvCR1fkrk/0bVZoDxXt
|
||||
pwux58CiJAbn6dhFIP9thqghqQ75Z/YR245pbulpamBgLTVdqWPyaaXokcXpr8wg
|
||||
DhPZnfowCFu++UqoBeJ0IJGa1dpKdXYR8VIZFXXBf8vPGWsDu1dxMYHEM03Geutm
|
||||
PNOJgENJGu9XHGBtzadiIiUI4rrmBqeMhQCUeMuiT3URfLAKujz2fi2RvohJvI9/
|
||||
MYmngt54XY1AJW/wKpdO+FhyIyDl/xGbxdbe1DuCrAm4okAlQVrp1Q2TTEcXflns
|
||||
jeT+bba8
|
||||
-----END CERTIFICATE-----
|
||||
@@ -1,28 +0,0 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDc/lfhE4VpWkc2
|
||||
gj5rj56krmBx9FHHICN2uivKNP8d1JBT0KcTbyXnOtSw/Hsllypuc039LqAlywgN
|
||||
KqCUpEsGAE9pvrn8zAm8cqijB+4bvnXjgOyBjlsy+gKpJMZfvsB2jVa9wSPCxiiX
|
||||
GINydKn0DxVlf+qNOBYd7z9KLaxoNrbMnjvefiprSr8O8ZchAO+JlzJzGQ8mChGk
|
||||
XDTegmZ1mwkYnfj5M3QA31eJnReA5AgoirxBdzsHL5hSvJ95zPgZhBP1/Qr2x9jd
|
||||
bRuSRnotb21q5lTc3f+evl+45TuJr4iE+inuXL70TqXIYdWLCpy59vP3nAFAlH0A
|
||||
TBskl21FAgMBAAECggEAJUEbP24zB1eYua+rJibH76sVxyAQySi50cIAr83PVBAJ
|
||||
ZJfAEp6iHSDlyhBGEkgxdv0pII1Dohtf+Bg/ic9IdnKG8KSeZedfnM0XcKRdl3+8
|
||||
D+Yj+JMu/KD44dq5NlrJxzJ8dPCiPqt5HD+dqSXRoLsKOFogCD50PAeg+7hHYCnI
|
||||
worCm6MoCD8Qps6ArmR/YRatAF0wPQxCTX+TRww12gbgWTFPl0ocETth0r3LQHtz
|
||||
jaOu/EtO87WXt1i3NjaRImLMnBytOPVUM0tLXGiAnXvfg39c8cyYUof2FbFO+kgT
|
||||
nK89NrlPWMUo6jGZyf4riVdcPqza/FH5IEv4ToLL4QKBgQD8ICRM9oLtBJKf+749
|
||||
auZbca25fSDfid/pSWaGB0VymJoETPfUMhKnrBi8uLcL0VJ6+I+kFmhZL/j3R5g3
|
||||
7D9NhJyfGDBJv3CfjK2L/zPCiESEnMt0IRiEcxaIX+K9SjfHwCam4XLsnDWNG49B
|
||||
WZ0onQNjY5IdYV7wsRMlBDmN6wKBgQDgY7qCUJVilRVX2TLOYgKIGaAb7QVVX9Bz
|
||||
wukPRD/OFoufZRltbhwWCDrDRVJZlRccpAq+cr6KXg9AKhbn2xc6aLG4vPWBgLB0
|
||||
P+QcR4lszRqqiM0yRUhOJSk3nFBtS7lsf80qTdP+Cz/M317/z7yqQNi92tNaHNLN
|
||||
sYmVrM61jwKBgQDuIznGS+xcDL6lR3Vns2nDI3twQOTk3uhUA5VHsOSCmeqXd095
|
||||
6JXAM4fl8R5LljmulsmttdB3tR0WC1SWNZmREVmR15n8fkrVGF3vZmuwKV92VlbA
|
||||
6GWs7LtysgaKvegzzqVzaGxRWjYmgsprckZDzxIdNTYUdBzlgItRokzuYwKBgG7Y
|
||||
9U7g7hsIGMYP9ug7RJLlTdHd0e+t6HT3SViQV5DAVHMGZ3xGk7tSj2zdduPoIcW1
|
||||
R9VzK6uA8bm50Rzyf1QMWhcvyXwTDZgv48kQkdPcspqh//Qgg6qO8wCUyKplaREv
|
||||
RTPrxJjQB9F2WyC2B7Z3WFrZmeT/LigM1zHIb0kDAoGABmrg8nXGBrEdtYXHFdem
|
||||
1iP0X3+Xt/RwH50YjsNNbUmngIbiR5q71vFkfM7UhIjlnKX/HfSTCUyCtLjHBIFh
|
||||
E/OHbEVgElbegnCx3uX4+kxP/oFGNh9t9fJAOsipaYrVVyQWK3C5ilrcBcx4jdXB
|
||||
c4cumeA0lZ2p1hc82ArHxYk=
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -56,6 +56,7 @@ def mwcli(mw_input=0):
|
||||
print("(12) 修改面板用户名")
|
||||
print("(13) 显示面板错误日志")
|
||||
print("(20) 关闭BasicAuth认证")
|
||||
print("(21) 解除域名绑定")
|
||||
print("(0) 取消")
|
||||
print(raw_tip)
|
||||
try:
|
||||
@@ -65,7 +66,7 @@ def mwcli(mw_input=0):
|
||||
except:
|
||||
mw_input = 0
|
||||
|
||||
nums = [1, 2, 3, 4, 5, 10, 11, 12, 13, 20]
|
||||
nums = [1, 2, 3, 4, 5, 10, 11, 12, 13, 20, 21]
|
||||
if not mw_input in nums:
|
||||
print(raw_tip)
|
||||
print("已取消!")
|
||||
@@ -109,6 +110,12 @@ def mwcli(mw_input=0):
|
||||
os.remove(basic_auth)
|
||||
os.system(INIT_CMD + " restart")
|
||||
print("|-关闭basic_auth成功")
|
||||
elif mw_input == 21:
|
||||
bind_domain = 'data/bind_domain.pl'
|
||||
if os.path.exists(bind_domain):
|
||||
os.remove(bind_domain)
|
||||
os.system(INIT_CMD + " unbind_domain")
|
||||
print("|-解除域名绑定成功")
|
||||
|
||||
|
||||
def set_panel_pwd(password, ncli=False):
|
||||
@@ -125,6 +132,22 @@ def set_panel_pwd(password, ncli=False):
|
||||
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):
|
||||
# 随机面板用户名
|
||||
import db
|
||||
@@ -164,6 +187,8 @@ if __name__ == "__main__":
|
||||
set_panel_username(sys.argv[2])
|
||||
else:
|
||||
set_panel_username()
|
||||
elif method == 'password':
|
||||
show_panel_pwd()
|
||||
elif method == 'getServerIp':
|
||||
getServerIp()
|
||||
elif method == "cli":
|
||||
|
||||
Reference in New Issue
Block a user