alpha
Login
or
Join now
alice.pds.demo.boltless.dev
/
core
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
2
Pulls
1
Pipelines
introduce capabilities to knotserver
author
Akshay
date
1 year ago
(Mar 31, 2025, 4:52 PM +0100)
commit
d3bf20a0
d3bf20a04dbd302d7950872165df9f9002c1ab8f
parent
f129b4f1
f129b4f1a54b84168b97f1cc26864367f7f61a84
+33
3 changed files
Expand all
Collapse all
Unified
Split
appview
state
signer.go
knotserver
handler.go
routes.go
+14
appview/state/signer.go
View file
Reviewed
···
301
301
302
302
return us.client.Do(req)
303
303
}
304
304
+
305
305
+
func (us *UnsignedClient) Capabilities(ownerDid, repoName string) (*http.Response, error) {
306
306
+
const (
307
307
+
Method = "GET"
308
308
+
Endpoint = "/capabilities"
309
309
+
)
310
310
+
311
311
+
req, err := us.newRequest(Method, Endpoint, nil)
312
312
+
if err != nil {
313
313
+
return nil, err
314
314
+
}
315
315
+
316
316
+
return us.client.Do(req)
317
317
+
}
+1
knotserver/handler.go
View file
Reviewed
···
70
70
}
71
71
72
72
r.Get("/", h.Index)
73
73
+
r.Get("/capabilities", h.Capabilities)
73
74
r.Get("/version", h.Version)
74
75
r.Route("/{did}", func(r chi.Router) {
75
76
// Repo routes
+18
knotserver/routes.go
View file
Reviewed
···
31
31
w.Write([]byte("This is a knot server. More info at https://tangled.sh"))
32
32
}
33
33
34
34
+
func (h *Handle) Capabilities(w http.ResponseWriter, r *http.Request) {
35
35
+
w.Header().Set("Content-Type", "application/json")
36
36
+
37
37
+
capabilities := map[string]any{
38
38
+
"pull_requests": map[string]any{
39
39
+
"patch_submissions": true,
40
40
+
},
41
41
+
}
42
42
+
43
43
+
jsonData, err := json.Marshal(capabilities)
44
44
+
if err != nil {
45
45
+
http.Error(w, "Failed to serialize JSON", http.StatusInternalServerError)
46
46
+
return
47
47
+
}
48
48
+
49
49
+
w.Write(jsonData)
50
50
+
}
51
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")