mirror of https://git.jolheiser.com/ugit.git
feat: add private tag to private repos on tailnet
Signed-off-by: jolheiser <git@jolheiser.com>tui
parent
ff1eaf72bf
commit
ad26f8c949
|
@ -30,9 +30,13 @@ func (rh repoHandler) index(w http.ResponseWriter, r *http.Request) error {
|
|||
if err != nil {
|
||||
return httperr.Error(err)
|
||||
}
|
||||
if repo.Meta.Private && !rh.s.ShowPrivate {
|
||||
continue
|
||||
if repo.Meta.Private {
|
||||
if !rh.s.ShowPrivate {
|
||||
continue
|
||||
}
|
||||
repo.Meta.Tags = append(repo.Meta.Tags, "private")
|
||||
}
|
||||
|
||||
if tagFilter != "" && !slices.Contains(repo.Meta.Tags, strings.ToLower(tagFilter)) {
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -26,8 +26,11 @@ func (rh repoHandler) repoMiddleware(next http.Handler) http.Handler {
|
|||
}
|
||||
return httperr.Status(err, httpErr)
|
||||
}
|
||||
if repo.Meta.Private && !rh.s.ShowPrivate {
|
||||
return httperr.Status(errors.New("could not get git repo"), http.StatusNotFound)
|
||||
if repo.Meta.Private {
|
||||
if !rh.s.ShowPrivate {
|
||||
return httperr.Status(errors.New("could not get git repo"), http.StatusNotFound)
|
||||
}
|
||||
repo.Meta.Tags = append(repo.Meta.Tags, "private")
|
||||
}
|
||||
r = r.WithContext(context.WithValue(r.Context(), repoCtxKey, repo))
|
||||
next.ServeHTTP(w, r)
|
||||
|
|
Loading…
Reference in New Issue