Example #1
0
def upload(app_key):
    release_notes = 'empty'
    if 'releaseNotes' in request.form:
        release_notes = request.form['releaseNotes']
    apk_file = request.files['file']
    if apk_file:
        apk_filename = secure_filename(apk_file.filename)
        apk_file_path = os.path.join(app.config["TMP_DIR"], apk_filename)
        apk_file.save(apk_file_path)

        result = parse_apk(apk_file_path, app_key)

        build = result["build"]
        icon_path = result["icon_path"]
        build.release_notes = release_notes
        db.session.add(build)
        db.session.commit()

        storage_worker.put(build, apk_file_path, icon_path)

        application = Application.query.filter_by(app_key=app_key).first()
        application.icon_url = storage_worker.get_icon_link(app_key)
        db.session.commit()
        return serialize(build)
    return make_response('{"error":"upload_error"}', 400)
Example #2
0
 def __init__(self, user_app):
     self.app_key = user_app.app.app_key
     self.package = user_app.app.package
     self.name = user_app.app.name
     self.icon_url = storage_worker.get_icon_link(self.app_key)
     self.created_on = user_app.app.created_on
     self.permission = user_app.permission
     self.app_type = user_app.app.app_type
Example #3
0
 def __init__(self, user_app):
     self.app_key = user_app.app.app_key
     self.package = user_app.app.package
     self.name = user_app.app.name
     self.icon_url = storage_worker.get_icon_link(self.app_key)
     self.created_on = user_app.app.created_on
     self.permission = user_app.permission
     self.app_type = user_app.app.app_type
Example #4
0
def app_info(app_key):
    application = UserApp.query.filter_by(app_key=app_key, user_id=g.user.id).first()
    if application:
        application.icon_url = storage_worker.get_icon_link(app_key)
        return serialize(application)
    return make_response('{"error":"app_not_found"}', 404)
Example #5
0
def app_info(app_key):
    application = UserApp.query.filter_by(app_key=app_key, user_id=g.user.id).first()
    if application:
        application.icon_url = storage_worker.get_icon_link(app_key)
        return serialize(application)
    return make_response('{"error":"app_not_found"}', 404)