~edwargix/git.sr.ht

96536442c594189786487ab0cc3d6dfc09a238ed — Drew DeVault 8 years ago fc4ed75
Add not_found.html, plaintext cgit passthrough
2 files changed, 17 insertions(+), 1 deletions(-)

M git/blueprints/cgit.py
A templates/not_found.html
M git/blueprints/cgit.py => git/blueprints/cgit.py +7 -1
@@ 1,4 1,4 @@
from flask import Blueprint, request, render_template
from flask import Blueprint, Response, request, render_template
import requests
from git.config import cfg



@@ 15,3 15,9 @@ def cgit_passthrough(user, repo, cgit_path):
            cgit_html=r.text,
            owner_name=user,
            repo_name=repo)

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

A templates/not_found.html => templates/not_found.html +10 -0
@@ 0,0 1,10 @@
{% extends "layout.html" %}
{% block body %} 
<div class="container">
  <h2>404 Not Found</h2>
  <p>
  Whatever you're looking for, it isn't here.
  <a href="/">Index <i class="fa fa-caret-right"></i></a>
  </p>
</div>
{% endblock %}