mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-24 02:06:19 +01:00
Added CURRENT_VERSION constant.
This commit is contained in:
parent
fb14514a65
commit
9b7e472410
@ -4,11 +4,9 @@ import classNames from 'classnames';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import Link from 'components/common/Link';
|
||||
import styles from './Footer.module.css';
|
||||
import useStore from 'store/version';
|
||||
import { HOMEPAGE_URL, REPO_URL } from 'lib/constants';
|
||||
import { CURRENT_VERSION, HOMEPAGE_URL, REPO_URL } from 'lib/constants';
|
||||
|
||||
export default function Footer() {
|
||||
const { current } = useStore();
|
||||
const { pathname } = useRouter();
|
||||
|
||||
return (
|
||||
@ -28,9 +26,9 @@ export default function Footer() {
|
||||
/>
|
||||
</div>
|
||||
<div className={classNames(styles.version, 'col-12 col-md-4')}>
|
||||
<Link href={REPO_URL}>{`v${current}`}</Link>
|
||||
<Link href={REPO_URL}>{`v${CURRENT_VERSION}`}</Link>
|
||||
</div>
|
||||
{!pathname.includes('/share/') && <Script src={`/telemetry.js?v=${current}`} />}
|
||||
{!pathname.includes('/share/') && <Script src={`/telemetry.js`} />}
|
||||
</footer>
|
||||
);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
export const CURRENT_VERSION = process.env.currentVersion;
|
||||
export const AUTH_TOKEN = 'umami.auth';
|
||||
export const LOCALE_CONFIG = 'umami.locale';
|
||||
export const TIMEZONE_CONFIG = 'umami.timezone';
|
||||
|
@ -1,18 +1,18 @@
|
||||
import { TELEMETRY_PIXEL } from 'lib/constants';
|
||||
import { CURRENT_VERSION, TELEMETRY_PIXEL } from 'lib/constants';
|
||||
|
||||
export default function handler(req, res) {
|
||||
const { v } = req.query;
|
||||
res.setHeader('content-type', 'text/javascript');
|
||||
|
||||
if (process.env.DISABLE_TELEMETRY) {
|
||||
return res.send('/* telemetry disabled */');
|
||||
}
|
||||
|
||||
const script = `
|
||||
(()=>{const i=document.createElement('img');
|
||||
i.setAttribute('src','${TELEMETRY_PIXEL}?v=${v}');
|
||||
i.setAttribute('src','${TELEMETRY_PIXEL}?v=${CURRENT_VERSION}');
|
||||
i.setAttribute('style','width:0;height:0;position:absolute;pointer-events:none;');
|
||||
document.body.appendChild(i);})();
|
||||
`;
|
||||
|
||||
res.setHeader('content-type', 'text/javascript');
|
||||
if (process.env.DISABLE_TELEMETRY) {
|
||||
res.send('/* telemetry disabled */');
|
||||
} else {
|
||||
res.send(script.replace(/\s\s+/g, ''));
|
||||
}
|
||||
return res.send(script.replace(/\s\s+/g, ''));
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
import create from 'zustand';
|
||||
import produce from 'immer';
|
||||
import semver from 'semver';
|
||||
import { VERSION_CHECK, UPDATES_URL } from 'lib/constants';
|
||||
import { CURRENT_VERSION, VERSION_CHECK, UPDATES_URL } from 'lib/constants';
|
||||
import { getItem } from 'lib/web';
|
||||
|
||||
const initialState = {
|
||||
current: process.env.currentVersion,
|
||||
current: CURRENT_VERSION,
|
||||
latest: null,
|
||||
hasUpdate: false,
|
||||
checked: false,
|
||||
|
Loading…
Reference in New Issue
Block a user