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

super_signature
xiaoyu 4 years ago
parent 1fe5d51143
commit ce6a0e8dcc
  1. 19
      fir_client/src/components/FirDownload.vue
  2. 7
      fir_client/src/components/FirSuperSignBase.vue
  3. 14
      fir_download/src/components/FirDownload.vue
  4. 17
      fir_ser/api/utils/storage/caches.py
  5. 2
      fir_ser/api/utils/utils.py
  6. 29
      fir_ser/api/views/download.py

@ -191,15 +191,21 @@
isdownload: false, isdownload: false,
udid: "", udid: "",
wxeasytypeflag: false, wxeasytypeflag: false,
timer: '',
} }
}, methods: { },
beforeDestroy() {
clearTimeout(this.timer);
},
methods: {
download() { download() {
if (this.currentappinfo.app_id) { if (this.currentappinfo.app_id) {
this.isdownload = true; this.isdownload = true;
getdownloadurl(res => { getdownloadurl(res => {
if (res.code === 1000) { if (res.code === 1000) {
if (res.data.download_url === "") { if (res.data.download_url === "") {
window.location.href = this.full_url; window.location.href = this.full_url.split("?")[0];
// window.location.href = this.full_url;
return return
} }
if (this.currentappinfo.type === 1) { if (this.currentappinfo.type === 1) {
@ -212,6 +218,15 @@
} else { } else {
if (this.agent !== '') { if (this.agent !== '') {
this.downloadurl = res.data.download_url; this.downloadurl = res.data.download_url;
window.location.href = this.downloadurl;
if (res.data.extra_url !== "") {
// eslint-disable-next-line no-unused-vars
this.timmer = setTimeout(data => {
window.location.href = res.data.extra_url;
}, 3000);
}
return;
} }
} }
} else { } else {

@ -567,10 +567,17 @@
}) })
}, },
iosdeveloperFun(params) { iosdeveloperFun(params) {
const loading = this.$loading({
lock: true,
text: '执行中,请耐心等待...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
iosdeveloper(data => { iosdeveloper(data => {
if (data.code === 1000) { if (data.code === 1000) {
this.app_developer_lists = data.data; this.app_developer_lists = data.data;
this.pagination.total = data.count; this.pagination.total = data.count;
loading.close();
if (data.use_num) { if (data.use_num) {
this.developer_used_info = data.use_num; this.developer_used_info = data.use_num;
if (this.developer_used_info.all_usable_number !== 0) { if (this.developer_used_info.all_usable_number !== 0) {

@ -189,8 +189,11 @@
iserror: false, iserror: false,
udid: "", udid: "",
wxeasytypeflag: false, wxeasytypeflag: false,
timer: '',
} }
}, beforeDestroy() {
clearTimeout(this.timer);
}, methods: { }, methods: {
download() { download() {
if (this.currentappinfo.app_id) { if (this.currentappinfo.app_id) {
@ -198,7 +201,7 @@
getdownloadurl(res => { getdownloadurl(res => {
if (res.code === 1000) { if (res.code === 1000) {
if (res.data.download_url === "") { if (res.data.download_url === "") {
window.location.href = this.full_url; window.location.href = this.full_url.split("?")[0];
return return
} }
if (this.currentappinfo.type === 1) { if (this.currentappinfo.type === 1) {
@ -211,6 +214,15 @@
} else { } else {
if (this.agent !== '') { if (this.agent !== '') {
this.downloadurl = res.data.download_url; this.downloadurl = res.data.download_url;
window.location.href = this.downloadurl;
if (res.data.extra_url !== "") {
// eslint-disable-next-line no-unused-vars
this.timmer = setTimeout(data => {
window.location.href = res.data.extra_url;
}, 3000);
}
return;
} }
} }
} else { } else {

@ -39,24 +39,27 @@ def get_download_url_by_cache(app_obj, filename, limit, isdownload=True, key='',
developerid=SuperSign_obj.developerid).first() developerid=SuperSign_obj.developerid).first()
if APPToDeveloper_obj: if APPToDeveloper_obj:
return local_storage.get_download_url( return local_storage.get_download_url(
APPToDeveloper_obj.binary_file + "." + download_url_type, limit) APPToDeveloper_obj.binary_file + "." + download_url_type, limit), ""
else: else:
return "" return "", ""
else: else:
return "" return "", ""
else: else:
return "" return "", ""
return local_storage.get_download_url(filename.split(".")[0] + "." + download_url_type, limit) mobileconifg = ""
if download_url_type == 'mobileconifg':
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]) 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)
if download_val: if download_val:
if download_val.get("time") > now - 60: if download_val.get("time") > now - 60:
return download_val.get("download_url") return download_val.get("download_url"), ""
else: else:
user_obj = UserInfo.objects.filter(pk=app_obj.get("user_id")).first() user_obj = UserInfo.objects.filter(pk=app_obj.get("user_id")).first()
storage = Storage(user_obj) storage = Storage(user_obj)
return storage.get_download_url(filename, limit) return storage.get_download_url(filename, limit), ""
def get_app_instance_by_cache(app_id, password, limit, udid): def get_app_instance_by_cache(app_id, password, limit, udid):

@ -50,7 +50,7 @@ def delete_app_profile_file(developer_obj, app_obj):
file = get_profile_full_path(developer_obj, app_obj) file = get_profile_full_path(developer_obj, app_obj)
try: try:
if os.path.isfile(file): if os.path.isfile(file):
os.remove(get_profile_full_path(developer_obj, app_obj)) os.remove(file)
except Exception as e: except Exception as e:
logger.error("delete_app_profile_file developer_obj:%s app_obj:%s file:%s Exception:%s" % ( logger.error("delete_app_profile_file developer_obj:%s app_obj:%s file:%s Exception:%s" % (
developer_obj, app_obj, file, e)) developer_obj, app_obj, file, e))

@ -17,9 +17,10 @@ from api.utils.storage.caches import get_app_instance_by_cache, get_download_url
import os import os
from rest_framework_extensions.cache.decorators import cache_response from rest_framework_extensions.cache.decorators import cache_response
from api.utils.serializer import AppsShortSerializer from api.utils.serializer import AppsShortSerializer
from api.models import Apps, AppReleaseInfo, APPToDeveloper from api.models import Apps, AppReleaseInfo, APPToDeveloper, APPSuperSignUsedInfo
from django.http import FileResponse from django.http import FileResponse
import logging import logging
from api.utils.utils import get_profile_full_path
logger = logging.getLogger(__file__) logger = logging.getLogger(__file__)
@ -75,6 +76,22 @@ class DownloadView(APIView):
response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid() + '.mobileconfig' response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid() + '.mobileconfig'
return response return response
res.msg = "mobileconifg release_id error" res.msg = "mobileconifg release_id error"
elif ftype == 'mobileprovision':
release_obj = AppReleaseInfo.objects.filter(release_id=filename.split('.')[0]).first()
if release_obj:
appsuper_obj = APPSuperSignUsedInfo.objects.filter(app_id=release_obj.app_id).last()
if not appsuper_obj:
appsuper_obj = APPSuperSignUsedInfo.objects.last()
developer_obj = appsuper_obj.developerid
file_path = get_profile_full_path(developer_obj, release_obj.app_id)
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"
else: else:
file_path = os.path.join(settings.MEDIA_ROOT, filename) file_path = os.path.join(settings.MEDIA_ROOT, filename)
try: try:
@ -164,16 +181,18 @@ class InstallView(APIView):
if app_obj: if app_obj:
if app_obj.get("type") == 0: if app_obj.get("type") == 0:
apptype = '.apk' apptype = '.apk'
download_url = get_download_url_by_cache(app_obj, release_id + apptype, 600) download_url, extra_url = get_download_url_by_cache(app_obj, release_id + apptype, 600)
else: else:
apptype = '.ipa' apptype = '.ipa'
if isdownload: if isdownload:
download_url = get_download_url_by_cache(app_obj, release_id + apptype, 600, udid=udid) download_url, extra_url = get_download_url_by_cache(app_obj, release_id + apptype, 600,
udid=udid)
else: else:
download_url = get_download_url_by_cache(app_obj, release_id + apptype, 600, isdownload, download_url, extra_url = get_download_url_by_cache(app_obj, release_id + apptype, 600,
isdownload,
udid=udid) udid=udid)
res.data = {"download_url": download_url} res.data = {"download_url": download_url, "extra_url": extra_url}
if download_url != "" and "mobileconifg" not in download_url: if download_url != "" and "mobileconifg" not in download_url:
set_app_download_by_cache(app_id) set_app_download_by_cache(app_id)
if request.META.get('HTTP_X_FORWARDED_FOR', None): if request.META.get('HTTP_X_FORWARDED_FOR', None):

Loading…
Cancel
Save