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.
This commit is contained in:
Conrad Hoffmann 2023-12-11 21:08:55 +01:00
parent 468badf423
commit c2bdab5b75
2 changed files with 15 additions and 1 deletions

View File

@ -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("/~<username>/job/<int:job_id>/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")

View File

@ -69,7 +69,7 @@
<dt>Updated</dt>
<dd>{{ job.updated | date }}</dd>
<dt>Build manifest</dt>
<dd><a href="/api/jobs/{{ job.id }}/manifest">view manifest »</a></dd>
<dd><a href="/~{{ job.owner.username }}/job/{{ job.id }}/manifest">view manifest »</a></dd>
</dl>
{% if current_user and job.status.value in [
"success", "failed", "timeout", "cancelled"