diff --git a/Makefile b/Makefile index 2819b80e..2a496297 100644 --- a/Makefile +++ b/Makefile @@ -196,7 +196,7 @@ define write_version_file echo " \"version\": \"$(version)\"," >> $(DIST_DIR)/version.json echo " \"announcement\": \"AdGuard Home $(version) is now available!\"," >> $(DIST_DIR)/version.json echo " \"announcement_url\": \"https://github.com/AdguardTeam/AdGuardHome/releases\"," >> $(DIST_DIR)/version.json - echo " \"selfupdate_min_version\": \"v0.0\"," >> $(DIST_DIR)/version.json + echo " \"selfupdate_min_version\": \"0.0\"," >> $(DIST_DIR)/version.json # Windows builds echo " \"download_windows_amd64\": \"$(BASE_URL)/AdGuardHome_windows_amd64.zip\"," >> $(DIST_DIR)/version.json diff --git a/changelog.config.js b/changelog.config.js index 427807cd..8adfb5b7 100644 --- a/changelog.config.js +++ b/changelog.config.js @@ -1,9 +1,9 @@ module.exports = { "disableEmoji": true, "list": [ - "+", - "*", - "-", + "+ ", + "* ", + "- ", ], "maxMessageLength": 64, "minMessageLength": 3, @@ -12,7 +12,7 @@ module.exports = { "scope", "subject", "body", - "issues" + "issues", ], "scopes": [ "", @@ -26,20 +26,20 @@ module.exports = { "documentation", ], "types": { - "+": { + "+ ": { "description": "A new feature", "emoji": "", - "value": "+" + "value": "+ " }, - "*": { + "* ": { "description": "A code change that neither fixes a bug or adds a feature", "emoji": "", - "value": "*" + "value": "* " }, - "-": { + "- ": { "description": "A bug fix", "emoji": "", - "value": "-" + "value": "- " } } }; diff --git a/client/src/actions/index.js b/client/src/actions/index.js index 8edffc08..a8245d73 100644 --- a/client/src/actions/index.js +++ b/client/src/actions/index.js @@ -4,6 +4,7 @@ import axios from 'axios'; import { splitByNewLine, sortClients } from '../helpers/helpers'; import { CHECK_TIMEOUT, SETTINGS_NAMES } from '../helpers/constants'; +import { areEqualVersions } from '../helpers/version'; import { getTlsStatus } from './encryption'; import apiClient from '../api/Api'; import { addErrorToast, addNoticeToast, addSuccessToast } from './toasts'; @@ -121,7 +122,7 @@ export const getVersion = (recheck = false) => async (dispatch, getState) => { const { dnsVersion } = getState().dashboard; const currentVersion = dnsVersion === 'undefined' ? 0 : dnsVersion; - if (data && currentVersion !== data.new_version) { + if (data && !areEqualVersions(currentVersion, data.new_version)) { dispatch(addSuccessToast('updates_checked')); } else { dispatch(addSuccessToast('updates_version_equal')); diff --git a/client/src/helpers/version.js b/client/src/helpers/version.js new file mode 100644 index 00000000..1cf1e5fe --- /dev/null +++ b/client/src/helpers/version.js @@ -0,0 +1,17 @@ +/** + * Checks if versions are equal. + * Please note, that this method strips the "v" prefix. + * + * @param left {string} - left version + * @param right {string} - right version + * @return {boolean} true if versions are equal + */ +export const areEqualVersions = (left, right) => { + if (!left || !right) { + return false; + } + + const leftVersion = left.replace(/^v/, ''); + const rightVersion = right.replace(/^v/, ''); + return leftVersion === rightVersion; +}; diff --git a/client/src/reducers/index.js b/client/src/reducers/index.js index 050ae116..56d26fb7 100644 --- a/client/src/reducers/index.js +++ b/client/src/reducers/index.js @@ -14,6 +14,7 @@ import stats from './stats'; import queryLogs from './queryLogs'; import dnsConfig from './dnsConfig'; import filtering from './filtering'; +import { areEqualVersions } from '../helpers/version'; const settings = handleActions( { @@ -81,7 +82,7 @@ const dashboard = handleActions( [actions.getVersionSuccess]: (state, { payload }) => { const currentVersion = state.dnsVersion === 'undefined' ? 0 : state.dnsVersion; - if (!payload.disabled && currentVersion !== payload.new_version) { + if (!payload.disabled && !areEqualVersions(currentVersion, payload.new_version)) { const { announcement_url: announcementUrl, new_version: newVersion,