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.

Serve repositories from the root of the URL space

ed03b3d1fa16ef6b55e2773aaf10e3be13282c3a · Keenan Nemetz · 3h ago · parent d37d301f

Serve repositories from the root of the URL space

A repository is now /<name> and its Git transport /<name>.git, so the URL a
person opens, the URL a clone uses, and the Go module path are the same name.
The forge's own pages moved under /-/ (admin, accounts, the directory, the
feed, sign-in, assets), a prefix no repository name can start with: names are
[a-z0-9...] and cannot begin with "-". That leaves the router with two disjoint
spaces and removes the /r/ and /git/ prefixes, which existed only to keep
repositories away from the forge's own paths.

Routes: repoRoutes lose /r/; global, auth and admin routes gain /-/; assets
move to /-/static/ because a subtree pattern like /static/ cannot coexist with
one-segment-wildcard repo routes — Go's mux reports them as conflicting
neither-more-specific patterns. The catch-all still renders the styled 404.

Transport: githttp.Route parses /<name>.git/<rest> instead of a /git/ prefix,
and forgepaths.go hands such requests to the proxy before the mux, because a
wildcard fills a whole segment and cannot match "<name>.git". LFS stays on the
mux (<name>.git/info/lfs/...), and the Go module discovery probe moves to the
same pre-router so a package path under a public repository is answered even
when its first segments name a page tab.

Names: repo.ValidateName now refuses the four root paths the forge must keep —
static, robots.txt, sitemap.xml, sitemap-pages.xml. Everything else is an
ordinary repository name, including admin, u, and activity.

Docs and the packaged URLs follow the new layout; robots.txt, the sitemaps and
the instance activity feed point at the new paths. No aliases: the old /r/ and
/git/ URLs are gone.

Verified with ./vole workflow check and ./vole workflow run verify.

server/web/admin_users.go +7−7

@@ -54,7 +54,7 @@ func (w *Web) adminInviteView(r *http.Request, acct *identity.Account, inv *iden
54 54 // The token is in the fragment, so it is not sent to the server, not written to
55 55 // an access log in front of it, and not carried in a Referer when the page
56 56 // links anywhere.
57 link := "/invite#" + inv.Token
57 link := "/-/invite#" + inv.Token
58 58 if base := w.Cfg.BaseURL(); base != "" {
59 59 link = base + link
60 60 }
@@ -86,7 +86,7 @@ func (w *Web) AdminUsersPage(rw http.ResponseWriter, r *http.Request) {
86 86 if _, ok := w.requireInstanceAdmin(rw, r); !ok {
87 87 return
88 88 }
89 http.Redirect(rw, r, "/admin?tab=accounts", http.StatusMovedPermanently)
89 http.Redirect(rw, r, "/-/admin?tab=accounts", http.StatusMovedPermanently)
90 90 }
91 91
92 92 func (w *Web) CreateAdminUser(rw http.ResponseWriter, r *http.Request) {
@@ -133,7 +133,7 @@ func (w *Web) CreateAdminBot(rw http.ResponseWriter, r *http.Request) {
133 133 w.renderAdminTab(rw, r, "accounts", err.Error(), http.StatusBadRequest)
134 134 return
135 135 }
136 http.Redirect(rw, r, "/users/"+acct.Name, http.StatusSeeOther)
136 http.Redirect(rw, r, "/-/users/"+acct.Name, http.StatusSeeOther)
137 137 }
138 138
139 139 func (w *Web) AdminUserPage(rw http.ResponseWriter, r *http.Request) {
@@ -162,7 +162,7 @@ func (w *Web) SetAdminUserRole(rw http.ResponseWriter, r *http.Request) {
162 162 w.render(rw, "admin_user", w.adminUserView(r, acct, err.Error()), http.StatusBadRequest)
163 163 return
164 164 }
165 http.Redirect(rw, r, "/users/"+acct.Name, http.StatusSeeOther)
165 http.Redirect(rw, r, "/-/users/"+acct.Name, http.StatusSeeOther)
166 166 }
167 167
168 168 func (w *Web) RetireAdminUser(rw http.ResponseWriter, r *http.Request) {
@@ -178,7 +178,7 @@ func (w *Web) RetireAdminUser(rw http.ResponseWriter, r *http.Request) {
178 178 w.render(rw, "admin_user", w.adminUserView(r, acct, err.Error()), http.StatusBadRequest)
179 179 return
180 180 }
181 http.Redirect(rw, r, "/admin?tab=accounts", http.StatusSeeOther)
181 http.Redirect(rw, r, "/-/admin?tab=accounts", http.StatusSeeOther)
182 182 }
183 183
184 184 func (w *Web) InviteAdminUser(rw http.ResponseWriter, r *http.Request) {
@@ -208,7 +208,7 @@ func (w *Web) RevokeAdminUserSessions(rw http.ResponseWriter, r *http.Request) {
208 208 w.serverError(rw, r, "cannot revoke sessions: "+err.Error())
209 209 return
210 210 }
211 http.Redirect(rw, r, "/users/"+acct.Name, http.StatusSeeOther)
211 http.Redirect(rw, r, "/-/users/"+acct.Name, http.StatusSeeOther)
212 212 }
213 213
214 214 func (w *Web) RemoveAdminUserKey(rw http.ResponseWriter, r *http.Request) {
@@ -225,5 +225,5 @@ func (w *Web) RemoveAdminUserKey(rw http.ResponseWriter, r *http.Request) {
225 225 w.render(rw, "admin_user", w.adminUserView(r, acct, err.Error()), http.StatusBadRequest)
226 226 return
227 227 }
228 http.Redirect(rw, r, "/users/"+acct.Name, http.StatusSeeOther)
228 http.Redirect(rw, r, "/-/users/"+acct.Name, http.StatusSeeOther)
229 229 }