mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9d9b39dfe2 | ||
|
|
422514c40a | ||
|
|
632568643b | ||
|
|
a5f29a2a6a | ||
|
|
b02705aa5a | ||
|
|
1f9ab560e3 | ||
|
|
b3970326cd | ||
|
|
f6d008e0b6 | ||
|
|
6f9a49ad7a | ||
|
|
fc3c7d334a | ||
|
|
1030d1b923 | ||
|
|
94d4a90bcc | ||
|
|
da4b872666 | ||
|
|
cf15b19f4b | ||
|
|
aa9cdaada4 | ||
|
|
659c9fe16b | ||
|
|
2b8c6d6e43 | ||
|
|
263f83088f | ||
|
|
374c938ac0 | ||
|
|
6aa73b0cae | ||
|
|
7f731ae06f | ||
|
|
f87aff704c | ||
|
|
be9fa87133 | ||
|
|
de6fc19dee | ||
|
|
3987c6d3dc | ||
|
|
96875052cd | ||
|
|
583de57f96 | ||
|
|
41b7245f03 | ||
|
|
ee3684706f | ||
|
|
07936dfb81 | ||
|
|
5c46202be0 | ||
|
|
7123a15457 | ||
|
|
4aeb45b1d5 | ||
|
|
006a62be22 | ||
|
|
1e91d11125 | ||
|
|
99fb4aa723 | ||
|
|
5c5bbb2da2 | ||
|
|
8b05045901 | ||
|
|
1b73439525 | ||
|
|
ec51ad016a | ||
|
|
a42fae66ac | ||
|
|
b4c635c2e5 | ||
|
|
9802bc5915 |
@@ -162,6 +162,7 @@ plugins/openlitespeed
|
|||||||
plugins/system_safe
|
plugins/system_safe
|
||||||
plugins/tamper_proof
|
plugins/tamper_proof
|
||||||
plugins/tamper_proof_*
|
plugins/tamper_proof_*
|
||||||
|
plugins/cryptocurrency_trade
|
||||||
plugins/op_load_balance
|
plugins/op_load_balance
|
||||||
plugins/gdrive
|
plugins/gdrive
|
||||||
plugins/mtproxy
|
plugins/mtproxy
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
基本上可以使用,后续会继续优化!欢迎提供意见!
|
基本上可以使用,后续会继续优化!欢迎提供意见!
|
||||||
|
|
||||||
- 吹水组 - https://t.me/mdserver_web
|
- 吹水组 - https://t.me/mdserver_web
|
||||||
|
- 交流论坛 - https://bbs.midoks.me
|
||||||
|
|
||||||
```
|
```
|
||||||
如果出现问题,最好私给我面板信息。不要让我猜。如果不提供,不要提出问题,自行解决。 — 座右铭
|
如果出现问题,最好私给我面板信息。不要让我猜。如果不提供,不要提出问题,自行解决。 — 座右铭
|
||||||
@@ -98,12 +99,12 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### 版本更新 0.13.0
|
### 版本更新 0.13.1
|
||||||
|
|
||||||
* 一键迁移插件。
|
* 关闭issue,建立bbs.midoks.me。问题集中处理,发挥群众的力量。
|
||||||
* 修复acme ssl申请。
|
* 添加站操作回调钩子site_cb。 网站统计和OP防火墙不再手动重载配置
|
||||||
* IP识别优化。
|
* 修复ubuntu20 pureftp 安装时,端口没有加入安全里
|
||||||
* 解决删除站点残留的问题。
|
* 增加global_static hook关键字,并优化menu的文件加载hook
|
||||||
* 各种细节优化。
|
* 各种细节优化。
|
||||||
|
|
||||||
### JSDelivr安装地址
|
### JSDelivr安装地址
|
||||||
@@ -112,7 +113,6 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
|
|||||||
|
|
||||||
```
|
```
|
||||||
curl -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh | bash
|
curl -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh | bash
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- 直接更新
|
- 直接更新
|
||||||
|
|||||||
@@ -1522,7 +1522,7 @@ fullchain.pem 粘贴到证书输入框
|
|||||||
self.__config['orders'][i]['auth_to'] = auth_to
|
self.__config['orders'][i]['auth_to'] = auth_to
|
||||||
|
|
||||||
# 是否到了允许重试的时间
|
# 是否到了允许重试的时间
|
||||||
if 'next_retry_time' in self._config['orders'][i]:
|
if 'next_retry_time' in self.__config['orders'][i]:
|
||||||
timeout = self.__config['orders'][i][
|
timeout = self.__config['orders'][i][
|
||||||
'next_retry_time'] - int(time.time())
|
'next_retry_time'] - int(time.time())
|
||||||
if timeout > 0:
|
if timeout > 0:
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ from flask import request
|
|||||||
|
|
||||||
class config_api:
|
class config_api:
|
||||||
|
|
||||||
__version = '0.13.0'
|
__version = '0.13.1'
|
||||||
__api_addr = 'data/api.json'
|
__api_addr = 'data/api.json'
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -824,7 +824,9 @@ class config_api:
|
|||||||
data['username'] = mw.M('users').where(
|
data['username'] = mw.M('users').where(
|
||||||
"id=?", (1,)).getField('username')
|
"id=?", (1,)).getField('username')
|
||||||
|
|
||||||
# databases hook 获取
|
data['hook_tag'] = request.args.get('tag', '')
|
||||||
|
|
||||||
|
# databases hook
|
||||||
database_hook_file = 'data/hook_database.json'
|
database_hook_file = 'data/hook_database.json'
|
||||||
if os.path.exists(database_hook_file):
|
if os.path.exists(database_hook_file):
|
||||||
df = mw.readFile(database_hook_file)
|
df = mw.readFile(database_hook_file)
|
||||||
@@ -833,7 +835,7 @@ class config_api:
|
|||||||
else:
|
else:
|
||||||
data['hook_database'] = []
|
data['hook_database'] = []
|
||||||
|
|
||||||
# menu hook 获取
|
# menu hook
|
||||||
menu_hook_file = 'data/hook_menu.json'
|
menu_hook_file = 'data/hook_menu.json'
|
||||||
if os.path.exists(menu_hook_file):
|
if os.path.exists(menu_hook_file):
|
||||||
df = mw.readFile(menu_hook_file)
|
df = mw.readFile(menu_hook_file)
|
||||||
@@ -842,4 +844,13 @@ class config_api:
|
|||||||
else:
|
else:
|
||||||
data['hook_menu'] = []
|
data['hook_menu'] = []
|
||||||
|
|
||||||
|
# global_static hook
|
||||||
|
global_static_hook_file = 'data/hook_global_static.json'
|
||||||
|
if os.path.exists(global_static_hook_file):
|
||||||
|
df = mw.readFile(global_static_hook_file)
|
||||||
|
df = json.loads(df)
|
||||||
|
data['hook_global_static'] = df
|
||||||
|
else:
|
||||||
|
data['hook_global_static'] = []
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -123,12 +123,12 @@ class firewall_api:
|
|||||||
address = port
|
address = port
|
||||||
if self.__isUfw:
|
if self.__isUfw:
|
||||||
mw.execShell('ufw delete deny from ' + address + ' to any')
|
mw.execShell('ufw delete deny from ' + address + ' to any')
|
||||||
elif self.__isIptables:
|
|
||||||
cmd = 'iptables -D INPUT -s ' + address + ' -j DROP'
|
|
||||||
mw.execShell(cmd)
|
|
||||||
elif self.__isFirewalld:
|
elif self.__isFirewalld:
|
||||||
mw.execShell(
|
mw.execShell(
|
||||||
'firewall-cmd --permanent --remove-rich-rule=\'rule family=ipv4 source address="' + address + '" drop\'')
|
'firewall-cmd --permanent --remove-rich-rule=\'rule family=ipv4 source address="' + address + '" drop\'')
|
||||||
|
elif self.__isIptables:
|
||||||
|
cmd = 'iptables -D INPUT -s ' + address + ' -j DROP'
|
||||||
|
mw.execShell(cmd)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -149,14 +149,15 @@ class firewall_api:
|
|||||||
return mw.returnJson(False, '失败,不能删除当前面板端口!')
|
return mw.returnJson(False, '失败,不能删除当前面板端口!')
|
||||||
if self.__isUfw:
|
if self.__isUfw:
|
||||||
mw.execShell('ufw delete allow ' + port + '/tcp')
|
mw.execShell('ufw delete allow ' + port + '/tcp')
|
||||||
elif self.__isIptables:
|
|
||||||
mw.execShell(
|
|
||||||
'iptables -D INPUT -p tcp -m state --state NEW -m tcp --dport ' + port + ' -j ACCEPT')
|
|
||||||
elif self.__isFirewalld:
|
elif self.__isFirewalld:
|
||||||
|
port = port.replace(':', '-')
|
||||||
mw.execShell(
|
mw.execShell(
|
||||||
'firewall-cmd --permanent --zone=public --remove-port=' + port + '/tcp')
|
'firewall-cmd --permanent --zone=public --remove-port=' + port + '/tcp')
|
||||||
mw.execShell(
|
mw.execShell(
|
||||||
'firewall-cmd --permanent --zone=public --remove-port=' + port + '/udp')
|
'firewall-cmd --permanent --zone=public --remove-port=' + port + '/udp')
|
||||||
|
elif self.__isIptables:
|
||||||
|
mw.execShell(
|
||||||
|
'iptables -D INPUT -p tcp -m state --state NEW -m tcp --dport ' + port + ' -j ACCEPT')
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
msg = mw.getInfo('删除防火墙放行端口[{1}]成功!', (port,))
|
msg = mw.getInfo('删除防火墙放行端口[{1}]成功!', (port,))
|
||||||
@@ -438,13 +439,13 @@ class firewall_api:
|
|||||||
def addAcceptPort(self, port):
|
def addAcceptPort(self, port):
|
||||||
if self.__isUfw:
|
if self.__isUfw:
|
||||||
mw.execShell('ufw allow ' + port + '/tcp')
|
mw.execShell('ufw allow ' + port + '/tcp')
|
||||||
elif self.__isIptables:
|
|
||||||
cmd = 'iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport ' + port + ' -j ACCEPT'
|
|
||||||
mw.execShell(cmd)
|
|
||||||
elif self.__isFirewalld:
|
elif self.__isFirewalld:
|
||||||
port = port.replace(':', '-')
|
port = port.replace(':', '-')
|
||||||
cmd = 'firewall-cmd --permanent --zone=public --add-port=' + port + '/tcp'
|
cmd = 'firewall-cmd --permanent --zone=public --add-port=' + port + '/tcp'
|
||||||
mw.execShell(cmd)
|
mw.execShell(cmd)
|
||||||
|
elif self.__isIptables:
|
||||||
|
cmd = 'iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport ' + port + ' -j ACCEPT'
|
||||||
|
mw.execShell(cmd)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class plugins_api:
|
|||||||
t = mw.readFile(menu_file)
|
t = mw.readFile(menu_file)
|
||||||
tlist = json.loads(t)
|
tlist = json.loads(t)
|
||||||
for menu_data in tlist:
|
for menu_data in tlist:
|
||||||
if 'path' in menu_data:
|
if tag == menu_data['name'] and 'path' in menu_data:
|
||||||
tpath = self.menuGetAbsPath(tag, menu_data['path'])
|
tpath = self.menuGetAbsPath(tag, menu_data['path'])
|
||||||
content = mw.readFile(tpath)
|
content = mw.readFile(tpath)
|
||||||
data['plugin_content'] = content
|
data['plugin_content'] = content
|
||||||
@@ -256,13 +256,14 @@ class plugins_api:
|
|||||||
data = json.loads(t)
|
data = json.loads(t)
|
||||||
|
|
||||||
for idx in range(len(data)):
|
for idx in range(len(data)):
|
||||||
if data[idx]['title'] == info['title'] and data[idx]['name'] == info['name']:
|
if data[idx]['name'] == info['name']:
|
||||||
data.remove(data[idx])
|
data.remove(data[idx])
|
||||||
|
break
|
||||||
mw.writeFile(hookPath, json.dumps(data))
|
mw.writeFile(hookPath, json.dumps(data))
|
||||||
|
|
||||||
def hookInstall(self, info):
|
def hookInstall(self, info):
|
||||||
valid_hook = ['backup', 'database']
|
valid_hook = ['backup', 'database']
|
||||||
valid_list_hook = ['menu']
|
valid_list_hook = ['menu', 'global_static', 'site_cb']
|
||||||
if 'hook' in info:
|
if 'hook' in info:
|
||||||
hooks = info['hook']
|
hooks = info['hook']
|
||||||
for h in hooks:
|
for h in hooks:
|
||||||
@@ -280,7 +281,7 @@ class plugins_api:
|
|||||||
|
|
||||||
def hookUninstall(self, info):
|
def hookUninstall(self, info):
|
||||||
valid_hook = ['backup', 'database']
|
valid_hook = ['backup', 'database']
|
||||||
valid_list_hook = ['menu']
|
valid_list_hook = ['menu', 'global_static', 'site_cb']
|
||||||
if 'hook' in info:
|
if 'hook' in info:
|
||||||
hooks = info['hook']
|
hooks = info['hook']
|
||||||
for h in hooks:
|
for h in hooks:
|
||||||
@@ -795,7 +796,8 @@ class plugins_api:
|
|||||||
for index in range(len(tmp_data)):
|
for index in range(len(tmp_data)):
|
||||||
plugins_info.append(tmp_data[index])
|
plugins_info.append(tmp_data[index])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(json_file)
|
||||||
|
print(mw.getTracebackInfo())
|
||||||
|
|
||||||
start = (page - 1) * pageSize
|
start = (page - 1) * pageSize
|
||||||
end = start + pageSize
|
end = start + pageSize
|
||||||
|
|||||||
+33
-4
@@ -72,6 +72,30 @@ class site_api:
|
|||||||
mw.execShell("mkdir -p " + self.sslLetsDir +
|
mw.execShell("mkdir -p " + self.sslLetsDir +
|
||||||
" && chmod -R 755 " + self.sslLetsDir)
|
" && chmod -R 755 " + self.sslLetsDir)
|
||||||
|
|
||||||
|
def runHook(self, hook_name, func_name):
|
||||||
|
# 站点操作Hook
|
||||||
|
hook_file = 'data/hook_site_cb.json'
|
||||||
|
hook_cfg = []
|
||||||
|
if os.path.exists(hook_file):
|
||||||
|
t = mw.readFile(hook_file)
|
||||||
|
hook_cfg = json.loads(t)
|
||||||
|
|
||||||
|
hook_num = len(hook_cfg)
|
||||||
|
if hook_num == 0:
|
||||||
|
return
|
||||||
|
|
||||||
|
import plugins_api
|
||||||
|
pa = plugins_api.plugins_api()
|
||||||
|
|
||||||
|
for x in range(hook_num):
|
||||||
|
hook_data = hook_cfg[x]
|
||||||
|
if func_name in hook_data:
|
||||||
|
app_name = hook_data["name"]
|
||||||
|
run_func = hook_data[func_name]['func']
|
||||||
|
# print(app_name, run_func)
|
||||||
|
pa.run(app_name, run_func)
|
||||||
|
return True
|
||||||
|
|
||||||
##### ----- start ----- ###
|
##### ----- start ----- ###
|
||||||
def listApi(self):
|
def listApi(self):
|
||||||
limit = request.form.get('limit', '10')
|
limit = request.form.get('limit', '10')
|
||||||
@@ -1272,6 +1296,7 @@ class site_api:
|
|||||||
mw.M('domain').add('pid,name,port,addtime',
|
mw.M('domain').add('pid,name,port,addtime',
|
||||||
(pid, domain_name, domain_port, mw.getDate()))
|
(pid, domain_name, domain_port, mw.getDate()))
|
||||||
|
|
||||||
|
self.runHook('site_cb', 'add')
|
||||||
return mw.returnJson(True, '域名添加成功!')
|
return mw.returnJson(True, '域名添加成功!')
|
||||||
|
|
||||||
def addDirBindApi(self):
|
def addDirBindApi(self):
|
||||||
@@ -1401,7 +1426,7 @@ class site_api:
|
|||||||
data['filename'] = filename
|
data['filename'] = filename
|
||||||
return mw.getJson(data)
|
return mw.getJson(data)
|
||||||
|
|
||||||
# 修改物理路径
|
# 修改物理路径
|
||||||
def setPathApi(self):
|
def setPathApi(self):
|
||||||
mid = request.form.get('id', '')
|
mid = request.form.get('id', '')
|
||||||
path = request.form.get('path', '')
|
path = request.form.get('path', '')
|
||||||
@@ -2530,16 +2555,18 @@ location ^~ {from} {\n\
|
|||||||
self.createRootDir(self.sitePath)
|
self.createRootDir(self.sitePath)
|
||||||
self.nginxAddConf()
|
self.nginxAddConf()
|
||||||
|
|
||||||
|
mw.M('domain').add('pid,name,port,addtime',
|
||||||
|
(pid, self.siteName, self.sitePort, mw.getDate()))
|
||||||
|
|
||||||
# 添加更多域名
|
# 添加更多域名
|
||||||
for domain in siteMenu['domainlist']:
|
for domain in siteMenu['domainlist']:
|
||||||
self.addDomain(domain, self.siteName, pid)
|
self.addDomain(domain, self.siteName, pid)
|
||||||
|
|
||||||
mw.M('domain').add('pid,name,port,addtime',
|
|
||||||
(pid, self.siteName, self.sitePort, mw.getDate()))
|
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
data['siteStatus'] = False
|
data['siteStatus'] = False
|
||||||
mw.restartWeb()
|
mw.restartWeb()
|
||||||
|
|
||||||
|
self.runHook('site_cb', 'add')
|
||||||
return mw.returnJson(True, '添加成功')
|
return mw.returnJson(True, '添加成功')
|
||||||
|
|
||||||
def deleteWSLogs(self, webname):
|
def deleteWSLogs(self, webname):
|
||||||
@@ -2608,6 +2635,8 @@ location ^~ {from} {\n\
|
|||||||
|
|
||||||
mw.M('binding').where("pid=?", (sid,)).delete()
|
mw.M('binding').where("pid=?", (sid,)).delete()
|
||||||
mw.restartWeb()
|
mw.restartWeb()
|
||||||
|
|
||||||
|
self.runHook('site_cb', 'delete')
|
||||||
return mw.returnJson(True, '站点删除成功!')
|
return mw.returnJson(True, '站点删除成功!')
|
||||||
|
|
||||||
def setEndDate(self, sid, edate):
|
def setEndDate(self, sid, edate):
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ if [ ! -d $WEB_PATH ];then
|
|||||||
mkdir -p $WEB_PATH
|
mkdir -p $WEB_PATH
|
||||||
rsync -vauP --delete --exclude=".*" $GIT_PROJECT_DIR/ $WEB_PATH
|
rsync -vauP --delete --exclude=".*" $GIT_PROJECT_DIR/ $WEB_PATH
|
||||||
else
|
else
|
||||||
rsync -vauP --exclude=".*" $GIT_PROJECT_DIR/ $WEB_PATH
|
if [ -f $GIT_PROJECT_DIR/exclude.list ];then
|
||||||
|
rsync -vauP --delete --exclude-from="$GIT_PROJECT_DIR/exclude.list" $GIT_PROJECT_DIR/ $WEB_PATH
|
||||||
|
else
|
||||||
|
rsync -vauP --exclude=".*" $GIT_PROJECT_DIR/ $WEB_PATH
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sysName=`uname`
|
sysName=`uname`
|
||||||
|
|||||||
@@ -1,4 +1,16 @@
|
|||||||
{
|
{
|
||||||
|
"hook":[
|
||||||
|
{
|
||||||
|
"tag":"site_cb",
|
||||||
|
"site_cb": {
|
||||||
|
"title":"网站统计",
|
||||||
|
"name":"op_waf",
|
||||||
|
"add":{"func":"reload"},
|
||||||
|
"update":{"func":"reload"},
|
||||||
|
"delete":{"func":"reload"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"title":"OP防火墙",
|
"title":"OP防火墙",
|
||||||
"tip":"soft",
|
"tip":"soft",
|
||||||
"name":"op_waf",
|
"name":"op_waf",
|
||||||
@@ -12,5 +24,5 @@
|
|||||||
"home":"https://github.com/loveshell/ngx_lua_waf",
|
"home":"https://github.com/loveshell/ngx_lua_waf",
|
||||||
"date":"2019-04-21",
|
"date":"2019-04-21",
|
||||||
"pid": "1",
|
"pid": "1",
|
||||||
"versions": ["0.2.5"]
|
"versions": ["0.2.6"]
|
||||||
}
|
}
|
||||||
@@ -59,11 +59,11 @@ Install_openresty()
|
|||||||
mkdir -p ${openrestyDir}
|
mkdir -p ${openrestyDir}
|
||||||
echo '正在安装脚本文件...' > $install_tmp
|
echo '正在安装脚本文件...' > $install_tmp
|
||||||
|
|
||||||
|
# wget -O openresty-1.21.4.1.tar.gz https://openresty.org/download/openresty-1.21.4.1.tar.gz
|
||||||
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
|
if [ ! -f ${openrestyDir}/openresty-${VERSION}.tar.gz ];then
|
||||||
wget -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz
|
wget -O ${openrestyDir}/openresty-${VERSION}.tar.gz https://openresty.org/download/openresty-${VERSION}.tar.gz
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
|
cd ${openrestyDir} && tar -zxvf openresty-${VERSION}.tar.gz
|
||||||
|
|
||||||
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
|
# --with-openssl=$serverPath/source/lib/openssl-1.0.2q
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ AutoRename no
|
|||||||
AnonymousCantUpload no
|
AnonymousCantUpload no
|
||||||
MaxDiskUsage 99
|
MaxDiskUsage 99
|
||||||
CustomerProof yes
|
CustomerProof yes
|
||||||
PassivePortRange 48000 50000
|
|
||||||
PIDFile {$SERVER_PATH}/pureftp/etc/pure-ftpd.pid
|
PIDFile {$SERVER_PATH}/pureftp/etc/pure-ftpd.pid
|
||||||
PureDB {$SERVER_PATH}/pureftp/etc/pureftpd.pdb
|
PureDB {$SERVER_PATH}/pureftp/etc/pureftpd.pdb
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ serverPath=$(dirname "$rootPath")
|
|||||||
|
|
||||||
install_tmp=${rootPath}/tmp/mw_install.pl
|
install_tmp=${rootPath}/tmp/mw_install.pl
|
||||||
|
|
||||||
|
|
||||||
|
if [ -f ${rootPath}/bin/activate ];then
|
||||||
|
source ${rootPath}/bin/activate
|
||||||
|
fi
|
||||||
|
|
||||||
sysName=`uname`
|
sysName=`uname`
|
||||||
echo "use system: ${sysName}"
|
echo "use system: ${sysName}"
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ bash ${rootPath}/scripts/getos.sh
|
|||||||
OSNAME=`cat ${rootPath}/data/osname.pl`
|
OSNAME=`cat ${rootPath}/data/osname.pl`
|
||||||
|
|
||||||
|
|
||||||
|
if [ -f ${rootPath}/bin/activate ];then
|
||||||
|
source ${rootPath}/bin/activate
|
||||||
|
fi
|
||||||
|
|
||||||
if id www &> /dev/null ;then
|
if id www &> /dev/null ;then
|
||||||
echo "www uid is `id -u www`"
|
echo "www uid is `id -u www`"
|
||||||
echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
echo "www shell is `grep "^www:" /etc/passwd |cut -d':' -f7 `"
|
||||||
|
|||||||
@@ -0,0 +1,127 @@
|
|||||||
|
#
|
||||||
|
# Discuz Sphinx Config File
|
||||||
|
#
|
||||||
|
|
||||||
|
indexer
|
||||||
|
{
|
||||||
|
mem_limit = 32M
|
||||||
|
write_buffer = 64M
|
||||||
|
}
|
||||||
|
|
||||||
|
searchd
|
||||||
|
{
|
||||||
|
listen = 9312
|
||||||
|
listen = 9306:mysql41
|
||||||
|
log = {$SERVER_APP}/index/searchd.log
|
||||||
|
query_log = {$SERVER_APP}/index/query.log
|
||||||
|
read_timeout = 5
|
||||||
|
max_children = 0
|
||||||
|
pid_file = {$SERVER_APP}/index/searchd.pid
|
||||||
|
seamless_rotate = 1
|
||||||
|
preopen_indexes = 1
|
||||||
|
unlink_old = 1
|
||||||
|
#workers = threads # for RT to work
|
||||||
|
binlog_path = {$SERVER_APP}/index/binlog
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
source pre_forum_thread
|
||||||
|
{
|
||||||
|
type = mysql
|
||||||
|
sql_host = 127.0.0.1
|
||||||
|
sql_user = bbs
|
||||||
|
sql_pass = bbs
|
||||||
|
sql_db = bbs
|
||||||
|
sql_port = 3306
|
||||||
|
sql_query_pre = SET NAMES UTF8
|
||||||
|
sql_query_pre = SET SESSION query_cache_type=OFF
|
||||||
|
sql_query_pre = REPLACE INTO bbs_common_sphinxcounter SELECT 1, MAX(tid) FROM bbs_forum_thread
|
||||||
|
sql_query = SELECT t.tid as id,t.tid,t.subject,t.digest,t.displayorder,t.authorid,t.lastpost,t.special \
|
||||||
|
FROM bbs_forum_thread AS t WHERE t.tid>=$start AND t.tid<=$end
|
||||||
|
sql_query_range = SELECT (SELECT MIN(tid) FROM bbs_forum_thread),maxid FROM bbs_common_sphinxcounter WHERE indexid=1
|
||||||
|
|
||||||
|
sql_range_step = 5000
|
||||||
|
sql_attr_uint = tid
|
||||||
|
|
||||||
|
sql_attr_uint = digest
|
||||||
|
sql_attr_uint = displayorder
|
||||||
|
sql_attr_uint = authorid
|
||||||
|
sql_attr_uint = special
|
||||||
|
sql_attr_timestamp =lastpost
|
||||||
|
}
|
||||||
|
|
||||||
|
index pre_forum_thread
|
||||||
|
{
|
||||||
|
source = pre_forum_thread
|
||||||
|
path = {$SERVER_APP}/index/db/pre_forum_thread/index
|
||||||
|
|
||||||
|
min_word_len = 2
|
||||||
|
html_strip = 1
|
||||||
|
ngram_len = 1
|
||||||
|
ngram_chars = U+3000..U+2FA1F
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# threads_minute
|
||||||
|
source pre_forum_thread_minute : pre_forum_thread
|
||||||
|
{
|
||||||
|
sql_query_pre = SET NAMES UTF8
|
||||||
|
sql_query_pre = SET SESSION query_cache_type=OFF
|
||||||
|
sql_query_range = SELECT maxid-1,(SELECT MAX(tid) FROM bbs_forum_thread) FROM bbs_common_sphinxcounter WHERE indexid=1
|
||||||
|
}
|
||||||
|
|
||||||
|
# threads_minute
|
||||||
|
index pre_forum_thread_minute : pre_forum_thread
|
||||||
|
{
|
||||||
|
source = pre_forum_thread_minute
|
||||||
|
path = {$SERVER_APP}/index/db/pre_forum_thread/pre_forum_thread_minute
|
||||||
|
}
|
||||||
|
|
||||||
|
#posts
|
||||||
|
source pre_forum_post : pre_forum_thread
|
||||||
|
{
|
||||||
|
type = mysql
|
||||||
|
sql_query_pre =
|
||||||
|
sql_query_pre = SET NAMES UTF8
|
||||||
|
sql_query_pre = SET SESSION query_cache_type=OFF
|
||||||
|
sql_query_pre = REPLACE INTO bbs_common_sphinxcounter SELECT 2, MAX(pid) FROM bbs_forum_post
|
||||||
|
sql_query = SELECT p.pid AS id,p.tid,p.subject,p.message,t.digest,t.displayorder,t.authorid,t.lastpost,t.special \
|
||||||
|
FROM bbs_forum_post AS p LEFT JOIN bbs_forum_thread AS t USING(tid) where p.pid >=$start and p.pid <=$end \
|
||||||
|
AND p.first=1
|
||||||
|
sql_query_range = SELECT (SELECT MIN(pid) FROM bbs_forum_post),maxid FROM bbs_common_sphinxcounter WHERE indexid=2
|
||||||
|
sql_range_step = 5000
|
||||||
|
sql_attr_uint = tid
|
||||||
|
sql_attr_uint = digest
|
||||||
|
sql_attr_uint= displayorder
|
||||||
|
sql_attr_uint = authorid
|
||||||
|
sql_attr_uint = special
|
||||||
|
sql_attr_timestamp = lastpost
|
||||||
|
}
|
||||||
|
|
||||||
|
#posts
|
||||||
|
index pre_forum_post
|
||||||
|
{
|
||||||
|
source = pre_forum_post
|
||||||
|
path = {$SERVER_APP}/index/db/pre_forum_thread/pre_forum_post
|
||||||
|
|
||||||
|
min_word_len = 2
|
||||||
|
html_strip = 1
|
||||||
|
ngram_len = 1
|
||||||
|
ngram_chars = U+3000..U+2FA1F
|
||||||
|
}
|
||||||
|
|
||||||
|
#pre_forum_post_minute
|
||||||
|
source pre_forum_post_minute : pre_forum_post
|
||||||
|
{
|
||||||
|
sql_query_pre = SET NAMES UTF8
|
||||||
|
sql_query_pre = SET SESSION query_cache_type=OFF
|
||||||
|
sql_query_range = SELECT maxid-1,(SELECT MAX(pid) FROM bbs_forum_post) FROM bbs_common_sphinxcounter WHERE indexid=2
|
||||||
|
}
|
||||||
|
|
||||||
|
#pre_forum_post_minute
|
||||||
|
index pre_forum_post_minute : pre_forum_post
|
||||||
|
{
|
||||||
|
source = pre_forum_thread
|
||||||
|
path = {$SERVER_APP}/index/db/pre_forum_thread/pre_forum_post_minute
|
||||||
|
}
|
||||||
|
|
||||||
+19
-18
@@ -25,7 +25,7 @@ class App():
|
|||||||
|
|
||||||
self.__host_dir = self.getServerDir() + '/host'
|
self.__host_dir = self.getServerDir() + '/host'
|
||||||
if not os.path.exists(self.__host_dir):
|
if not os.path.exists(self.__host_dir):
|
||||||
os.makedirs(self.__host_dir)
|
mw.execShell('mkdir -p ' + self.__host_dir)
|
||||||
|
|
||||||
def getPluginName(self):
|
def getPluginName(self):
|
||||||
return 'webssh'
|
return 'webssh'
|
||||||
@@ -145,24 +145,25 @@ class App():
|
|||||||
|
|
||||||
def get_server_list(self):
|
def get_server_list(self):
|
||||||
host_list = []
|
host_list = []
|
||||||
for name in os.listdir(self.__host_dir):
|
if os.path.exists(self.__host_dir):
|
||||||
info_file = self.__host_dir + '/' + name + '/info.json'
|
for name in os.listdir(self.__host_dir):
|
||||||
if not os.path.exists(info_file):
|
info_file = self.__host_dir + '/' + name + '/info.json'
|
||||||
continue
|
if not os.path.exists(info_file):
|
||||||
try:
|
continue
|
||||||
info_tmp = self.getSshInfo(info_file)
|
try:
|
||||||
host_info = {}
|
info_tmp = self.getSshInfo(info_file)
|
||||||
host_info['host'] = name
|
host_info = {}
|
||||||
host_info['port'] = info_tmp['port']
|
host_info['host'] = name
|
||||||
host_info['ps'] = info_tmp['ps']
|
host_info['port'] = info_tmp['port']
|
||||||
# host_info['sort'] = int(info_tmp['sort'])
|
host_info['ps'] = info_tmp['ps']
|
||||||
except Exception as e:
|
# host_info['sort'] = int(info_tmp['sort'])
|
||||||
print(e)
|
except Exception as e:
|
||||||
# if os.path.exists(info_file):
|
print(e)
|
||||||
# os.remove(info_file)
|
# if os.path.exists(info_file):
|
||||||
# continue
|
# os.remove(info_file)
|
||||||
|
# continue
|
||||||
|
|
||||||
host_list.append(host_info)
|
host_list.append(host_info)
|
||||||
|
|
||||||
host_list = sorted(host_list, key=lambda x: x['host'], reverse=False)
|
host_list = sorted(host_list, key=lambda x: x['host'], reverse=False)
|
||||||
return mw.returnJson(True, 'ok!', host_list)
|
return mw.returnJson(True, 'ok!', host_list)
|
||||||
|
|||||||
@@ -9,6 +9,14 @@
|
|||||||
"css_path":"menu/index.css",
|
"css_path":"menu/index.css",
|
||||||
"js_path":"js/webssh.js"
|
"js_path":"js/webssh.js"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tag":"global_static",
|
||||||
|
"global_static": {
|
||||||
|
"title":"终端管理",
|
||||||
|
"name":"webssh",
|
||||||
|
"css_path":"menu/ico.css"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"id":3,
|
"id":3,
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
/* menu start */
|
||||||
|
.menu .menu_plugin_webssh {
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMBJREFUeNpiYKAQMM6cOVMASBuQozk9Pf0AC5AuAOJ6cgwAWt7IhMQvRKIfAPEEYgxhQWL3o9EFpBgwAeifQhKdD7YI5oWPUMEEmAQR4COyATBwAIgdgIacB2IFYkxhQouWB0BsCA3E86QGIsxvDSBXgGIDSxr5ALTgAk4XADWAQt4fiB2BChcAaQVoGoHheLwuAGqagBz/UNsciQ4DEgE/zAUfQM4DOt+eRANAYTMRZADIrxfIdMUFSnMzA0CAAQD0hjqnYxWD2gAAAABJRU5ErkJggg==");
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu .current .menu_plugin_webssh:hover {
|
||||||
|
background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQXAJ6ipUFITySRPIiMkDFRQuXm5jJKQy1kQCGeOzBXQSl3PiWLPVhfZSxrQCpxP9na2yeEPTREQ8LExmRqb5OXm/Hx8TU9RAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjMyQjYwMTU3OTA2QTExRUJCN0NFQUUwQjRDMzM4RDJDIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjMyQjYwMTU4OTA2QTExRUJCN0NFQUUwQjRDMzM4RDJDIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MzJCNjAxNTU5MDZBMTFFQkI3Q0VBRTBCNEMzMzhEMkMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MzJCNjAxNTY5MDZBMTFFQkI3Q0VBRTBCNEMzMzhEMkMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4B//79/Pv6+fj39vX08/Lx8O/u7ezr6uno5+bl5OPi4eDf3t3c29rZ2NfW1dTT0tHQz87NzMvKycjHxsXEw8LBwL++vby7urm4t7a1tLOysbCvrq2sq6qpqKempaSjoqGgn56dnJuamZiXlpWUk5KRkI+OjYyLiomIh4aFhIOCgYB/fn18e3p5eHd2dXRzcnFwb25tbGtqaWhnZmVkY2JhYF9eXVxbWllYV1ZVVFNSUVBPTk1MS0pJSEdGRURDQkFAPz49PDs6OTg3NjU0MzIxMC8uLSwrKikoJyYlJCMiISAfHh0cGxoZGBcWFRQTEhEQDw4NDAsKCQgHBgUEAwIBAAAh+QQFMgAXACwAAAAAEAAQAAAFU6AljmRpBVOqrqtFVXAsy9Q7VMMDzHHN/5UawGQC1CiWg4IoOiINAoGB6BxBENSjyIE4oFKMprYhIFgYkvTQpWWOqm6RcVBI2+/2AuXL6k8CcSYhACH5BAUyABcALAcACQAFAAIAAAUIYJSMBLGcSggAIfkEBTIAFwAsBwAJAAUAAgAABQhgMI0MI51ACAAh+QQFMgAXACwHAAkABQACAAAFCGCUjASxnEoIADs=");
|
||||||
|
}
|
||||||
|
/* menu end */
|
||||||
@@ -1,15 +1,4 @@
|
|||||||
|
|
||||||
/* menu start */
|
|
||||||
.menu .menu_plugin_webssh {
|
|
||||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAMBJREFUeNpiYKAQMM6cOVMASBuQozk9Pf0AC5AuAOJ6cgwAWt7IhMQvRKIfAPEEYgxhQWL3o9EFpBgwAeifQhKdD7YI5oWPUMEEmAQR4COyATBwAIgdgIacB2IFYkxhQouWB0BsCA3E86QGIsxvDSBXgGIDSxr5ALTgAk4XADWAQt4fiB2BChcAaQVoGoHheLwuAGqagBz/UNsciQ4DEgE/zAUfQM4DOt+eRANAYTMRZADIrxfIdMUFSnMzA0CAAQD0hjqnYxWD2gAAAABJRU5ErkJggg==");
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu .current .menu_plugin_webssh:hover {
|
|
||||||
background-image: url("data:image/gif;base64,R0lGODlhEAAQAMQXAJ6ipUFITySRPIiMkDFRQuXm5jJKQy1kQCGeOzBXQSl3PiWLPVhfZSxrQCpxP9na2yeEPTREQ8LExmRqb5OXm/Hx8TU9RAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjMyQjYwMTU3OTA2QTExRUJCN0NFQUUwQjRDMzM4RDJDIiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOjMyQjYwMTU4OTA2QTExRUJCN0NFQUUwQjRDMzM4RDJDIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6MzJCNjAxNTU5MDZBMTFFQkI3Q0VBRTBCNEMzMzhEMkMiIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6MzJCNjAxNTY5MDZBMTFFQkI3Q0VBRTBCNEMzMzhEMkMiLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz4B//79/Pv6+fj39vX08/Lx8O/u7ezr6uno5+bl5OPi4eDf3t3c29rZ2NfW1dTT0tHQz87NzMvKycjHxsXEw8LBwL++vby7urm4t7a1tLOysbCvrq2sq6qpqKempaSjoqGgn56dnJuamZiXlpWUk5KRkI+OjYyLiomIh4aFhIOCgYB/fn18e3p5eHd2dXRzcnFwb25tbGtqaWhnZmVkY2JhYF9eXVxbWllYV1ZVVFNSUVBPTk1MS0pJSEdGRURDQkFAPz49PDs6OTg3NjU0MzIxMC8uLSwrKikoJyYlJCMiISAfHh0cGxoZGBcWFRQTEhEQDw4NDAsKCQgHBgUEAwIBAAAh+QQFMgAXACwAAAAAEAAQAAAFU6AljmRpBVOqrqtFVXAsy9Q7VMMDzHHN/5UawGQC1CiWg4IoOiINAoGB6BxBENSjyIE4oFKMprYhIFgYkvTQpWWOqm6RcVBI2+/2AuXL6k8CcSYhACH5BAUyABcALAcACQAFAAIAAAUIYJSMBLGcSggAIfkEBTIAFwAsBwAJAAUAAgAABQhgMI0MI51ACAAh+QQFMgAXACwHAAkABQACAAAFCGCUjASxnEoIADs=");
|
|
||||||
}
|
|
||||||
/* menu end */
|
|
||||||
|
|
||||||
|
|
||||||
.xterm{
|
.xterm{
|
||||||
position: inherit;
|
position: inherit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,8 +191,10 @@ def pSqliteDb(dbname='web_logs', site_name='unset', name="logs"):
|
|||||||
conn = mw.M(dbname).dbPos(db_dir, name)
|
conn = mw.M(dbname).dbPos(db_dir, name)
|
||||||
|
|
||||||
conn.execute("PRAGMA synchronous = 0")
|
conn.execute("PRAGMA synchronous = 0")
|
||||||
conn.execute("PRAGMA page_size = 4096")
|
conn.execute("PRAGMA cache_size = 8000")
|
||||||
|
conn.execute("PRAGMA page_size = 32768")
|
||||||
conn.execute("PRAGMA journal_mode = wal")
|
conn.execute("PRAGMA journal_mode = wal")
|
||||||
|
conn.execute("PRAGMA journal_size_limit = 1073741824")
|
||||||
return conn
|
return conn
|
||||||
|
|
||||||
|
|
||||||
@@ -263,6 +265,8 @@ def initDreplace():
|
|||||||
loadLuaSiteFile()
|
loadLuaSiteFile()
|
||||||
loadDebugLogFile()
|
loadDebugLogFile()
|
||||||
|
|
||||||
|
if not mw.isAppleSystem():
|
||||||
|
mw.execShell("chown -R www:www " + getServerDir())
|
||||||
return 'ok'
|
return 'ok'
|
||||||
|
|
||||||
|
|
||||||
@@ -277,9 +281,6 @@ def start():
|
|||||||
import tool_task
|
import tool_task
|
||||||
tool_task.createBgTask()
|
tool_task.createBgTask()
|
||||||
|
|
||||||
if not mw.isAppleSystem():
|
|
||||||
mw.execShell("chown -R www:www " + getServerDir())
|
|
||||||
|
|
||||||
# issues:326
|
# issues:326
|
||||||
luaRestart()
|
luaRestart()
|
||||||
return 'ok'
|
return 'ok'
|
||||||
|
|||||||
@@ -1,10 +1,22 @@
|
|||||||
{
|
{
|
||||||
"sort": 7,
|
"hook":[
|
||||||
|
{
|
||||||
|
"tag":"site_cb",
|
||||||
|
"site_cb": {
|
||||||
|
"title":"网站统计",
|
||||||
|
"name":"webstats",
|
||||||
|
"add":{"func":"reload"},
|
||||||
|
"update":{"func":"reload"},
|
||||||
|
"delete":{"func":"reload"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sort": "7",
|
||||||
"ps": "网站统计报表",
|
"ps": "网站统计报表",
|
||||||
"name": "webstats",
|
"name": "webstats",
|
||||||
"title": "网站统计",
|
"title": "网站统计",
|
||||||
"shell": "install.sh",
|
"shell": "install.sh",
|
||||||
"versions":["0.2.4"],
|
"versions":["0.2.5"],
|
||||||
"tip": "soft",
|
"tip": "soft",
|
||||||
"install_pre_inspection":true,
|
"install_pre_inspection":true,
|
||||||
"checks": "server/webstats",
|
"checks": "server/webstats",
|
||||||
|
|||||||
@@ -1084,6 +1084,7 @@ end
|
|||||||
function _M.get_client_ip(self)
|
function _M.get_client_ip(self)
|
||||||
local client_ip = "unknown"
|
local client_ip = "unknown"
|
||||||
local cdn = auto_config['cdn']
|
local cdn = auto_config['cdn']
|
||||||
|
local request_header = ngx.req.get_headers()
|
||||||
if cdn == true then
|
if cdn == true then
|
||||||
for _,v in ipairs(auto_config['cdn_headers']) do
|
for _,v in ipairs(auto_config['cdn_headers']) do
|
||||||
if request_header[v] ~= nil and request_header[v] ~= "" then
|
if request_header[v] ~= nil and request_header[v] ~= "" then
|
||||||
|
|||||||
@@ -1110,7 +1110,7 @@ function reName(type, fileName) {
|
|||||||
</div>',
|
</div>',
|
||||||
success:function(){
|
success:function(){
|
||||||
$("#newFileName").focus().keyup(function(e){
|
$("#newFileName").focus().keyup(function(e){
|
||||||
if(e.keyCode == 13) $("#ReNameBtn").click();
|
if(e.keyCode == 13) $(".layui-layer-btn0").click();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
yes:function(){
|
yes:function(){
|
||||||
|
|||||||
@@ -648,7 +648,11 @@ function onlineEditFile(k, f) {
|
|||||||
"Ctrl-S": function() {
|
"Ctrl-S": function() {
|
||||||
$("#textBody").text(t.getValue());
|
$("#textBody").text(t.getValue());
|
||||||
onlineEditFile(2, f)
|
onlineEditFile(2, f)
|
||||||
}
|
},
|
||||||
|
"Cmd-S":function() {
|
||||||
|
$("#textBody").text(t.getValue());
|
||||||
|
onlineEditFile(2, f)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
mode: d,
|
mode: d,
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
|
|||||||
@@ -2,35 +2,42 @@
|
|||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="renderer" content="webkit">
|
<meta name="renderer" content="webkit">
|
||||||
<title>{{data['title']}}</title>
|
<title>{{data['title']}}</title>
|
||||||
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon" />
|
<link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon" />
|
||||||
<link href="/static/bootstrap-3.3.5/css/bootstrap.min.css?v={{config.version}}" rel="stylesheet">
|
<link href="/static/bootstrap-3.3.5/css/bootstrap.min.css?v={{config.version}}" rel="stylesheet">
|
||||||
<link href="/static/css/site.css?v={{config.version}}" rel="stylesheet">
|
<link href="/static/css/site.css?v={{config.version}}" rel="stylesheet">
|
||||||
<link href="/static/codemirror/lib/codemirror.css?v={{config.version}}" rel="stylesheet">
|
<link href="/static/codemirror/lib/codemirror.css?v={{config.version}}" rel="stylesheet">
|
||||||
<script src="/static/language/Simplified_Chinese/lan.js?v={{config.version}}"></script>
|
<script src="/static/language/Simplified_Chinese/lan.js?v={{config.version}}"></script>
|
||||||
<!--[if lte IE 9]>
|
<!--[if lte IE 9]>
|
||||||
<script src="/static/js/requestAnimationFrame.js"></script>
|
<script src="/static/js/requestAnimationFrame.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
<!-- 统计一下用户量,让我的开发更有激情 -->
|
<!-- 统计一下用户量,让我的开发更有激情 -->
|
||||||
<!-- Google tag (gtag.js) -->
|
<!-- Google tag (gtag.js) -->
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FC74BB2RGD"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FC74BB2RGD"></script>
|
||||||
<script>
|
<script>
|
||||||
window.dataLayer = window.dataLayer || [];
|
window.dataLayer = window.dataLayer || [];
|
||||||
function gtag(){dataLayer.push(arguments);}
|
function gtag(){dataLayer.push(arguments);}
|
||||||
gtag('js', new Date());
|
gtag('js', new Date());
|
||||||
gtag('config', 'G-FC74BB2RGD');
|
gtag('config', 'G-FC74BB2RGD');
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{% for menu in data['hook_menu'] %}
|
{% for menu in data['hook_menu'] %}
|
||||||
{% if menu['js_path'] %}
|
{% if menu['css_path'] and data['hook_tag'] == menu['name'] %}
|
||||||
<!-- 加载插件css -->
|
<!-- 加载插件css -->
|
||||||
<link href="/plugins/file?name={{menu['name']}}&v={{config.version}}&f={{menu['css_path']}}" rel="stylesheet" />
|
<link href="/plugins/file?name={{menu['name']}}&v={{config.version}}&f={{menu['css_path']}}" rel="stylesheet" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- 全局静态HOOK -->
|
||||||
|
{% for menu in data['hook_global_static'] %}
|
||||||
|
{% if menu['css_path'] %}
|
||||||
|
<link href="/plugins/file?name={{menu['name']}}&v={{config.version}}&f={{menu['css_path']}}" rel="stylesheet" />
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -85,9 +92,9 @@
|
|||||||
<div class="footer bgw">mdserver-web ©2018-∞ Linux面板 (<a class="btlink" target="_blank" href="//github.com/midoks/mdserver-web">源码</a>) <span style="margin-left:5px;">/</span>
|
<div class="footer bgw">mdserver-web ©2018-∞ Linux面板 (<a class="btlink" target="_blank" href="//github.com/midoks/mdserver-web">源码</a>) <span style="margin-left:5px;">/</span>
|
||||||
<a class="btlink" style="margin-left:5px;" href="//github.com/midoks/mdserver-web/wiki" target="_blank">WIKI</a><span style="margin-left:5px;">/</span>
|
<a class="btlink" style="margin-left:5px;" href="//github.com/midoks/mdserver-web/wiki" target="_blank">WIKI</a><span style="margin-left:5px;">/</span>
|
||||||
<a class='btlink panel_ad_list_mode' style="margin-left:5px;">AD</a>
|
<a class='btlink panel_ad_list_mode' style="margin-left:5px;">AD</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -158,8 +165,14 @@ if (thisPath.indexOf('?')>-1){
|
|||||||
<script src="/static/laydate/laydate.js?v={{config.version}}"></script>
|
<script src="/static/laydate/laydate.js?v={{config.version}}"></script>
|
||||||
|
|
||||||
{% for menu in data['hook_menu'] %}
|
{% for menu in data['hook_menu'] %}
|
||||||
|
{% if menu['js_path'] and data['hook_tag'] == menu['name'] %}
|
||||||
|
<script src="/plugins/file?name={{menu['name']}}&f={{menu['js_path']}}&v={{config.version}}"></script>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- 全局静态HOOK -->
|
||||||
|
{% for menu in data['hook_global_static'] %}
|
||||||
{% if menu['js_path'] %}
|
{% if menu['js_path'] %}
|
||||||
<!-- 加载插件js -->
|
|
||||||
<script src="/plugins/file?name={{menu['name']}}&f={{menu['js_path']}}&v={{config.version}}"></script>
|
<script src="/plugins/file?name={{menu['name']}}&f={{menu['js_path']}}&v={{config.version}}"></script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
+24
-12
@@ -196,32 +196,44 @@ error_logs()
|
|||||||
|
|
||||||
mw_update()
|
mw_update()
|
||||||
{
|
{
|
||||||
cn=$(curl --insecure -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
LOCAL_ADDR=common
|
||||||
if [ ! -z "$cn" ];then
|
ping -c 1 github.com > /dev/null 2>&1
|
||||||
curl --insecure -fsSL https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/update.sh | bash
|
if [ "$?" != "0" ];then
|
||||||
else
|
LOCAL_ADDR=cn
|
||||||
|
fi
|
||||||
|
if [ "$LOCAL_ADDR" == "common" ];then
|
||||||
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash
|
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/master/scripts/update.sh | bash
|
||||||
|
else
|
||||||
|
curl --insecure -fsSL https://gitee.com/midoks/mdserver-web/raw/master/scripts/install.sh | bash
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
mw_update_dev()
|
mw_update_dev()
|
||||||
{
|
{
|
||||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
LOCAL_ADDR=common
|
||||||
if [ ! -z "$cn" ];then
|
ping -c 1 github.com > /dev/null 2>&1
|
||||||
curl --insecure -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/update_dev.sh | bash
|
if [ "$?" != "0" ];then
|
||||||
else
|
LOCAL_ADDR=cn
|
||||||
|
fi
|
||||||
|
if [ "$LOCAL_ADDR" == "common" ];then
|
||||||
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
|
curl --insecure -fsSL https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/update_dev.sh | bash
|
||||||
|
else
|
||||||
|
curl --insecure -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/update_dev.sh | bash
|
||||||
fi
|
fi
|
||||||
cd /www/server/mdserver-web
|
cd /www/server/mdserver-web
|
||||||
}
|
}
|
||||||
|
|
||||||
mw_mirror()
|
mw_mirror()
|
||||||
{
|
{
|
||||||
cn=$(curl --insecure -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
LOCAL_ADDR=common
|
||||||
if [ ! -z "$cn" ];then
|
ping -c 1 github.com > /dev/null 2>&1
|
||||||
bash <(curl --insecure -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)
|
if [ "$?" != "0" ];then
|
||||||
else
|
LOCAL_ADDR=cn
|
||||||
|
fi
|
||||||
|
if [ "$LOCAL_ADDR" == "common" ];then
|
||||||
bash <(curl --insecure -sSL https://raw.githubusercontent.com/midoks/change-linux-mirrors/main/change-mirrors.sh)
|
bash <(curl --insecure -sSL https://raw.githubusercontent.com/midoks/change-linux-mirrors/main/change-mirrors.sh)
|
||||||
|
else
|
||||||
|
bash <(curl --insecure -sSL https://gitee.com/SuperManito/LinuxMirrors/raw/main/ChangeMirrors.sh)
|
||||||
fi
|
fi
|
||||||
cd /www/server/mdserver-web
|
cd /www/server/mdserver-web
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-14
@@ -56,6 +56,16 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# cn=$(curl --insecure -fsSL -m 10 https://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||||
|
|
||||||
|
HTTP_PREFIX="https://"
|
||||||
|
LOCAL_ADDR=common
|
||||||
|
ping -c 1 github.com > /dev/null 2>&1
|
||||||
|
if [ "$?" != "0" ];then
|
||||||
|
LOCAL_ADDR=cn
|
||||||
|
HTTP_PREFIX="https://ghproxy.com/"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $OSNAME != "macos" ];then
|
if [ $OSNAME != "macos" ];then
|
||||||
if id www &> /dev/null ;then
|
if id www &> /dev/null ;then
|
||||||
echo ""
|
echo ""
|
||||||
@@ -71,11 +81,8 @@ if [ $OSNAME != "macos" ];then
|
|||||||
mkdir -p /www/backup/site
|
mkdir -p /www/backup/site
|
||||||
|
|
||||||
# https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh
|
# https://cdn.jsdelivr.net/gh/midoks/mdserver-web@latest/scripts/install.sh
|
||||||
|
|
||||||
cn=$(curl --insecure -fsSL -m 10 https://ipinfo.io/json | grep "\"country\": \"CN\"")
|
|
||||||
|
|
||||||
if [ ! -d /www/server/mdserver-web ];then
|
if [ ! -d /www/server/mdserver-web ];then
|
||||||
if [ ! -z "$cn" ];then
|
if [ "$LOCAL_ADDR" != "common" ];then
|
||||||
curl -sSLo /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip
|
curl -sSLo /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip
|
||||||
else
|
else
|
||||||
curl -sSLo /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
|
curl -sSLo /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
|
||||||
@@ -89,8 +96,8 @@ if [ $OSNAME != "macos" ];then
|
|||||||
|
|
||||||
# install acme.sh
|
# install acme.sh
|
||||||
if [ ! -d /root/.acme.sh ];then
|
if [ ! -d /root/.acme.sh ];then
|
||||||
if [ ! -z "$cn" ];then
|
if [ "$LOCAL_ADDR" != "common" ];then
|
||||||
curl -sSL -o /tmp/acme.tar.gz https://ghproxy.com/github.com/acmesh-official/acme.sh/archive/master.tar.gz
|
curl -sSLo /tmp/acme.tar.gz https://gitee.com/neilpang/acme.sh/repository/archive/master.tar.gz
|
||||||
tar xvzf /tmp/acme.tar.gz -C /tmp
|
tar xvzf /tmp/acme.tar.gz -C /tmp
|
||||||
cd /tmp/acme.sh-master
|
cd /tmp/acme.sh-master
|
||||||
bash acme.sh install
|
bash acme.sh install
|
||||||
@@ -103,17 +110,13 @@ if [ $OSNAME != "macos" ];then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo "use system version: ${OSNAME}"
|
echo "use system version: ${OSNAME}"
|
||||||
|
|
||||||
if [ "${OSNAME}" == "macos" ];then
|
if [ "${OSNAME}" == "macos" ];then
|
||||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
if [ "$LOCAL_ADDR" != "common" ];then
|
||||||
HTTP_PREFIX="https://"
|
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/install/macos.sh | bash
|
||||||
if [ ! -z "$cn" ];then
|
else
|
||||||
HTTP_PREFIX="https://ghproxy.com/"
|
curl -fsSL ${HTTP_PREFIX}https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install/macos.sh | bash
|
||||||
fi
|
fi
|
||||||
curl -fsSL ${HTTP_PREFIX}https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install/macos.sh | bash
|
|
||||||
else
|
else
|
||||||
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
|
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -83,9 +83,6 @@ if [ ! -f /usr/sbin/firewalld ];then
|
|||||||
#取消服务锁定
|
#取消服务锁定
|
||||||
systemctl unmask firewalld
|
systemctl unmask firewalld
|
||||||
systemctl start firewalld
|
systemctl start firewalld
|
||||||
|
|
||||||
sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
|
|
||||||
firewall-cmd --reload
|
|
||||||
|
|
||||||
# look
|
# look
|
||||||
# firewall-cmd --list-all
|
# firewall-cmd --list-all
|
||||||
@@ -102,7 +99,7 @@ if [ ! -f /usr/sbin/firewalld ];then
|
|||||||
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
# firewall-cmd --permanent --zone=public --add-port=3306/tcp
|
||||||
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
# firewall-cmd --permanent --zone=public --add-port=30000-40000/tcp
|
||||||
|
|
||||||
# sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
|
sed -i 's#AllowZoneDrifting=yes#AllowZoneDrifting=no#g' /etc/firewalld/firewalld.conf
|
||||||
firewall-cmd --reload
|
firewall-cmd --reload
|
||||||
|
|
||||||
#安装时不开启
|
#安装时不开启
|
||||||
|
|||||||
+15
-5
@@ -74,7 +74,6 @@ fi
|
|||||||
# HTTP_PREFIX="https://ghproxy.com/"
|
# HTTP_PREFIX="https://ghproxy.com/"
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
|
|
||||||
if [ $OSNAME != "macos" ];then
|
if [ $OSNAME != "macos" ];then
|
||||||
mkdir -p /www/server
|
mkdir -p /www/server
|
||||||
mkdir -p /www/wwwroot
|
mkdir -p /www/wwwroot
|
||||||
@@ -83,7 +82,13 @@ if [ $OSNAME != "macos" ];then
|
|||||||
mkdir -p /www/backup/site
|
mkdir -p /www/backup/site
|
||||||
|
|
||||||
if [ ! -d /www/server/mdserver-web ];then
|
if [ ! -d /www/server/mdserver-web ];then
|
||||||
curl -sSLo /tmp/dev.zip ${HTTP_PREFIX}github.com/midoks/mdserver-web/archive/refs/heads/dev.zip
|
|
||||||
|
if [ "$LOCAL_ADDR" == "common" ];then
|
||||||
|
curl -sSLo /tmp/dev.zip ${HTTP_PREFIX}github.com/midoks/mdserver-web/archive/refs/heads/dev.zip
|
||||||
|
else
|
||||||
|
curl -sSLo /tmp/dev.zip https://gitee.com/midoks/mdserver-web/repository/archive/dev.zip
|
||||||
|
fi
|
||||||
|
|
||||||
cd /tmp && unzip /tmp/dev.zip
|
cd /tmp && unzip /tmp/dev.zip
|
||||||
mv -f /tmp/mdserver-web-dev /www/server/mdserver-web
|
mv -f /tmp/mdserver-web-dev /www/server/mdserver-web
|
||||||
rm -rf /tmp/dev.zip
|
rm -rf /tmp/dev.zip
|
||||||
@@ -92,8 +97,9 @@ if [ $OSNAME != "macos" ];then
|
|||||||
|
|
||||||
# install acme.sh
|
# install acme.sh
|
||||||
if [ ! -d /root/.acme.sh ];then
|
if [ ! -d /root/.acme.sh ];then
|
||||||
if [ "$HTTP_PREFIX" == "https://ghproxy.com/" ];then
|
if [ "$LOCAL_ADDR" != "common" ];then
|
||||||
curl -sSL -o /tmp/acme.tar.gz ${HTTP_PREFIX}github.com/acmesh-official/acme.sh/archive/master.tar.gz
|
# curl -sSL -o /tmp/acme.tar.gz ${HTTP_PREFIX}github.com/acmesh-official/acme.sh/archive/master.tar.gz
|
||||||
|
curl -sSLo /tmp/acme.tar.gz https://gitee.com/neilpang/acme.sh/repository/archive/master.tar.gz
|
||||||
tar xvzf /tmp/acme.tar.gz -C /tmp
|
tar xvzf /tmp/acme.tar.gz -C /tmp
|
||||||
cd /tmp/acme.sh-master
|
cd /tmp/acme.sh-master
|
||||||
bash acme.sh install
|
bash acme.sh install
|
||||||
@@ -109,7 +115,11 @@ fi
|
|||||||
echo "use system version: ${OSNAME}"
|
echo "use system version: ${OSNAME}"
|
||||||
|
|
||||||
if [ "${OSNAME}" == "macos" ];then
|
if [ "${OSNAME}" == "macos" ];then
|
||||||
curl -fsSL ${HTTP_PREFIX}raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install/macos.sh | bash
|
if [ "$LOCAL_ADDR" != "common" ];then
|
||||||
|
curl -fsSL https://gitee.com/midoks/mdserver-web/raw/dev/scripts/install/macos.sh | bash
|
||||||
|
else
|
||||||
|
curl -fsSL ${HTTP_PREFIX}https://raw.githubusercontent.com/midoks/mdserver-web/dev/scripts/install/macos.sh | bash
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
|
cd /www/server/mdserver-web && bash scripts/install/${OSNAME}.sh
|
||||||
fi
|
fi
|
||||||
|
|||||||
+10
-2
@@ -47,9 +47,17 @@ else
|
|||||||
echo "OK"
|
echo "OK"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
# cn=$(curl -fsSL -m 10 http://ipinfo.io/json | grep "\"country\": \"CN\"")
|
||||||
|
HTTP_PREFIX="https://"
|
||||||
|
LOCAL_ADDR=common
|
||||||
|
ping -c 1 github.com > /dev/null 2>&1
|
||||||
|
if [ "$?" != "0" ];then
|
||||||
|
LOCAL_ADDR=cn
|
||||||
|
HTTP_PREFIX="https://ghproxy.com/"
|
||||||
|
fi
|
||||||
|
|
||||||
PIPSRC="https://pypi.python.org/simple"
|
PIPSRC="https://pypi.python.org/simple"
|
||||||
if [ ! -z "$cn" ];then
|
if [ "$LOCAL_ADDR" != "common" ];then
|
||||||
PIPSRC="https://pypi.tuna.tsinghua.edu.cn/simple"
|
PIPSRC="https://pypi.tuna.tsinghua.edu.cn/simple"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+11
-2
@@ -55,8 +55,17 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
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 [ ! -z "$cn" ];then
|
HTTP_PREFIX="https://"
|
||||||
|
LOCAL_ADDR=common
|
||||||
|
ping -c 1 github.com > /dev/null 2>&1
|
||||||
|
if [ "$?" != "0" ];then
|
||||||
|
LOCAL_ADDR=cn
|
||||||
|
HTTP_PREFIX="https://ghproxy.com/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ "$LOCAL_ADDR" != "common" ];then
|
||||||
curl -sSLo /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip
|
curl -sSLo /tmp/master.zip https://gitee.com/midoks/mdserver-web/repository/archive/master.zip
|
||||||
else
|
else
|
||||||
curl -sSLo /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
|
curl -sSLo /tmp/master.zip https://codeload.github.com/midoks/mdserver-web/zip/master
|
||||||
|
|||||||
+10
-2
@@ -54,8 +54,16 @@ else
|
|||||||
OSNAME='unknow'
|
OSNAME='unknow'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
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 [ ! -z "$cn" ];then
|
HTTP_PREFIX="https://"
|
||||||
|
LOCAL_ADDR=common
|
||||||
|
ping -c 1 github.com > /dev/null 2>&1
|
||||||
|
if [ "$?" != "0" ];then
|
||||||
|
LOCAL_ADDR=cn
|
||||||
|
HTTP_PREFIX="https://ghproxy.com/"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$LOCAL_ADDR" != "common" ];then
|
||||||
curl -sSLo /tmp/dev.zip https://gitee.com/midoks/mdserver-web/repository/archive/dev.zip
|
curl -sSLo /tmp/dev.zip https://gitee.com/midoks/mdserver-web/repository/archive/dev.zip
|
||||||
else
|
else
|
||||||
curl -sSLo /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip
|
curl -sSLo /tmp/dev.zip https://github.com/midoks/mdserver-web/archive/refs/heads/dev.zip
|
||||||
|
|||||||
Reference in New Issue
Block a user