From 42478f21d93f218ea9015304813f017ef7dea844 Mon Sep 17 00:00:00 2001 From: isummer Date: Fri, 19 Aug 2022 17:16:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E6=8E=88=E6=9D=83=E7=A0=81?= =?UTF-8?q?=E4=B8=BA=E4=B8=80=E6=AC=A1=EF=BC=8C=E8=B6=85=E7=BA=A7=E7=AD=BE?= =?UTF-8?q?=E8=8B=B9=E6=9E=9C=E5=8C=85=E4=B8=8B=E8=BD=BD=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E9=97=AE=E9=A2=98=202.=E4=BF=AE=E5=A4=8D=E7=A7=81=E6=9C=89?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E9=A1=B5=E8=B7=B3=E8=BD=AC=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=A1=B5=E9=9D=A2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/api/utils/modelutils.py | 5 ++++- fir_ser/common/libs/mp/wechat.py | 5 ----- fir_ser/common/utils/download.py | 2 +- fir_ser/xsign/views/receiveudids.py | 10 +++++++--- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/fir_ser/api/utils/modelutils.py b/fir_ser/api/utils/modelutils.py index 85c625e..3344206 100644 --- a/fir_ser/api/utils/modelutils.py +++ b/fir_ser/api/utils/modelutils.py @@ -323,4 +323,7 @@ def get_user_storage_obj(user_obj, default=False): def get_preview_short_config(user_obj, short): - return f"{'#/' if UserConfig(user_obj).PREVIEW_ROUTE_HASH else ''}{short}" + if user_obj: + return f"{'#/' if UserConfig(user_obj).PREVIEW_ROUTE_HASH else ''}{short}" + else: + return f"{'#/' if Config.PREVIEW_ROUTE_HASH else ''}{short}" diff --git a/fir_ser/common/libs/mp/wechat.py b/fir_ser/common/libs/mp/wechat.py index e0514ea..466ee68 100644 --- a/fir_ser/common/libs/mp/wechat.py +++ b/fir_ser/common/libs/mp/wechat.py @@ -72,11 +72,6 @@ def create_menu(menu_json=None): "name": "官方地址", "key": "flyapps" }, - { - "type": "view", - "name": "留言反馈", - "url": "https://flyapps.cn/gbook/" - }, { "type": "click", "name": "查询当前绑定", diff --git a/fir_ser/common/utils/download.py b/fir_ser/common/utils/download.py index 2f90333..822b6e0 100644 --- a/fir_ser/common/utils/download.py +++ b/fir_ser/common/utils/download.py @@ -125,7 +125,7 @@ def get_app_download_url(request, res, app_id, short, password, release_id, is_d logger.info(f'app download url :{res.data}') if download_url != "" and "mobileconifg" not in download_url: - if not check_app_download_token(app_obj.get("need_password"), is_download, app_id, password): + if not check_app_download_token(app_obj.get("need_password"), is_download, app_id, password, bool(udid)): res.code = 1006 res.msg = '下载授权码有误' return res diff --git a/fir_ser/xsign/views/receiveudids.py b/fir_ser/xsign/views/receiveudids.py index 8957e7a..952948e 100644 --- a/fir_ser/xsign/views/receiveudids.py +++ b/fir_ser/xsign/views/receiveudids.py @@ -15,7 +15,7 @@ from rest_framework.views import APIView from api.models import Apps, AppDownloadToken from api.utils.modelutils import get_redirect_server_domain, add_remote_info_from_request, \ - get_app_download_uri + get_app_download_uri, get_preview_short_config from api.utils.response import BaseResponse from common.base.baseutils import get_real_ip_address, make_random_uuid, get_server_domain_from_request, AesBaseCrypt from common.cache.storage import TaskStateCache @@ -56,12 +56,16 @@ class IosUDIDView(APIView): stream_f = str(request.body) format_udid_info = udid_bytes_to_dict(stream_f) logger.info(f"short {short} receive new udid {format_udid_info}") + org_short = short + short = get_preview_short_config(None, short) server_domain = get_redirect_server_domain(request) try: app_obj = Apps.objects.filter(short=short, app_id=app_id).first() if app_obj: + user_obj = app_obj.user_id + short = get_preview_short_config(user_obj, short) if p_token and verify_token(p_token, app_obj.app_id, True): - server_domain = get_app_download_uri(request, app_obj.user_id, app_obj, preview=False) + server_domain = get_app_download_uri(request, user_obj, app_obj, preview=False) if app_obj.issupersign and app_obj.user_id.supersign_active: res = check_app_permission(app_obj, BaseResponse()) if res.code != 1000: @@ -76,7 +80,7 @@ class IosUDIDView(APIView): # return Response('ok') data = { 'format_udid_info': format_udid_info, - 'short': short, + 'short': org_short, 'app_id': app_id, 'client_ip': client_ip, 'r_token': make_token(app_obj.app_id, time_limit=60, key='receive_udid', force_new=True)