fix: add test

This commit is contained in:
2025-11-17 20:01:44 +08:00
parent e81a475bba
commit 572f793061
4 changed files with 32 additions and 1 deletions

View File

@@ -32,6 +32,14 @@ export class CloudflareDDNS {
if(!result.success) {
throw new Error(`更新失败: ${JSON.stringify(result.errors)}`);
}
console.log(`更新成功: ${domain} -> ${new_ip}`);
return result;
}
async getList(zone_id: string, api_token: string) {
const url = `https://api.cloudflare.com/client/v4/zones/${zone_id}/dns_records`;
return fetch(url, {
method: 'GET',
headers: this.makeHeader(api_token),
}).then(res => res.json());
}
}