Add require login feature to see gists

This commit is contained in:
Thomas Miceli
2023-04-28 20:31:10 +02:00
parent 64d0818c9f
commit 333efeacbf
12 changed files with 77 additions and 23 deletions

View File

@ -47,9 +47,10 @@ func gitHttp(ctx echo.Context) error {
gist := getData(ctx, "gist").(*models.Gist)
noAuth := ctx.QueryParam("service") == "git-upload-pack" ||
noAuth := (ctx.QueryParam("service") == "git-upload-pack" ||
strings.HasSuffix(ctx.Request().URL.Path, "git-upload-pack") ||
ctx.Request().Method == "GET"
ctx.Request().Method == "GET") &&
!getData(ctx, "RequireLogin").(bool)
repositoryPath := git.RepositoryPath(gist.User.Username, gist.Uuid)