fix app plist files

storage_cloud
nineven 5 years ago
parent 173d28c615
commit d6abf32a82
  1. 2
      fir_client/src/components/FirAppInfostimeline.vue
  2. 123
      fir_ser/api/utils/app/apputils.py
  3. 4
      fir_ser/api/views/download.py

@ -12,7 +12,7 @@
<i class="el-icon-cloudy" v-if="! app.is_master"></i> <i class="el-icon-cloudy" v-if="! app.is_master"></i>
<i class="el-icon-cloudy" style="background-color: #409eff" v-else></i> <i class="el-icon-cloudy" style="background-color: #409eff" v-else></i>
<b class="ng-binding">{{app.build_version}} (Build {{app.app_version}})</b> <b class="ng-binding">{{app.app_version}} (Build {{app.build_version}})</b>
<div class="release-metainfo ng-hide" <div class="release-metainfo ng-hide"
v-if="app.release_type === 0"> v-if="app.release_type === 0">
<small> <small>

@ -8,80 +8,55 @@ from api.models import AppReleaseInfo,Apps
import random,xmltodict,json import random,xmltodict,json
from api.utils.storage.storage import Storage from api.utils.storage.storage import Storage
def make_resigned(bin_url,img_url,bundle_id,bundle_version,name): def make_resigned(bin_url,img_url,bundle_id,app_version,name):
ios_plist_tem = """ ios_plist_tem = """<?xml version="1.0" encoding="UTF-8"?>
{ <plist version="1.0"><dict>
"plist": { <key>items</key>
"@version": "1.0", <array>
"dict": { <dict>
"key": "items", <key>assets</key>
"array": { <array>
"dict": { <dict>
"key": [ <key>kind</key>
"assets", <string>software-package</string>
"metadata" <key>url</key>
], <string><![CDATA[%s]]></string>
"array": { </dict>
"dict": [ <dict>
{ <key>kind</key>
"key": [ <string>display-image</string>
"kind", <key>needs-shine</key>
"url" <integer>0</integer>
], <key>url</key>
"string": [ <string><![CDATA[%s]]></string>
"software-package", </dict>
"%s" <dict>
] <key>kind</key>
}, <string>full-size-image</string>
{ <key>needs-shine</key>
"key": [ <true/>
"kind", <key>url</key>
"needs-shine", <string><![CDATA[%s]]></string>
"url" </dict>
], </array>
"string": [ <key>metadata</key>
"display-image", <dict>
"%s" <key>bundle-identifier</key>
], <string>%s</string>
"integer": "0" <key>bundle-version</key>
}, <string><![CDATA[%s]]></string>
{ <key>kind</key>
"key": [ <string>software</string>
"kind", <key>title</key>
"needs-shine", <string><![CDATA[%s]]></string>
"url" </dict>
], </dict>
"string": [ </array>
"full-size-image", </dict>
"%s" </plist>""" % (bin_url, img_url, img_url, bundle_id, app_version, name)
],
"true": null return ios_plist_tem
}
]
},
"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 bytes2human(n): def bytes2human(n):
symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y') symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')

@ -50,9 +50,9 @@ class DownloadView(APIView):
if release_obj: if release_obj:
storage = Storage(release_obj.app_id.user_id) storage = Storage(release_obj.app_id.user_id)
bundle_id = release_obj.app_id.bundle_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 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 = FileResponse(ios_plist_bytes)
response['content_type'] = "application/x-plist" response['content_type'] = "application/x-plist"
response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid() response['Content-Disposition'] = 'attachment; filename=' + make_random_uuid()

Loading…
Cancel
Save