feat(users): add version checking endpoint

Add app version checking functionality to notify users when updates are available. The feature extracts the current version from the x-App-Version header, compares it with the latest configured version, and returns update information including download links and release notes.
This commit is contained in:
2025-11-29 20:47:01 +08:00
parent ff2dfd5bb3
commit ae41a2b643
4 changed files with 204 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
import { createParamDecorator, ExecutionContext } from '@nestjs/common';
/**
* 从请求头中获取应用版本号的装饰器
* 从 x-App-Version 请求头中提取版本信息
*/
export const AppVersion = createParamDecorator(
(data: unknown, ctx: ExecutionContext): string | undefined => {
const request = ctx.switchToHttp().getRequest();
return request.headers['x-app-version'];
},
);