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='原神猜语音时间',