From 2bdb70d928f1e41e1d4fa1e15e24246f0c37873a Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 19 Dec 2019 09:34:06 -0500 Subject: [PATCH] Add placeholder route for go get --- gitsrht/blueprints/repo.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gitsrht/blueprints/repo.py b/gitsrht/blueprints/repo.py index 4ad7bf3..16261a8 100644 --- a/gitsrht/blueprints/repo.py +++ b/gitsrht/blueprints/repo.py @@ -21,9 +21,10 @@ from pygments.lexers import guess_lexer, guess_lexer_for_filename, TextLexer from scmsrht.access import get_repo, get_repo_or_redir from scmsrht.formatting import get_formatted_readme, get_highlighted_file from scmsrht.urls import get_clone_urls -from srht.config import cfg +from srht.config import cfg, get_origin from srht.markdown import markdown from srht.redis import redis +from urllib.parse import urlparse repo = Blueprint('repo', __name__) @@ -105,6 +106,22 @@ def summary(owner, repo): is_annotated=lambda t: isinstance(t, pygit2.Tag), message=message) +@repo.route("///") +def go_get(owner, repo, path): + if "go-get" not in request.args: + abort(404) + owner, repo = get_repo_or_redir(owner, repo) + root = get_origin("git.sr.ht", external=True) + origin = urlparse(root).netloc + return "".join(['', + 'Placeholder page for Go import resolution', + '', + ]) + def lookup_ref(git_repo, ref, path): ref = ref or git_repo.default_branch().name[len("refs/heads/"):] if path is None: -- 2.38.4