Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@app.route("/api/v1/stats/images_latest")
def api_stats_images_latest():
return mime_json(database.get_images_latest())
@app.route("/api/manifest/")
def api_manifest(manifest_hash):
return mime_json(database.get_manifest_info(manifest_hash))
@app.route("/api/v1/stats/popular_packages")
def api_stats_popular_packages():
return mime_json(database.get_popular_packages())
@app.route("/api/v1/stats/popular_targets")
def api_stats_popular_targets():
return mime_json(database.get_popular_targets())
@app.route("/api/v1/supported")
def api_supported():
return mime_json(database.get_supported_targets_json())
@app.route("/api/distributions")
def api_distributions():
return mime_json(config.get_all())
@app.route("/api/upgrade-request", methods=["POST"])
@app.route("/api/upgrade-request/", methods=["GET"])
def api_upgrade_request(request_hash=None):
if request.method == "POST":
try:
request_json = json.loads(request.get_data().decode("utf-8"))
except json.JSONDecodeError:
return "[]", HTTPStatus.BAD_REQUEST
else:
if not request_hash:
return "[]", HTTPStatus.BAD_REQUEST
request_json = {"request_hash": request_hash}
return br.process_request(request_json, sysupgrade_requested=1)
@app.route("/api/versions")
def api_versions():
return mime_json(database.api_get_versions())