From 1afab8dcc0bdb7e6022d39a1b9caba3723bc037d Mon Sep 17 00:00:00 2001 From: CMHopeSunshine <277073121@qq.com> Date: Sun, 1 Jan 2023 17:33:29 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E5=A2=9E=E5=8A=A0=E9=80=89?= =?UTF-8?q?=E6=8B=A9`=E5=8E=9F=E7=A5=9E=E7=BB=91=E5=AE=9A=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81`=E5=8F=91=E9=80=81=E5=BD=A2=E5=BC=8F?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B9=EF=BC=88=E5=9B=BE=E7=89=87|?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LittlePaimon/config/config/model.py | 1 + LittlePaimon/plugins/Paimon_Bind/get_cookie.py | 4 +++- LittlePaimon/web/pages/config_manage.py | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/LittlePaimon/config/config/model.py b/LittlePaimon/config/config/model.py index ba10762..87ec788 100644 --- a/LittlePaimon/config/config/model.py +++ b/LittlePaimon/config/config/model.py @@ -6,6 +6,7 @@ from pydantic import BaseModel, Field class ConfigModel(BaseModel): CookieWeb_enable: bool = Field(True, alias='启用CookieWeb') CookieWeb_url: str = Field('http://127.0.0.1:13579/LittlePaimon/cookie', alias='CookieWeb地址') + qrcode_bind_use_url: bool = Field(False, alias='绑定二维码以链接形式发送') sim_gacha_cd_group: int = Field(30, alias='模拟抽卡群冷却') sim_gacha_cd_member: int = Field(60, alias='模拟抽卡群员冷却') diff --git a/LittlePaimon/plugins/Paimon_Bind/get_cookie.py b/LittlePaimon/plugins/Paimon_Bind/get_cookie.py index 6cc0571..6e8696c 100644 --- a/LittlePaimon/plugins/Paimon_Bind/get_cookie.py +++ b/LittlePaimon/plugins/Paimon_Bind/get_cookie.py @@ -130,7 +130,7 @@ async def _(event: MessageEvent): # sourcery skip: use-fstring-for-concatenatio running_login_data[str(event.user_id)] = login_data img_b64 = generate_qrcode(login_data['url']) running_login_data[str(event.user_id)]['img_b64'] = img_b64 - img = f'二维码链接:{config.CookieWeb_url}/qrcode?user_id={event.user_id}' if config.CookieWeb_enable else MessageSegment.image(img_b64) + img = f'二维码链接:{config.CookieWeb_url}/qrcode?user_id={event.user_id}' if config.qrcode_bind_use_url else MessageSegment.image(img_b64) msg_data = await qrcode_bind.send( img + f'\n请在3分钟内使用米游社扫码并确认进行绑定。\n注意:1.扫码即代表你同意将Cookie信息授权给{NICKNAME}\n2.扫码时会提示登录原神,实际不会把你顶掉原神\n3.其他人请不要乱扫,否则会将你的账号绑到TA身上!', at_sender=True) @@ -203,6 +203,8 @@ app: FastAPI = get_app() @app.get('/LittlePaimon/cookie/qrcode') async def qrcode_img_url(user_id: str): + if not config.qrcode_bind_use_url: + return {'status': 'error', 'msg': '请在QQ内查看二维码'} if user_id not in running_login_data: return {'status': 'error', 'msg': '二维码不存在'} img_base64 = running_login_data[user_id]['img_b64'].lstrip('base64://') diff --git a/LittlePaimon/web/pages/config_manage.py b/LittlePaimon/web/pages/config_manage.py index 9d25cbd..4f4f0af 100644 --- a/LittlePaimon/web/pages/config_manage.py +++ b/LittlePaimon/web/pages/config_manage.py @@ -285,6 +285,14 @@ other_form = Form( onText='所有人', offText='仅超级用户' ), + Switch( + label='原神绑定二维码发送形式', + name='绑定二维码以链接形式发送', + value='${绑定二维码以链接形式发送}', + labelRemark=Remark(shape='circle', content='选择原神绑定二维码的发送形式(直接图片发送或者链接形式发送)'), + onText='链接', + offText='图片' + ), InputNumber( label='原神猜语音时间', name='原神猜语音时间',