Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Updated check updates logic.
Mike Cao5873a56fff04
diff --git a/components/common/UpdateNotice.js b/components/common/UpdateNotice.jsindex bc27215ef..8bba1694e 100644--- a/components/common/UpdateNotice.js+++ b/components/common/UpdateNotice.js@@ -6,15 +6,10 @@ import { setItem } from 'lib/web';import { REPO_URL, VERSION_CHECK } from 'lib/constants';import Button from './Button';import styles from './UpdateNotice.module.css';-import useUser from 'hooks/useUser';-import useConfig from 'hooks/useConfig';export default function UpdateNotice() {- const { user } = useUser();- const { updatesDisabled } = useConfig();const { latest, checked, hasUpdate, releaseUrl } = useStore();const [dismissed, setDismissed] = useState(false);- const allowCheck = user?.is_admin && !updatesDisabled;const updateCheck = useCallback(() => {setItem(VERSION_CHECK, { version: latest, time: Date.now() });@@ -32,12 +27,12 @@ export default function UpdateNotice() {}useEffect(() => {- if (!checked && allowCheck) {+ if (!checked) {checkVersion();}}, [checked]);- if (!hasUpdate || dismissed || !allowCheck) {+ if (!hasUpdate || dismissed) {return null;}diff --git a/components/layout/Header.js b/components/layout/Header.jsindex 0d36429dc..c6942ef5c 100644--- a/components/layout/Header.js+++ b/components/layout/Header.js@@ -8,22 +8,26 @@ import ThemeButton from 'components/settings/ThemeButton';import HamburgerButton from 'components/common/HamburgerButton';import UpdateNotice from 'components/common/UpdateNotice';import UserButton from 'components/settings/UserButton';-import useUser from 'hooks/useUser';import { HOMEPAGE_URL } from 'lib/constants';+import useConfig from '/hooks/useConfig';+import useUser from 'hooks/useUser';import Logo from 'assets/logo.svg';import styles from './Header.module.css';export default function Header() {const { user } = useUser();const { pathname } = useRouter();+ const { updatesDisabled } = useConfig();+ const isSharePage = pathname.includes('/share/');+ const allowUpdate = user?.is_admin && !updatesDisabled && !isSharePage;return (<>- <UpdateNotice />+ {allowUpdate && <UpdateNotice />}<header className={classNames(styles.header, 'row')}><div className={styles.title}><Icon icon={<Logo />} size="large" className={styles.logo} />- <Link href={pathname.includes('/share') ? HOMEPAGE_URL : '/'}>umami</Link>+ <Link href={isSharePage ? HOMEPAGE_URL : '/'}>umami</Link></div><HamburgerButton />{user && (