mirror of
https://github.com/certd/certd.git
synced 2026-04-21 10:27:25 +08:00
chore: 1
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import { Controller, Get, Provide } from '@midwayjs/core';
|
||||
import { BaseController, Constants } from '@certd/lib-server';
|
||||
import { http, logger } from '@certd/pipeline';
|
||||
/**
|
||||
*/
|
||||
@Provide()
|
||||
@Controller('/api/app/')
|
||||
export class AppController extends BaseController {
|
||||
@Get('/latest', { summary: Constants.per.authOnly })
|
||||
async latest(): Promise<any> {
|
||||
const res = await http.request({
|
||||
url: 'https://registry.npmmirror.com/@certd/pipeline',
|
||||
method: 'get',
|
||||
});
|
||||
try {
|
||||
const latest = res['dist-tags'].latest;
|
||||
return this.ok(latest);
|
||||
} catch (e: any) {
|
||||
logger.error(e);
|
||||
return this.ok('');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import { MidwayEnvironmentService } from '@midwayjs/core';
|
||||
import { Controller, Get, Inject, Provide } from '@midwayjs/core';
|
||||
import { Controller, Get, Inject, MidwayEnvironmentService, Provide } from '@midwayjs/core';
|
||||
import { logger } from '@certd/pipeline';
|
||||
import { Constants } from '@certd/lib-server';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user