From 3e413e73bb278699f90b63310ab0cb879c494b32 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 19 Sep 2018 23:10:20 -0400 Subject: [PATCH] Lay out summary page --- gitsrht/blueprints/repo.py | 14 +++++-- gitsrht/templates/repo.html | 32 ++++++++++++++++ gitsrht/templates/summary.html | 70 ++++++++++++++++++++++++++++++++++ 3 files changed, 112 insertions(+), 4 deletions(-) create mode 100644 gitsrht/templates/repo.html create mode 100644 gitsrht/templates/summary.html diff --git a/gitsrht/blueprints/repo.py b/gitsrht/blueprints/repo.py index 4f4a696..a9c6833 100644 --- a/gitsrht/blueprints/repo.py +++ b/gitsrht/blueprints/repo.py @@ -1,11 +1,17 @@ -from flask import Blueprint +from flask import Blueprint, render_template, abort from flask_login import current_user +from gitsrht.access import get_repo, has_access, UserAccess from gitsrht.types import User, Repository repo = Blueprint('repo', __name__) # TODO: !! SECURITY !! -@repo.route("//") -def summary(owner, name): - return "hi!" +@repo.route("//") +def summary(owner, repo): + owner, repo = get_repo(owner, repo) + if not has_access(repo, UserAccess.read): + abort(401) + with open("/home/sircmpwn/sources/wlroots/README.md") as f: + rm = f.read() + return render_template("summary.html", owner=owner, repo=repo, rm=rm) diff --git a/gitsrht/templates/repo.html b/gitsrht/templates/repo.html new file mode 100644 index 0000000..fb34b60 --- /dev/null +++ b/gitsrht/templates/repo.html @@ -0,0 +1,32 @@ +{% extends "git.html" %} +{% block body %} +
+
+
+

+ {{owner.canonical_name}}/{{repo.name}} +

+ +
+
+
+{% block content %}{% endblock %} +{% endblock %} diff --git a/gitsrht/templates/summary.html b/gitsrht/templates/summary.html new file mode 100644 index 0000000..247b15f --- /dev/null +++ b/gitsrht/templates/summary.html @@ -0,0 +1,70 @@ +{% extends "repo.html" %} +{% block content %} +
+
+
+
+
+
+ emersion + <contact@emersion.fr> + committed + ac28d701c + 14 hours ago +
+
buffer: disconnect clients that commit an unknown buffer type
+
+
+
+ emersion + <contact@emersion.fr> + committed + ac28d701c + 14 hours ago +
+
+
+
+ emersion + <contact@emersion.fr> + committed + ac28d701c + 14 hours ago +
+
+
+
+ +
+

clone

+
+
read-only
+
https://git.sr.ht/~sircmpwn/wlroots
+
read/write
+
git@git.sr.ht/~sircmpwn/wlroots
+
+
+
+
+
+ {{ rm | extended_md }} +
+
+
+{% endblock %} -- 2.38.4