mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 11:58:28 +00:00
Repackage discovery registry so that it can be converted to JSON.
The registry uses a non-string type as keys which is not possible in JSON.
This commit is contained in:
parent
598ce4bb5f
commit
fffae9a741
@ -451,7 +451,12 @@ func restPostDiscoveryHint(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func restGetDiscovery(w http.ResponseWriter, r *http.Request) {
|
func restGetDiscovery(w http.ResponseWriter, r *http.Request) {
|
||||||
json.NewEncoder(w).Encode(discoverer.All())
|
registry := discoverer.All()
|
||||||
|
devices := make(map[string][]struct{}, len(registry))
|
||||||
|
for device, addrs := range registry {
|
||||||
|
devices[device.String()] = make([]struct{}, len(addrs))
|
||||||
|
}
|
||||||
|
json.NewEncoder(w).Encode(devices)
|
||||||
}
|
}
|
||||||
|
|
||||||
func restGetReport(m *model.Model, w http.ResponseWriter, r *http.Request) {
|
func restGetReport(m *model.Model, w http.ResponseWriter, r *http.Request) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user