mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 08:44:25 +08:00
add refresh browser cache when client version not match server version
This commit is contained in:
+27
-9
@@ -1,13 +1,17 @@
|
||||
import type { VersionInfo } from '@/core/version.ts';
|
||||
|
||||
import { getBasePath } from './web.ts';
|
||||
|
||||
export function isProduction(): boolean {
|
||||
return __EZBOOKKEEPING_IS_PRODUCTION__;
|
||||
}
|
||||
const clientVersionHolder: VersionInfo = {
|
||||
version: __EZBOOKKEEPING_VERSION__,
|
||||
commitHash: __EZBOOKKEEPING_BUILD_COMMIT_HASH__,
|
||||
buildTime: __EZBOOKKEEPING_BUILD_UNIX_TIME__
|
||||
};
|
||||
|
||||
export function getVersion(): string {
|
||||
const isRelease = !getBuildTime();
|
||||
const commitHash = __EZBOOKKEEPING_BUILD_COMMIT_HASH__;
|
||||
let version = __EZBOOKKEEPING_VERSION__;
|
||||
export function formatDisplayVersion(versionInfo: VersionInfo): string {
|
||||
const isRelease = !versionInfo.buildTime;
|
||||
const commitHash = versionInfo.commitHash;
|
||||
let version = versionInfo.version;
|
||||
|
||||
if (version && (!isRelease || !isProduction())) {
|
||||
version += '-dev';
|
||||
@@ -15,6 +19,8 @@ export function getVersion(): string {
|
||||
|
||||
if (!version) {
|
||||
version = 'unknown';
|
||||
} else {
|
||||
version = 'v' + version;
|
||||
}
|
||||
|
||||
if (commitHash) {
|
||||
@@ -24,8 +30,20 @@ export function getVersion(): string {
|
||||
return version;
|
||||
}
|
||||
|
||||
export function getBuildTime(): string {
|
||||
return __EZBOOKKEEPING_BUILD_UNIX_TIME__;
|
||||
export function isProduction(): boolean {
|
||||
return __EZBOOKKEEPING_IS_PRODUCTION__;
|
||||
}
|
||||
|
||||
export function getClientVersionInfo(): VersionInfo {
|
||||
return clientVersionHolder;
|
||||
}
|
||||
|
||||
export function getClientDisplayVersion(): string {
|
||||
return formatDisplayVersion(clientVersionHolder);
|
||||
}
|
||||
|
||||
export function getClientBuildTime(): string {
|
||||
return clientVersionHolder.buildTime || '';
|
||||
}
|
||||
|
||||
export function getMobileVersionPath(): string {
|
||||
|
||||
Reference in New Issue
Block a user