From fffae9a7414d28c6a76d91a3ecbb305688996ef1 Mon Sep 17 00:00:00 2001 From: Phill Luby Date: Wed, 15 Oct 2014 19:23:28 +0100 Subject: [PATCH] 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. --- cmd/syncthing/gui.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index 7a4adc40..3a18a639 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -451,7 +451,12 @@ func restPostDiscoveryHint(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) {