perf: 增加域名管理 子域名检查提醒

This commit is contained in:
xiaojunnuo
2026-04-11 22:43:42 +08:00
parent a846c4b66e
commit 2bdf1832da
3 changed files with 40 additions and 1 deletions
@@ -3,6 +3,7 @@ import { Constants, CrudController } from '@certd/lib-server';
import { DomainService } from "../../../modules/cert/service/domain-service.js";
import { checkPlus } from '@certd/plus-core';
import { ApiTags } from '@midwayjs/swagger';
import { parseDomainByPsl } from '@certd/plugin-lib';
/**
* 授权
@@ -187,4 +188,12 @@ export class DomainController extends CrudController<DomainService> {
return this.ok(setting);
}
@Post('/isSubdomain', { description: Constants.per.authOnly, summary: "判断是否为子域名" })
async isSubdomain(@Body(ALL) body: any) {
const { domain } = body;
const parsed = parseDomainByPsl(domain)
const mainDomain = parsed.domain || ''
return this.ok(mainDomain !== domain);
}
}