chore: 补充其他access的测试按钮

This commit is contained in:
xiaojunnuo
2026-02-15 22:45:22 +08:00
parent 9671348dc1
commit 7cd8a645a8
16 changed files with 420 additions and 136 deletions
@@ -1,4 +1,5 @@
import {AccessInput, BaseAccess, IsAccess} from '@certd/pipeline';
import { AccessInput, BaseAccess, IsAccess } from '@certd/pipeline';
import { UpyunClient } from './client.js';
/**
* 这个注解将注册一个授权配置
@@ -30,6 +31,41 @@ export class UpyunAccess extends BaseAccess {
})
password = '';
@AccessInput({
title: "测试",
component: {
name: "api-test",
action: "onTestRequest",
},
helper: "点击测试接口看是否正常",
})
testRequest = true;
async onTestRequest() {
await this.getCdnList();
return "ok";
}
async getCdnList() {
const upyunClient = new UpyunClient({
access: this,
logger: this.ctx.logger,
http: this.ctx.http
});
const cookie = await upyunClient.getLoginToken();
const req = {
cookie,
url: "https://console.upyun.com/api/account/domains/?limit=1000&business_type=file&security_cdn=false&websocket=false&key=&domain=",
method: "GET",
data: {}
};
const res = await upyunClient.doRequest(req);
const domains = res.data?.domains || [];
return domains
}
}
new UpyunAccess();