This commit is contained in:
2025-11-16 13:32:35 +08:00
parent e35712820f
commit 2c800d336c
11 changed files with 414 additions and 18 deletions

View File

@@ -0,0 +1,26 @@
import {app} from '../app.ts';
import { CloudflareDDNS } from '../ddns/cloudflare/index.ts';
app.route({
path: 'cf',
key: 'update',
description: '更新Cloudflare DNS记录, 需要提供zone_id, record_id, domain, new_ip, api_token, type参数 type参数可选默认为A记录 A 或AAAA',
}).define(async (ctx) => {
const { zone_id, record_id, domain, new_ip, api_token, type = 'A' } = ctx.query || {};
if(!zone_id || !record_id || !domain || !new_ip || !api_token) {
ctx.throw?.('缺少必要参数');
}
const cf = new CloudflareDDNS();
const result = await cf.updateRecord({
zone_id,
record_id,
domain,
new_ip,
api_token,
type,
});
ctx.body = { result };
}).addTo(app);