pull/109/head
midoks 3 years ago
parent 422a74aa1d
commit 52f118b1bb
  1. 8
      class/core/site_api.py

@ -1526,9 +1526,13 @@ class site_api:
def getSecurity(self, sid, name): def getSecurity(self, sid, name):
filename = self.getHostConf(name) filename = self.getHostConf(name)
conf = mw.readFile(filename) conf = mw.readFile(filename)
if type(conf) == bool:
return mw.returnJson(False, '读取配置文件失败!')
data = {} data = {}
if conf.find('SECURITY-START') != -1: if conf.find('SECURITY-START') != -1:
rep = "#SECURITY-START(\n|.){1,500}#SECURITY-END" rep = "#SECURITY-START(.|\n)*#SECURITY-END"
tmp = re.search(rep, conf).group() tmp = re.search(rep, conf).group()
data['fix'] = re.search( data['fix'] = re.search(
"\(.+\)\$", tmp).group().replace('(', '').replace(')$', '').replace('|', ',') "\(.+\)\$", tmp).group().replace('(', '').replace(')$', '').replace('|', ',')
@ -1553,7 +1557,7 @@ class site_api:
if os.path.exists(file): if os.path.exists(file):
conf = mw.readFile(file) conf = mw.readFile(file)
if conf.find('SECURITY-START') != -1: if conf.find('SECURITY-START') != -1:
rep = "\s{0,4}#SECURITY-START(\n|.){1,500}#SECURITY-END\n?" rep = "\s{0,4}#SECURITY-START(\n|.)*#SECURITY-END\n?"
conf = re.sub(rep, '', conf) conf = re.sub(rep, '', conf)
mw.writeLog('网站管理', '站点[' + name + ']已关闭防盗链设置!') mw.writeLog('网站管理', '站点[' + name + ']已关闭防盗链设置!')
else: else:

Loading…
Cancel
Save