+14
appview/state/signer.go
+14
appview/state/signer.go
···
301
301
302
302
return us.client.Do(req)
303
303
}
304
+
305
+
func (us *UnsignedClient) Capabilities(ownerDid, repoName string) (*http.Response, error) {
306
+
const (
307
+
Method = "GET"
308
+
Endpoint = "/capabilities"
309
+
)
310
+
311
+
req, err := us.newRequest(Method, Endpoint, nil)
312
+
if err != nil {
313
+
return nil, err
314
+
}
315
+
316
+
return us.client.Do(req)
317
+
}
+1
knotserver/handler.go
+1
knotserver/handler.go
+18
knotserver/routes.go
+18
knotserver/routes.go
···
31
31
w.Write([]byte("This is a knot server. More info at https://tangled.sh"))
32
32
}
33
33
34
+
func (h *Handle) Capabilities(w http.ResponseWriter, r *http.Request) {
35
+
w.Header().Set("Content-Type", "application/json")
36
+
37
+
capabilities := map[string]any{
38
+
"pull_requests": map[string]any{
39
+
"patch_submissions": true,
40
+
},
41
+
}
42
+
43
+
jsonData, err := json.Marshal(capabilities)
44
+
if err != nil {
45
+
http.Error(w, "Failed to serialize JSON", http.StatusInternalServerError)
46
+
return
47
+
}
48
+
49
+
w.Write(jsonData)
50
+
}
51
+
34
52
func (h *Handle) RepoIndex(w http.ResponseWriter, r *http.Request) {
35
53
path, _ := securejoin.SecureJoin(h.c.Repo.ScanPath, didPath(r))
36
54
l := h.l.With("path", path, "handler", "RepoIndex")