~edwargix/git.sr.ht

39cbae1f85dc45ca43ec4cd2c84b78990519e535 — Ludovic Chabant 6 years ago 5b547f4
Moved authorization endpoint to scm.sr.ht
1 files changed, 1 insertions(+), 13 deletions(-)

M gitsrht/blueprints/repo.py
M gitsrht/blueprints/repo.py => gitsrht/blueprints/repo.py +1 -13
@@ 16,7 16,7 @@ from io import BytesIO
from pygments import highlight
from pygments.lexers import guess_lexer, guess_lexer_for_filename, TextLexer
from pygments.formatters import HtmlFormatter
from scmsrht.access import get_repo, get_repo_or_redir, has_access, UserAccess
from scmsrht.access import get_repo, get_repo_or_redir
from scmsrht.formatting import get_formatted_readme, get_highlighted_file
from scmsrht.redis import redis
from scmsrht.urls import get_clone_urls


@@ 25,18 25,6 @@ from srht.markdown import markdown

repo = Blueprint('repo', __name__)

@repo.route("/authorize")
def authorize_http_access():
    original_uri = request.headers.get("X-Original-URI")
    original_uri = original_uri.split("/")
    owner, repo = original_uri[1], original_uri[2]
    owner, repo = get_repo(owner, repo)
    if not repo:
        return "authorized", 200
    if not has_access(repo, UserAccess.read):
        return "unauthorized", 403
    return "authorized", 200

def get_readme(repo, tip, link_prefix=None):
    if not tip:
        return None