diff --git a/AGHTechDoc.md b/AGHTechDoc.md index 3e3574e2..e70d1609 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 argument: 200 OK + { + "disabled":true + } + It means that update check is disabled by user. UI should do nothing. diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js index 642d8503..cc25a4b9 100644 --- a/client/src/reducers/index.js +++ b/client/src/reducers/index.js @@ -82,7 +82,7 @@ const dashboard = handleActions( [actions.getVersionSuccess]: (state, { payload }) => { const currentVersion = state.dnsVersion === 'undefined' ? 0 : state.dnsVersion; - if (payload && isVersionGreater(currentVersion, payload.new_version)) { + if (!payload.disabled && isVersionGreater(currentVersion, payload.new_version)) { const { announcement_url: announcementUrl, new_version: newVersion, @@ -96,7 +96,7 @@ const dashboard = handleActions( canAutoUpdate, isUpdateAvailable: true, processingVersion: false, - checkUpdateFlag: !!payload, + checkUpdateFlag: !payload.disabled, }; return newState; } @@ -104,6 +104,7 @@ const dashboard = handleActions( return { ...state, processingVersion: false, + checkUpdateFlag: !payload.disabled, }; }, 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 }