mirror of
https://github.com/certd/certd.git
synced 2026-07-14 09:27:32 +08:00
fix: 修复火山引擎查不到自定义源站域名的问题
This commit is contained in:
+38
-28
@@ -86,8 +86,6 @@ export class VolcengineDeployToVOD extends AbstractTaskPlugin {
|
||||
})
|
||||
domainType!: string;
|
||||
|
||||
|
||||
|
||||
@TaskInput(
|
||||
createRemoteSelectInputDefine({
|
||||
title: "域名",
|
||||
@@ -111,18 +109,24 @@ export class VolcengineDeployToVOD extends AbstractTaskPlugin {
|
||||
const access = await this.getAccess<VolcengineAccess>(this.accessId);
|
||||
const certId = await this.uploadOrGetCertId(access);
|
||||
|
||||
const service = await this.getVodService({ version: "2023-07-01", region: this.regionId });
|
||||
const domainTypeMapping: Record<string, string> = {
|
||||
play: "vod_play",
|
||||
image: "vod_image",
|
||||
};
|
||||
const apiDomainType = domainTypeMapping[this.domainType] || this.domainType;
|
||||
|
||||
const service = await this.getVodService({ version: "2026-01-01", region: this.regionId });
|
||||
const domains = Array.isArray(this.domainList) ? this.domainList : [this.domainList];
|
||||
for (const domain of domains) {
|
||||
this.logger.info(`开始部署域名${domain}证书`);
|
||||
await service.request({
|
||||
action: "UpdateDomainConfig",
|
||||
action: "UpdateVodDomainConfig",
|
||||
method: "POST",
|
||||
body: {
|
||||
SpaceName: this.spaceName,
|
||||
DomainType: this.domainType,
|
||||
DomainType: apiDomainType,
|
||||
Domain: domain,
|
||||
Config: {
|
||||
UpdateCdnConfigParam: {
|
||||
HTTPS: {
|
||||
Switch: true,
|
||||
CertInfo: {
|
||||
@@ -207,34 +211,40 @@ export class VolcengineDeployToVOD extends AbstractTaskPlugin {
|
||||
if (!this.spaceName) {
|
||||
throw new Error("请先选择空间名称");
|
||||
}
|
||||
const service = await this.getVodService({ version: "2023-01-01", region: this.regionId });
|
||||
const service = await this.getVodService({ version: "2026-01-01", region: this.regionId });
|
||||
|
||||
const query: Record<string, any> = {
|
||||
SpaceName: this.spaceName,
|
||||
DomainType: this.domainType,
|
||||
const domainTypeMapping: Record<string, string> = {
|
||||
play: "vod_play",
|
||||
image: "vod_image",
|
||||
};
|
||||
const apiDomainType = domainTypeMapping[this.domainType] || this.domainType;
|
||||
|
||||
const body: Record<string, any> = {
|
||||
SpaceName: this.spaceName,
|
||||
ListCdnDomainsParam: {
|
||||
PageNum: 1,
|
||||
PageSize: 100,
|
||||
},
|
||||
};
|
||||
if (apiDomainType) {
|
||||
body.DomainType = apiDomainType;
|
||||
}
|
||||
const res = await service.request({
|
||||
action: "ListDomain",
|
||||
query,
|
||||
action: "ListVodDomains",
|
||||
method: "POST",
|
||||
body,
|
||||
});
|
||||
|
||||
const instances = res.Result?.PlayInstanceInfo?.ByteInstances;
|
||||
if (!instances || instances.length === 0) {
|
||||
throw new Error("找不到域名,您也可以手动输入域名");
|
||||
}
|
||||
const list = [];
|
||||
for (const item of instances) {
|
||||
if (item.Domains && item.Domains.length > 0) {
|
||||
for (const domain of item.Domains) {
|
||||
if (domain.Domain) {
|
||||
list.push({
|
||||
value: domain.Domain,
|
||||
label: domain.Domain,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
const domains = res.Result?.VodInfo?.Domains;
|
||||
if (!domains || domains.length === 0) {
|
||||
return [];
|
||||
}
|
||||
const list = domains.map((item: any) => {
|
||||
return {
|
||||
value: item.Domain,
|
||||
label: item.Domain,
|
||||
};
|
||||
});
|
||||
return this.ctx.utils.options.buildGroupOptions(list, this.certDomains);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user