From 49bc74e7a0498dc64064d7330e95a02dc043d57f Mon Sep 17 00:00:00 2001 From: Pascal Jungblut Date: Tue, 10 Mar 2015 23:45:43 +0100 Subject: [PATCH] Use lowerCamelCase for the JSON API (fixes #1338) Replace the current mix of UpperCamelCase und lowerCamelCase with consistent lowerCamelCase keys for the JSON API. Also adapt the frontend so it works with the changed API. Attention: this will break existing consumers of the API. --- cmd/syncthing/gui.go | 16 +- gui/index.html | 186 +++++------ gui/scripts/syncthing/app.js | 2 +- .../core/controllers/syncthingController.js | 313 +++++++++--------- internal/auto/gui.files.go | 6 +- internal/config/config.go | 110 +++--- internal/model/model.go | 11 + internal/model/sharedpullerstate.go | 16 +- internal/stats/device.go | 2 +- internal/stats/folder.go | 6 +- 10 files changed, 339 insertions(+), 329 deletions(-) diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index bbdf5ded..04c86f5c 100644 --- a/cmd/syncthing/gui.go +++ b/cmd/syncthing/gui.go @@ -46,8 +46,8 @@ import ( ) type guiError struct { - Time time.Time - Error string + Time time.Time `json:"time"` + Error string `json:"error"` } var ( @@ -824,12 +824,12 @@ func toNeedSlice(fs []db.FileInfoTruncated) []map[string]interface{} { output := make([]map[string]interface{}, len(fs)) for i, file := range fs { output[i] = map[string]interface{}{ - "Name": file.Name, - "Flags": file.Flags, - "Modified": file.Modified, - "Version": file.Version, - "LocalVersion": file.LocalVersion, - "Size": file.Size(), + "name": file.Name, + "flags": file.Flags, + "modified": file.Modified, + "version": file.Version, + "localVersion": file.LocalVersion, + "size": file.Size(), } } return output diff --git a/gui/index.html b/gui/index.html index 3c651b04..3ced4ee2 100644 --- a/gui/index.html +++ b/gui/index.html @@ -155,7 +155,7 @@

Notice

-

{{err.Time | date:"H:mm:ss"}}: {{friendlyDevices(err.Error)}}

+

{{err.time | date:"H:mm:ss"}}: {{friendlyDevices(err.error)}}