~edwargix/git.sr.ht

8c3ab74ce6215b2be838ddc25250ece84476e3e0 — Drew DeVault 8 years ago 2ee221f
Fix stupid error in HEAD~2
2 files changed, 7 insertions(+), 10 deletions(-)

M gitsrht/app.py
M gitsrht/blueprints/public.py
M gitsrht/app.py => gitsrht/app.py +2 -1
@@ 45,5 45,6 @@ app.register_blueprint(manage)
def inject():
    return {
        "oauth_url": oauth_url(request.full_path),
        "current_user": User.query.filter(User.id == current_user).first() if current_user else None
        "current_user": User.query.filter(User.id == current_user.id).first() \
                if current_user else None
    }

M gitsrht/blueprints/public.py => gitsrht/blueprints/public.py +5 -9
@@ 66,19 66,15 @@ def cgit_passthrough(user, repo, cgit_path):
            owner_name="~" + user,
            repo_name=repo)

@public.route("/~<user>/<repo>/snapshot/<tarball>.tar.xz")
@public.route("/~<user>/<repo>/plain/<tarball>.tar.xz")
def tarball(user, repo, tarball):
@public.route("/~<user>/<repo>/patch", defaults={"path": None})
@public.route("/~<user>/<repo>/patch/<path:path>")
@public.route("/~<user>/<repo>/plain/<path:path>")
@public.route("/~<user>/<repo>/snapshot/<path:path>")
def cgit_plain(user, repo, path):
    check_repo(user, repo)
    r = requests.get("{}/{}".format(upstream, request.full_path), stream=True)
    return Response(stream_with_context(r.iter_content()), content_type=r.headers['content-type'])

@public.route("/~<user>/<repo>/patch")
@public.route("/~<user>/<repo>/patch/")
def cgit_plain(user, repo):
    r = requests.get("{}/{}".format(upstream, request.full_path))
    return Response(r.text, mimetype="text/plain")

@public.route("/~<username>")
def user_index(username):
    user = User.query.filter(User.username == username).first()