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