mirror of
https://github.com/certd/certd.git
synced 2026-05-16 05:07:32 +08:00
chore: 修改权限判断字段从summary改成description
This commit is contained in:
@@ -13,7 +13,7 @@ export class AppController extends BaseController {
|
||||
@Inject()
|
||||
fileService: FileService;
|
||||
|
||||
@Get('/latest', { summary: Constants.per.authOnly })
|
||||
@Get('/latest', { description: Constants.per.authOnly })
|
||||
async latest(): Promise<any> {
|
||||
try {
|
||||
const res = await http.request({
|
||||
@@ -30,7 +30,7 @@ export class AppController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@Get('/favicon', { summary: Constants.per.guest })
|
||||
@Get('/favicon', { description: Constants.per.guest })
|
||||
public async getFavicon() {
|
||||
if (isComm()) {
|
||||
const siteInfo = await this.sysSettingsService.getSetting<SysSiteInfo>(SysSiteInfo);
|
||||
@@ -47,7 +47,7 @@ export class AppController extends BaseController {
|
||||
this.ctx.response.set('Cache-Control', 'public,max-age=25920');
|
||||
}
|
||||
|
||||
@Post('/webhook', { summary: Constants.per.guest })
|
||||
@Post('/webhook', { description: Constants.per.guest })
|
||||
public async webhook( @Body() body: any) {
|
||||
logger.info('webhook', JSON.stringify(body))
|
||||
return this.ok("success")
|
||||
|
||||
@@ -53,13 +53,13 @@ export class BasicController extends BaseController {
|
||||
@Inject()
|
||||
addonGetterService: AddonGetterService;
|
||||
|
||||
@Post('/captcha/get', { summary: Constants.per.guest })
|
||||
@Post('/captcha/get', { description: Constants.per.guest })
|
||||
async getCaptcha(@Query("captchaAddonId") captchaAddonId:number) {
|
||||
const form = await this.captchaService.getCaptcha(captchaAddonId)
|
||||
return this.ok(form);
|
||||
}
|
||||
|
||||
@Post('/sendSmsCode', { summary: Constants.per.guest })
|
||||
@Post('/sendSmsCode', { description: Constants.per.guest })
|
||||
public async sendSmsCode(
|
||||
@Body(ALL)
|
||||
body: SmsCodeReq,
|
||||
@@ -80,7 +80,7 @@ export class BasicController extends BaseController {
|
||||
return this.ok(null);
|
||||
}
|
||||
|
||||
@Post('/sendEmailCode', { summary: Constants.per.guest })
|
||||
@Post('/sendEmailCode', { description: Constants.per.guest })
|
||||
public async sendEmailCode(
|
||||
@Body(ALL)
|
||||
body: EmailCodeReq,
|
||||
|
||||
@@ -13,7 +13,7 @@ export class FileController extends BaseController {
|
||||
@Inject()
|
||||
fileService: FileService;
|
||||
|
||||
@Post('/upload', { summary: Constants.per.authOnly })
|
||||
@Post('/upload', { description: Constants.per.authOnly })
|
||||
async upload(@Files() files: UploadFileInfo<string>[], @Fields() fields: any) {
|
||||
console.log('files', files, fields);
|
||||
const cacheKey = uploadTmpFileCacheKey + nanoid();
|
||||
@@ -33,7 +33,7 @@ export class FileController extends BaseController {
|
||||
});
|
||||
}
|
||||
|
||||
@Get('/download', { summary: Constants.per.guest })
|
||||
@Get('/download', { description: Constants.per.guest })
|
||||
async download(@Query('key') key: string) {
|
||||
let userId: any = null;
|
||||
if (!key.startsWith('/public')) {
|
||||
|
||||
@@ -8,12 +8,12 @@ import {BaseController, Constants} from '@certd/lib-server';
|
||||
export class HealthController extends BaseController {
|
||||
|
||||
|
||||
@Get('/liveliness', { summary: Constants.per.guest })
|
||||
@Get('/liveliness', { description: Constants.per.guest })
|
||||
async liveliness(): Promise<any> {
|
||||
return this.ok('ok')
|
||||
}
|
||||
|
||||
@Get('/readiness', { summary: Constants.per.guest })
|
||||
@Get('/readiness', { description: Constants.per.guest })
|
||||
async readiness(): Promise<any> {
|
||||
return this.ok('ok')
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Constants } from '@certd/lib-server';
|
||||
export class HomeController {
|
||||
@Inject()
|
||||
environmentService: MidwayEnvironmentService;
|
||||
@Get('/', { summary: Constants.per.guest })
|
||||
@Get('/', { description: Constants.per.guest })
|
||||
async home(): Promise<string> {
|
||||
logger.info('当前环境:', this.environmentService.getCurrentEnvironment()); // prod
|
||||
return 'Hello Midwayjs!';
|
||||
|
||||
@@ -19,7 +19,7 @@ export class ForgotPasswordController extends BaseController {
|
||||
@Inject()
|
||||
sysSettingsService: SysSettingsService;
|
||||
|
||||
@Post('/forgotPassword', { summary: Constants.per.guest })
|
||||
@Post('/forgotPassword', { description: Constants.per.guest })
|
||||
public async forgotPassword(
|
||||
@Body(ALL)
|
||||
body: any,
|
||||
|
||||
@@ -28,7 +28,7 @@ export class LoginController extends BaseController {
|
||||
passkeyService: PasskeyService;
|
||||
|
||||
|
||||
@Post('/login', { summary: Constants.per.guest })
|
||||
@Post('/login', { description: Constants.per.guest })
|
||||
public async login(
|
||||
@Body(ALL)
|
||||
body: any,
|
||||
@@ -48,7 +48,7 @@ export class LoginController extends BaseController {
|
||||
// this.loginService.writeTokenCookie(this.ctx,token);
|
||||
}
|
||||
|
||||
@Post('/loginBySms', { summary: Constants.per.guest })
|
||||
@Post('/loginBySms', { description: Constants.per.guest })
|
||||
public async loginBySms(
|
||||
@Body(ALL)
|
||||
body: any
|
||||
@@ -71,7 +71,7 @@ export class LoginController extends BaseController {
|
||||
return this.ok(token);
|
||||
}
|
||||
|
||||
@Post('/loginByTwoFactor', { summary: Constants.per.guest })
|
||||
@Post('/loginByTwoFactor', { description: Constants.per.guest })
|
||||
public async loginByTwoFactor(
|
||||
@Body(ALL)
|
||||
body: any
|
||||
@@ -89,7 +89,7 @@ export class LoginController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@Post('/passkey/generateAuthentication', { summary: Constants.per.guest })
|
||||
@Post('/passkey/generateAuthentication', { description: Constants.per.guest })
|
||||
public async generateAuthentication() {
|
||||
const options = await this.passkeyService.generateAuthenticationOptions(
|
||||
this.ctx
|
||||
@@ -100,7 +100,7 @@ export class LoginController extends BaseController {
|
||||
});
|
||||
}
|
||||
|
||||
@Post('/loginByPasskey', { summary: Constants.per.guest })
|
||||
@Post('/loginByPasskey', { description: Constants.per.guest })
|
||||
public async loginByPasskey(
|
||||
@Body(ALL)
|
||||
body: any
|
||||
@@ -117,7 +117,7 @@ export class LoginController extends BaseController {
|
||||
return this.ok(token);
|
||||
}
|
||||
|
||||
@Post('/logout', { summary: Constants.per.authOnly })
|
||||
@Post('/logout', { description: Constants.per.authOnly })
|
||||
public logout() {
|
||||
this.ctx.cookies.set("certd_token", "", {
|
||||
maxAge: 0
|
||||
|
||||
@@ -53,7 +53,7 @@ export class ConnectController extends BaseController {
|
||||
return addon as IOauthProvider;
|
||||
}
|
||||
|
||||
@Post('/login', { summary: Constants.per.guest })
|
||||
@Post('/login', { description: Constants.per.guest })
|
||||
public async login(@Body(ALL) body: { type: string, forType?:string ,from?:string }) {
|
||||
|
||||
const addon = await this.getOauthProvider(body.type);
|
||||
@@ -72,7 +72,7 @@ export class ConnectController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@Get('/callback/:type', { summary: Constants.per.guest })
|
||||
@Get('/callback/:type', { description: Constants.per.guest })
|
||||
public async callback(@Param('type') type: string, @Query() query: Record<string, string>) {
|
||||
|
||||
checkPlus()
|
||||
@@ -123,7 +123,7 @@ export class ConnectController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
@Post('/getLogoutUrl', { summary: Constants.per.guest })
|
||||
@Post('/getLogoutUrl', { description: Constants.per.guest })
|
||||
public async logout(@Body(ALL) body: any) {
|
||||
checkPlus()
|
||||
const addon = await this.getOauthProvider(body.type);
|
||||
@@ -132,7 +132,7 @@ export class ConnectController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@Post('/token', { summary: Constants.per.guest })
|
||||
@Post('/token', { description: Constants.per.guest })
|
||||
public async token(@Body(ALL) body: { validationCode: string, type: string }) {
|
||||
checkPlus()
|
||||
const validationValue = await this.codeService.getValidationValue(body.validationCode);
|
||||
@@ -166,7 +166,7 @@ export class ConnectController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@Post('/autoRegister', { summary: Constants.per.guest })
|
||||
@Post('/autoRegister', { description: Constants.per.guest })
|
||||
public async autoRegister(@Body(ALL) body: { validationCode: string, type: string }) {
|
||||
|
||||
const validationValue = this.codeService.getValidationValue(body.validationCode);
|
||||
@@ -195,7 +195,7 @@ export class ConnectController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@Post('/bind', { summary: Constants.per.loginOnly })
|
||||
@Post('/bind', { description: Constants.per.loginOnly })
|
||||
public async bind(@Body(ALL) body: any) {
|
||||
//需要已登录
|
||||
const userId = this.getUserId();
|
||||
@@ -214,7 +214,7 @@ export class ConnectController extends BaseController {
|
||||
return this.ok(1);
|
||||
}
|
||||
|
||||
@Post('/unbind', { summary: Constants.per.loginOnly })
|
||||
@Post('/unbind', { description: Constants.per.loginOnly })
|
||||
public async unbind(@Body(ALL) body: any) {
|
||||
//需要已登录
|
||||
const userId = this.getUserId();
|
||||
@@ -225,7 +225,7 @@ export class ConnectController extends BaseController {
|
||||
return this.ok(1);
|
||||
}
|
||||
|
||||
@Post('/bounds', { summary: Constants.per.loginOnly })
|
||||
@Post('/bounds', { description: Constants.per.loginOnly })
|
||||
public async bounds(@Body(ALL) body: any) {
|
||||
//需要已登录
|
||||
const userId = this.getUserId();
|
||||
@@ -238,7 +238,7 @@ export class ConnectController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@Post('/providers', { summary: Constants.per.guest })
|
||||
@Post('/providers', { description: Constants.per.guest })
|
||||
public async providers() {
|
||||
const defineList = addonRegistry.getDefineList("oauth");
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ export class RegisterController extends BaseController {
|
||||
@Inject()
|
||||
sysSettingsService: SysSettingsService;
|
||||
|
||||
@Post('/register', { summary: Constants.per.guest })
|
||||
@Post('/register', { description: Constants.per.guest })
|
||||
public async register(
|
||||
@Body(ALL)
|
||||
body: RegisterReq,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Constants, SysSettingsService } from '@certd/lib-server';
|
||||
export class HomeController {
|
||||
@Inject()
|
||||
sysSettingsService: SysSettingsService;
|
||||
@Get('/robots.txt', { summary: Constants.per.guest })
|
||||
@Get('/robots.txt', { description: Constants.per.guest })
|
||||
async robots(): Promise<string> {
|
||||
const publicSettings = await this.sysSettingsService.getPublicSettings();
|
||||
if (!publicSettings.robots) {
|
||||
|
||||
@@ -71,7 +71,7 @@ export class BasicSettingsController extends BaseController {
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Get("/productInfo", { summary: Constants.per.guest })
|
||||
@Get("/productInfo", { description: Constants.per.guest })
|
||||
async getProductInfo() {
|
||||
const info = await http.request({
|
||||
url: "https://app.handfree.work/certd/info.json"
|
||||
@@ -80,7 +80,7 @@ export class BasicSettingsController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
@Get("/all", { summary: Constants.per.guest })
|
||||
@Get("/all", { description: Constants.per.guest })
|
||||
async getAllSettings() {
|
||||
const sysPublic = await this.getSysPublic();
|
||||
const installInfo = await this.getInstallInfo();
|
||||
|
||||
@@ -32,7 +32,7 @@ export class UnhiddenController {
|
||||
sysSettingsService: SysSettingsService;
|
||||
|
||||
|
||||
@Post('/:randomPath', {summary: Constants.per.guest})
|
||||
@Post('/:randomPath', {description: Constants.per.guest})
|
||||
async randomPath(@Body("password") password: any) {
|
||||
await this.checkUnhiddenPath()
|
||||
const hiddenSetting = await this.safeService.getHiddenSetting()
|
||||
@@ -50,7 +50,7 @@ export class UnhiddenController {
|
||||
}
|
||||
}
|
||||
|
||||
@Get('/:randomPath', {summary: Constants.per.guest})
|
||||
@Get('/:randomPath', {description: Constants.per.guest})
|
||||
async unhiddenGet() {
|
||||
await this.checkUnhiddenPath()
|
||||
this.ctx.response.body = unhiddenHtml
|
||||
|
||||
@@ -10,8 +10,8 @@ export class WebhookController extends BaseController {
|
||||
@Inject()
|
||||
pipelineService: PipelineService;
|
||||
|
||||
@Get('/:webhookKey', { summary: Constants.per.guest })
|
||||
@Post('/:webhookKey', { summary: Constants.per.guest })
|
||||
@Get('/:webhookKey', { description: Constants.per.guest })
|
||||
@Post('/:webhookKey', { description: Constants.per.guest })
|
||||
async webhook(@Param('webhookKey') webhookKey: string): Promise<any> {
|
||||
await this.pipelineService.triggerByWebhook(webhookKey);
|
||||
return this.ok({});
|
||||
|
||||
Reference in New Issue
Block a user