From db19ed8c953c40a728cdd8ff6b38dbd22c61f6c2 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Sun, 19 Sep 2021 09:54:02 -0400 Subject: [PATCH] Implement a UI for discovering the existence of notes-based tarball signatures --- gitsrht/blueprints/repo.py | 5 ++++- gitsrht/templates/ref.html | 8 ++++++++ gitsrht/templates/refs.html | 17 ++++++++++++++--- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/gitsrht/blueprints/repo.py b/gitsrht/blueprints/repo.py index 9fb601e..2362d92 100644 --- a/gitsrht/blueprints/repo.py +++ b/gitsrht/blueprints/repo.py @@ -134,6 +134,7 @@ def summary(owner, repo): message = session.pop("message", None) return render_template("summary.html", view="summary", owner=owner, repo=repo, readme=readme, commits=commits, + signature=lookup_signature(git_repo, latest_tag[0].decode('utf-8'))[1], latest_tag=latest_tag, default_branch=default_branch, is_annotated=lambda t: isinstance(t, pygit2.Tag), message=message, license=license) @@ -536,7 +537,8 @@ def refs(owner, repo): tags = [( ref, - git_repo.get(git_repo.references[ref].target) + git_repo.get(git_repo.references[ref].target), + lookup_signature(git_repo, ref.decode('utf-8'))[1] ) for ref in git_repo.raw_listall_references() if ref.startswith(b"refs/tags/")] tags = [tag for tag in tags @@ -626,5 +628,6 @@ def ref(owner, repo, ref): .filter(Artifact.commit == tag.target.hex)).all() return render_template("ref.html", view="refs", owner=owner, repo=repo, git_repo=git_repo, tag=tag, + signature=lookup_signature(git_repo, ref)[1], artifacts=artifacts, default_branch=git_repo.default_branch(), strip_pgp_signature=strip_pgp_signature) diff --git a/gitsrht/templates/ref.html b/gitsrht/templates/ref.html index 3aade25..ff35ef2 100644 --- a/gitsrht/templates/ref.html +++ b/gitsrht/templates/ref.html @@ -20,6 +20,14 @@ owner=repo.owner.canonical_name, repo=repo.name, ref=tag.name)}}" >.tar.gz {{icon("caret-right")}} + {% if signature %} + .tar.gz.asc {{icon("caret-right")}} + {% endif %}