From d38b58cd85d663ecadaf785d53dc16666444fa9a Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 14 Jul 2020 17:08:53 +0300 Subject: [PATCH] * POST /control/version.json: change response when update is disabled --- AGHTechDoc.md | 6 +++++- home/control_update.go | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/AGHTechDoc.md b/AGHTechDoc.md index 3e3574e2..527a7eaa 100644 --- a/AGHTechDoc.md +++ b/AGHTechDoc.md @@ -344,10 +344,14 @@ Response: If `can_autoupdate` is true, then the server can automatically upgrade to a new version. -Response with empty body: +Response when auto-update is disabled by command-line aragument: 200 OK + { + "disabled":true + } + It means that update check is disabled by user. UI should do nothing. diff --git a/home/control_update.go b/home/control_update.go index d734f4d1..566b8327 100644 --- a/home/control_update.go +++ b/home/control_update.go @@ -41,6 +41,10 @@ type getVersionJSONRequest struct { // Get the latest available version from the Internet func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) { if Context.disableUpdate { + resp := make(map[string]interface{}) + resp["disabled"] = true + d, _ := json.Marshal(resp) + _, _ = w.Write(d) return }