From 4bfa750a8425f32e02b210a898033b277af2c7c7 Mon Sep 17 00:00:00 2001 From: Stevenma <3296308883@qq.com> Date: Sun, 10 May 2026 17:35:48 +0800 Subject: [PATCH] add version.txt v0.3.0, /api/version reads from file --- src/index.ts | 8 +++++++- version.txt | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 version.txt diff --git a/src/index.ts b/src/index.ts index e75f232..3b17abc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -64,7 +64,13 @@ app.get('/api/activity/ping', (req, res) => { // 版本/健康检查 (用于验证部署) app.get('/api/version', (req, res) => { - res.json({ version: 'd823421' }); + const fs = require('fs'); + const path = require('path'); + let ver = 'unknown'; + try { + ver = fs.readFileSync(path.join(__dirname, '..', 'version.txt'), 'utf8').trim(); + } catch {} + res.json({ version: ver }); }); app.use('/api', authRoutes); diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..268b033 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +v0.3.0