mirror of
https://github.com/aaPanel/aaPanel.git
synced 2026-08-20 06:35:47 +02:00
1. Added Mail Marketing Automation trigger tasks 2. Added Mail Marketing Groups Import, Export, Merge 3. Added Mail Marketing Subscribers to support paste import 4. Added Mail Marketing Template Import Export Duplicate 5. Added Mail server add timed automatic reply 6. Added HTTPS Protection function for Website (disables automatic HTTP to HTTPS redirection when enabled) 7. Optimize Website Interface Button Integration 8. Optimize the response speed of WP Toolkit interface
60 lines
2.1 KiB
Python
60 lines
2.1 KiB
Python
# coding: utf-8
|
||
# -------------------------------------------------------------------
|
||
# aaPanel
|
||
# -------------------------------------------------------------------
|
||
# Copyright (c) 2015-2099 aaPanel(www.aapanel.com) All rights reserved.
|
||
# -------------------------------------------------------------------
|
||
# Author: zouhw <zhw@aapanel.com>
|
||
# -------------------------------------------------------------------
|
||
|
||
# ------------------------------
|
||
# Docker模型
|
||
# ------------------------------
|
||
import public
|
||
import dk_public as dp
|
||
|
||
class main:
|
||
|
||
# 获取docker主机列表
|
||
def get_list(self,args=None):
|
||
info = dp.sql("hosts").select()
|
||
for i in info:
|
||
if dp.docker_client(i['url']):
|
||
i['status'] = True
|
||
else:
|
||
i['status'] = False
|
||
return info
|
||
|
||
# 添加docker主机
|
||
def add(self,args):
|
||
"""
|
||
:param url 连接主机的url
|
||
:param remark 主机备注
|
||
:return:
|
||
"""
|
||
import time
|
||
host_lists = self.get_list()
|
||
for h in host_lists:
|
||
if h['url'] == args.url:
|
||
return public.returnMsg(False, public.lang("The host already exists!"))
|
||
# 测试连接
|
||
if not dp.docker_client(args.url):
|
||
return public.returnMsg(False, public.lang("Failed to connect to the server, please check if docker is started!"))
|
||
pdata = {
|
||
"url": args.url,
|
||
"remark": public.xsssec(args.remark),
|
||
"time": int(time.time())
|
||
}
|
||
dp.write_log("Add host [{}] successful!".format(args.url))
|
||
dp.sql('hosts').insert(pdata)
|
||
return public.returnMsg(True, public.lang("Add docker host successfully!"))
|
||
|
||
def delete(self,args):
|
||
"""
|
||
:param id 连接主机id
|
||
:return:
|
||
"""
|
||
data = dp.sql('hosts').where('id=?',args(args.id,)).find()
|
||
dp.sql('hosts').delete(id=args.id)
|
||
dp.write_log("Delete host [{}] successful!".format(data['url']))
|
||
return public.returnMsg(True, public.lang("Delete host successfully!")) |