Merge branch 'super_signature'

pull/1/head
xiaoyu 4 years ago
commit 49f8f1c0ca
  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,
udid: "",
wxeasytypeflag: false,
timer: '',
}
}, methods: {
},
beforeDestroy() {
clearTimeout(this.timer);
},
methods: {
download() {
if (this.currentappinfo.app_id) {
this.isdownload = true;
getdownloadurl(res => {
if (res.code === 1000) {
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
}
if (this.currentappinfo.type === 1) {
@ -212,6 +218,15 @@
} else {
if (this.agent !== '') {
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 {

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

@ -189,8 +189,11 @@
iserror: false,
udid: "",
wxeasytypeflag: false,
timer: '',
}
}, beforeDestroy() {
clearTimeout(this.timer);
}, methods: {
download() {
if (this.currentappinfo.app_id) {
@ -198,7 +201,7 @@
getdownloadurl(res => {
if (res.code === 1000) {
if (res.data.download_url === "") {
window.location.href = this.full_url;
window.location.href = this.full_url.split("?")[0];
return
}
if (this.currentappinfo.type === 1) {
@ -211,6 +214,15 @@
} else {
if (this.agent !== '') {
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 {

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

@ -50,7 +50,7 @@ def delete_app_profile_file(developer_obj, app_obj):
file = get_profile_full_path(developer_obj, app_obj)
try:
if os.path.isfile(file):
os.remove(get_profile_full_path(developer_obj, app_obj))
os.remove(file)
except Exception as e:
logger.error("delete_app_profile_file developer_obj:%s app_obj:%s file:%s Exception:%s" % (
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
from rest_framework_extensions.cache.decorators import cache_response
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
import logging
from api.utils.utils import get_profile_full_path
logger = logging.getLogger(__file__)
@ -75,6 +76,22 @@ class DownloadView(APIView):
response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid() + '.mobileconfig'
return response
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:
file_path = os.path.join(settings.MEDIA_ROOT, filename)
try:
@ -164,16 +181,18 @@ class InstallView(APIView):
if app_obj:
if app_obj.get("type") == 0:
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:
apptype = '.ipa'
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:
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)
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:
set_app_download_by_cache(app_id)
if request.META.get('HTTP_X_FORWARDED_FOR', None):

Loading…
Cancel
Save