Merge branch 'super_signature'

pull/1/head
xiaoyu 4 years ago
commit dc64563c55
  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>
<div v-else>
<button v-if="isdownload" disabled="" class="loading"
style="min-width: 42px; width: 42px; padding: 21px 0; border-top-color: transparent; border-left-color: transparent;">
&nbsp;
</button>
<div v-if="isdownload">
<div v-if="gomobile">
<button disabled="" class="loading"
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-if="currentappinfo.need_password"
style="margin:0 auto; width:166px">
@ -81,7 +100,8 @@
</div>
<el-divider v-if="currentappinfo.need_password"></el-divider>
<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>
</button>
@ -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 !== '') {

@ -66,10 +66,29 @@
<button type="button" v-else-if="wrong">{{ msg }}</button>
<div v-else>
<button v-if="isdownload" disabled="" class="loading"
style="min-width: 42px; width: 42px; padding: 21px 0; border-top-color: transparent; border-left-color: transparent;">
&nbsp;
</button>
<div v-if="isdownload">
<div v-if="gomobile">
<button disabled="" class="loading"
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-if="currentappinfo.need_password" style="margin:0 auto; width:166px">
<input class="passwd" placeholder="请输入密码" v-model="password"/>
@ -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 !== '') {

@ -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)

@ -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:

@ -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"

Loading…
Cancel
Save