mirror of
https://github.com/quay/quay.git
synced 2026-01-26 06:21:37 +03:00
* chore: drop deprecated tables and remove unused code * isort imports * migration: check for table existence before drop
49 lines
1.5 KiB
Python
49 lines
1.5 KiB
Python
import json
|
|
import logging
|
|
|
|
from flask import Blueprint, make_response, redirect
|
|
|
|
from app import get_app_url
|
|
from auth.auth_context import get_authenticated_user
|
|
from auth.decorators import require_session_login
|
|
|
|
logger = logging.getLogger(__name__)
|
|
wellknown = Blueprint("wellknown", __name__)
|
|
|
|
|
|
@wellknown.route("/app-capabilities", methods=["GET"])
|
|
def app_capabilities():
|
|
view_image_tmpl = "%s/{namespace}/{reponame}:{tag}" % get_app_url()
|
|
|
|
image_security = "%s/api/v1/repository/{namespace}/{reponame}/image/{imageid}/security"
|
|
image_security_tmpl = image_security % get_app_url()
|
|
|
|
manifest_security = "%s/api/v1/repository/{namespace}/{reponame}/manifest/{digest}/security"
|
|
manifest_security_tmpl = manifest_security % get_app_url()
|
|
|
|
metadata = {
|
|
"appName": "io.quay",
|
|
"capabilities": {
|
|
"io.quay.view-image": {
|
|
"url-template": view_image_tmpl,
|
|
},
|
|
"io.quay.image-security": {
|
|
"rest-api-template": image_security_tmpl,
|
|
"deprecated": True,
|
|
},
|
|
"io.quay.manifest-security": {
|
|
"rest-api-template": manifest_security_tmpl,
|
|
},
|
|
},
|
|
}
|
|
|
|
resp = make_response(json.dumps(metadata))
|
|
resp.headers["Content-Type"] = "application/json"
|
|
return resp
|
|
|
|
|
|
@wellknown.route("/change-password", methods=["GET"])
|
|
@require_session_login
|
|
def change_password():
|
|
return redirect("/user/%s?tab=settings" % get_authenticated_user().username)
|