Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
doc: trim Trailing Whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
a76yyyy committed May 24, 2023
1 parent 8f8d0b8 commit 0729c1f
Show file tree
Hide file tree
Showing 52 changed files with 317 additions and 317 deletions.
24 changes: 12 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ Nothing right now.
> 源码部署更新方式如下, 如**更新后发生错误请重新拉取容器!**
``` bash
# 先cd到源码所在目录, 执行命令后重启进程
# 先cd到源码所在目录, 执行命令后重启进程
wget https://fastly.jsdelivr.net/gh/qd-today/qd@master/update.sh -O ./update.sh && \
sh ./update.sh
sh ./update.sh
```

## [20220208] - 2022.02.08 更新
Expand Down Expand Up @@ -327,20 +327,20 @@ Nothing right now.
```python
# 以下为全局代理域名列表相关设置
# proxies为全局代理域名列表, 默认为空[], 表示不启用全局代理;
# 代理格式应为'scheme://username:password@host:port',例如:proxies = ['http://admin:[email protected]:8923','https://proxy.com:8888'];
# 任务级代理请在新建或修改任务时添加,任务级代理优先级大于全局代理;
proxies = os.getenv('PROXIES', '').split('|') # 若希望部分地址不走代理, 请修改proxy_direct_mode及proxy_direct
proxy_direct_mode = os.getenv('PROXY_DIRECT_MODE', '') # 默认为空, 可选输入:'url'为网址匹配模式;'regexp'为正则表达式匹配模式;''空则不启用全局代理黑名单
# proxy_direct_mode = os.getenv('PROXY_DIRECT_MODE', 'url')进入网址完全匹配模式, 在proxy_direct名单的url均不通过代理请求, 以'|'分隔url网址, url格式应为scheme://domain或scheme://domain:port
# 例如: proxy_direct = os.getenv('PROXY_DIRECT', 'http://127.0.0.1:80|https://localhost');
# proxy_direct_mode= os.getenv('PROXY_DIRECT_MODE', 'regexp')进入正则表达式匹配模式, 满足正则表达式的网址均不通过代理请求;
# proxies为全局代理域名列表, 默认为空[], 表示不启用全局代理;
# 代理格式应为'scheme://username:password@host:port',例如:proxies = ['http://admin:[email protected]:8923','https://proxy.com:8888'];
# 任务级代理请在新建或修改任务时添加,任务级代理优先级大于全局代理;
proxies = os.getenv('PROXIES', '').split('|') # 若希望部分地址不走代理, 请修改proxy_direct_mode及proxy_direct
proxy_direct_mode = os.getenv('PROXY_DIRECT_MODE', '') # 默认为空, 可选输入:'url'为网址匹配模式;'regexp'为正则表达式匹配模式;''空则不启用全局代理黑名单
# proxy_direct_mode = os.getenv('PROXY_DIRECT_MODE', 'url')进入网址完全匹配模式, 在proxy_direct名单的url均不通过代理请求, 以'|'分隔url网址, url格式应为scheme://domain或scheme://domain:port
# 例如: proxy_direct = os.getenv('PROXY_DIRECT', 'http://127.0.0.1:80|https://localhost');
# proxy_direct_mode= os.getenv('PROXY_DIRECT_MODE', 'regexp')进入正则表达式匹配模式, 满足正则表达式的网址均不通过代理请求;
# 启用regexp模式后自动采用以下默认匹配正则表达式, 如无特别需求请勿修改
proxy_direct = os.getenv('PROXY_DIRECT', r"""(?xi)\A
([a-z][a-z0-9+\-.]*://)? # Scheme
(0(.0){3}|127(.0){2}.1|localhost|\[::([\d]+)?\]) # Domain/Hostname/IPv4/IPv6
(:[0-9]+)? """ # :Port
)
)
```

## [20210908] - 2021.09.08 更新
Expand Down Expand Up @@ -393,7 +393,7 @@ Nothing right now.

