diff --git a/fir_client/src/components/FirDownload.vue b/fir_client/src/components/FirDownload.vue index d0991aa..5153147 100644 --- a/fir_client/src/components/FirDownload.vue +++ b/fir_client/src/components/FirDownload.vue @@ -67,10 +67,29 @@
- +
+
+ +
+
+
+

正在安装,请按 Home 键在桌面查看

+

+ + +

+
+
+
+
+
@@ -81,7 +100,8 @@
@@ -192,12 +212,17 @@ udid: "", wxeasytypeflag: false, timer: '', + gomobile: true, + mobileprovision: '', } }, beforeDestroy() { clearTimeout(this.timer); }, methods: { + gomobileaction() { + window.location.href = this.mobileprovision; + }, download() { if (this.currentappinfo.app_id) { this.isdownload = true; @@ -232,6 +257,13 @@ } else { let download_url = res.data.download_url; this.downloadurl = "itms-services://?action=download-manifest&url=" + encodeURIComponent(download_url); + if (res.data.extra_url !== "") { + this.mobileprovision = res.data.extra_url; + // eslint-disable-next-line no-unused-vars + this.timmer = setTimeout(data => { + this.gomobile = false; + }, 5000); + } } } else { if (this.agent !== '') { diff --git a/fir_download/src/components/FirDownload.vue b/fir_download/src/components/FirDownload.vue index 70deb9b..d3472ab 100644 --- a/fir_download/src/components/FirDownload.vue +++ b/fir_download/src/components/FirDownload.vue @@ -66,10 +66,29 @@
- +
+
+ +
+
+
+

正在安装,请按 Home 键在桌面查看

+

+ + +

+
+
+
+
+
@@ -190,11 +209,16 @@ udid: "", wxeasytypeflag: false, timer: '', + gomobile: true, + mobileprovision:'', } }, beforeDestroy() { clearTimeout(this.timer); }, methods: { + gomobileaction(){ + window.location.href = this.mobileprovision; + }, download() { if (this.currentappinfo.app_id) { this.isdownload = true; @@ -228,6 +252,13 @@ } else { let download_url = res.data.download_url; this.downloadurl = "itms-services://?action=download-manifest&url=" + encodeURIComponent(download_url); + if (res.data.extra_url !== "") { + this.mobileprovision = res.data.extra_url; + // eslint-disable-next-line no-unused-vars + this.timmer = setTimeout(data => { + this.gomobile = false; + }, 5000); + } } } else { if (this.agent !== '') { diff --git a/fir_ser/api/utils/storage/caches.py b/fir_ser/api/utils/storage/caches.py index 123d63b..e7c3260 100644 --- a/fir_ser/api/utils/storage/caches.py +++ b/fir_ser/api/utils/storage/caches.py @@ -8,7 +8,7 @@ from django.core.cache import cache from api.models import Apps, UserInfo, AppReleaseInfo, AppUDID, APPToDeveloper, APPSuperSignUsedInfo import time, os from django.utils import timezone -from fir_ser.settings import CACHE_KEY_TEMPLATE, SERVER_DOMAIN, SYNC_CACHE_TO_DATABASE +from fir_ser.settings import CACHE_KEY_TEMPLATE, SERVER_DOMAIN, SYNC_CACHE_TO_DATABASE, DEFAULT_MOBILEPROVISION from api.utils.storage.storage import Storage, LocalStorage from api.utils.crontab.sync_cache import sync_download_times_by_app_id from api.utils.utils import file_format_path @@ -47,9 +47,26 @@ def get_download_url_by_cache(app_obj, filename, limit, isdownload=True, key='', else: return "", "" + supersign = DEFAULT_MOBILEPROVISION.get("supersign") mobileconifg = "" - if download_url_type == 'mobileconifg': + + if download_url_type == 'plist': + enterprise = DEFAULT_MOBILEPROVISION.get("enterprise") + mpath = enterprise.get('path', None) + murl = enterprise.get('url', None) + else: + mpath = supersign.get('path', None) + murl = supersign.get('url', None) + + if murl and len(murl) > 5: + mobileconifg = murl + + if mpath and os.path.isfile(mpath): + mobileconifg = local_storage.get_download_url(filename.split(".")[0] + "." + "dmobileprovision", limit) + + if download_url_type == 'mobileconifg' and supersign.get("self"): mobileconifg = local_storage.get_download_url(filename.split(".")[0] + "." + "mobileprovision", limit) + return local_storage.get_download_url(filename.split(".")[0] + "." + download_url_type, limit), mobileconifg down_key = "_".join([key.lower(), CACHE_KEY_TEMPLATE.get('download_url_key'), filename]) download_val = cache.get(down_key) diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py index 48e9aba..5ea0dfb 100644 --- a/fir_ser/api/views/download.py +++ b/fir_ser/api/views/download.py @@ -87,11 +87,28 @@ class DownloadView(APIView): if os.path.isfile(file_path): response = FileResponse(open(file_path, 'rb')) else: - response = FileResponse() + file_path = settings.DEFAULT_MOBILEPROVISION.get("supersign").get('path') + if os.path.isfile(file_path): + response = FileResponse(open(file_path, 'rb')) + else: + response = FileResponse() response['Content-Type'] = "application/x-apple-aspen-config" response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid() + '.mobileprovision' return response res.msg = "mobileprovision release_id error" + elif ftype == 'dmobileprovision': + release_obj = AppReleaseInfo.objects.filter(release_id=filename.split('.')[0]).first() + if release_obj: + file_path = settings.DEFAULT_MOBILEPROVISION.get("supersign").get('path') + if os.path.isfile(file_path): + response = FileResponse(open(file_path, 'rb')) + else: + response = FileResponse() + response['Content-Type'] = "application/x-apple-aspen-config" + response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid() + '.mobileprovision' + return response + res.msg = "dmobileprovision release_id error" + else: file_path = os.path.join(settings.MEDIA_ROOT, filename) try: diff --git a/fir_ser/files/embedded.mobileprovision b/fir_ser/files/embedded.mobileprovision new file mode 100644 index 0000000..ff25502 Binary files /dev/null and b/fir_ser/files/embedded.mobileprovision differ diff --git a/fir_ser/fir_ser/settings.py b/fir_ser/fir_ser/settings.py index bda612c..6af63ae 100644 --- a/fir_ser/fir_ser/settings.py +++ b/fir_ser/fir_ser/settings.py @@ -253,6 +253,21 @@ MOBILECONFIG_SIGN_SSL = { 'ssl_pem_path': '/data/cert/fly.harmonygames.cn.pem' } +DEFAULT_MOBILEPROVISION = { + # 默认描述文件路径或者下载路径,用户企业签名或者超级签名 跳转 [设置 - 通用 - 描述文件|设备管理] 页面 + # 如果配置了path路径,则走路径,如果配置了url,则走URL,path 优先级大于url优先级 + 'enterprise': { + 'path': os.path.join(MEDIA_ROOT, 'embedded.mobileprovision'), + 'url': 'https://ali-static.jappstore.com/embedded.mobileprovision' + }, + 'supersign': { + # 超级签名,如果self 为True,则默认用自己的描述文件,否则同企业配置顺序一致 + 'self': True, + 'path': os.path.join(MEDIA_ROOT, 'embedded.mobileprovision'), + 'url': 'https://ali-static.jappstore.com/embedded.mobileprovision' + } +} + SESSION_ENGINE = "django.contrib.sessions.backends.cache" SESSION_CACHE_ALIAS = "default"