feat: show application version and check Gitea releases

This commit is contained in:
abaishu0730 committed 2026-10-27 14:27:37 +08:00
1 parent dcea4a063f
commit f161322532
11 files changed
+273 -7

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ function createServer(options) {
const supplied = Buffer.from(String(request.headers['x-order-token'] || ''));
const expected = Buffer.from(options.token);
if (supplied.length !== expected.length || !crypto.timingSafeEqual(supplied, expected)) return reply(401, {error:'配对失效,请重新加载扩展。'});
if (request.method === 'GET' && request.url === '/health') return reply(200, {ok:true,version:'0.1.0',busy});
if (request.method === 'GET' && request.url === '/health') return reply(200, {ok:true,version:require('../../package.json').version,busy});
const jobRoute = /^\/jobs\/([a-f0-9]{32})$/.exec(request.url);
if (request.method === 'GET' && jobRoute) return jobs.has(jobRoute[1]) ? reply(200,jobs.get(jobRoute[1])) : reply(404,{error:'任务已过期,请检查输出目录后重试。'});
if (request.method !== 'POST' || request.url !== '/export') return reply(404, {error:'未知操作。'});