1
0
Эх сурвалжийг харах

/rest/version should return JSON (fixes #694)

Jakob Borg 11 жил өмнө
parent
commit
d7956dd495

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
auto/gui.files.go


+ 7 - 1
cmd/syncthing/gui.go

@@ -200,7 +200,13 @@ func withModel(m *model.Model, h func(m *model.Model, w http.ResponseWriter, r *
 }
 
 func restGetVersion(w http.ResponseWriter, r *http.Request) {
-	w.Write([]byte(Version))
+	w.Header().Set("Content-Type", "application/json; charset=utf-8")
+	json.NewEncoder(w).Encode(map[string]string{
+		"version":     Version,
+		"longVersion": LongVersion,
+		"os":          runtime.GOOS,
+		"arch":        runtime.GOARCH,
+	})
 }
 
 func restGetCompletion(m *model.Model, w http.ResponseWriter, r *http.Request) {

+ 1 - 1
gui/app.js

@@ -390,7 +390,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
         refreshNodeStats();
 
         $http.get(urlbase + '/version').success(function (data) {
-            $scope.version = data;
+            $scope.version = data.version;
         });
 
         $http.get(urlbase + '/report').success(function (data) {

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно