Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Add repository settings for description, branch, and visibility

1948358f9719cd0e5a15bd75a5d5dd3640e4ea82 · Keenan Nemetz · 15d ago · parent e84a66f5

Add repository settings for description, branch, and visibility

The Settings tab is shown only to repository admins and edits the facts that
repository owns: description, default branch (validated and required to exist),
and public/private visibility. Visibility toggles the ACL default between none
and read and leaves explicit entries alone; access rules stay an instance-admin
operation.

The page is read-gated before it is admin-gated, so a private repository still
answers 404 rather than confirming that settings exist. Saves carry CSRF, are
audited, and refresh the repository index. Adds Meta setters for the description
file and HEAD, plus git helpers to validate a branch and point HEAD at it.

server/web/web.go +9−5

@@ -116,8 +116,8 @@ func (w *Web) who(idOrName string) string {
116 116 // same ACL rule the handlers use, so the lock/globe icon cannot disagree with
117 117 // whether an anonymous clone works. Templates call it as
118 118 // {{template "repohead" (nav .Name "issues")}}.
119 func (w *Web) repoNav(name, tab string) repoNavData {
120 n := repoNavData{Name: name, Tab: tab, Private: true}
119 func (w *Web) repoNav(name, tab string, canAdmin bool) repoNavData {
120 n := repoNavData{Name: name, Tab: tab, Private: true, CanAdmin: canAdmin}
121 121 m, err := w.Repos.Open(name)
122 122 if err != nil {
123 123 return n
@@ -129,9 +129,10 @@ func (w *Web) repoNav(name, tab string) repoNavData {
129 129 }
130 130
131 131 type repoNavData struct {
132 Name string
133 Tab string
134 Private bool
132 Name string
133 Tab string
134 Private bool
135 CanAdmin bool
135 136 }
136 137
137 138 // Page is embedded by every view. Exported so html/template can promote its
@@ -148,6 +149,9 @@ type Page struct {
148 149 // DevLogin names the account a loopback browser is signed in as. Empty on a
149 150 // normal instance; the header uses it to make the development state visible.
150 151 DevLogin string
152 // CanAdmin reports whether the viewer may administer the repository named in
153 // the request path. The repository header uses it to show Settings.
154 CanAdmin bool
151 155 }
152 156
153 157 // canRead reports whether the viewer may see the repository. An anonymous