From 70b46d4a8f89cf8eded21ebb237e8c8ce6c40d30 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Tue, 7 Apr 2026 22:29:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8Dspaceship=E5=88=9B?= =?UTF-8?q?=E5=BB=BArecord=E6=8A=A5=E9=94=99=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/certd/certd/issues/705 --- .../plugins/plugin-spaceship/dns-provider.ts | 41 +++++++------------ 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/packages/ui/certd-server/src/plugins/plugin-spaceship/dns-provider.ts b/packages/ui/certd-server/src/plugins/plugin-spaceship/dns-provider.ts index aec3bbb1a..fee525d17 100644 --- a/packages/ui/certd-server/src/plugins/plugin-spaceship/dns-provider.ts +++ b/packages/ui/certd-server/src/plugins/plugin-spaceship/dns-provider.ts @@ -3,11 +3,7 @@ import { SpaceshipAccess } from "./access.js"; import { PageRes, PageSearch } from "@certd/pipeline"; export type SpaceshipRecord = { - id: string; name: string; - type: string; - content: string; - domainId: string; }; @IsDnsProvider({ @@ -32,7 +28,7 @@ export class SpaceshipProvider extends AbstractDnsProvider { await this.access.getDomainInfo(domain); const recordRes = await this.access.doRequest({ - url: `https://spaceship.dev/api/v1/domains/${domain}/records`, + url: `https://spaceship.dev/api/v1/dns/records/${domain}`, method: "POST", data: { force: false, @@ -41,40 +37,33 @@ export class SpaceshipProvider extends AbstractDnsProvider { type: type, value: value, name: hostRecord, - ttl: 300 + ttl: 60 } ] } }); - return { - id: recordRes.items[0].id, - name: hostRecord, - type: type, - content: value, - domainId: domain - }; + return recordRes; } async removeRecord(options: RemoveRecordOptions): Promise { - const recordRes = options.recordRes; - this.logger.info("删除域名解析:", recordRes); + const recordReq = options.recordReq; + this.logger.info("删除域名解析:", recordReq); await this.access.doRequest({ - url: `https://spaceship.dev/api/v1/domains/${recordRes.domainId}/records`, + // https://spaceship.dev/api/v1/dns/records/xxx.net + url: `https://spaceship.dev/api/v1/dns/records/${recordReq.domain}`, method: "DELETE", - data: { - Records: [ - { - type: recordRes.type, - value: recordRes.content, - name: recordRes.name - } - ] - } + data: [ + { + type: recordReq.type, + value: recordReq.value, + name: recordReq.hostRecord + } + ] }); - this.logger.info("删除域名解析成功:", recordRes.name); + this.logger.info("删除域名解析成功:", JSON.stringify(recordReq)); } async getDomainListPage(req: PageSearch): Promise> {