From d6abf32a822b21931d0c0ecaaec0091870416ae7 Mon Sep 17 00:00:00 2001 From: nineven Date: Fri, 27 Mar 2020 14:59:12 +0800 Subject: [PATCH] fix app plist files --- .../src/components/FirAppInfostimeline.vue | 2 +- fir_ser/api/utils/app/apputils.py | 123 +++++++----------- fir_ser/api/views/download.py | 4 +- 3 files changed, 52 insertions(+), 77 deletions(-) diff --git a/fir_client/src/components/FirAppInfostimeline.vue b/fir_client/src/components/FirAppInfostimeline.vue index 7ab78fe..7cac420 100644 --- a/fir_client/src/components/FirAppInfostimeline.vue +++ b/fir_client/src/components/FirAppInfostimeline.vue @@ -12,7 +12,7 @@ - {{app.build_version}} (Build {{app.app_version}}) + {{app.app_version}} (Build {{app.build_version}})
diff --git a/fir_ser/api/utils/app/apputils.py b/fir_ser/api/utils/app/apputils.py index 216d790..487b71e 100644 --- a/fir_ser/api/utils/app/apputils.py +++ b/fir_ser/api/utils/app/apputils.py @@ -8,80 +8,55 @@ from api.models import AppReleaseInfo,Apps import random,xmltodict,json from api.utils.storage.storage import Storage -def make_resigned(bin_url,img_url,bundle_id,bundle_version,name): - - ios_plist_tem = """ - { - "plist": { - "@version": "1.0", - "dict": { - "key": "items", - "array": { - "dict": { - "key": [ - "assets", - "metadata" - ], - "array": { - "dict": [ - { - "key": [ - "kind", - "url" - ], - "string": [ - "software-package", - "%s" - ] - }, - { - "key": [ - "kind", - "needs-shine", - "url" - ], - "string": [ - "display-image", - "%s" - ], - "integer": "0" - }, - { - "key": [ - "kind", - "needs-shine", - "url" - ], - "string": [ - "full-size-image", - "%s" - ], - "true": null - } - ] - }, - "dict": { - "key": [ - "bundle-identifier", - "bundle-version", - "kind", - "title" - ], - "string": [ - "%s", - "%s", - "software", - "%s" - ] - } - } - } - } - } - } - """ % (bin_url, img_url, img_url, bundle_id, bundle_version, name) - - return xmltodict.unparse(json.loads(ios_plist_tem),pretty=True) +def make_resigned(bin_url,img_url,bundle_id,app_version,name): + + ios_plist_tem = """ + + items + + + assets + + + kind + software-package + url + + + + kind + display-image + needs-shine + 0 + url + + + + kind + full-size-image + needs-shine + + url + + + + metadata + + bundle-identifier + %s + bundle-version + + kind + software + title + + + + + +""" % (bin_url, img_url, img_url, bundle_id, app_version, name) + + return ios_plist_tem def bytes2human(n): symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py index e1c08ba..07223ac 100644 --- a/fir_ser/api/views/download.py +++ b/fir_ser/api/views/download.py @@ -50,9 +50,9 @@ class DownloadView(APIView): if release_obj: storage = Storage(release_obj.app_id.user_id) bundle_id = release_obj.app_id.bundle_id - bundle_version = release_obj.build_version + app_version = release_obj.app_version name = release_obj.app_id.name - ios_plist_bytes = make_resigned(storage.get_download_url(filename),storage.get_download_url(release_obj.icon_url),bundle_id,bundle_version,name) + ios_plist_bytes = make_resigned(storage.get_download_url(filename),storage.get_download_url(release_obj.icon_url),bundle_id,app_version,name) response = FileResponse(ios_plist_bytes) response['content_type'] = "application/x-plist" response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid()