mirror of
https://github.com/midoks/mdserver-web.git
synced 2026-10-18 23:45:52 +08:00
u
This commit is contained in:
@@ -22,6 +22,7 @@ class site_api:
|
||||
|
||||
setupPath = None # 安装路径
|
||||
vhostPath = None
|
||||
logsPath = None
|
||||
rewritePath = None
|
||||
sslDir = None # ssl目录
|
||||
|
||||
@@ -35,6 +36,8 @@ class site_api:
|
||||
if not os.path.exists(rw):
|
||||
public.execShell("mkdir -p " + rw + " && chmod -R 755 " + rw)
|
||||
|
||||
self.logsPath = public.getRootDir() + '/wwwlogs'
|
||||
|
||||
# ssl conf
|
||||
if public.isAppleSystem():
|
||||
self.sslDir = self.setupPath + '/letsencrypt/'
|
||||
@@ -166,6 +169,24 @@ class site_api:
|
||||
public.execShell("which chattr && chattr +i " + filename)
|
||||
return public.returnJson(True, '已打开防跨站设置!')
|
||||
|
||||
def logsOpenApi(self):
|
||||
mid = request.form.get('id', '').encode('utf-8')
|
||||
name = public.M('sites').where("id=?", (mid,)).getField('name')
|
||||
|
||||
# NGINX
|
||||
filename = self.getHostConf(name)
|
||||
if os.path.exists(filename):
|
||||
conf = public.readFile(filename)
|
||||
rep = self.logsPath + "/" + name + ".log"
|
||||
if conf.find(rep) != -1:
|
||||
conf = conf.replace(rep, "off")
|
||||
else:
|
||||
conf = conf.replace('access_log off', 'access_log ' + rep)
|
||||
public.writeFile(filename, conf)
|
||||
|
||||
public.restartWeb()
|
||||
return public.returnJson(True, '操作成功!')
|
||||
|
||||
def getCertListApi(self):
|
||||
try:
|
||||
vpath = self.sslDir
|
||||
|
||||
Reference in New Issue
Block a user