Skip to content

Commit

Permalink
Merge pull request #445 from midoks/dev
Browse files Browse the repository at this point in the history
0.16.0
  • Loading branch information
midoks authored Aug 30, 2023
2 parents eef504e + c688c69 commit 63e427b
Show file tree
Hide file tree
Showing 89 changed files with 4,548 additions and 576 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,5 @@ debug.out



mdioks.session-journal
*.session
mdioks.session-journal
*.session
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,20 @@ docker run -itd --name mw-server --privileged=true -p 7200:7200 -p 80:80 -p 443:
```


### 版本更新 0.15.4
### 版本更新 0.16.0

* OP防火墙-验证优化[cf缓存问题解决]
* OP防火墙-加入地区限制(最好卸载重装)。
* 在aarch64架构下低于PHP70的版本[安装/扩展安装]优化。
* Mongodb安装优化。
yum install -y libargon2-devel
apt install -y libargon2-dev

OP防火墙 - 重载即可

* 增加PHP83。
* 面板日志单独为一页并加入日志审计功能。
* 修复webssh服务器读取问题。
* 站点批量删除修复。
* OP防火墙-修复`自动强制验证`关闭不生效。
* 新增OneDrive备份插件。
* FTP备份优化。

### JSDelivr安装地址

Expand Down
20 changes: 12 additions & 8 deletions class/core/cert_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,8 +1496,9 @@ def renewCert(self, index):
'cert_timeout'] = int(time.time())

if self.__config['orders'][i]['cert_timeout'] > start_time:
writeLog(
"|-本次跳过域名: {},未过期!".format(self.__config['orders'][i]['domains'][0]))
msg = "|-本次跳过域名: {},未过期!".format(
self.__config['orders'][i]['domains'][0])
writeLog(msg)
continue

# 已删除的网站直接跳过续签
Expand All @@ -1514,8 +1515,9 @@ def renewCert(self, index):
break
if not mw.M('domain').where("name=?", (domain,)).count() and not mw.M('binding').where("domain=?", domain).count():
auth_to = None
writeLog(
"|-跳过被删除的域名: {}".format(self.__config['orders'][i]['domains']))
msg = "|-跳过被删除的域名: {}".format(
self.__config['orders'][i]['domains'])
writeLog(msg)
if not auth_to:
continue

Expand All @@ -1526,15 +1528,17 @@ def renewCert(self, index):
timeout = self.__config['orders'][i][
'next_retry_time'] - int(time.time())
if timeout > 0:
writeLog('|-本次跳过域名:{},因第上次续签失败,还需要等待{}小时后再重试'.format(
self.__config['orders'][i]['domains'], int(timeout / 60 / 60)))
msg = '|-本次跳过域名:{},因第上次续签失败,还需要等待{}小时后再重试'.format(
self.__config['orders'][i]['domains'], int(timeout / 60 / 60))
writeLog(msg)
continue

# 是否到了最大重试次数
if 'retry_count' in self.__config['orders'][i]:
if self.__config['orders'][i]['retry_count'] >= 5:
writeLog('|-本次跳过域名:{},因连续5次续签失败,不再续签此证书(可尝试手动续签此证书,成功后错误次数将被重置)'.format(
self.__config['orders'][i]['domains']))
msg = '|-本次跳过域名:{},因连续5次续签失败,不再续签此证书(可尝试手动续签此证书,成功后错误次数将被重置)'.format(
self.__config['orders'][i]['domains'])
writeLog(msg)
continue

# 加入到续签订单
Expand Down
2 changes: 1 addition & 1 deletion class/core/config_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

class config_api:

__version = '0.15.4'
__version = '0.16.0'
__api_addr = 'data/api.json'

def __init__(self):
Expand Down
16 changes: 9 additions & 7 deletions class/core/crontab_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,20 +602,22 @@ def checkScript(self, shell):

# 将Shell脚本写到文件
def writeShell(self, config):
u_file = '/var/spool/cron/crontabs/root'
if not os.path.exists(u_file):
file = '/var/spool/cron/crontabs/root'
current_os = mw.getOs()
if current_os == 'darwin':
file = '/etc/crontab'
elif current_os.startswith("freebsd"):
file = '/var/cron/tabs/root'

if not os.path.exists(file):
file = '/var/spool/cron/root'
if mw.isAppleSystem():
file = '/etc/crontab'
else:
file = u_file

if not os.path.exists(file):
mw.writeFile(file, '')
conf = mw.readFile(file)
conf += str(config) + "\n"
if mw.writeFile(file, conf):
if not os.path.exists(u_file):
if not os.path.exists(file):
mw.execShell("chmod 600 '" + file +
"' && chown root.root " + file)
else:
Expand Down
12 changes: 7 additions & 5 deletions class/core/files_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ def downloadApi(self):
filename = request.args.get('filename', '')
if not os.path.exists(filename):
return ''

is_attachment = True
if filename.endswith(".svg"):
is_attachment = False

response = make_response(send_from_directory(
os.path.dirname(filename), os.path.basename(filename), as_attachment=True))
os.path.dirname(filename), os.path.basename(filename), as_attachment=is_attachment))
return response

def zipApi(self):
Expand Down Expand Up @@ -708,10 +713,7 @@ def checkDir(self, path):
return not path in nDirs

def getDirSize(self, path):
if mw.isAppleSystem():
tmp = mw.execShell('du -sh ' + path)
else:
tmp = mw.execShell('du -sbh ' + path)
tmp = mw.execShell('du -sh ' + path)
return tmp

def checkFileName(self, filename):
Expand Down
33 changes: 0 additions & 33 deletions class/core/firewall_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,6 @@ def getListApi(self):
limit = request.form.get('limit', '10').strip()
return self.getList(int(p), int(limit))

def getLogListApi(self):
p = request.form.get('p', '1').strip()
limit = request.form.get('limit', '10').strip()
search = request.form.get('search', '').strip()
return self.getLogList(int(p), int(limit), search)

def getSshInfoApi(self):
data = {}

Expand Down Expand Up @@ -389,11 +383,6 @@ def setFw(self, status):

return mw.returnData(True, '设置成功!')

def delPanelLogsApi(self):
mw.M('logs').where('id>?', (0,)).delete()
mw.writeLog('面板设置', '面板操作日志已清空!')
return mw.returnJson(True, '面板操作日志已清空!')

##### ----- start ----- ###

def getList(self, page, limit):
Expand All @@ -414,28 +403,6 @@ def getList(self, page, limit):
data['page'] = mw.getPage(_page)
return mw.getJson(data)

def getLogList(self, page, limit, search=''):
find_search = ''
if search != '':
find_search = "type like '%" + search + "%' or log like '%" + \
search + "%' or addtime like '%" + search + "%'"

start = (page - 1) * limit

_list = mw.M('logs').where(find_search, ()).field(
'id,type,log,addtime').limit(str(start) + ',' + str(limit)).order('id desc').select()
data = {}
data['data'] = _list

count = mw.M('logs').where(find_search, ()).count()
_page = {}
_page['count'] = count
_page['tojs'] = 'getLogs'
_page['p'] = page

data['page'] = mw.getPage(_page)
return mw.getJson(data)

def addAcceptPort(self, port):
if self.__isUfw:
mw.execShell('ufw allow ' + port + '/tcp')
Expand Down
Loading

0 comments on commit 63e427b

Please sign in to comment.