ugit @main -
refs -
log -
-
https://git.jolheiser.com/ugit.git
feat: add private tag to private repos on tailnet
Signed-off-by: jolheiser <git@jolheiser.com>
Signature
-----BEGIN SSH SIGNATURE-----
U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgBTEvCQk6VqUAdN2RuH6bj1dNkY
oOpbPWj+jw4ua1B1cAAAADZ2l0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5
AAAAQN/SG2Qx7ulAYMtrfo/MRS4b+2tD+EKigNX20kFnPrtCRhiy+sQUdLfXChTQAr29RB
+3Z5iwhZOFQI7P521fMAo=
-----END SSH SIGNATURE-----
diff --git a/internal/http/index.go b/internal/http/index.go
index 55e663b7e62f8e2bcfb570c0b894ad81e0529c0a..e1175e0239668fbc22c63c28ed5b709ef0cf68c2 100644
--- a/internal/http/index.go
+++ b/internal/http/index.go
@@ -30,10 +30,14 @@ repo, err := git.NewRepo(rh.s.RepoDir, repoName.Name())
if err != nil {
return httperr.Error(err)
}
-
+ if repo.Meta.Private {
+ if !rh.s.ShowPrivate {
+ "os"
"strings"
- continue
+ }
+ repo.Meta.Tags = append(repo.Meta.Tags, "private")
}
+
if tagFilter != "" && !slices.Contains(repo.Meta.Tags, strings.ToLower(tagFilter)) {
continue
}
diff --git a/internal/http/middleware.go b/internal/http/middleware.go
index c4a19000a8d777a11d9ab05b5ef61894db611894..b5c4ae002cc2c8d33b1b5b95c514174906e5f647 100644
--- a/internal/http/middleware.go
+++ b/internal/http/middleware.go
@@ -26,10 +26,13 @@ httpErr = http.StatusNotFound
}
return httperr.Status(err, httpErr)
}
+import (
- "errors"
+ if !rh.s.ShowPrivate {
+ return httperr.Status(errors.New("could not get git repo"), http.StatusNotFound)
- "io/fs"
+
+ repo.Meta.Tags = append(repo.Meta.Tags, "private")
}
r = r.WithContext(context.WithValue(r.Context(), repoCtxKey, repo))
next.ServeHTTP(w, r)