Skip to content

Commit

Permalink
feat: 输出二维码登录链接,显示+1概率 (#268)
Browse files Browse the repository at this point in the history
* feat: 输出二维码登录链接,显示+1概率

* modified:   utils/system_info.py

* modified:   miuitask.py

* modified:   requirements.txt
modified:   utils/api/login.py

* modified:   utils/api/login.py

* Update Dockerfile

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: 0-8-4 <ljd69154@liangjundi.cn>
  • Loading branch information
3 people authored Apr 6, 2024
1 parent 597bd50 commit 08ddd7c
Show file tree
Hide file tree
Showing 11 changed files with 286 additions and 168 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM python:alpine

RUN apk add --no-cache gcc g++ musl-dev python3-dev libffi-dev
RUN apk add --no-cache gcc g++ musl-dev python3-dev libffi-dev rust cargo

RUN pip install --no-cache-dir pdm

Expand Down
29 changes: 19 additions & 10 deletions miuitask.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
'''
Date: 2023-11-13 20:29:19
"""
Author: Night-stars-1 nujj1042633805@gmail.com
Date: 2024-02-21 22:50:45
LastEditTime: 2024-04-05 22:43:45
LastEditors: Night-stars-1 nujj1042633805@gmail.com
LastEditTime: 2023-12-18 19:21:36
'''
"""

# new Env("MIUI-Auto-Task") # pylint: disable=missing-module-docstring
# cron 30 8 * * * miuitask.py

import asyncio

from tenacity import RetryError, Retrying, stop_after_attempt
from tenacity import Retrying, stop_after_attempt

from utils.api.login import Login
from utils.api.sign import BaseSign, CheckIn
Expand All @@ -30,27 +32,34 @@ async def main():
with attempt:
login_obj = Login(account)
if cookies := await login_obj.login():
sign_obj = BaseSign(cookies, account.user_agent)
await login_obj.checkin_info()
sign_obj = BaseSign(account)
daily_tasks = await sign_obj.check_daily_tasks()
sign_task_obj = sign_obj.AVAILABLE_SIGNS # 签到任务对象合集
for task in daily_tasks:
log.info(f"开始执行{task.name}任务")
if task.showType:
log.info(f"{task.name}任务已完成")
continue
if not (task_obj := sign_task_obj.get(task.name)): # 签到任务对象
if not (
task_obj := sign_task_obj.get(task.name)
): # 签到任务对象
log.error(f"未找到{task.name}任务")
continue
if not getattr(account, task_obj.__name__):
log.info(f"任务{task.name}被禁用")
continue
token = await get_token(cookies["cUserId"]) if task_obj == CheckIn else None
status, reason = await task_obj(cookies, account.user_agent, token).sign()
token = (
await get_token(cookies["cUserId"])
if task_obj == CheckIn
else None
)
status, reason = await task_obj(account, token).sign()
if not status and reason == "cookie":
raise ValueError("Cookie失效")
user_info = await sign_obj.user_info()
log.info(f"{user_info.title} 成长值: {user_info.point}")
except RetryError:
except ValueError:
...
notify_me(InterceptHandler.message)

Expand Down
15 changes: 14 additions & 1 deletion pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies = [
"tzdata>=2023.3",
"onepush>=1.3.0",
"qrcode>=7.4.2",
"requests-toolbelt>=1.0.0",
]
requires-python = ">=3.11"
license = {text = "MIT"}
Expand Down
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
cryptography==41.0.7
cryptography==42.0.4
httpx==0.25.2
loguru==0.7.2
onepush==1.3.0
orjson==3.9.10
orjson==3.9.15
pydantic==2.5.2
PyYAML==6.0.1
qrcode==7.4.2
tenacity==8.2.3
qrcode>=7.4.2
Loading

0 comments on commit 08ddd7c

Please sign in to comment.