Skip to content

Commit b7ef30f

Browse files
authored
fix: read version from package.json instead of hardcoded value (#111)
Remove the hardcoded '0.5.3' in UpdateService.getCurrentVersion() and instead import version from package.json, following the same pattern already used in GeneralPanel. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent bc063c5 commit b7ef30f

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/services/updateService.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export interface VersionInfo {
66
}
77

88
import { PROJECT_REPO_URL } from '../constants/project';
9+
import { version } from '../../package.json';
910

1011
const REPO_OWNER = PROJECT_REPO_URL.split('/').slice(-2).join('/');
1112
const VERSION_INFO_URL = `https://raw.githubusercontent.com/${REPO_OWNER}/main/versions/version-info.xml`;
@@ -20,9 +21,7 @@ export class UpdateService {
2021
private static readonly REPO_URL = VERSION_INFO_URL;
2122

2223
private static getCurrentVersion(): string {
23-
// 在实际应用中,这个版本号应该在构建时注入
24-
// 这里暂时硬编码,你可以通过构建脚本或环境变量来动态设置
25-
return '0.5.3';
24+
return version;
2625
}
2726

2827
static async checkForUpdates(): Promise<UpdateCheckResult> {

0 commit comments

Comments
 (0)