mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-15 03:02:07 +03:00
* (ui): fix the version check - strip the v prefix
This commit is contained in:
parent
4f4a688ee6
commit
1e5419714d
2
Makefile
2
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
|
||||
|
@ -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": "- "
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -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'));
|
||||
|
17
client/src/helpers/version.js
Normal file
17
client/src/helpers/version.js
Normal file
@ -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;
|
||||
};
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user