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:
12
src/common/decorators/app-version.decorator.ts
Normal file
12
src/common/decorators/app-version.decorator.ts
Normal 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'];
|
||||
},
|
||||
);
|
||||
Reference in New Issue
Block a user