```bash
# 如需使用Proxy功能请安装PyCurl
# Windows源码运行, 请执行 pip install pycurl==7.43.0.5
# Windows源码运行, 请执行 pip install pycurl==7.43.0.5
pip install pycurl # pip3 install pycurl
# 如因curl导致500或599错误, 请卸载PyCurl或修改环境变量USE_PYCURL为False
# pip uninstall pycurl
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ RUN sed -i 's/mirrors.ustc.edu.cn/dl-cdn.alpinelinux.org/g' /etc/apk/repositorie
apk del .build_deps && \
sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
rm -rf /var/cache/apk/* && \
rm -rf /usr/share/man/*
rm -rf /usr/share/man/*

ENV PORT 80
EXPOSE $PORT/tcp
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.ja3
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# 基础镜像
# 集成 curl-impersonate 解决 ja3 指纹被识别为 curl 的问题
# 集成 curl-impersonate 解决 ja3 指纹被识别为 curl 的问题
# https://github.com/qd-today/qd/issues/289
# 不支持 http3 和 Quic 连接, 如需相关功能请使用 latest 版本
FROM a76yyyy/pycurl:ja3-latest
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.lite
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 基础镜像
# 去除了 OCR 相关功能, 其他与 latest 版本保持一致.
# 适用于硬盘空间不大于 600M 的 Docker 构建.
# 去除了 OCR 相关功能, 其他与 latest 版本保持一致.
# 适用于硬盘空间不大于 600M 的 Docker 构建.
FROM a76yyyy/pycurl:lite-latest

# 维护者信息
Expand Down Expand Up @@ -51,7 +51,7 @@ RUN sed -i 's/mirrors.ustc.edu.cn/dl-cdn.alpinelinux.org/g' /etc/apk/repositorie
apk del .build_deps && \
sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories && \
rm -rf /var/cache/apk/* && \
rm -rf /usr/share/man/*
rm -rf /usr/share/man/*

ENV PORT=80
EXPOSE $PORT/tcp
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
| 版本 | 是否获得支持 |
|------- | ------------------ |
| 202110xx | :white_check_mark: |
| 20211017 | :x: |
| 20230524 | :x: |

## 报告漏洞

Expand All @@ -16,7 +16,7 @@
告诉他们在哪里, 多长时间可以得到一个报告的漏洞的更新;

如果漏洞被接受或被拒绝, 会有什么结果, 等等。
<!--
<!--
# Security Policy
## Supported Versions
Expand Down
12 changes: 6 additions & 6 deletions backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

class DBnew():
def __init__(self, path):
self.path = path
def new(self, userid, maindb):
self.path = path

def new(self, userid, maindb):
try:
conn = sqlite3.connect(self.path)
c = conn.cursor()
Expand Down Expand Up @@ -129,7 +129,7 @@ def new(self, userid, maindb):
);
''' )

# 获取数据库信息
# 获取数据库信息
userid = int(userid)
user = maindb.db.user.get(id=userid, fields=('id', 'email', 'email_verified', 'password', 'password_md5', 'userkey', 'nickname', 'role', 'ctime', 'mtime', 'atime', 'cip',
'mip', 'aip', 'skey', 'barkurl', 'wxpusher', 'noticeflg', 'logtime', 'status', 'notepad', 'diypusher', 'qywx_token', 'tg_token', 'dingding_token', 'qywx_webhook', 'push_batch'))
Expand All @@ -140,7 +140,7 @@ def new(self, userid, maindb):
tpls.append(tpl)
tasks = []
tasklogs = []
for task in maindb.db.task.list(userid, fields=('id', 'tplid', 'userid', 'note', 'disabled', 'init_env', 'env', 'session', 'retry_count', 'retry_interval', 'last_success', 'success_count',
for task in maindb.db.task.list(userid, fields=('id', 'tplid', 'userid', 'note', 'disabled', 'init_env', 'env', 'session', 'retry_count', 'retry_interval', 'last_success', 'success_count',
'failed_count', 'last_failed', 'next', 'last_failed_count', 'ctime', 'mtime', 'ontimeflg', 'ontime', '_groups', 'pushsw', 'newontime'), limit=None):
if task['userid'] == userid:
tasks.append(task)
Expand All @@ -150,7 +150,7 @@ def new(self, userid, maindb):
c.close()
conn.close()


except Exception as e:
raise Exception("backup database error")
print("OK")
20 changes: 10 additions & 10 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ class redis(object):
unsafe_eval_timeout = float(os.getenv('UNSAFE_EVAL_TIMEOUT', 3.0)) # unsafe_eval 最大时间限制

# 以下为全局代理域名列表相关设置
# proxies为全局代理域名列表, 默认为空[], 表示不启用全局代理;
# 代理格式应为'scheme://username:password@host:port',例如:proxies = ['http://admin:[email protected]:8923','https://proxy.com:8888'];
# 任务级代理请在新建或修改任务时添加,任务级代理优先级大于全局代理;
proxies = os.getenv('PROXIES', '').split('|') # 若希望部分地址不走代理, 请修改proxy_direct_mode及proxy_direct
proxy_direct_mode = os.getenv('PROXY_DIRECT_MODE', 'regexp') # 默认为'regexp'以过滤本地请求, 可选输入:'regexp'为正则表达式匹配模式;'url'为网址匹配模式;''空则不启用全局代理黑名单
# proxy_direct_mode = os.getenv('PROXY_DIRECT_MODE', 'url')进入网址完全匹配模式, 在proxy_direct名单的url均不通过代理请求, 以'|'分隔url网址, url格式应为scheme://domain或scheme://domain:port
# 例如: proxy_direct = os.getenv('PROXY_DIRECT', 'http://127.0.0.1:80|https://localhost');
# proxy_direct_mode= os.getenv('PROXY_DIRECT_MODE', 'regexp')进入正则表达式匹配模式, 满足正则表达式的网址均不通过代理请求;
# proxies为全局代理域名列表, 默认为空[], 表示不启用全局代理;
# 代理格式应为'scheme://username:password@host:port',例如:proxies = ['http://admin:[email protected]:8923','https://proxy.com:8888'];
# 任务级代理请在新建或修改任务时添加,任务级代理优先级大于全局代理;
proxies = os.getenv('PROXIES', '').split('|') # 若希望部分地址不走代理, 请修改proxy_direct_mode及proxy_direct
proxy_direct_mode = os.getenv('PROXY_DIRECT_MODE', 'regexp') # 默认为'regexp'以过滤本地请求, 可选输入:'regexp'为正则表达式匹配模式;'url'为网址匹配模式;''空则不启用全局代理黑名单
# proxy_direct_mode = os.getenv('PROXY_DIRECT_MODE', 'url')进入网址完全匹配模式, 在proxy_direct名单的url均不通过代理请求, 以'|'分隔url网址, url格式应为scheme://domain或scheme://domain:port
# 例如: proxy_direct = os.getenv('PROXY_DIRECT', 'http://127.0.0.1:80|https://localhost');
# proxy_direct_mode= os.getenv('PROXY_DIRECT_MODE', 'regexp')进入正则表达式匹配模式, 满足正则表达式的网址均不通过代理请求;
# 启用regexp模式后自动采用以下默认匹配正则表达式, 如无特别需求请勿修改
proxy_direct = os.getenv('PROXY_DIRECT', r"""(?xi)\A
([a-z][a-z0-9+\-.]*://)? # Scheme
(0(.0){3}|127(.0){2}.1|localhost|\[::([\d]+)?\]) # Domain/Hostname/IPv4/IPv6
(:[0-9]+)? """ # :Port
)
)

new_task_delay = int(os.getenv('NEW_TASK_DELAY', 1)) # 新建任务后准备时间

Expand All @@ -127,7 +127,7 @@ class redis(object):

# google analytics
ga_key = "" # google analytics密钥
user0isadmin = bool(strtobool(os.getenv('USER0ISADMIN','True')))
user0isadmin = bool(strtobool(os.getenv('USER0ISADMIN','True')))

try:
from local_config import * # 修改local_config.py文件的内容不受通过git更新源码的影响
Expand Down
2 changes: 1 addition & 1 deletion db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ def __init__(self) -> None:
self.site = Site()
self.pubtpl = Pubtpl()
self.notepad = Notepad()

18 changes: 9 additions & 9 deletions db/notepad.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,31 +42,31 @@ async def get(self, userid, notepadid, fields=None, one_or_none=False, first=Tru
_fields = (getattr(Notepad, field) for field in fields)

smtm = select(_fields).where(Notepad.userid == userid).where(Notepad.notepadid == notepadid)

result = await self._get(smtm, one_or_none=one_or_none, first=first, sql_session=sql_session)
if to_dict and result is not None:
return self.to_dict(result,fields)
return result

async def list(self, fields=None, limit=1000, to_dict=True, sql_session=None, **kwargs):
if fields is None:
_fields = Notepad
else:
_fields = (getattr(Notepad, field) for field in fields)

smtm = select(_fields)

for key, value in kwargs.items():
smtm = smtm.where(getattr(Notepad, key) == value)

if limit:
smtm = smtm.limit(limit)

result = await self._get(smtm, sql_session=sql_session)
if to_dict and result is not None:
return [self.to_dict(row,fields) for row in result]
return result

def delete(self, userid, notepadid, sql_session=None):
return self._delete(delete(Notepad).where(Notepad.userid == userid).where(Notepad.notepadid == notepadid), sql_session=sql_session)

Expand All @@ -90,16 +90,16 @@ async def test():
print('notepad1_content: ',notepad1_content)
print('notepad_list: ',notepad_list)
print('notepad_list_content: ',notepad_list_content)

await notepad.mod(1,1,content='test1')
notepad1 = await notepad.get(1,1)
print('notepad1 after mod : ',notepad1)

await notepad.delete(1,1)
await notepad.delete(1,2)
await notepad.delete(2,1)
await notepad.delete(2,2)
return
return
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
task = asyncio.ensure_future(test(), loop=loop)
Expand Down
12 changes: 6 additions & 6 deletions db/pubtpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,30 +48,30 @@ async def get(self, id, fields=None, one_or_none=False, first=True, to_dict=True
_fields = (getattr(Pubtpl, field) for field in fields)

smtm = select(_fields).where(Pubtpl.id == id)

result = await self._get(smtm, one_or_none=one_or_none, first=first, sql_session=sql_session)
if to_dict and result is not None:
return self.to_dict(result,fields)
return result

async def list(self, fields=None, limit=1000, to_dict=True, sql_session=None, **kwargs):
if fields is None:
_fields = Pubtpl
else:
_fields = (getattr(Pubtpl, field) for field in fields)

smtm = select(_fields)

for key, value in kwargs.items():
smtm = smtm.where(getattr(Pubtpl, key) == value)

if limit:
smtm = smtm.limit(limit)

result = await self._get(smtm, sql_session=sql_session)
if to_dict and result is not None:
return [self.to_dict(row,fields) for row in result]
return result

def delete(self, id, sql_session=None):
return self._delete(delete(Pubtpl).where(Pubtpl.id == id), sql_session=sql_session)
10 changes: 5 additions & 5 deletions db/push_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PushRequest(BaseDB,AlchemyMixin):
id, from_tplid, from_userid, to_tplid, to_userid, status, msg, ctime, mtime, atime
'''
__tablename__ = 'push_request'

id = Column(Integer, primary_key=True)
from_tplid = Column(INTEGER, nullable=False)
from_userid = Column(INTEGER, nullable=False)
Expand Down Expand Up @@ -71,7 +71,7 @@ async def get(self, id, fields=None, one_or_none=False, first=True, to_dict=True
_fields = (getattr(PushRequest, field) for field in fields)

smtm = select(_fields).where(PushRequest.id == id)

result = await self._get(smtm, one_or_none=one_or_none, first=first, sql_session=sql_session)
if to_dict and result is not None:
return self.to_dict(result,fields)
Expand All @@ -82,12 +82,12 @@ async def list(self, fields=None, limit=1000, to_dict=True, sql_session=None, **
_fields = PushRequest
else:
_fields = (getattr(PushRequest, field) for field in fields)

smtm = select(_fields)

for key, value in kwargs.items():
smtm = smtm.where(getattr(PushRequest, key) == value)

if limit:
smtm = smtm.limit(limit)

Expand Down
4 changes: 2 additions & 2 deletions db/site.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Site(BaseDB,AlchemyMixin):
regEn
'''
__tablename__ = 'site'

id = Column(Integer, primary_key=True)
regEn = Column(INTEGER, nullable=False, server_default=text("'1'"))
MustVerifyEmailEn = Column(INTEGER, nullable=False, server_default=text("'0'"))
Expand All @@ -40,7 +40,7 @@ async def get(self, id, fields=None, one_or_none=False, first=True, to_dict=True
_fields = (getattr(Site, field) for field in fields)

smtm = select(_fields).where(Site.id == id)

result = await self._get(smtm, one_or_none=one_or_none, first=first, sql_session=sql_session)
if to_dict and result is not None:
return self.to_dict(result,fields)
Expand Down
10 changes: 5 additions & 5 deletions db/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async def get(self, id, fields=None, one_or_none=False, first=True, to_dict=True
_fields = (getattr(Task, field) for field in fields)

smtm = select(_fields).where(Task.id == id)

result = await self._get(smtm, one_or_none=one_or_none, first=first, sql_session=sql_session)
if to_dict and result is not None:
return self.to_dict(result,fields)
Expand All @@ -101,21 +101,21 @@ async def list(self, userid=None, fields=None, limit=1000, to_dict=True, scan=Fa
smtm = select(_fields)
if userid is not None:
smtm = smtm.where(Task.userid == userid)

if scan and scan_time is not None:
smtm = smtm.where(Task.next <= scan_time)

for key, value in kwargs.items():
smtm = smtm.where(getattr(Task, key) == value)

if limit:
smtm = smtm.limit(limit)

result = await self._get(smtm,sql_session=sql_session)
if to_dict and result is not None:
return [self.to_dict(row,fields) for row in result]
return result

def delete(self, id, sql_session=None):
return self._delete(delete(Task).where(Task.id == id), sql_session=sql_session)

Expand Down
Loading

0 comments on commit 0729c1f

Please sign in to comment.