增加苹果企业签名,下载描述文件之后,自动跳转到描述文件安装设置

super_signature
xiaoyu 4 years ago
parent ce6a0e8dcc
commit d0700522ee
  1. 42
      fir_client/src/components/FirDownload.vue
  2. 39
      fir_download/src/components/FirDownload.vue
  3. 21
      fir_ser/api/utils/storage/caches.py
  4. 19
      fir_ser/api/views/download.py
  5. BIN
      fir_ser/files/embedded.mobileprovision
  6. 15
      fir_ser/fir_ser/settings.py

@ -67,10 +67,29 @@
<button type="button" v-else-if="wrong">{{ msg }}</button> <button type="button" v-else-if="wrong">{{ msg }}</button>
<div v-else> <div v-else>
<button v-if="isdownload" disabled="" class="loading" <div v-if="isdownload">
style="min-width: 42px; width: 42px; padding: 21px 0; border-top-color: transparent; border-left-color: transparent;"> <div v-if="gomobile">
&nbsp; <button disabled="" class="loading"
</button> style="min-width: 42px; width: 42px; padding: 21px 0; border-top-color: transparent; border-left-color: transparent;">
</button>
</div>
<div v-else>
<div class="actions type-ios">
<div><p>正在安装请按 Home 键在桌面查看</p>
<p>
<button @click="gomobileaction">
<el-link icon="el-icon-loadings" type="primary"
:underline="false">
立即信任
</el-link>
</button>
</p>
</div>
</div>
</div>
</div>
<div v-else> <div v-else>
<div v-if="currentappinfo.need_password" <div v-if="currentappinfo.need_password"
style="margin:0 auto; width:166px"> style="margin:0 auto; width:166px">
@ -81,7 +100,8 @@
</div> </div>
<el-divider v-if="currentappinfo.need_password"></el-divider> <el-divider v-if="currentappinfo.need_password"></el-divider>
<button @click="download"> <button @click="download">
<el-link icon="el-icon-loadings" type="primary" :underline="false"> <el-link icon="el-icon-loadings" type="primary"
:underline="false">
下载安装 下载安装
</el-link> </el-link>
</button> </button>
@ -192,12 +212,17 @@
udid: "", udid: "",
wxeasytypeflag: false, wxeasytypeflag: false,
timer: '', timer: '',
gomobile: true,
mobileprovision: '',
} }
}, },
beforeDestroy() { beforeDestroy() {
clearTimeout(this.timer); clearTimeout(this.timer);
}, },
methods: { methods: {
gomobileaction() {
window.location.href = this.mobileprovision;
},
download() { download() {
if (this.currentappinfo.app_id) { if (this.currentappinfo.app_id) {
this.isdownload = true; this.isdownload = true;
@ -232,6 +257,13 @@
} else { } else {
let download_url = res.data.download_url; let download_url = res.data.download_url;
this.downloadurl = "itms-services://?action=download-manifest&url=" + encodeURIComponent(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 { } else {
if (this.agent !== '') { if (this.agent !== '') {

@ -66,10 +66,29 @@
<button type="button" v-else-if="wrong">{{ msg }}</button> <button type="button" v-else-if="wrong">{{ msg }}</button>
<div v-else> <div v-else>
<button v-if="isdownload" disabled="" class="loading" <div v-if="isdownload">
style="min-width: 42px; width: 42px; padding: 21px 0; border-top-color: transparent; border-left-color: transparent;"> <div v-if="gomobile">
&nbsp; <button disabled="" class="loading"
</button> style="min-width: 42px; width: 42px; padding: 21px 0; border-top-color: transparent; border-left-color: transparent;">
</button>
</div>
<div v-else>
<div class="actions type-ios">
<div><p>正在安装请按 Home 键在桌面查看</p>
<p>
<button @click="gomobileaction">
<a icon="el-icon-loadings" type="primary"
:underline="false">
立即信任
</a>
</button>
</p>
</div>
</div>
</div>
</div>
<div v-else> <div v-else>
<div v-if="currentappinfo.need_password" style="margin:0 auto; width:166px"> <div v-if="currentappinfo.need_password" style="margin:0 auto; width:166px">
<input class="passwd" placeholder="请输入密码" v-model="password"/> <input class="passwd" placeholder="请输入密码" v-model="password"/>
@ -190,11 +209,16 @@
udid: "", udid: "",
wxeasytypeflag: false, wxeasytypeflag: false,
timer: '', timer: '',
gomobile: true,
mobileprovision:'',
} }
}, beforeDestroy() { }, beforeDestroy() {
clearTimeout(this.timer); clearTimeout(this.timer);
}, methods: { }, methods: {
gomobileaction(){
window.location.href = this.mobileprovision;
},
download() { download() {
if (this.currentappinfo.app_id) { if (this.currentappinfo.app_id) {
this.isdownload = true; this.isdownload = true;
@ -228,6 +252,13 @@
} else { } else {
let download_url = res.data.download_url; let download_url = res.data.download_url;
this.downloadurl = "itms-services://?action=download-manifest&url=" + encodeURIComponent(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 { } else {
if (this.agent !== '') { if (this.agent !== '') {

@ -8,7 +8,7 @@ from django.core.cache import cache
from api.models import Apps, UserInfo, AppReleaseInfo, AppUDID, APPToDeveloper, APPSuperSignUsedInfo from api.models import Apps, UserInfo, AppReleaseInfo, AppUDID, APPToDeveloper, APPSuperSignUsedInfo
import time, os import time, os
from django.utils import timezone 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.storage.storage import Storage, LocalStorage
from api.utils.crontab.sync_cache import sync_download_times_by_app_id from api.utils.crontab.sync_cache import sync_download_times_by_app_id
from api.utils.utils import file_format_path 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: else:
return "", "" return "", ""
supersign = DEFAULT_MOBILEPROVISION.get("supersign")
mobileconifg = "" 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) 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 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]) down_key = "_".join([key.lower(), CACHE_KEY_TEMPLATE.get('download_url_key'), filename])
download_val = cache.get(down_key) download_val = cache.get(down_key)

@ -87,11 +87,28 @@ class DownloadView(APIView):
if os.path.isfile(file_path): if os.path.isfile(file_path):
response = FileResponse(open(file_path, 'rb')) response = FileResponse(open(file_path, 'rb'))
else: 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-Type'] = "application/x-apple-aspen-config"
response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid() + '.mobileprovision' response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid() + '.mobileprovision'
return response return response
res.msg = "mobileprovision release_id error" 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: else:
file_path = os.path.join(settings.MEDIA_ROOT, filename) file_path = os.path.join(settings.MEDIA_ROOT, filename)
try: try:

@ -253,6 +253,21 @@ MOBILECONFIG_SIGN_SSL = {
'ssl_pem_path': '/data/cert/fly.harmonygames.cn.pem' '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_ENGINE = "django.contrib.sessions.backends.cache"
SESSION_CACHE_ALIAS = "default" SESSION_CACHE_ALIAS = "default"

Loading…
Cancel
Save