Signed-off-by: Lewis lewis@tangled.org
+20
appview/middleware/middleware.go
+20
appview/middleware/middleware.go
···
226
226
return
227
227
}
228
228
229
+
if repo.RepoDid != "" && req.Context().Value("repoDidCanonical") == nil {
230
+
gitPaths := []string{"/info/refs", "/git-upload-pack", "/git-receive-pack", "/git-upload-archive"}
231
+
user := chi.URLParam(req, "user")
232
+
repoParam := chi.URLParam(req, "repo")
233
+
remaining := strings.TrimPrefix(req.URL.Path, "/"+user+"/"+repoParam)
234
+
235
+
isGitPath := slices.ContainsFunc(gitPaths, func(p string) bool {
236
+
return strings.HasSuffix(remaining, p)
237
+
})
238
+
239
+
if !isGitPath && req.URL.Query().Get("go-get") != "1" {
240
+
target := "/" + repo.RepoDid + remaining
241
+
if req.URL.RawQuery != "" {
242
+
target += "?" + req.URL.RawQuery
243
+
}
244
+
http.Redirect(w, req, target, http.StatusFound)
245
+
return
246
+
}
247
+
}
248
+
229
249
ctx := context.WithValue(req.Context(), "repo", repo)
230
250
next.ServeHTTP(w, req.WithContext(ctx))
231
251
})
+6
appview/pages/repoinfo/repoinfo.go
+6
appview/pages/repoinfo/repoinfo.go
···
20
20
}
21
21
22
22
func (r RepoInfo) FullName() string {
23
+
if r.RepoDid != "" {
24
+
return r.RepoDid
25
+
}
23
26
return path.Join(r.owner(), r.Name)
24
27
}
25
28
···
32
35
}
33
36
34
37
func (r RepoInfo) FullNameWithoutAt() string {
38
+
if r.RepoDid != "" {
39
+
return userutil.FlattenDid(r.RepoDid)
40
+
}
35
41
return path.Join(r.ownerWithoutAt(), r.Name)
36
42
}
37
43
appview/state/router.go
appview/state/router.go
This file has not been changed.
eventconsumer/consumer.go
eventconsumer/consumer.go
This file has not been changed.
knotserver/events.go
knotserver/events.go
This file has not been changed.
knotserver/migrate.go
knotserver/migrate.go
This file has not been changed.
knotserver/server.go
knotserver/server.go
This file has not been changed.
spindle/stream.go
spindle/stream.go
This file has not been changed.
History
12 rounds
1 comment
oyster.cafe
submitted
#11
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
merge conflicts detected
expand
collapse
expand
collapse
- go.mod:34
- go.sum:339
expand 0 comments
oyster.cafe
submitted
#10
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#9
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
expand 1 comment
oyster.cafe
submitted
#8
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#7
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#6
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#5
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#4
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#3
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#2
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
2/3 failed, 1/3 success
expand
collapse
expand 0 comments
oyster.cafe
submitted
#1
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
expand 0 comments
oyster.cafe
submitted
#0
1 commit
expand
collapse
knotserver: add repo DID migration on startup
Signed-off-by: Lewis <lewis@tangled.org>
appview/state/router.go:65can you absorb this?knotserver/server.go:91I remember you have tested this against knot1's ~4k repos. Is it ok to run on background without progress indicator?