diff --git a/components/common/UpdateNotice.js b/components/common/UpdateNotice.js
index 27ec562a..0bdb1041 100644
--- a/components/common/UpdateNotice.js
+++ b/components/common/UpdateNotice.js
@@ -8,7 +8,7 @@ import useForceUpdate from '../../hooks/useForceUpdate';
export default function UpdateNotice() {
const forceUpdte = useForceUpdate();
- const { hasUpdate, latest, updateCheck } = useVersion();
+ const { hasUpdate, latest, updateCheck } = useVersion(true);
function handleViewClick() {
location.href = 'https://github.com/mikecao/umami/releases';
diff --git a/components/layout/Footer.js b/components/layout/Footer.js
index 7bd1ebd3..30782de0 100644
--- a/components/layout/Footer.js
+++ b/components/layout/Footer.js
@@ -2,9 +2,10 @@ import React from 'react';
import { FormattedMessage } from 'react-intl';
import Link from 'components/common/Link';
import styles from './Footer.module.css';
+import useVersion from 'hooks/useVersion';
export default function Footer() {
- const version = process.env.VERSION;
+ const { current } = useVersion();
return (
);
diff --git a/hooks/useVersion.js b/hooks/useVersion.js
index d8e3d699..bec5670b 100644
--- a/hooks/useVersion.js
+++ b/hooks/useVersion.js
@@ -1,27 +1,22 @@
import { useEffect, useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux';
-import semver from 'semver';
-import { getItem, setItem } from 'lib/web';
import { checkVersion } from 'redux/actions/app';
import { VERSION_CHECK } from 'lib/constants';
+import { setItem } from 'lib/web';
-export default function useVersion() {
+export default function useVersion(check) {
const dispatch = useDispatch();
const versions = useSelector(state => state.app.versions);
- const lastCheck = getItem(VERSION_CHECK);
-
- const { current, latest } = versions;
- const hasUpdate = latest && semver.gt(latest, current) && lastCheck?.version !== latest;
const updateCheck = useCallback(() => {
- setItem(VERSION_CHECK, { version: latest, time: Date.now() });
+ setItem(VERSION_CHECK, { version: versions.latest, time: Date.now() });
}, [versions]);
useEffect(() => {
- if (!versions.latest) {
+ if (check && !versions.latest) {
dispatch(checkVersion());
}
- }, [versions]);
+ }, [versions, check]);
- return { ...versions, hasUpdate, updateCheck };
+ return { ...versions, updateCheck };
}
diff --git a/package.json b/package.json
index 066448ab..7d7b135d 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "umami",
- "version": "0.69.0",
+ "version": "0.70.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao ",
"license": "MIT",
@@ -63,7 +63,8 @@
"date-fns": "^2.16.1",
"date-fns-tz": "^1.0.10",
"detect-browser": "^5.1.1",
- "formik": "^2.1.6",
+ "dotenv": "^8.2.0",
+ "formik": "^2.1.7",
"immer": "^7.0.9",
"is-localhost-ip": "^1.4.0",
"isbot-fast": "^1.2.0",
@@ -73,7 +74,7 @@
"next": "^9.5.3",
"react": "^16.13.1",
"react-dom": "^16.13.1",
- "react-intl": "^5.8.3",
+ "react-intl": "^5.8.4",
"react-redux": "^7.2.1",
"react-simple-maps": "^2.1.2",
"react-spring": "^8.0.27",
@@ -89,7 +90,7 @@
"uuid": "^8.3.0"
},
"devDependencies": {
- "@formatjs/cli": "^2.12.0",
+ "@formatjs/cli": "^2.13.0",
"@prisma/cli": "2.8.0",
"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-node-resolve": "^9.0.0",
@@ -97,7 +98,6 @@
"@svgr/webpack": "^5.4.0",
"cross-env": "^7.0.2",
"del": "^6.0.0",
- "dotenv": "^8.2.0",
"dotenv-cli": "^4.0.0",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
diff --git a/redux/actions/app.js b/redux/actions/app.js
index 490bd7f1..94b77daa 100644
--- a/redux/actions/app.js
+++ b/redux/actions/app.js
@@ -1,6 +1,7 @@
import { createSlice } from '@reduxjs/toolkit';
import { getItem } from 'lib/web';
-import { LOCALE_CONFIG, THEME_CONFIG } from 'lib/constants';
+import { LOCALE_CONFIG, THEME_CONFIG, VERSION_CHECK } from 'lib/constants';
+import semver from 'semver';
const app = createSlice({
name: 'app',
@@ -10,6 +11,7 @@ const app = createSlice({
versions: {
current: process.env.VERSION,
latest: null,
+ hasUpdate: false,
},
},
reducers: {
@@ -60,11 +62,14 @@ export function checkVersion() {
const { tag_name } = data;
const latest = tag_name.startsWith('v') ? tag_name.slice(1) : tag_name;
+ const lastCheck = getItem(VERSION_CHECK);
+ const hasUpdate = latest && semver.gt(latest, current) && lastCheck?.version !== latest;
return dispatch(
setVersions({
current,
latest,
+ hasUpdate,
}),
);
};
diff --git a/scripts/start-env.js b/scripts/start-env.js
index 63b66369..05823b7a 100644
--- a/scripts/start-env.js
+++ b/scripts/start-env.js
@@ -1,3 +1,3 @@
const cli = require('next/dist/cli/next-start');
-cli.nextStart(['-p', process.env.PORT || 3000, '-H', process.env.HOSTNAME || '0.0.0.0']);
+cli.nextStart(['-p', process.env.PORT || 3000, '-H', process.env.HOSTNAME || 'localhost']);
diff --git a/yarn.lock b/yarn.lock
index 00d976eb..3d341f16 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1064,12 +1064,12 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
-"@formatjs/cli@^2.12.0":
- version "2.12.0"
- resolved "https://registry.yarnpkg.com/@formatjs/cli/-/cli-2.12.0.tgz#f0bb253db073903634e57e587e0395cd0d0cd681"
- integrity sha512-F0epNBWCXjKGgej8GL1q4RLGqR38bRCPmGLb3VautkbZ74achB0cVGj2w/AdlQiJJ1mU5rEU13pRroukUBZ+GA==
+"@formatjs/cli@^2.13.0":
+ version "2.13.0"
+ resolved "https://registry.yarnpkg.com/@formatjs/cli/-/cli-2.13.0.tgz#64018c82f9fbc291918792daf1eed16e4b56bb7f"
+ integrity sha512-1E/rdrKiHi7gbcN0WuY792X+jCHWI+9jC3565hhZXAJYmgNe9SntRW02nEJOK3WOkhm6yMWiHPLkFpyLq5hW3w==
dependencies:
- "@formatjs/ts-transformer" "^2.11.0"
+ "@formatjs/ts-transformer" "^2.11.1"
"@types/json-stable-stringify" "^1.0.32"
"@types/lodash" "^4.14.150"
"@types/loud-rejection" "^2.0.0"
@@ -1078,10 +1078,11 @@
commander "^6.1.0"
fast-glob "^3.2.4"
fs-extra "^9.0.0"
- intl-messageformat-parser "^6.0.7"
+ intl-messageformat-parser "^6.0.8"
json-stable-stringify "^1.0.1"
lodash "^4.17.15"
loud-rejection "^2.2.0"
+ tslib "^2.0.1"
typescript "^4.0"
"@formatjs/ecma402-abstract@^1.2.2":
@@ -1089,19 +1090,28 @@
resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.2.2.tgz#4810bdbd696d3805c535fd0620b7c8f45ab3164f"
integrity sha512-mLCoAPGlXCVskb/ojBO6iurGqwo6sZvAl8pRC4N25bz4LPWExAM9LsOo057zN3Br1JxUM3RZHG4YGnVt+nSRYQ==
-"@formatjs/intl-displaynames@^3.3.9":
- version "3.3.9"
- resolved "https://registry.yarnpkg.com/@formatjs/intl-displaynames/-/intl-displaynames-3.3.9.tgz#18eeb39aa05d4a8b064e520725f9178d0c3f8c50"
- integrity sha512-6Ez9Ab9p9bsxCM4OlqsT+R0rmrj5lr6xjIXiCTs/pSDFeiNPQabWDHcBpiGlMRE3zifOwUOFSoi5AGGYMFgetw==
+"@formatjs/ecma402-abstract@^1.2.3":
+ version "1.2.3"
+ resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.2.3.tgz#ca94911dd8e9c89eeaabba0f00e2f692979fc27b"
+ integrity sha512-sEkxTZj7qa+Pi/c4ppE5mxZYJkqQO3GNZzJZjAxgsXip2ixO/TZn58qrxdQ0V8mXmf+5xf+AfveyPvv4yHaRtw==
dependencies:
- "@formatjs/ecma402-abstract" "^1.2.2"
+ tslib "^2.0.1"
-"@formatjs/intl-listformat@^4.2.7":
- version "4.2.7"
- resolved "https://registry.yarnpkg.com/@formatjs/intl-listformat/-/intl-listformat-4.2.7.tgz#bcccfee92c69e661d4da51567540aa39fef9ceae"
- integrity sha512-7sYy7pBGzClvSZI98FhVeNt6N/ELdvrj8pvLOfcR0+FQyhv0ixanog7bRo9kT8ECin9+RwEpTmX7jGCh8Bcgjw==
+"@formatjs/intl-displaynames@^3.3.10":
+ version "3.3.10"
+ resolved "https://registry.yarnpkg.com/@formatjs/intl-displaynames/-/intl-displaynames-3.3.10.tgz#905ad86431fdadfab2ec188bf9f4fe9e359d1fe6"
+ integrity sha512-SdIMuaKUO0N5zQb6CXtIrwjJbX+DC8ju7ifrcqpLagUMh2nIEJCz7sf0Q6lOMWEE+un1VTmjaXpRPP55cP40IA==
dependencies:
- "@formatjs/ecma402-abstract" "^1.2.2"
+ "@formatjs/ecma402-abstract" "^1.2.3"
+ tslib "^2.0.1"
+
+"@formatjs/intl-listformat@^4.2.8":
+ version "4.2.8"
+ resolved "https://registry.yarnpkg.com/@formatjs/intl-listformat/-/intl-listformat-4.2.8.tgz#aa8935234dd5f8fcec6d08dfdf2be43e11ba671c"
+ integrity sha512-9qAThh/1HV9T/g6E11VbN5b209zg28fMUMrZqrpHiZZxc2PPHvP/CGqK7mo8hpyCoMUVo3kFxB5CFnw5difJrA==
+ dependencies:
+ "@formatjs/ecma402-abstract" "^1.2.3"
+ tslib "^2.0.1"
"@formatjs/intl-numberformat@^5.5.2":
version "5.6.2"
@@ -1110,32 +1120,35 @@
dependencies:
"@formatjs/ecma402-abstract" "^1.2.2"
-"@formatjs/intl-relativetimeformat@^7.2.7":
- version "7.2.7"
- resolved "https://registry.yarnpkg.com/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-7.2.7.tgz#dce72ebafb1ca0bf14673fab3b1aad145e1abac6"
- integrity sha512-R6rxX4PfPQ/EuDRALLSIEDCDW/FAmmu6xpRXIPdZ33bEP7SXEksJB039Bw//I0VIm2fBeIlxe9oqvRGfuqpwVg==
+"@formatjs/intl-relativetimeformat@^7.2.8":
+ version "7.2.8"
+ resolved "https://registry.yarnpkg.com/@formatjs/intl-relativetimeformat/-/intl-relativetimeformat-7.2.8.tgz#a423ef9acd379980f58730b4757713156076de14"
+ integrity sha512-h6H5lcPn1LbVlAk62m7DYtY68aE6AiZVK1bLEo3HeWrMBFCskWAe9I/5kI+RjStdGZzo+CqBl+rSTcrSXjVj+g==
dependencies:
- "@formatjs/ecma402-abstract" "^1.2.2"
+ "@formatjs/ecma402-abstract" "^1.2.3"
+ tslib "^2.0.1"
-"@formatjs/intl@^1.3.3":
- version "1.3.3"
- resolved "https://registry.yarnpkg.com/@formatjs/intl/-/intl-1.3.3.tgz#d59997b7ef832e7c47e8ca50861ff7ff7461d56c"
- integrity sha512-gFuCIZEH6o1O2ZF8YlhHJEApRrBarQ7iyqxFp4ujllr/tcjgSxfzF+LSBCPyJ1OQIU98ynOc0XKdrAR2wUd3ow==
+"@formatjs/intl@^1.3.4":
+ version "1.3.4"
+ resolved "https://registry.yarnpkg.com/@formatjs/intl/-/intl-1.3.4.tgz#66441b85986726256f83fdffdb533c6334bc299b"
+ integrity sha512-aq6bhi2aZPYUEL15iiBrsNzDtw4Qe1r9dsqM26fbTbfWa6r5sdqcFwGySoeTzguxd+ZXoc9RypSMERjH92xFKA==
dependencies:
- "@formatjs/ecma402-abstract" "^1.2.2"
- "@formatjs/intl-displaynames" "^3.3.9"
- "@formatjs/intl-listformat" "^4.2.7"
- "@formatjs/intl-relativetimeformat" "^7.2.7"
+ "@formatjs/ecma402-abstract" "^1.2.3"
+ "@formatjs/intl-displaynames" "^3.3.10"
+ "@formatjs/intl-listformat" "^4.2.8"
+ "@formatjs/intl-relativetimeformat" "^7.2.8"
fast-memoize "^2.5.2"
- intl-messageformat "^9.3.8"
- intl-messageformat-parser "^6.0.7"
+ intl-messageformat "^9.3.9"
+ intl-messageformat-parser "^6.0.8"
+ tslib "^2.0.1"
-"@formatjs/ts-transformer@^2.11.0":
- version "2.11.0"
- resolved "https://registry.yarnpkg.com/@formatjs/ts-transformer/-/ts-transformer-2.11.0.tgz#90c4b5afae55fd8b8c7ab6aa08ca94a123eb94b9"
- integrity sha512-d0++zpEeeCtE+RwbEB+TYw0WnC+jlNniIZu9NcILdgN6LEr9+TRxO+Gz4d7nj3g0D5X1LyNx6P4JI+byGxHqzw==
+"@formatjs/ts-transformer@^2.11.1":
+ version "2.11.1"
+ resolved "https://registry.yarnpkg.com/@formatjs/ts-transformer/-/ts-transformer-2.11.1.tgz#9b30c066cd1ca1831bfc76e22b01e2858b931923"
+ integrity sha512-VAjFBnWSQfO71PrR0NeGgwGoHOAlNMuQv4kdV6GpxQ/3d4YM+202Cpu6r1BmCvxkuXhijTMUu7ubKeenUr8WcA==
dependencies:
- intl-messageformat-parser "^6.0.7"
+ intl-messageformat-parser "^6.0.8"
+ tslib "^2.0.1"
typescript "^4.0"
"@formatjs/ts-transformer@^2.6.0":
@@ -4145,10 +4158,10 @@ for-own@^0.1.3:
dependencies:
for-in "^1.0.1"
-formik@^2.1.6:
- version "2.1.6"
- resolved "https://registry.yarnpkg.com/formik/-/formik-2.1.6.tgz#f723bfccb2c7abec886aa6a4930b360d20f1a0b3"
- integrity sha512-m9DcxlZw/58p4xuhH3dzUzQWaC4dig0RKX7yNQOJt4VRhXn7p+YRrs3o17r3YwzvOLua3zC53VMbfupLsDwO5w==
+formik@^2.1.7:
+ version "2.1.7"
+ resolved "https://registry.yarnpkg.com/formik/-/formik-2.1.7.tgz#40bd04e59b242176d0a17c701830f1536cd7506b"
+ integrity sha512-n1wviIh0JsvHqj9PufNvOV+fS7mFwh9FfMxxTMnTrKR/uVYMS06DKaivXBlJdDF0qEwTcPHxSmIQ3deFHL3Hsg==
dependencies:
deepmerge "^2.1.1"
hoist-non-react-statics "^3.3.0"
@@ -4694,13 +4707,22 @@ intl-messageformat-parser@^6.0.7:
dependencies:
"@formatjs/ecma402-abstract" "^1.2.2"
-intl-messageformat@^9.3.8:
- version "9.3.8"
- resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-9.3.8.tgz#561f31800cc3ced5dada6c991a0dd0233931850f"
- integrity sha512-XuFoC6kvsgL1qtzro9ubOaJ2zVgeJWb5X0mTYvG7p1OinbOZYPscP8eYyVJf9g++tDy/fwx9TfeaFlunmhC+Vw==
+intl-messageformat-parser@^6.0.8:
+ version "6.0.8"
+ resolved "https://registry.yarnpkg.com/intl-messageformat-parser/-/intl-messageformat-parser-6.0.8.tgz#4180b280d21653df7c8c078e75e0bb7f0e3322c3"
+ integrity sha512-g1nV8YVI/Nscbu3qjGGgMcq61Es7L2bI+08gcbAx3taiFMJ3oJgQhC/wYksWLsq2cvLxq5pQ5Te06CE793/iVA==
+ dependencies:
+ "@formatjs/ecma402-abstract" "^1.2.3"
+ tslib "^2.0.1"
+
+intl-messageformat@^9.3.9:
+ version "9.3.9"
+ resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-9.3.9.tgz#41f9f139adbbb509da657133047c8c5bf4ca22a9"
+ integrity sha512-SB6b68bY+RZPBhg3XTmwfX0lL3ywvOuAcS+iH6cptiHPfzOPSzP05F3ZOirARwj8pVbC9Xd4w0pMtF/sGnHurw==
dependencies:
fast-memoize "^2.5.2"
- intl-messageformat-parser "^6.0.7"
+ intl-messageformat-parser "^6.0.8"
+ tslib "^2.0.1"
invariant@^2.2.2, invariant@^2.2.4:
version "2.2.4"
@@ -7165,22 +7187,23 @@ react-fast-compare@^2.0.1:
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-2.0.4.tgz#e84b4d455b0fec113e0402c329352715196f81f9"
integrity sha512-suNP+J1VU1MWFKcyt7RtjiSWUjvidmQSlqu+eHslq+342xCbGTYmC0mEhPCOHxlW0CywylOC1u2DFAT+bv4dBw==
-react-intl@^5.8.3:
- version "5.8.3"
- resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-5.8.3.tgz#2018aca11a49d2d1b0f602e0dda653a47bf59dfb"
- integrity sha512-ueM7JhbBIi+6FpH6jCrJuKcYpjmFn9UAHA28ojY8LMAL1PowZ/53XGGMvfj32J0/2EIuHQ6vUbi/07kJqe1ksQ==
+react-intl@^5.8.4:
+ version "5.8.4"
+ resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-5.8.4.tgz#aba5432fcba17f47d9d46ac9bea1881c92f4f354"
+ integrity sha512-ToDeHYBpO9WBAOpnwQKihUdxB4qE1nqcGKV9Jq2upj1zspxeX3OddWaZwz8wNV5yjoYnoDY3HLWeBP4IXwbwqg==
dependencies:
- "@formatjs/ecma402-abstract" "^1.2.2"
- "@formatjs/intl" "^1.3.3"
- "@formatjs/intl-displaynames" "^3.3.9"
- "@formatjs/intl-listformat" "^4.2.7"
- "@formatjs/intl-relativetimeformat" "^7.2.7"
+ "@formatjs/ecma402-abstract" "^1.2.3"
+ "@formatjs/intl" "^1.3.4"
+ "@formatjs/intl-displaynames" "^3.3.10"
+ "@formatjs/intl-listformat" "^4.2.8"
+ "@formatjs/intl-relativetimeformat" "^7.2.8"
"@types/hoist-non-react-statics" "^3.3.1"
fast-memoize "^2.5.2"
hoist-non-react-statics "^3.3.2"
- intl-messageformat "^9.3.8"
- intl-messageformat-parser "^6.0.7"
+ intl-messageformat "^9.3.9"
+ intl-messageformat-parser "^6.0.8"
shallow-equal "^1.2.1"
+ tslib "^2.0.1"
react-is@16.13.1, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.9.0:
version "16.13.1"
@@ -8711,6 +8734,11 @@ tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043"
integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==
+tslib@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.0.1.tgz#410eb0d113e5b6356490eec749603725b021b43e"
+ integrity sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==
+
tsutils@^3.17.1:
version "3.17.1"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.17.1.tgz#ed719917f11ca0dee586272b2ac49e015a2dd759"