From c2bdab5b752d0700fd8c3d6a8849b4427d2994be Mon Sep 17 00:00:00 2001 From: Conrad Hoffmann Date: Mon, 11 Dec 2023 21:08:55 +0100 Subject: [PATCH] Un-break "View manifest" link in UI This link was using the previously unauthenticated API endpoint for manifests. However, that now requires authentication like any other endpoint. Instead, provide a simple UI route which displays the manifest. --- buildsrht/blueprints/jobs.py | 14 ++++++++++++++ buildsrht/templates/job.html | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/buildsrht/blueprints/jobs.py b/buildsrht/blueprints/jobs.py index 52cca88..c1b47f0 100644 --- a/buildsrht/blueprints/jobs.py +++ b/buildsrht/blueprints/jobs.py @@ -510,3 +510,17 @@ def job_by_id(username, job_id): sort_tasks=lambda tasks: sorted(tasks, key=lambda t: t.id), min_artifact_date=min_artifact_date, payment_required=payment_required) + +@jobs.route("/~/job//manifest") +def manifest_by_job_id(username, job_id): + user = User.query.filter(User.username == username).first() + if not user: + abort(404) + job = Job.query.options(sa.orm.joinedload(Job.tasks)).get(job_id) + if not job: + abort(404) + if not get_access(job): + abort(404) + if job.owner_id != user.id: + abort(404) + return Response(job.manifest, mimetype="text/plain") diff --git a/buildsrht/templates/job.html b/buildsrht/templates/job.html index 1a7b9bf..604b1bf 100644 --- a/buildsrht/templates/job.html +++ b/buildsrht/templates/job.html @@ -69,7 +69,7 @@
Updated
{{ job.updated | date }}
Build manifest
-
view manifest »
+
view manifest »
{% if current_user and job.status.value in [ "success", "failed", "timeout", "cancelled" -- 2.38.5