|
|
|
@ -34,11 +34,11 @@ def get_download_url_by_cache(app_obj, filename, limit, is_download=True, key='' |
|
|
|
|
else: |
|
|
|
|
local_storage = LocalStorage(**Config.IOS_PMFILE_DOWNLOAD_DOMAIN) |
|
|
|
|
download_url_type = 'plist' |
|
|
|
|
if not udid: |
|
|
|
|
if udid: |
|
|
|
|
return run_xsign_app_download_url(app_obj, udid, download_url_type, limit) |
|
|
|
|
else: |
|
|
|
|
if app_obj.get('issupersign', None): |
|
|
|
|
download_url_type = 'mobileconifg' |
|
|
|
|
else: |
|
|
|
|
return run_xsign_app_download_url(app_obj, udid, download_url_type, limit) |
|
|
|
|
|
|
|
|
|
supersign = Config.DEFAULT_MOBILEPROVISION.get("supersign") |
|
|
|
|
mobileconifg = "" |
|
|
|
@ -63,17 +63,7 @@ def get_download_url_by_cache(app_obj, filename, limit, is_download=True, key='' |
|
|
|
|
return local_storage.get_download_url(filename.split(".")[0] + "." + download_url_type, limit), mobileconifg |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_app_instance_by_cache(app_id, password, is_download, limit, udid): |
|
|
|
|
if udid: |
|
|
|
|
app_info = Apps.objects.filter(app_id=app_id).values("pk", 'user_id', 'type', 'need_password', 'issupersign', |
|
|
|
|
'user_id__certification__status').first() |
|
|
|
|
if app_info: |
|
|
|
|
app_info['d_count'] = get_app_d_count_by_app_id(app_id) |
|
|
|
|
need_password = app_info.get("need_password") |
|
|
|
|
if need_password and not is_download: |
|
|
|
|
if not check_app_access_token(app_id, password): |
|
|
|
|
return False, '下载授权码有误' |
|
|
|
|
return True, app_info |
|
|
|
|
def get_app_instance_by_cache(app_id, limit): |
|
|
|
|
app_instance_cache = AppInstanceCache(app_id) |
|
|
|
|
app_obj_cache = app_instance_cache.get_storage_cache() |
|
|
|
|
if not app_obj_cache: |
|
|
|
@ -85,11 +75,6 @@ def get_app_instance_by_cache(app_id, password, is_download, limit, udid): |
|
|
|
|
app_instance_cache.set_storage_cache(app_obj_cache, limit) |
|
|
|
|
if not app_obj_cache: |
|
|
|
|
return False, '应用不存在' |
|
|
|
|
need_password = app_obj_cache.get("need_password") |
|
|
|
|
if need_password and not is_download: |
|
|
|
|
if not check_app_access_token(app_id, password): |
|
|
|
|
return False, '下载授权码有误' |
|
|
|
|
|
|
|
|
|
return True, app_obj_cache |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -114,8 +99,16 @@ def set_app_download_by_cache(app_id, limit=900): |
|
|
|
|
return download_times + 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def check_app_download_token(need_password, is_download, app_id, password, only_check=False, udid=None): |
|
|
|
|
if need_password: |
|
|
|
|
if is_download or check_app_access_token(app_id, password, only_check, udid): |
|
|
|
|
return True |
|
|
|
|
else: |
|
|
|
|
return True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_app_download_url(request, res, app_id, short, password, release_id, is_download, udid): |
|
|
|
|
status, app_obj = get_app_instance_by_cache(app_id, password, is_download, 900, udid) |
|
|
|
|
status, app_obj = get_app_instance_by_cache(app_id, 900) |
|
|
|
|
if status: |
|
|
|
|
if app_obj.get("type") == 0: |
|
|
|
|
app_type = '.apk' |
|
|
|
@ -127,6 +120,12 @@ def get_app_download_url(request, res, app_id, short, password, release_id, is_d |
|
|
|
|
|
|
|
|
|
res.data = {"download_url": download_url, "extra_url": extra_url} |
|
|
|
|
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): |
|
|
|
|
res.code = 1006 |
|
|
|
|
res.msg = '下载授权码有误' |
|
|
|
|
return res |
|
|
|
|
|
|
|
|
|
ip = get_real_ip_address(request) |
|
|
|
|
msg = f"remote ip {ip} short {short} download_url {download_url} app_obj {app_obj}" |
|
|
|
|
logger.info(msg) |
|
|
|
|