mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-08 13:39:53 +00:00
feat: normalize provider names
This commit is contained in:
parent
70e6920288
commit
047b3bc079
@ -26,17 +26,23 @@ import (
|
|||||||
"github.com/pocketbase/pocketbase/models"
|
"github.com/pocketbase/pocketbase/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
提供商类型常量值。
|
||||||
|
|
||||||
|
注意:如果追加新的枚举值,请保持以 ASCII 排序。
|
||||||
|
NOTICE: If you add new enum, please keep ASCII order.
|
||||||
|
*/
|
||||||
const (
|
const (
|
||||||
configTypeAliyun = "aliyun"
|
configTypeACMEHttpReq = "acmehttpreq"
|
||||||
configTypeTencent = "tencent"
|
configTypeAliyun = "aliyun"
|
||||||
configTypeHuaweiCloud = "huaweicloud"
|
configTypeAWS = "aws"
|
||||||
configTypeAws = "aws"
|
configTypeCloudflare = "cloudflare"
|
||||||
configTypeCloudflare = "cloudflare"
|
configTypeGoDaddy = "godaddy"
|
||||||
configTypeNamesilo = "namesilo"
|
configTypeHuaweiCloud = "huaweicloud"
|
||||||
configTypeGodaddy = "godaddy"
|
configTypeNamesilo = "namesilo"
|
||||||
configTypePdns = "pdns"
|
configTypePowerDNS = "powerdns"
|
||||||
configTypeHttpreq = "httpreq"
|
configTypeTencentCloud = "tencentcloud"
|
||||||
configTypeVolcengine = "volcengine"
|
configTypeVolcEngine = "volcengine"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultSSLProvider = "letsencrypt"
|
const defaultSSLProvider = "letsencrypt"
|
||||||
@ -205,23 +211,23 @@ func GetWithTypeOption(t string, option *ApplyOption) (Applicant, error) {
|
|||||||
switch t {
|
switch t {
|
||||||
case configTypeAliyun:
|
case configTypeAliyun:
|
||||||
return NewAliyun(option), nil
|
return NewAliyun(option), nil
|
||||||
case configTypeTencent:
|
case configTypeTencentCloud:
|
||||||
return NewTencent(option), nil
|
return NewTencent(option), nil
|
||||||
case configTypeHuaweiCloud:
|
case configTypeHuaweiCloud:
|
||||||
return NewHuaweiCloud(option), nil
|
return NewHuaweiCloud(option), nil
|
||||||
case configTypeAws:
|
case configTypeAWS:
|
||||||
return NewAws(option), nil
|
return NewAws(option), nil
|
||||||
case configTypeCloudflare:
|
case configTypeCloudflare:
|
||||||
return NewCloudflare(option), nil
|
return NewCloudflare(option), nil
|
||||||
case configTypeNamesilo:
|
case configTypeNamesilo:
|
||||||
return NewNamesilo(option), nil
|
return NewNamesilo(option), nil
|
||||||
case configTypeGodaddy:
|
case configTypeGoDaddy:
|
||||||
return NewGodaddy(option), nil
|
return NewGodaddy(option), nil
|
||||||
case configTypePdns:
|
case configTypePowerDNS:
|
||||||
return NewPdns(option), nil
|
return NewPdns(option), nil
|
||||||
case configTypeHttpreq:
|
case configTypeACMEHttpReq:
|
||||||
return NewHttpreq(option), nil
|
return NewHttpreq(option), nil
|
||||||
case configTypeVolcengine:
|
case configTypeVolcEngine:
|
||||||
return NewVolcengine(option), nil
|
return NewVolcengine(option), nil
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("unknown config type")
|
return nil, errors.New("unknown config type")
|
||||||
|
@ -13,30 +13,36 @@ import (
|
|||||||
"github.com/usual2970/certimate/internal/repository"
|
"github.com/usual2970/certimate/internal/repository"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/*
|
||||||
|
提供商部署目标常量值。
|
||||||
|
|
||||||
|
注意:如果追加新的枚举值,请保持以 ASCII 排序。
|
||||||
|
NOTICE: If you add new enum, please keep ASCII order.
|
||||||
|
*/
|
||||||
const (
|
const (
|
||||||
targetAliyunOSS = "aliyun-oss"
|
targetAliyunALB = "aliyun-alb"
|
||||||
targetAliyunCDN = "aliyun-cdn"
|
targetAliyunCDN = "aliyun-cdn"
|
||||||
targetAliyunDCDN = "aliyun-dcdn"
|
targetAliyunCLB = "aliyun-clb"
|
||||||
targetAliyunCLB = "aliyun-clb"
|
targetAliyunDCDN = "aliyun-dcdn"
|
||||||
targetAliyunALB = "aliyun-alb"
|
targetAliyunNLB = "aliyun-nlb"
|
||||||
targetAliyunNLB = "aliyun-nlb"
|
targetAliyunOSS = "aliyun-oss"
|
||||||
targetTencentCDN = "tencent-cdn"
|
targetBaiduCloudCDN = "baiducloud-cdn"
|
||||||
targetTencentECDN = "tencent-ecdn"
|
targetBytePlusCDN = "byteplus-cdn"
|
||||||
targetTencentCLB = "tencent-clb"
|
targetDogeCloudCDN = "dogecloud-cdn"
|
||||||
targetTencentCOS = "tencent-cos"
|
targetHuaweiCloudCDN = "huaweicloud-cdn"
|
||||||
targetTencentTEO = "tencent-teo"
|
targetHuaweiCloudELB = "huaweicloud-elb"
|
||||||
targetHuaweiCloudCDN = "huaweicloud-cdn"
|
targetK8sSecret = "k8s-secret"
|
||||||
targetHuaweiCloudELB = "huaweicloud-elb"
|
targetLocal = "local"
|
||||||
targetBaiduCloudCDN = "baiducloud-cdn"
|
targetQiniuCDN = "qiniu-cdn"
|
||||||
targetVolcEngineLive = "volcengine-live"
|
targetSSH = "ssh"
|
||||||
targetVolcEngineCDN = "volcengine-cdn"
|
targetTencentCloudCDN = "tencentcloud-cdn"
|
||||||
targetBytePlusCDN = "byteplus-cdn"
|
targetTencentCloudCLB = "tencentcloud-clb"
|
||||||
targetQiniuCdn = "qiniu-cdn"
|
targetTencentCloudCOS = "tencentcloud-cos"
|
||||||
targetDogeCloudCdn = "dogecloud-cdn"
|
targetTencentCloudECDN = "tencentcloud-ecdn"
|
||||||
targetLocal = "local"
|
targetTencentCloudEO = "tencentcloud-eo"
|
||||||
targetSSH = "ssh"
|
targetVolcEngineCDN = "volcengine-cdn"
|
||||||
targetWebhook = "webhook"
|
targetVolcEngineLive = "volcengine-live"
|
||||||
targetK8sSecret = "k8s-secret"
|
targetWebhook = "webhook"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DeployerOption struct {
|
type DeployerOption struct {
|
||||||
@ -128,15 +134,15 @@ func getWithTypeAndOption(deployType string, option *DeployerOption) (Deployer,
|
|||||||
return NewAliyunALBDeployer(option)
|
return NewAliyunALBDeployer(option)
|
||||||
case targetAliyunNLB:
|
case targetAliyunNLB:
|
||||||
return NewAliyunNLBDeployer(option)
|
return NewAliyunNLBDeployer(option)
|
||||||
case targetTencentCDN:
|
case targetTencentCloudCDN:
|
||||||
return NewTencentCDNDeployer(option)
|
return NewTencentCDNDeployer(option)
|
||||||
case targetTencentECDN:
|
case targetTencentCloudECDN:
|
||||||
return NewTencentECDNDeployer(option)
|
return NewTencentECDNDeployer(option)
|
||||||
case targetTencentCLB:
|
case targetTencentCloudCLB:
|
||||||
return NewTencentCLBDeployer(option)
|
return NewTencentCLBDeployer(option)
|
||||||
case targetTencentCOS:
|
case targetTencentCloudCOS:
|
||||||
return NewTencentCOSDeployer(option)
|
return NewTencentCOSDeployer(option)
|
||||||
case targetTencentTEO:
|
case targetTencentCloudEO:
|
||||||
return NewTencentTEODeployer(option)
|
return NewTencentTEODeployer(option)
|
||||||
case targetHuaweiCloudCDN:
|
case targetHuaweiCloudCDN:
|
||||||
return NewHuaweiCloudCDNDeployer(option)
|
return NewHuaweiCloudCDNDeployer(option)
|
||||||
@ -144,9 +150,9 @@ func getWithTypeAndOption(deployType string, option *DeployerOption) (Deployer,
|
|||||||
return NewHuaweiCloudELBDeployer(option)
|
return NewHuaweiCloudELBDeployer(option)
|
||||||
case targetBaiduCloudCDN:
|
case targetBaiduCloudCDN:
|
||||||
return NewBaiduCloudCDNDeployer(option)
|
return NewBaiduCloudCDNDeployer(option)
|
||||||
case targetQiniuCdn:
|
case targetQiniuCDN:
|
||||||
return NewQiniuCDNDeployer(option)
|
return NewQiniuCDNDeployer(option)
|
||||||
case targetDogeCloudCdn:
|
case targetDogeCloudCDN:
|
||||||
return NewDogeCloudCDNDeployer(option)
|
return NewDogeCloudCDNDeployer(option)
|
||||||
case targetLocal:
|
case targetLocal:
|
||||||
return NewLocalDeployer(option)
|
return NewLocalDeployer(option)
|
||||||
|
@ -7,27 +7,27 @@ import (
|
|||||||
|
|
||||||
"github.com/usual2970/certimate/internal/domain"
|
"github.com/usual2970/certimate/internal/domain"
|
||||||
"github.com/usual2970/certimate/internal/pkg/core/deployer"
|
"github.com/usual2970/certimate/internal/pkg/core/deployer"
|
||||||
providerAliyunAlb "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-alb"
|
providerAliyunALB "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-alb"
|
||||||
providerAliyunCdn "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-cdn"
|
providerAliyunCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-cdn"
|
||||||
providerAliyunClb "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-clb"
|
providerAliyunCLB "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-clb"
|
||||||
providerAliyunDcdn "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-dcdn"
|
providerAliyunDCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-dcdn"
|
||||||
providerAliyunNlb "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-nlb"
|
providerAliyunNLB "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-nlb"
|
||||||
providerAliyunOss "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-oss"
|
providerAliyunOSS "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/aliyun-oss"
|
||||||
providerBaiduCloudCdn "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/baiducloud-cdn"
|
providerBaiduCloudCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/baiducloud-cdn"
|
||||||
providerBytePlusCdn "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/byteplus-cdn"
|
providerBytePlusCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/byteplus-cdn"
|
||||||
providerDogeCdn "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/dogecloud-cdn"
|
providerDogeCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/dogecloud-cdn"
|
||||||
providerHuaweiCloudCdn "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/huaweicloud-cdn"
|
providerHuaweiCloudCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/huaweicloud-cdn"
|
||||||
providerHuaweiCloudElb "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/huaweicloud-elb"
|
providerHuaweiCloudELB "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/huaweicloud-elb"
|
||||||
providerK8sSecret "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/k8s-secret"
|
providerK8sSecret "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/k8s-secret"
|
||||||
providerLocal "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/local"
|
providerLocal "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/local"
|
||||||
providerQiniuCdn "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/qiniu-cdn"
|
providerQiniuCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/qiniu-cdn"
|
||||||
providerSSH "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/ssh"
|
providerSSH "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/ssh"
|
||||||
providerTencentCloudCdn "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-cdn"
|
providerTencentCloudCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-cdn"
|
||||||
providerTencentCloudClb "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-clb"
|
providerTencentCloudCLB "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-clb"
|
||||||
providerTencentCloudCos "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-cos"
|
providerTencentCloudCOD "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-cos"
|
||||||
providerTencentCloudEcdn "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-ecdn"
|
providerTencentCloudECDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-ecdn"
|
||||||
providerTencentCloudTeo "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-teo"
|
providerTencentCloudEO "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-eo"
|
||||||
providerVolcEngineCdn "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/volcengine-cdn"
|
providerVolcEngineCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/volcengine-cdn"
|
||||||
providerVolcEngineLive "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/volcengine-live"
|
providerVolcEngineLive "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/volcengine-live"
|
||||||
providerWebhook "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/webhook"
|
providerWebhook "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/webhook"
|
||||||
"github.com/usual2970/certimate/internal/pkg/utils/maps"
|
"github.com/usual2970/certimate/internal/pkg/utils/maps"
|
||||||
@ -47,18 +47,18 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
|
|
||||||
switch target {
|
switch target {
|
||||||
case targetAliyunALB:
|
case targetAliyunALB:
|
||||||
deployer, err := providerAliyunAlb.NewWithLogger(&providerAliyunAlb.AliyunALBDeployerConfig{
|
deployer, err := providerAliyunALB.NewWithLogger(&providerAliyunALB.AliyunALBDeployerConfig{
|
||||||
AccessKeyId: access.AccessKeyId,
|
AccessKeyId: access.AccessKeyId,
|
||||||
AccessKeySecret: access.AccessKeySecret,
|
AccessKeySecret: access.AccessKeySecret,
|
||||||
Region: maps.GetValueAsString(deployConfig, "region"),
|
Region: maps.GetValueAsString(deployConfig, "region"),
|
||||||
ResourceType: providerAliyunAlb.DeployResourceType(maps.GetValueAsString(deployConfig, "resourceType")),
|
ResourceType: providerAliyunALB.DeployResourceType(maps.GetValueAsString(deployConfig, "resourceType")),
|
||||||
LoadbalancerId: maps.GetValueAsString(deployConfig, "loadbalancerId"),
|
LoadbalancerId: maps.GetValueAsString(deployConfig, "loadbalancerId"),
|
||||||
ListenerId: maps.GetValueAsString(deployConfig, "listenerId"),
|
ListenerId: maps.GetValueAsString(deployConfig, "listenerId"),
|
||||||
}, logger)
|
}, logger)
|
||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
|
|
||||||
case targetAliyunCDN:
|
case targetAliyunCDN:
|
||||||
deployer, err := providerAliyunCdn.NewWithLogger(&providerAliyunCdn.AliyunCDNDeployerConfig{
|
deployer, err := providerAliyunCDN.NewWithLogger(&providerAliyunCDN.AliyunCDNDeployerConfig{
|
||||||
AccessKeyId: access.AccessKeyId,
|
AccessKeyId: access.AccessKeyId,
|
||||||
AccessKeySecret: access.AccessKeySecret,
|
AccessKeySecret: access.AccessKeySecret,
|
||||||
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
||||||
@ -66,18 +66,18 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
|
|
||||||
case targetAliyunCLB:
|
case targetAliyunCLB:
|
||||||
deployer, err := providerAliyunClb.NewWithLogger(&providerAliyunClb.AliyunCLBDeployerConfig{
|
deployer, err := providerAliyunCLB.NewWithLogger(&providerAliyunCLB.AliyunCLBDeployerConfig{
|
||||||
AccessKeyId: access.AccessKeyId,
|
AccessKeyId: access.AccessKeyId,
|
||||||
AccessKeySecret: access.AccessKeySecret,
|
AccessKeySecret: access.AccessKeySecret,
|
||||||
Region: maps.GetValueAsString(deployConfig, "region"),
|
Region: maps.GetValueAsString(deployConfig, "region"),
|
||||||
ResourceType: providerAliyunClb.DeployResourceType(maps.GetValueAsString(deployConfig, "resourceType")),
|
ResourceType: providerAliyunCLB.DeployResourceType(maps.GetValueAsString(deployConfig, "resourceType")),
|
||||||
LoadbalancerId: maps.GetValueAsString(deployConfig, "loadbalancerId"),
|
LoadbalancerId: maps.GetValueAsString(deployConfig, "loadbalancerId"),
|
||||||
ListenerPort: maps.GetValueAsInt32(deployConfig, "listenerPort"),
|
ListenerPort: maps.GetValueAsInt32(deployConfig, "listenerPort"),
|
||||||
}, logger)
|
}, logger)
|
||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
|
|
||||||
case targetAliyunDCDN:
|
case targetAliyunDCDN:
|
||||||
deployer, err := providerAliyunDcdn.NewWithLogger(&providerAliyunDcdn.AliyunDCDNDeployerConfig{
|
deployer, err := providerAliyunDCDN.NewWithLogger(&providerAliyunDCDN.AliyunDCDNDeployerConfig{
|
||||||
AccessKeyId: access.AccessKeyId,
|
AccessKeyId: access.AccessKeyId,
|
||||||
AccessKeySecret: access.AccessKeySecret,
|
AccessKeySecret: access.AccessKeySecret,
|
||||||
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
||||||
@ -85,18 +85,18 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
|
|
||||||
case targetAliyunNLB:
|
case targetAliyunNLB:
|
||||||
deployer, err := providerAliyunNlb.NewWithLogger(&providerAliyunNlb.AliyunNLBDeployerConfig{
|
deployer, err := providerAliyunNLB.NewWithLogger(&providerAliyunNLB.AliyunNLBDeployerConfig{
|
||||||
AccessKeyId: access.AccessKeyId,
|
AccessKeyId: access.AccessKeyId,
|
||||||
AccessKeySecret: access.AccessKeySecret,
|
AccessKeySecret: access.AccessKeySecret,
|
||||||
Region: maps.GetValueAsString(deployConfig, "region"),
|
Region: maps.GetValueAsString(deployConfig, "region"),
|
||||||
ResourceType: providerAliyunNlb.DeployResourceType(maps.GetValueAsString(deployConfig, "resourceType")),
|
ResourceType: providerAliyunNLB.DeployResourceType(maps.GetValueAsString(deployConfig, "resourceType")),
|
||||||
LoadbalancerId: maps.GetValueAsString(deployConfig, "loadbalancerId"),
|
LoadbalancerId: maps.GetValueAsString(deployConfig, "loadbalancerId"),
|
||||||
ListenerId: maps.GetValueAsString(deployConfig, "listenerId"),
|
ListenerId: maps.GetValueAsString(deployConfig, "listenerId"),
|
||||||
}, logger)
|
}, logger)
|
||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
|
|
||||||
case targetAliyunOSS:
|
case targetAliyunOSS:
|
||||||
deployer, err := providerAliyunOss.NewWithLogger(&providerAliyunOss.AliyunOSSDeployerConfig{
|
deployer, err := providerAliyunOSS.NewWithLogger(&providerAliyunOSS.AliyunOSSDeployerConfig{
|
||||||
AccessKeyId: access.AccessKeyId,
|
AccessKeyId: access.AccessKeyId,
|
||||||
AccessKeySecret: access.AccessKeySecret,
|
AccessKeySecret: access.AccessKeySecret,
|
||||||
Region: maps.GetValueAsString(deployConfig, "region"),
|
Region: maps.GetValueAsString(deployConfig, "region"),
|
||||||
@ -117,7 +117,7 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
return nil, nil, fmt.Errorf("failed to unmarshal access config: %w", err)
|
return nil, nil, fmt.Errorf("failed to unmarshal access config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
deployer, err := providerBaiduCloudCdn.NewWithLogger(&providerBaiduCloudCdn.BaiduCloudCDNDeployerConfig{
|
deployer, err := providerBaiduCloudCDN.NewWithLogger(&providerBaiduCloudCDN.BaiduCloudCDNDeployerConfig{
|
||||||
AccessKeyId: access.AccessKeyId,
|
AccessKeyId: access.AccessKeyId,
|
||||||
SecretAccessKey: access.SecretAccessKey,
|
SecretAccessKey: access.SecretAccessKey,
|
||||||
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
||||||
@ -132,7 +132,7 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
return nil, nil, fmt.Errorf("failed to unmarshal access config: %w", err)
|
return nil, nil, fmt.Errorf("failed to unmarshal access config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
deployer, err := providerBytePlusCdn.NewWithLogger(&providerBytePlusCdn.BytePlusCDNDeployerConfig{
|
deployer, err := providerBytePlusCDN.NewWithLogger(&providerBytePlusCDN.BytePlusCDNDeployerConfig{
|
||||||
AccessKey: access.AccessKey,
|
AccessKey: access.AccessKey,
|
||||||
SecretKey: access.SecretKey,
|
SecretKey: access.SecretKey,
|
||||||
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
||||||
@ -140,14 +140,14 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
}
|
}
|
||||||
|
|
||||||
case targetDogeCloudCdn:
|
case targetDogeCloudCDN:
|
||||||
{
|
{
|
||||||
access := &domain.DogeCloudAccess{}
|
access := &domain.DogeCloudAccess{}
|
||||||
if err := json.Unmarshal([]byte(accessConfig), access); err != nil {
|
if err := json.Unmarshal([]byte(accessConfig), access); err != nil {
|
||||||
return nil, nil, fmt.Errorf("failed to unmarshal access config: %w", err)
|
return nil, nil, fmt.Errorf("failed to unmarshal access config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
deployer, err := providerDogeCdn.NewWithLogger(&providerDogeCdn.DogeCloudCDNDeployerConfig{
|
deployer, err := providerDogeCDN.NewWithLogger(&providerDogeCDN.DogeCloudCDNDeployerConfig{
|
||||||
AccessKey: access.AccessKey,
|
AccessKey: access.AccessKey,
|
||||||
SecretKey: access.SecretKey,
|
SecretKey: access.SecretKey,
|
||||||
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
||||||
@ -164,7 +164,7 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
|
|
||||||
switch target {
|
switch target {
|
||||||
case targetHuaweiCloudCDN:
|
case targetHuaweiCloudCDN:
|
||||||
deployer, err := providerHuaweiCloudCdn.NewWithLogger(&providerHuaweiCloudCdn.HuaweiCloudCDNDeployerConfig{
|
deployer, err := providerHuaweiCloudCDN.NewWithLogger(&providerHuaweiCloudCDN.HuaweiCloudCDNDeployerConfig{
|
||||||
AccessKeyId: access.AccessKeyId,
|
AccessKeyId: access.AccessKeyId,
|
||||||
SecretAccessKey: access.SecretAccessKey,
|
SecretAccessKey: access.SecretAccessKey,
|
||||||
Region: maps.GetValueAsString(deployConfig, "region"),
|
Region: maps.GetValueAsString(deployConfig, "region"),
|
||||||
@ -173,11 +173,11 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
|
|
||||||
case targetHuaweiCloudELB:
|
case targetHuaweiCloudELB:
|
||||||
deployer, err := providerHuaweiCloudElb.NewWithLogger(&providerHuaweiCloudElb.HuaweiCloudELBDeployerConfig{
|
deployer, err := providerHuaweiCloudELB.NewWithLogger(&providerHuaweiCloudELB.HuaweiCloudELBDeployerConfig{
|
||||||
AccessKeyId: access.AccessKeyId,
|
AccessKeyId: access.AccessKeyId,
|
||||||
SecretAccessKey: access.SecretAccessKey,
|
SecretAccessKey: access.SecretAccessKey,
|
||||||
Region: maps.GetValueAsString(deployConfig, "region"),
|
Region: maps.GetValueAsString(deployConfig, "region"),
|
||||||
ResourceType: providerHuaweiCloudElb.DeployResourceType(maps.GetValueAsString(deployConfig, "resourceType")),
|
ResourceType: providerHuaweiCloudELB.DeployResourceType(maps.GetValueAsString(deployConfig, "resourceType")),
|
||||||
CertificateId: maps.GetValueAsString(deployConfig, "certificateId"),
|
CertificateId: maps.GetValueAsString(deployConfig, "certificateId"),
|
||||||
LoadbalancerId: maps.GetValueAsString(deployConfig, "loadbalancerId"),
|
LoadbalancerId: maps.GetValueAsString(deployConfig, "loadbalancerId"),
|
||||||
ListenerId: maps.GetValueAsString(deployConfig, "listenerId"),
|
ListenerId: maps.GetValueAsString(deployConfig, "listenerId"),
|
||||||
@ -223,14 +223,14 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
}
|
}
|
||||||
|
|
||||||
case targetQiniuCdn:
|
case targetQiniuCDN:
|
||||||
{
|
{
|
||||||
access := &domain.QiniuAccess{}
|
access := &domain.QiniuAccess{}
|
||||||
if err := json.Unmarshal([]byte(accessConfig), access); err != nil {
|
if err := json.Unmarshal([]byte(accessConfig), access); err != nil {
|
||||||
return nil, nil, fmt.Errorf("failed to unmarshal access config: %w", err)
|
return nil, nil, fmt.Errorf("failed to unmarshal access config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
deployer, err := providerQiniuCdn.NewWithLogger(&providerQiniuCdn.QiniuCDNDeployerConfig{
|
deployer, err := providerQiniuCDN.NewWithLogger(&providerQiniuCDN.QiniuCDNDeployerConfig{
|
||||||
AccessKey: access.AccessKey,
|
AccessKey: access.AccessKey,
|
||||||
SecretKey: access.SecretKey,
|
SecretKey: access.SecretKey,
|
||||||
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
||||||
@ -266,7 +266,7 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
}
|
}
|
||||||
|
|
||||||
case targetTencentCDN, targetTencentCLB, targetTencentCOS, targetTencentECDN, targetTencentTEO:
|
case targetTencentCloudCDN, targetTencentCloudCLB, targetTencentCloudCOS, targetTencentCloudECDN, targetTencentCloudEO:
|
||||||
{
|
{
|
||||||
access := &domain.TencentAccess{}
|
access := &domain.TencentAccess{}
|
||||||
if err := json.Unmarshal([]byte(accessConfig), access); err != nil {
|
if err := json.Unmarshal([]byte(accessConfig), access); err != nil {
|
||||||
@ -274,28 +274,28 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch target {
|
switch target {
|
||||||
case targetTencentCDN:
|
case targetTencentCloudCDN:
|
||||||
deployer, err := providerTencentCloudCdn.NewWithLogger(&providerTencentCloudCdn.TencentCloudCDNDeployerConfig{
|
deployer, err := providerTencentCloudCDN.NewWithLogger(&providerTencentCloudCDN.TencentCloudCDNDeployerConfig{
|
||||||
SecretId: access.SecretId,
|
SecretId: access.SecretId,
|
||||||
SecretKey: access.SecretKey,
|
SecretKey: access.SecretKey,
|
||||||
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
||||||
}, logger)
|
}, logger)
|
||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
|
|
||||||
case targetTencentCLB:
|
case targetTencentCloudCLB:
|
||||||
deployer, err := providerTencentCloudClb.NewWithLogger(&providerTencentCloudClb.TencentCloudCLBDeployerConfig{
|
deployer, err := providerTencentCloudCLB.NewWithLogger(&providerTencentCloudCLB.TencentCloudCLBDeployerConfig{
|
||||||
SecretId: access.SecretId,
|
SecretId: access.SecretId,
|
||||||
SecretKey: access.SecretKey,
|
SecretKey: access.SecretKey,
|
||||||
Region: maps.GetValueAsString(deployConfig, "region"),
|
Region: maps.GetValueAsString(deployConfig, "region"),
|
||||||
ResourceType: providerTencentCloudClb.DeployResourceType(maps.GetValueAsString(deployConfig, "resourceType")),
|
ResourceType: providerTencentCloudCLB.DeployResourceType(maps.GetValueAsString(deployConfig, "resourceType")),
|
||||||
LoadbalancerId: maps.GetValueAsString(deployConfig, "loadbalancerId"),
|
LoadbalancerId: maps.GetValueAsString(deployConfig, "loadbalancerId"),
|
||||||
ListenerId: maps.GetValueAsString(deployConfig, "listenerId"),
|
ListenerId: maps.GetValueAsString(deployConfig, "listenerId"),
|
||||||
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
||||||
}, logger)
|
}, logger)
|
||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
|
|
||||||
case targetTencentCOS:
|
case targetTencentCloudCOS:
|
||||||
deployer, err := providerTencentCloudCos.NewWithLogger(&providerTencentCloudCos.TencentCloudCOSDeployerConfig{
|
deployer, err := providerTencentCloudCOD.NewWithLogger(&providerTencentCloudCOD.TencentCloudCOSDeployerConfig{
|
||||||
SecretId: access.SecretId,
|
SecretId: access.SecretId,
|
||||||
SecretKey: access.SecretKey,
|
SecretKey: access.SecretKey,
|
||||||
Region: maps.GetValueAsString(deployConfig, "region"),
|
Region: maps.GetValueAsString(deployConfig, "region"),
|
||||||
@ -304,16 +304,16 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
}, logger)
|
}, logger)
|
||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
|
|
||||||
case targetTencentECDN:
|
case targetTencentCloudECDN:
|
||||||
deployer, err := providerTencentCloudEcdn.NewWithLogger(&providerTencentCloudEcdn.TencentCloudECDNDeployerConfig{
|
deployer, err := providerTencentCloudECDN.NewWithLogger(&providerTencentCloudECDN.TencentCloudECDNDeployerConfig{
|
||||||
SecretId: access.SecretId,
|
SecretId: access.SecretId,
|
||||||
SecretKey: access.SecretKey,
|
SecretKey: access.SecretKey,
|
||||||
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
||||||
}, logger)
|
}, logger)
|
||||||
return deployer, logger, err
|
return deployer, logger, err
|
||||||
|
|
||||||
case targetTencentTEO:
|
case targetTencentCloudEO:
|
||||||
deployer, err := providerTencentCloudTeo.NewWithLogger(&providerTencentCloudTeo.TencentCloudTEODeployerConfig{
|
deployer, err := providerTencentCloudEO.NewWithLogger(&providerTencentCloudEO.TencentCloudEODeployerConfig{
|
||||||
SecretId: access.SecretId,
|
SecretId: access.SecretId,
|
||||||
SecretKey: access.SecretKey,
|
SecretKey: access.SecretKey,
|
||||||
ZoneId: maps.GetValueAsString(deployConfig, "zoneId"),
|
ZoneId: maps.GetValueAsString(deployConfig, "zoneId"),
|
||||||
@ -335,7 +335,7 @@ func createDeployer(target string, accessConfig string, deployConfig map[string]
|
|||||||
|
|
||||||
switch target {
|
switch target {
|
||||||
case targetVolcEngineCDN:
|
case targetVolcEngineCDN:
|
||||||
deployer, err := providerVolcEngineCdn.NewWithLogger(&providerVolcEngineCdn.VolcEngineCDNDeployerConfig{
|
deployer, err := providerVolcEngineCDN.NewWithLogger(&providerVolcEngineCDN.VolcEngineCDNDeployerConfig{
|
||||||
AccessKey: access.AccessKey,
|
AccessKey: access.AccessKey,
|
||||||
SecretKey: access.SecretKey,
|
SecretKey: access.SecretKey,
|
||||||
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
Domain: maps.GetValueAsString(deployConfig, "domain"),
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
providerSsl "github.com/usual2970/certimate/internal/pkg/core/uploader/providers/tencentcloud-ssl"
|
providerSsl "github.com/usual2970/certimate/internal/pkg/core/uploader/providers/tencentcloud-ssl"
|
||||||
)
|
)
|
||||||
|
|
||||||
type TencentCloudTEODeployerConfig struct {
|
type TencentCloudEODeployerConfig struct {
|
||||||
// 腾讯云 SecretId。
|
// 腾讯云 SecretId。
|
||||||
SecretId string `json:"secretId"`
|
SecretId string `json:"secretId"`
|
||||||
// 腾讯云 SecretKey。
|
// 腾讯云 SecretKey。
|
||||||
@ -26,25 +26,25 @@ type TencentCloudTEODeployerConfig struct {
|
|||||||
Domain string `json:"domain"`
|
Domain string `json:"domain"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type TencentCloudTEODeployer struct {
|
type TencentCloudEODeployer struct {
|
||||||
config *TencentCloudTEODeployerConfig
|
config *TencentCloudEODeployerConfig
|
||||||
logger deployer.Logger
|
logger deployer.Logger
|
||||||
sdkClients *wSdkClients
|
sdkClients *wSdkClients
|
||||||
sslUploader uploader.Uploader
|
sslUploader uploader.Uploader
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ deployer.Deployer = (*TencentCloudTEODeployer)(nil)
|
var _ deployer.Deployer = (*TencentCloudEODeployer)(nil)
|
||||||
|
|
||||||
type wSdkClients struct {
|
type wSdkClients struct {
|
||||||
ssl *tcSsl.Client
|
ssl *tcSsl.Client
|
||||||
teo *tcTeo.Client
|
teo *tcTeo.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
func New(config *TencentCloudTEODeployerConfig) (*TencentCloudTEODeployer, error) {
|
func New(config *TencentCloudEODeployerConfig) (*TencentCloudEODeployer, error) {
|
||||||
return NewWithLogger(config, deployer.NewNilLogger())
|
return NewWithLogger(config, deployer.NewNilLogger())
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWithLogger(config *TencentCloudTEODeployerConfig, logger deployer.Logger) (*TencentCloudTEODeployer, error) {
|
func NewWithLogger(config *TencentCloudEODeployerConfig, logger deployer.Logger) (*TencentCloudEODeployer, error) {
|
||||||
if config == nil {
|
if config == nil {
|
||||||
return nil, errors.New("config is nil")
|
return nil, errors.New("config is nil")
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ func NewWithLogger(config *TencentCloudTEODeployerConfig, logger deployer.Logger
|
|||||||
return nil, xerrors.Wrap(err, "failed to create ssl uploader")
|
return nil, xerrors.Wrap(err, "failed to create ssl uploader")
|
||||||
}
|
}
|
||||||
|
|
||||||
return &TencentCloudTEODeployer{
|
return &TencentCloudEODeployer{
|
||||||
logger: logger,
|
logger: logger,
|
||||||
config: config,
|
config: config,
|
||||||
sdkClients: clients,
|
sdkClients: clients,
|
||||||
@ -74,7 +74,7 @@ func NewWithLogger(config *TencentCloudTEODeployerConfig, logger deployer.Logger
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *TencentCloudTEODeployer) Deploy(ctx context.Context, certPem string, privkeyPem string) (*deployer.DeployResult, error) {
|
func (d *TencentCloudEODeployer) Deploy(ctx context.Context, certPem string, privkeyPem string) (*deployer.DeployResult, error) {
|
||||||
if d.config.ZoneId == "" {
|
if d.config.ZoneId == "" {
|
||||||
return nil, xerrors.New("config `zoneId` is required")
|
return nil, xerrors.New("config `zoneId` is required")
|
||||||
}
|
}
|
@ -8,7 +8,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
provider "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-teo"
|
provider "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/tencentcloud-eo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -21,7 +21,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
argsPrefix := "CERTIMATE_DEPLOYER_TENCENTCLOUDETEO_"
|
argsPrefix := "CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_"
|
||||||
|
|
||||||
flag.StringVar(&fInputCertPath, argsPrefix+"INPUTCERTPATH", "", "")
|
flag.StringVar(&fInputCertPath, argsPrefix+"INPUTCERTPATH", "", "")
|
||||||
flag.StringVar(&fInputKeyPath, argsPrefix+"INPUTKEYPATH", "", "")
|
flag.StringVar(&fInputKeyPath, argsPrefix+"INPUTKEYPATH", "", "")
|
||||||
@ -35,12 +35,12 @@ func init() {
|
|||||||
Shell command to run this test:
|
Shell command to run this test:
|
||||||
|
|
||||||
go test -v tencentcloud_cdn_test.go -args \
|
go test -v tencentcloud_cdn_test.go -args \
|
||||||
--CERTIMATE_DEPLOYER_TENCENTCLOUDETEO_INPUTCERTPATH="/path/to/your-input-cert.pem" \
|
--CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_INPUTCERTPATH="/path/to/your-input-cert.pem" \
|
||||||
--CERTIMATE_DEPLOYER_TENCENTCLOUDETEO_INPUTKEYPATH="/path/to/your-input-key.pem" \
|
--CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_INPUTKEYPATH="/path/to/your-input-key.pem" \
|
||||||
--CERTIMATE_DEPLOYER_TENCENTCLOUDETEO_SECRETID="your-secret-id" \
|
--CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_SECRETID="your-secret-id" \
|
||||||
--CERTIMATE_DEPLOYER_TENCENTCLOUDETEO_SECRETKEY="your-secret-key" \
|
--CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_SECRETKEY="your-secret-key" \
|
||||||
--CERTIMATE_DEPLOYER_TENCENTCLOUDETEO_ZONEID="your-zone-id" \
|
--CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_ZONEID="your-zone-id" \
|
||||||
--CERTIMATE_DEPLOYER_TENCENTCLOUDETEO_DOMAIN="example.com"
|
--CERTIMATE_DEPLOYER_TENCENTCLOUDEEO_DOMAIN="example.com"
|
||||||
*/
|
*/
|
||||||
func TestDeploy(t *testing.T) {
|
func TestDeploy(t *testing.T) {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
@ -56,7 +56,7 @@ func TestDeploy(t *testing.T) {
|
|||||||
fmt.Sprintf("DOMAIN: %v", fDomain),
|
fmt.Sprintf("DOMAIN: %v", fDomain),
|
||||||
}, "\n"))
|
}, "\n"))
|
||||||
|
|
||||||
deployer, err := provider.New(&provider.TencentCloudTEODeployerConfig{
|
deployer, err := provider.New(&provider.TencentCloudEODeployerConfig{
|
||||||
SecretId: fSecretId,
|
SecretId: fSecretId,
|
||||||
SecretKey: fSecretKey,
|
SecretKey: fSecretKey,
|
||||||
ZoneId: fZoneId,
|
ZoneId: fZoneId,
|
108
migrations/1734398918_updated_access.go
Normal file
108
migrations/1734398918_updated_access.go
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
package migrations
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/pocketbase/dbx"
|
||||||
|
"github.com/pocketbase/pocketbase/daos"
|
||||||
|
m "github.com/pocketbase/pocketbase/migrations"
|
||||||
|
"github.com/pocketbase/pocketbase/models/schema"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
m.Register(func(db dbx.Builder) error {
|
||||||
|
dao := daos.New(db);
|
||||||
|
|
||||||
|
collection, err := dao.FindCollectionByNameOrId("4yzbv8urny5ja1e")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// update
|
||||||
|
edit_configType := &schema.SchemaField{}
|
||||||
|
if err := json.Unmarshal([]byte(`{
|
||||||
|
"system": false,
|
||||||
|
"id": "hwy7m03o",
|
||||||
|
"name": "configType",
|
||||||
|
"type": "select",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"maxSelect": 1,
|
||||||
|
"values": [
|
||||||
|
"aliyun",
|
||||||
|
"acmehttpreq",
|
||||||
|
"aws",
|
||||||
|
"baiducloud",
|
||||||
|
"byteplus",
|
||||||
|
"cloudflare",
|
||||||
|
"dogecloud",
|
||||||
|
"godaddy",
|
||||||
|
"huaweicloud",
|
||||||
|
"k8s",
|
||||||
|
"local",
|
||||||
|
"namesilo",
|
||||||
|
"powerdns",
|
||||||
|
"qiniu",
|
||||||
|
"ssh",
|
||||||
|
"tencentcloud",
|
||||||
|
"volcengine",
|
||||||
|
"webhook"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}`), edit_configType); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
collection.Schema.AddField(edit_configType)
|
||||||
|
|
||||||
|
return dao.SaveCollection(collection)
|
||||||
|
}, func(db dbx.Builder) error {
|
||||||
|
dao := daos.New(db);
|
||||||
|
|
||||||
|
collection, err := dao.FindCollectionByNameOrId("4yzbv8urny5ja1e")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
// update
|
||||||
|
edit_configType := &schema.SchemaField{}
|
||||||
|
if err := json.Unmarshal([]byte(`{
|
||||||
|
"system": false,
|
||||||
|
"id": "hwy7m03o",
|
||||||
|
"name": "configType",
|
||||||
|
"type": "select",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"maxSelect": 1,
|
||||||
|
"values": [
|
||||||
|
"aliyun",
|
||||||
|
"tencent",
|
||||||
|
"huaweicloud",
|
||||||
|
"qiniu",
|
||||||
|
"aws",
|
||||||
|
"cloudflare",
|
||||||
|
"namesilo",
|
||||||
|
"godaddy",
|
||||||
|
"pdns",
|
||||||
|
"httpreq",
|
||||||
|
"local",
|
||||||
|
"ssh",
|
||||||
|
"webhook",
|
||||||
|
"k8s",
|
||||||
|
"baiducloud",
|
||||||
|
"dogecloud",
|
||||||
|
"volcengine",
|
||||||
|
"byteplus"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}`), edit_configType); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
collection.Schema.AddField(edit_configType)
|
||||||
|
|
||||||
|
return dao.SaveCollection(collection)
|
||||||
|
})
|
||||||
|
}
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 858 B After Width: | Height: | Size: 858 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type AliyunConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type AliyunAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -27,24 +27,24 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
accessKeyId: z
|
accessKeyId: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.access_key_id.placeholder")
|
.min(1, "access.form.access_key_id.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
accessSecretId: z
|
accessSecretId: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.access_key_secret.placeholder")
|
.min(1, "access.form.access_key_secret.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: AliyunConfig = {
|
let config: AliyunAccessConfig = {
|
||||||
accessKeyId: "",
|
accessKeyId: "",
|
||||||
accessKeySecret: "",
|
accessKeySecret: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as AliyunConfig;
|
if (data) config = data.config as AliyunAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -113,9 +113,9 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -128,7 +128,7 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -143,7 +143,7 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -158,9 +158,9 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
|||||||
name="accessKeyId"
|
name="accessKeyId"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.access_key_id.label")}</FormLabel>
|
<FormLabel>{t("access.form.access_key_id.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.access_key_id.placeholder")} {...field} />
|
<Input placeholder={t("access.form.access_key_id.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -173,9 +173,9 @@ const AccessAliyunForm = ({ data, op, onAfterReq }: AccessAliyunFormProps) => {
|
|||||||
name="accessSecretId"
|
name="accessSecretId"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.access_key_secret.label")}</FormLabel>
|
<FormLabel>{t("access.form.access_key_secret.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.access_key_secret.placeholder")} {...field} />
|
<Input placeholder={t("access.form.access_key_secret.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { AccessModel, accessProvidersMap, accessTypeFormSchema, type AwsConfig } from "@/domain/access";
|
import { AccessModel, accessProvidersMap, accessTypeFormSchema, type AWSAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -27,34 +27,34 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
region: z
|
region: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.region.placeholder")
|
.min(1, "access.form.region.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
accessKeyId: z
|
accessKeyId: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.access_key_id.placeholder")
|
.min(1, "access.form.access_key_id.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
secretAccessKey: z
|
secretAccessKey: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.secret_access_key.placeholder")
|
.min(1, "access.form.secret_access_key.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
hostedZoneId: z
|
hostedZoneId: z
|
||||||
.string()
|
.string()
|
||||||
.min(0, "access.authorization.form.aws_hosted_zone_id.placeholder")
|
.min(0, "access.form.aws_hosted_zone_id.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: AwsConfig = {
|
let config: AWSAccessConfig = {
|
||||||
region: "cn-north-1",
|
region: "cn-north-1",
|
||||||
accessKeyId: "",
|
accessKeyId: "",
|
||||||
secretAccessKey: "",
|
secretAccessKey: "",
|
||||||
hostedZoneId: "",
|
hostedZoneId: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as AwsConfig;
|
if (data) config = data.config as AWSAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -127,9 +127,9 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -142,7 +142,7 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -157,7 +157,7 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -172,9 +172,9 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
|||||||
name="region"
|
name="region"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.region.label")}</FormLabel>
|
<FormLabel>{t("access.form.region.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.region.placeholder")} {...field} />
|
<Input placeholder={t("access.form.region.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -187,9 +187,9 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
|||||||
name="accessKeyId"
|
name="accessKeyId"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.access_key_id.label")}</FormLabel>
|
<FormLabel>{t("access.form.access_key_id.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.access_key_id.placeholder")} {...field} />
|
<Input placeholder={t("access.form.access_key_id.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -202,9 +202,9 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
|||||||
name="secretAccessKey"
|
name="secretAccessKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.secret_access_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.secret_access_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.secret_access_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.secret_access_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -217,9 +217,9 @@ const AccessAwsForm = ({ data, op, onAfterReq }: AccessAwsFormProps) => {
|
|||||||
name="hostedZoneId"
|
name="hostedZoneId"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.aws_hosted_zone_id.label")}</FormLabel>
|
<FormLabel>{t("access.form.aws_hosted_zone_id.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.aws_hosted_zone_id.placeholder")} {...field} />
|
<Input placeholder={t("access.form.aws_hosted_zone_id.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type BaiduCloudConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type BaiduCloudAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -27,24 +27,24 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
accessKeyId: z
|
accessKeyId: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.access_key_id.placeholder")
|
.min(1, "access.form.access_key_id.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
secretAccessKey: z
|
secretAccessKey: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.secret_access_key.placeholder")
|
.min(1, "access.form.secret_access_key.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: BaiduCloudConfig = {
|
let config: BaiduCloudAccessConfig = {
|
||||||
accessKeyId: "",
|
accessKeyId: "",
|
||||||
secretAccessKey: "",
|
secretAccessKey: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as BaiduCloudConfig;
|
if (data) config = data.config as BaiduCloudAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -113,9 +113,9 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -128,7 +128,7 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -143,7 +143,7 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -158,9 +158,9 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
|||||||
name="accessKeyId"
|
name="accessKeyId"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.access_key_id.label")}</FormLabel>
|
<FormLabel>{t("access.form.access_key_id.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.access_key_id.placeholder")} {...field} />
|
<Input placeholder={t("access.form.access_key_id.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -173,9 +173,9 @@ const AccessBaiduCloudForm = ({ data, op, onAfterReq }: AccessBaiduCloudFormProp
|
|||||||
name="secretAccessKey"
|
name="secretAccessKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.secret_access_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.secret_access_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.secret_access_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.secret_access_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type ByteplusConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type BytePlusAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,24 +25,24 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
accessKey: z
|
accessKey: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.access_key.placeholder")
|
.min(1, "access.form.access_key.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
secretKey: z
|
secretKey: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.secret_key.placeholder")
|
.min(1, "access.form.secret_key.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: ByteplusConfig = {
|
let config: BytePlusAccessConfig = {
|
||||||
accessKey: "",
|
accessKey: "",
|
||||||
secretKey: "",
|
secretKey: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as ByteplusConfig;
|
if (data) config = data.config as BytePlusAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -110,9 +110,9 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -125,7 +125,7 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -140,7 +140,7 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -155,9 +155,9 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
|||||||
name="accessKey"
|
name="accessKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.access_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.access_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.access_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.access_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -170,9 +170,9 @@ const AccessByteplusForm = ({ data, op, onAfterReq }: AccessByteplusFormProps) =
|
|||||||
name="secretKey"
|
name="secretKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.secret_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.secret_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.secret_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.secret_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type CloudflareConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type CloudflareAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,19 +25,19 @@ const AccessCloudflareForm = ({ data, op, onAfterReq }: AccessCloudflareFormProp
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
dnsApiToken: z
|
dnsApiToken: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.cloud_dns_api_token.placeholder")
|
.min(1, "access.form.cloud_dns_api_token.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: CloudflareConfig = {
|
let config: CloudflareAccessConfig = {
|
||||||
dnsApiToken: "",
|
dnsApiToken: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as CloudflareConfig;
|
if (data) config = data.config as CloudflareAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -101,9 +101,9 @@ const AccessCloudflareForm = ({ data, op, onAfterReq }: AccessCloudflareFormProp
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -116,7 +116,7 @@ const AccessCloudflareForm = ({ data, op, onAfterReq }: AccessCloudflareFormProp
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -131,7 +131,7 @@ const AccessCloudflareForm = ({ data, op, onAfterReq }: AccessCloudflareFormProp
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -146,9 +146,9 @@ const AccessCloudflareForm = ({ data, op, onAfterReq }: AccessCloudflareFormProp
|
|||||||
name="dnsApiToken"
|
name="dnsApiToken"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.cloud_dns_api_token.label")}</FormLabel>
|
<FormLabel>{t("access.form.cloud_dns_api_token.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.cloud_dns_api_token.placeholder")} {...field} />
|
<Input placeholder={t("access.form.cloud_dns_api_token.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type DogeCloudConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type DogeCloudAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,18 +25,18 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
accessKey: z.string().min(1, "access.authorization.form.access_key.placeholder").max(64),
|
accessKey: z.string().min(1, "access.form.access_key.placeholder").max(64),
|
||||||
secretKey: z.string().min(1, "access.authorization.form.secret_key.placeholder").max(64),
|
secretKey: z.string().min(1, "access.form.secret_key.placeholder").max(64),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: DogeCloudConfig = {
|
let config: DogeCloudAccessConfig = {
|
||||||
accessKey: "",
|
accessKey: "",
|
||||||
secretKey: "",
|
secretKey: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as DogeCloudConfig;
|
if (data) config = data.config as DogeCloudAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -104,9 +104,9 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -119,7 +119,7 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -134,7 +134,7 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -149,9 +149,9 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
|||||||
name="accessKey"
|
name="accessKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.access_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.access_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.access_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.access_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -164,9 +164,9 @@ const AccessDogeCloudForm = ({ data, op, onAfterReq }: AccessDogeCloudFormProps)
|
|||||||
name="secretKey"
|
name="secretKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.secret_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.secret_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.secret_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.secret_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -5,7 +5,6 @@ import { cn } from "@/components/ui/utils";
|
|||||||
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog";
|
||||||
import { Label } from "@/components/ui/label";
|
import { Label } from "@/components/ui/label";
|
||||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||||
import AccessEditForm from "@/components/access/AccessEditForm";
|
|
||||||
import AccessTypeSelect from "@/components/access/AccessTypeSelect";
|
import AccessTypeSelect from "@/components/access/AccessTypeSelect";
|
||||||
import AccessAliyunForm from "./AccessAliyunForm";
|
import AccessAliyunForm from "./AccessAliyunForm";
|
||||||
import AccessTencentForm from "./AccessTencentForm";
|
import AccessTencentForm from "./AccessTencentForm";
|
||||||
@ -61,7 +60,7 @@ const AccessEditDialog = ({ trigger, op, data, className, outConfigType }: Acces
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "tencent":
|
case "tencentcloud":
|
||||||
childComponent = (
|
childComponent = (
|
||||||
<AccessTencentForm
|
<AccessTencentForm
|
||||||
data={data}
|
data={data}
|
||||||
@ -160,7 +159,7 @@ const AccessEditDialog = ({ trigger, op, data, className, outConfigType }: Acces
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "pdns":
|
case "powerdns":
|
||||||
childComponent = (
|
childComponent = (
|
||||||
<AccessPdnsForm
|
<AccessPdnsForm
|
||||||
data={data}
|
data={data}
|
||||||
@ -171,7 +170,7 @@ const AccessEditDialog = ({ trigger, op, data, className, outConfigType }: Acces
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "httpreq":
|
case "acmehttpreq":
|
||||||
childComponent = (
|
childComponent = (
|
||||||
<AccessHttpreqForm
|
<AccessHttpreqForm
|
||||||
data={data}
|
data={data}
|
||||||
@ -282,13 +281,12 @@ const AccessEditDialog = ({ trigger, op, data, className, outConfigType }: Acces
|
|||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
</DialogHeader>
|
</DialogHeader>
|
||||||
<ScrollArea className="max-h-[80vh]">
|
<ScrollArea className="max-h-[80vh]">
|
||||||
<AccessEditForm data={data} />
|
|
||||||
<div className="container py-3">
|
<div className="container py-3">
|
||||||
<div>
|
<div>
|
||||||
<Label>{t("access.authorization.form.type.label")}</Label>
|
<Label>{t("access.form.type.label")}</Label>
|
||||||
<AccessTypeSelect
|
<AccessTypeSelect
|
||||||
className="w-full mt-3"
|
className="w-full mt-3"
|
||||||
placeholder={t("access.authorization.form.type.placeholder")}
|
placeholder={t("access.form.type.placeholder")}
|
||||||
value={configType}
|
value={configType}
|
||||||
showSearch={true}
|
showSearch={true}
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
|
@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type GodaddyConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type GoDaddyAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,24 +25,24 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
apiKey: z
|
apiKey: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.godaddy_api_key.placeholder")
|
.min(1, "access.form.godaddy_api_key.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
apiSecret: z
|
apiSecret: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.godaddy_api_secret.placeholder")
|
.min(1, "access.form.godaddy_api_secret.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: GodaddyConfig = {
|
let config: GoDaddyAccessConfig = {
|
||||||
apiKey: "",
|
apiKey: "",
|
||||||
apiSecret: "",
|
apiSecret: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as GodaddyConfig;
|
if (data) config = data.config as GoDaddyAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -108,9 +108,9 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -123,7 +123,7 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -138,7 +138,7 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -153,9 +153,9 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
|||||||
name="apiKey"
|
name="apiKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.godaddy_api_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.godaddy_api_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.godaddy_api_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.godaddy_api_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -168,9 +168,9 @@ const AccessGodaddyForm = ({ data, op, onAfterReq }: AccessGodaddyFormProps) =>
|
|||||||
name="apiSecret"
|
name="apiSecret"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.godaddy_api_secret.label")}</FormLabel>
|
<FormLabel>{t("access.form.godaddy_api_secret.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.godaddy_api_secret.placeholder")} {...field} />
|
<Input placeholder={t("access.form.godaddy_api_secret.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type HttpreqConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type ACMEHttpReqAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,35 +25,35 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
endpoint: z.string().url("common.errmsg.url_invalid"),
|
endpoint: z.string().url("common.errmsg.url_invalid"),
|
||||||
mode: z.enum(["RAW", ""]),
|
mode: z.enum(["RAW", ""]),
|
||||||
username: z
|
username: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.access_key_secret.placeholder")
|
.min(1, "access.form.access_key_secret.placeholder")
|
||||||
.max(128, t("common.errmsg.string_max", { max: 128 })),
|
.max(128, t("common.errmsg.string_max", { max: 128 })),
|
||||||
password: z
|
password: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.access_key_secret.placeholder")
|
.min(1, "access.form.access_key_secret.placeholder")
|
||||||
.max(128, t("common.errmsg.string_max", { max: 128 })),
|
.max(128, t("common.errmsg.string_max", { max: 128 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: HttpreqConfig = {
|
let config: ACMEHttpReqAccessConfig = {
|
||||||
endpoint: "",
|
endpoint: "",
|
||||||
mode: "",
|
mode: "",
|
||||||
username: "",
|
username: "",
|
||||||
password: "",
|
password: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as HttpreqConfig;
|
if (data) config = data.config as ACMEHttpReqAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
id: data?.id,
|
id: data?.id,
|
||||||
name: data?.name || "",
|
name: data?.name || "",
|
||||||
configType: "httpreq",
|
configType: "acmehttpreq",
|
||||||
endpoint: config.endpoint,
|
endpoint: config.endpoint,
|
||||||
mode: config.mode === "RAW" ? "RAW" : "",
|
mode: config.mode === "RAW" ? "RAW" : "",
|
||||||
username: config.username,
|
username: config.username,
|
||||||
@ -119,9 +119,9 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -134,7 +134,7 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -149,7 +149,7 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -164,9 +164,9 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
|||||||
name="endpoint"
|
name="endpoint"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.httpreq_endpoint.label")}</FormLabel>
|
<FormLabel>{t("access.form.httpreq_endpoint.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.httpreq_endpoint.placeholder")} {...field} />
|
<Input placeholder={t("access.form.httpreq_endpoint.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -179,9 +179,9 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
|||||||
name="mode"
|
name="mode"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.httpreq_mode.label")}</FormLabel>
|
<FormLabel>{t("access.form.httpreq_mode.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.httpreq_mode.placeholder")} {...field} />
|
<Input placeholder={t("access.form.httpreq_mode.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -194,9 +194,9 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
|||||||
name="username"
|
name="username"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.username.label")}</FormLabel>
|
<FormLabel>{t("access.form.username.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.username.placeholder")} {...field} />
|
<Input placeholder={t("access.form.username.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -209,9 +209,9 @@ const AccessHttpreqForm = ({ data, op, onAfterReq }: AccessHttpreqFormProps) =>
|
|||||||
name="password"
|
name="password"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.password.label")}</FormLabel>
|
<FormLabel>{t("access.form.password.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.password.placeholder")} {...field} />
|
<Input placeholder={t("access.form.password.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type HuaweiCloudConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type HuaweiCloudAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,29 +25,29 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
region: z
|
region: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.region.placeholder")
|
.min(1, "access.form.region.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
accessKeyId: z
|
accessKeyId: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.access_key_id.placeholder")
|
.min(1, "access.form.access_key_id.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
secretAccessKey: z
|
secretAccessKey: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.secret_access_key.placeholder")
|
.min(1, "access.form.secret_access_key.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: HuaweiCloudConfig = {
|
let config: HuaweiCloudAccessConfig = {
|
||||||
region: "cn-north-1",
|
region: "cn-north-1",
|
||||||
accessKeyId: "",
|
accessKeyId: "",
|
||||||
secretAccessKey: "",
|
secretAccessKey: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as HuaweiCloudConfig;
|
if (data) config = data.config as HuaweiCloudAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -117,9 +117,9 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -132,7 +132,7 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -147,7 +147,7 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -162,9 +162,9 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
|||||||
name="region"
|
name="region"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.region.label")}</FormLabel>
|
<FormLabel>{t("access.form.region.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.region.placeholder")} {...field} />
|
<Input placeholder={t("access.form.region.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -177,9 +177,9 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
|||||||
name="accessKeyId"
|
name="accessKeyId"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.access_key_id.label")}</FormLabel>
|
<FormLabel>{t("access.form.access_key_id.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.access_key_id.placeholder")} {...field} />
|
<Input placeholder={t("access.form.access_key_id.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -192,9 +192,9 @@ const AccessHuaweiCloudForm = ({ data, op, onAfterReq }: AccessHuaweiCloudFormPr
|
|||||||
name="secretAccessKey"
|
name="secretAccessKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.secret_access_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.secret_access_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.secret_access_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.secret_access_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -10,7 +10,7 @@ import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "
|
|||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { readFileContent } from "@/utils/file";
|
import { readFileContent } from "@/utils/file";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type KubernetesConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type KubernetesAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -32,17 +32,17 @@ const AccessKubernetesForm = ({ data, op, onAfterReq }: AccessKubernetesFormProp
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
kubeConfig: z
|
kubeConfig: z
|
||||||
.string()
|
.string()
|
||||||
.min(0, "access.authorization.form.k8s_kubeconfig.placeholder")
|
.min(0, "access.form.k8s_kubeconfig.placeholder")
|
||||||
.max(20480, t("common.errmsg.string_max", { max: 20480 })),
|
.max(20480, t("common.errmsg.string_max", { max: 20480 })),
|
||||||
kubeConfigFile: z.any().optional(),
|
kubeConfigFile: z.any().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: KubernetesConfig & { kubeConfigFile?: string } = {
|
let config: KubernetesAccessConfig & { kubeConfigFile?: string } = {
|
||||||
kubeConfig: "",
|
kubeConfig: "",
|
||||||
kubeConfigFile: "",
|
kubeConfigFile: "",
|
||||||
};
|
};
|
||||||
@ -126,9 +126,9 @@ const AccessKubernetesForm = ({ data, op, onAfterReq }: AccessKubernetesFormProp
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -141,9 +141,9 @@ const AccessKubernetesForm = ({ data, op, onAfterReq }: AccessKubernetesFormProp
|
|||||||
name="kubeConfig"
|
name="kubeConfig"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem hidden>
|
<FormItem hidden>
|
||||||
<FormLabel>{t("access.authorization.form.k8s_kubeconfig.label")}</FormLabel>
|
<FormLabel>{t("access.form.k8s_kubeconfig.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.k8s_kubeconfig.placeholder")} {...field} />
|
<Input placeholder={t("access.form.k8s_kubeconfig.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -156,14 +156,14 @@ const AccessKubernetesForm = ({ data, op, onAfterReq }: AccessKubernetesFormProp
|
|||||||
name="kubeConfigFile"
|
name="kubeConfigFile"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.k8s_kubeconfig.label")}</FormLabel>
|
<FormLabel>{t("access.form.k8s_kubeconfig.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<div>
|
<div>
|
||||||
<Button type={"button"} variant={"secondary"} size={"sm"} className="w-48" onClick={handleSelectFileClick}>
|
<Button type={"button"} variant={"secondary"} size={"sm"} className="w-48" onClick={handleSelectFileClick}>
|
||||||
{fileName ? fileName : t("access.authorization.form.k8s_kubeconfig_file.placeholder")}
|
{fileName ? fileName : t("access.form.k8s_kubeconfig_file.placeholder")}
|
||||||
</Button>
|
</Button>
|
||||||
<Input
|
<Input
|
||||||
placeholder={t("access.authorization.form.k8s_kubeconfig.placeholder")}
|
placeholder={t("access.form.k8s_kubeconfig.placeholder")}
|
||||||
{...field}
|
{...field}
|
||||||
ref={fileInputRef}
|
ref={fileInputRef}
|
||||||
className="hidden"
|
className="hidden"
|
||||||
|
@ -26,7 +26,7 @@ const AccessLocalForm = ({ data, op, onAfterReq }: AccessLocalFormProps) => {
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
});
|
});
|
||||||
@ -93,9 +93,9 @@ const AccessLocalForm = ({ data, op, onAfterReq }: AccessLocalFormProps) => {
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -108,7 +108,7 @@ const AccessLocalForm = ({ data, op, onAfterReq }: AccessLocalFormProps) => {
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -123,7 +123,7 @@ const AccessLocalForm = ({ data, op, onAfterReq }: AccessLocalFormProps) => {
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
@ -8,36 +8,36 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type NamesiloConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type NameSiloAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
type AccessNamesiloFormProps = {
|
type AccessNameSiloFormProps = {
|
||||||
op: "add" | "edit" | "copy";
|
op: "add" | "edit" | "copy";
|
||||||
data?: AccessModel;
|
data?: AccessModel;
|
||||||
onAfterReq: () => void;
|
onAfterReq: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) => {
|
const AccessNameSiloForm = ({ data, op, onAfterReq }: AccessNameSiloFormProps) => {
|
||||||
const { createAccess, updateAccess } = useAccessStore();
|
const { createAccess, updateAccess } = useAccessStore();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const formSchema = z.object({
|
const formSchema = z.object({
|
||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
apiKey: z
|
apiKey: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.namesilo_api_key.placeholder")
|
.min(1, "access.form.namesilo_api_key.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: NamesiloConfig = {
|
let config: NameSiloAccessConfig = {
|
||||||
apiKey: "",
|
apiKey: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as NamesiloConfig;
|
if (data) config = data.config as NameSiloAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -101,9 +101,9 @@ const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) =
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -116,7 +116,7 @@ const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) =
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -131,7 +131,7 @@ const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) =
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -146,9 +146,9 @@ const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) =
|
|||||||
name="apiKey"
|
name="apiKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.namesilo_api_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.namesilo_api_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.namesilo_api_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.namesilo_api_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -165,4 +165,4 @@ const AccessNamesiloForm = ({ data, op, onAfterReq }: AccessNamesiloFormProps) =
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AccessNamesiloForm;
|
export default AccessNameSiloForm;
|
||||||
|
@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type PdnsConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type PowerDNSAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,28 +25,28 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
apiUrl: z.string().url("common.errmsg.url_invalid"),
|
apiUrl: z.string().url("common.errmsg.url_invalid"),
|
||||||
apiKey: z
|
apiKey: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.access_key_secret.placeholder")
|
.min(1, "access.form.access_key_secret.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: PdnsConfig = {
|
let config: PowerDNSAccessConfig = {
|
||||||
apiUrl: "",
|
apiUrl: "",
|
||||||
apiKey: "",
|
apiKey: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as PdnsConfig;
|
if (data) config = data.config as PowerDNSAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
id: data?.id,
|
id: data?.id,
|
||||||
name: data?.name || "",
|
name: data?.name || "",
|
||||||
configType: "pdns",
|
configType: "powerdns",
|
||||||
apiUrl: config.apiUrl,
|
apiUrl: config.apiUrl,
|
||||||
apiKey: config.apiKey,
|
apiKey: config.apiKey,
|
||||||
},
|
},
|
||||||
@ -108,9 +108,9 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -123,7 +123,7 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -138,7 +138,7 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -153,9 +153,9 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
|||||||
name="apiUrl"
|
name="apiUrl"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.pdns_api_url.label")}</FormLabel>
|
<FormLabel>{t("access.form.pdns_api_url.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.pdns_api_url.placeholder")} {...field} />
|
<Input placeholder={t("access.form.pdns_api_url.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -168,9 +168,9 @@ const AccessPdnsForm = ({ data, op, onAfterReq }: AccessPdnsFormProps) => {
|
|||||||
name="apiKey"
|
name="apiKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.pdns_api_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.pdns_api_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.pdns_api_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.pdns_api_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type QiniuConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type QiniuAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,18 +25,18 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
accessKey: z.string().min(1, "access.authorization.form.access_key.placeholder").max(64),
|
accessKey: z.string().min(1, "access.form.access_key.placeholder").max(64),
|
||||||
secretKey: z.string().min(1, "access.authorization.form.secret_key.placeholder").max(64),
|
secretKey: z.string().min(1, "access.form.secret_key.placeholder").max(64),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: QiniuConfig = {
|
let config: QiniuAccessConfig = {
|
||||||
accessKey: "",
|
accessKey: "",
|
||||||
secretKey: "",
|
secretKey: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as QiniuConfig;
|
if (data) config = data.config as QiniuAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -104,9 +104,9 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -119,7 +119,7 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -134,7 +134,7 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -149,9 +149,9 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
|||||||
name="accessKey"
|
name="accessKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.access_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.access_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.access_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.access_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -164,9 +164,9 @@ const AccessQiniuForm = ({ data, op, onAfterReq }: AccessQiniuFormProps) => {
|
|||||||
name="secretKey"
|
name="secretKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.secret_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.secret_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.secret_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.secret_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -10,7 +10,7 @@ import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "
|
|||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { readFileContent } from "@/utils/file";
|
import { readFileContent } from "@/utils/file";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type SSHConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type SSHAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
host: z.string().refine(
|
host: z.string().refine(
|
||||||
@ -50,28 +50,28 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
group: z.string().optional(),
|
group: z.string().optional(),
|
||||||
port: z
|
port: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.ssh_port.placeholder")
|
.min(1, "access.form.ssh_port.placeholder")
|
||||||
.max(5, t("common.errmsg.string_max", { max: 5 })),
|
.max(5, t("common.errmsg.string_max", { max: 5 })),
|
||||||
username: z
|
username: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.ssh_username.placeholder")
|
.min(1, "access.form.ssh_username.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
password: z
|
password: z
|
||||||
.string()
|
.string()
|
||||||
.min(0, "access.authorization.form.ssh_password.placeholder")
|
.min(0, "access.form.ssh_password.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
key: z
|
key: z
|
||||||
.string()
|
.string()
|
||||||
.min(0, "access.authorization.form.ssh_key.placeholder")
|
.min(0, "access.form.ssh_key.placeholder")
|
||||||
.max(20480, t("common.errmsg.string_max", { max: 20480 })),
|
.max(20480, t("common.errmsg.string_max", { max: 20480 })),
|
||||||
keyFile: z.any().optional(),
|
keyFile: z.any().optional(),
|
||||||
keyPassphrase: z
|
keyPassphrase: z
|
||||||
.string()
|
.string()
|
||||||
.min(0, "access.authorization.form.ssh_key_passphrase.placeholder")
|
.min(0, "access.form.ssh_key_passphrase.placeholder")
|
||||||
.max(2048, t("common.errmsg.string_max", { max: 2048 })),
|
.max(2048, t("common.errmsg.string_max", { max: 2048 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: SSHConfig = {
|
let config: SSHAccessConfig = {
|
||||||
host: "127.0.0.1",
|
host: "127.0.0.1",
|
||||||
port: "22",
|
port: "22",
|
||||||
username: "root",
|
username: "root",
|
||||||
@ -80,7 +80,7 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
keyFile: "",
|
keyFile: "",
|
||||||
keyPassphrase: "",
|
keyPassphrase: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as SSHConfig;
|
if (data) config = data.config as SSHAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -175,9 +175,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -190,7 +190,7 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -205,7 +205,7 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -220,9 +220,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
name="host"
|
name="host"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="grow">
|
<FormItem className="grow">
|
||||||
<FormLabel>{t("access.authorization.form.ssh_host.label")}</FormLabel>
|
<FormLabel>{t("access.form.ssh_host.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.ssh_host.placeholder")} {...field} />
|
<Input placeholder={t("access.form.ssh_host.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -235,9 +235,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
name="port"
|
name="port"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.ssh_port.label")}</FormLabel>
|
<FormLabel>{t("access.form.ssh_port.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.ssh_port.placeholder")} {...field} type="number" />
|
<Input placeholder={t("access.form.ssh_port.placeholder")} {...field} type="number" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -251,9 +251,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
name="username"
|
name="username"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.ssh_username.label")}</FormLabel>
|
<FormLabel>{t("access.form.ssh_username.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.ssh_username.placeholder")} {...field} />
|
<Input placeholder={t("access.form.ssh_username.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -266,9 +266,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
name="password"
|
name="password"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.ssh_password.label")}</FormLabel>
|
<FormLabel>{t("access.form.ssh_password.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.ssh_password.placeholder")} {...field} type="password" />
|
<Input placeholder={t("access.form.ssh_password.placeholder")} {...field} type="password" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -281,9 +281,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
name="key"
|
name="key"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem hidden>
|
<FormItem hidden>
|
||||||
<FormLabel>{t("access.authorization.form.ssh_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.ssh_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.ssh_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.ssh_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -296,14 +296,14 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
name="keyFile"
|
name="keyFile"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.ssh_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.ssh_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<div>
|
<div>
|
||||||
<Button type={"button"} variant={"secondary"} size={"sm"} className="w-48" onClick={handleSelectFileClick}>
|
<Button type={"button"} variant={"secondary"} size={"sm"} className="w-48" onClick={handleSelectFileClick}>
|
||||||
{fileName ? fileName : t("access.authorization.form.ssh_key_file.placeholder")}
|
{fileName ? fileName : t("access.form.ssh_key_file.placeholder")}
|
||||||
</Button>
|
</Button>
|
||||||
<Input
|
<Input
|
||||||
placeholder={t("access.authorization.form.ssh_key.placeholder")}
|
placeholder={t("access.form.ssh_key.placeholder")}
|
||||||
{...field}
|
{...field}
|
||||||
ref={fileInputRef}
|
ref={fileInputRef}
|
||||||
className="hidden"
|
className="hidden"
|
||||||
@ -324,9 +324,9 @@ const AccessSSHForm = ({ data, op, onAfterReq }: AccessSSHFormProps) => {
|
|||||||
name="keyPassphrase"
|
name="keyPassphrase"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.ssh_key_passphrase.label")}</FormLabel>
|
<FormLabel>{t("access.form.ssh_key_passphrase.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.ssh_key_passphrase.placeholder")} {...field} type="password" />
|
<Input placeholder={t("access.form.ssh_key_passphrase.placeholder")} {...field} type="password" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type TencentConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type TencentCloudAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,31 +25,31 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
secretId: z
|
secretId: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.secret_id.placeholder")
|
.min(1, "access.form.secret_id.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
secretKey: z
|
secretKey: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.secret_key.placeholder")
|
.min(1, "access.form.secret_key.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: TencentConfig = {
|
let config: TencentCloudAccessConfig = {
|
||||||
secretId: "",
|
secretId: "",
|
||||||
secretKey: "",
|
secretKey: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as TencentConfig;
|
if (data) config = data.config as TencentCloudAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
id: data?.id,
|
id: data?.id,
|
||||||
name: data?.name || "",
|
name: data?.name || "",
|
||||||
configType: "tencent",
|
configType: "tencentcloud",
|
||||||
secretId: config.secretId,
|
secretId: config.secretId,
|
||||||
secretKey: config.secretKey,
|
secretKey: config.secretKey,
|
||||||
},
|
},
|
||||||
@ -108,9 +108,9 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -123,7 +123,7 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -138,7 +138,7 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -153,9 +153,9 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
|||||||
name="secretId"
|
name="secretId"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.secret_id.label")}</FormLabel>
|
<FormLabel>{t("access.form.secret_id.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.secret_id.placeholder")} {...field} />
|
<Input placeholder={t("access.form.secret_id.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -168,9 +168,9 @@ const AccessTencentForm = ({ data, op, onAfterReq }: AccessTencentFormProps) =>
|
|||||||
name="secretKey"
|
name="secretKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.secret_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.secret_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.secret_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.secret_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Input } from "@/components/ui/input";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type VolcengineConfig } from "@/domain/access";
|
import { accessProvidersMap, accessTypeFormSchema, type AccessModel, type VolcEngineAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,24 +25,24 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
accessKeyId: z
|
accessKeyId: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.access_key_id.placeholder")
|
.min(1, "access.form.access_key_id.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
secretAccessKey: z
|
secretAccessKey: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.secret_access_key.placeholder")
|
.min(1, "access.form.secret_access_key.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: VolcengineConfig = {
|
let config: VolcEngineAccessConfig = {
|
||||||
accessKeyId: "",
|
accessKeyId: "",
|
||||||
secretAccessKey: "",
|
secretAccessKey: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as VolcengineConfig;
|
if (data) config = data.config as VolcEngineAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -110,9 +110,9 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -125,7 +125,7 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -140,7 +140,7 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -155,9 +155,9 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
|||||||
name="accessKeyId"
|
name="accessKeyId"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.access_key_id.label")}</FormLabel>
|
<FormLabel>{t("access.form.access_key_id.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.access_key_id.placeholder")} {...field} />
|
<Input placeholder={t("access.form.access_key_id.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -170,9 +170,9 @@ const AccessVolcengineForm = ({ data, op, onAfterReq }: AccessVolcengineFormProp
|
|||||||
name="secretAccessKey"
|
name="secretAccessKey"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.secret_access_key.label")}</FormLabel>
|
<FormLabel>{t("access.form.secret_access_key.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.secret_access_key.placeholder")} {...field} />
|
<Input placeholder={t("access.form.secret_access_key.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -8,7 +8,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { PbErrorData } from "@/domain/base";
|
import { PbErrorData } from "@/domain/base";
|
||||||
import { AccessModel, accessProvidersMap, accessTypeFormSchema, WebhookConfig } from "@/domain/access";
|
import { AccessModel, accessProvidersMap, accessTypeFormSchema, WebhookAccessConfig } from "@/domain/access";
|
||||||
import { save } from "@/repository/access";
|
import { save } from "@/repository/access";
|
||||||
import { useAccessStore } from "@/stores/access";
|
import { useAccessStore } from "@/stores/access";
|
||||||
|
|
||||||
@ -25,16 +25,16 @@ const AccessWebhookForm = ({ data, op, onAfterReq }: AccessWebhookFormProps) =>
|
|||||||
id: z.string().optional(),
|
id: z.string().optional(),
|
||||||
name: z
|
name: z
|
||||||
.string()
|
.string()
|
||||||
.min(1, "access.authorization.form.name.placeholder")
|
.min(1, "access.form.name.placeholder")
|
||||||
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
.max(64, t("common.errmsg.string_max", { max: 64 })),
|
||||||
configType: accessTypeFormSchema,
|
configType: accessTypeFormSchema,
|
||||||
url: z.string().url("common.errmsg.url_invalid"),
|
url: z.string().url("common.errmsg.url_invalid"),
|
||||||
});
|
});
|
||||||
|
|
||||||
let config: WebhookConfig = {
|
let config: WebhookAccessConfig = {
|
||||||
url: "",
|
url: "",
|
||||||
};
|
};
|
||||||
if (data) config = data.config as WebhookConfig;
|
if (data) config = data.config as WebhookAccessConfig;
|
||||||
|
|
||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
@ -98,9 +98,9 @@ const AccessWebhookForm = ({ data, op, onAfterReq }: AccessWebhookFormProps) =>
|
|||||||
name="name"
|
name="name"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.name.label")}</FormLabel>
|
<FormLabel>{t("access.form.name.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.name.placeholder")} {...field} />
|
<Input placeholder={t("access.form.name.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
@ -113,7 +113,7 @@ const AccessWebhookForm = ({ data, op, onAfterReq }: AccessWebhookFormProps) =>
|
|||||||
name="id"
|
name="id"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -128,7 +128,7 @@ const AccessWebhookForm = ({ data, op, onAfterReq }: AccessWebhookFormProps) =>
|
|||||||
name="configType"
|
name="configType"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem className="hidden">
|
<FormItem className="hidden">
|
||||||
<FormLabel>{t("access.authorization.form.config.label")}</FormLabel>
|
<FormLabel>{t("access.form.config.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
@ -143,9 +143,9 @@ const AccessWebhookForm = ({ data, op, onAfterReq }: AccessWebhookFormProps) =>
|
|||||||
name="url"
|
name="url"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>{t("access.authorization.form.webhook_url.label")}</FormLabel>
|
<FormLabel>{t("access.form.webhook_url.label")}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input placeholder={t("access.authorization.form.webhook_url.placeholder")} {...field} />
|
<Input placeholder={t("access.form.webhook_url.placeholder")} {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
@ -4,15 +4,16 @@ import { BookOpen as BookOpenIcon } from "lucide-react";
|
|||||||
|
|
||||||
import { version } from "@/domain/version";
|
import { version } from "@/domain/version";
|
||||||
|
|
||||||
type VersionProps = {
|
export type VersionProps = {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
style?: React.CSSProperties;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Version = ({ className }: VersionProps) => {
|
const Version = ({ className, style }: VersionProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Space className={className} size={4}>
|
<Space className={className} style={style} size={4}>
|
||||||
<Typography.Link type="secondary" href="https://docs.certimate.me" target="_blank">
|
<Typography.Link type="secondary" href="https://docs.certimate.me" target="_blank">
|
||||||
<div className="flex items-center justify-center space-x-1">
|
<div className="flex items-center justify-center space-x-1">
|
||||||
<BookOpenIcon size={16} />
|
<BookOpenIcon size={16} />
|
||||||
|
@ -60,14 +60,14 @@ const getForm = (data: WorkflowNode, defaultProivder?: string) => {
|
|||||||
return <DeployToQiniuCDN data={data} />;
|
return <DeployToQiniuCDN data={data} />;
|
||||||
case "webhook":
|
case "webhook":
|
||||||
return <DeployToWebhook data={data} />;
|
return <DeployToWebhook data={data} />;
|
||||||
case "tencent-cdn":
|
case "tencentcloud-cdn":
|
||||||
case "tencent-ecdn":
|
case "tencentcloud-ecdn":
|
||||||
return <DeployToTencentCDN data={data} />;
|
return <DeployToTencentCDN data={data} />;
|
||||||
case "tencent-clb":
|
case "tencentcloud-clb":
|
||||||
return <DeployToTencentCLB data={data} />;
|
return <DeployToTencentCLB data={data} />;
|
||||||
case "tencent-cos":
|
case "tencentcloud-cos":
|
||||||
return <DeployToTencentCOS data={data} />;
|
return <DeployToTencentCOS data={data} />;
|
||||||
case "tencent-teo":
|
case "tencentcloud-eo":
|
||||||
return <DeployToTencentTEO data={data} />;
|
return <DeployToTencentTEO data={data} />;
|
||||||
case "ssh":
|
case "ssh":
|
||||||
return <DeployToSSH data={data} />;
|
return <DeployToSSH data={data} />;
|
||||||
|
@ -56,7 +56,7 @@ const DeployToTencentCDN = ({ data }: DeployFormProps) => {
|
|||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
providerType: "tencent-cdn",
|
providerType: "tencentcloud-cdn",
|
||||||
access: config.access as string,
|
access: config.access as string,
|
||||||
certificate: config.certificate as string,
|
certificate: config.certificate as string,
|
||||||
domain: config.domain as string,
|
domain: config.domain as string,
|
||||||
@ -94,7 +94,7 @@ const DeployToTencentCDN = ({ data }: DeployFormProps) => {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
op="add"
|
op="add"
|
||||||
outConfigType="tencent"
|
outConfigType="tencentcloud"
|
||||||
/>
|
/>
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
@ -104,7 +104,7 @@ const DeployToTencentCDN = ({ data }: DeployFormProps) => {
|
|||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
form.setValue("access", value);
|
form.setValue("access", value);
|
||||||
}}
|
}}
|
||||||
providerType="tencent-cdn"
|
providerType="tencentcloud-cdn"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ const DeployToTencentCLB = ({ data }: DeployFormProps) => {
|
|||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
providerType: "tencent-clb",
|
providerType: "tencentcloud-clb",
|
||||||
access: config.access as string,
|
access: config.access as string,
|
||||||
certificate: config.certificate as string,
|
certificate: config.certificate as string,
|
||||||
region: config.region as string,
|
region: config.region as string,
|
||||||
@ -134,7 +134,7 @@ const DeployToTencentCLB = ({ data }: DeployFormProps) => {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
op="add"
|
op="add"
|
||||||
outConfigType="tencent"
|
outConfigType="tencentcloud"
|
||||||
/>
|
/>
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
@ -144,7 +144,7 @@ const DeployToTencentCLB = ({ data }: DeployFormProps) => {
|
|||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
form.setValue("access", value);
|
form.setValue("access", value);
|
||||||
}}
|
}}
|
||||||
providerType="tencent-clb"
|
providerType="tencentcloud-clb"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ const DeployToTencentCOS = ({ data }: DeployFormProps) => {
|
|||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
providerType: "tencent-cos",
|
providerType: "tencentcloud-cos",
|
||||||
access: config.access as string,
|
access: config.access as string,
|
||||||
certificate: config.certificate as string,
|
certificate: config.certificate as string,
|
||||||
region: config.region as string,
|
region: config.region as string,
|
||||||
@ -100,7 +100,7 @@ const DeployToTencentCOS = ({ data }: DeployFormProps) => {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
op="add"
|
op="add"
|
||||||
outConfigType="tencent"
|
outConfigType="tencentcloud"
|
||||||
/>
|
/>
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
@ -110,7 +110,7 @@ const DeployToTencentCOS = ({ data }: DeployFormProps) => {
|
|||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
form.setValue("access", value);
|
form.setValue("access", value);
|
||||||
}}
|
}}
|
||||||
providerType="tencent-cos"
|
providerType="tencentcloud-cos"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ const DeployToTencentTEO = ({ data }: DeployFormProps) => {
|
|||||||
const form = useForm<z.infer<typeof formSchema>>({
|
const form = useForm<z.infer<typeof formSchema>>({
|
||||||
resolver: zodResolver(formSchema),
|
resolver: zodResolver(formSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
providerType: "tencent-teo",
|
providerType: "tencentcloud-eo",
|
||||||
access: config.access as string,
|
access: config.access as string,
|
||||||
certificate: config.certificate as string,
|
certificate: config.certificate as string,
|
||||||
zoneId: config.zoneId as string,
|
zoneId: config.zoneId as string,
|
||||||
@ -97,7 +97,7 @@ const DeployToTencentTEO = ({ data }: DeployFormProps) => {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
op="add"
|
op="add"
|
||||||
outConfigType="tencent"
|
outConfigType="tencentcloud"
|
||||||
/>
|
/>
|
||||||
</FormLabel>
|
</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
@ -107,7 +107,7 @@ const DeployToTencentTEO = ({ data }: DeployFormProps) => {
|
|||||||
onValueChange={(value) => {
|
onValueChange={(value) => {
|
||||||
form.setValue("access", value);
|
form.setValue("access", value);
|
||||||
}}
|
}}
|
||||||
providerType="tencent-teo"
|
providerType="tencentcloud-eo"
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
|
@ -1,153 +1,150 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
import { type BaseModel } from "pocketbase";
|
import { type BaseModel } from "pocketbase";
|
||||||
|
|
||||||
type AccessUsages = "apply" | "deploy" | "all";
|
/*
|
||||||
|
注意:如果追加新的常量值,请保持以 ASCII 排序。
|
||||||
type AccessProvider = {
|
NOTICE: If you add new constant, please keep ASCII order.
|
||||||
type: string;
|
*/
|
||||||
name: string;
|
export const ACCESS_PROVIDER_TYPE_ACMEHTTPREQ = "acmehttpreq" as const;
|
||||||
icon: string;
|
export const ACCESS_PROVIDER_TYPE_ALIYUN = "aliyun" as const;
|
||||||
usage: AccessUsages;
|
export const ACCESS_PROVIDER_TYPE_AWS = "aws" as const;
|
||||||
};
|
export const ACCESS_PROVIDER_TYPE_BAIDUCLOUD = "baiducloud" as const;
|
||||||
|
export const ACCESS_PROVIDER_TYPE_BYTEPLUS = "byteplus" as const;
|
||||||
export const accessProvidersMap: Map<AccessProvider["type"], AccessProvider> = new Map(
|
export const ACCESS_PROVIDER_TYPE_CLOUDFLARE = "cloudflare" as const;
|
||||||
[
|
export const ACCESS_PROVIDER_TYPE_DOGECLOUD = "dogecloud" as const;
|
||||||
["aliyun", "common.provider.aliyun", "/imgs/providers/aliyun.svg", "all"],
|
export const ACCESS_PROVIDER_TYPE_GODADDY = "godaddy" as const;
|
||||||
["tencent", "common.provider.tencent", "/imgs/providers/tencent.svg", "all"],
|
export const ACCESS_PROVIDER_TYPE_HUAWEICLOUD = "huaweicloud" as const;
|
||||||
["huaweicloud", "common.provider.huaweicloud", "/imgs/providers/huaweicloud.svg", "all"],
|
export const ACCESS_PROVIDER_TYPE_KUBERNETES = "k8s" as const;
|
||||||
["baiducloud", "common.provider.baiducloud", "/imgs/providers/baiducloud.svg", "all"],
|
export const ACCESS_PROVIDER_TYPE_LOCAL = "local" as const;
|
||||||
["qiniu", "common.provider.qiniu", "/imgs/providers/qiniu.svg", "deploy"],
|
export const ACCESS_PROVIDER_TYPE_NAMESILO = "namesilo" as const;
|
||||||
["dogecloud", "common.provider.dogecloud", "/imgs/providers/dogecloud.svg", "deploy"],
|
export const ACCESS_PROVIDER_TYPE_POWERDNS = "powerdns" as const;
|
||||||
["volcengine", "common.provider.volcengine", "/imgs/providers/volcengine.svg", "all"],
|
export const ACCESS_PROVIDER_TYPE_QINIU = "qiniu" as const;
|
||||||
["byteplus", "common.provider.byteplus", "/imgs/providers/byteplus.svg", "all"],
|
export const ACCESS_PROVIDER_TYPE_SSH = "ssh" as const;
|
||||||
["aws", "common.provider.aws", "/imgs/providers/aws.svg", "apply"],
|
export const ACCESS_PROVIDER_TYPE_TENCENTCLOUD = "tencentcloud" as const;
|
||||||
["cloudflare", "common.provider.cloudflare", "/imgs/providers/cloudflare.svg", "apply"],
|
export const ACCESS_PROVIDER_TYPE_VOLCENGINE = "volcengine" as const;
|
||||||
["namesilo", "common.provider.namesilo", "/imgs/providers/namesilo.svg", "apply"],
|
export const ACCESS_PROVIDER_TYPE_WEBHOOK = "webhook" as const;
|
||||||
["godaddy", "common.provider.godaddy", "/imgs/providers/godaddy.svg", "apply"],
|
export const ACCESS_PROVIDER_TYPES = Object.freeze({
|
||||||
["pdns", "common.provider.pdns", "/imgs/providers/pdns.svg", "apply"],
|
ACMEHTTPREQ: ACCESS_PROVIDER_TYPE_ACMEHTTPREQ,
|
||||||
["httpreq", "common.provider.httpreq", "/imgs/providers/httpreq.svg", "apply"],
|
ALIYUN: ACCESS_PROVIDER_TYPE_ALIYUN,
|
||||||
["local", "common.provider.local", "/imgs/providers/local.svg", "deploy"],
|
AWS: ACCESS_PROVIDER_TYPE_AWS,
|
||||||
["ssh", "common.provider.ssh", "/imgs/providers/ssh.svg", "deploy"],
|
BAIDUCLOUD: ACCESS_PROVIDER_TYPE_BAIDUCLOUD,
|
||||||
["webhook", "common.provider.webhook", "/imgs/providers/webhook.svg", "deploy"],
|
BYTEPLUS: ACCESS_PROVIDER_TYPE_BYTEPLUS,
|
||||||
["k8s", "common.provider.kubernetes", "/imgs/providers/k8s.svg", "deploy"],
|
CLOUDFLARE: ACCESS_PROVIDER_TYPE_CLOUDFLARE,
|
||||||
].map(([type, name, icon, usage]) => [type, { type, name, icon, usage: usage as AccessUsages }])
|
DOGECLOUD: ACCESS_PROVIDER_TYPE_DOGECLOUD,
|
||||||
);
|
GODADDY: ACCESS_PROVIDER_TYPE_GODADDY,
|
||||||
|
HUAWEICLOUD: ACCESS_PROVIDER_TYPE_HUAWEICLOUD,
|
||||||
export const accessTypeFormSchema = z.union(
|
KUBERNETES: ACCESS_PROVIDER_TYPE_KUBERNETES,
|
||||||
[
|
LOCAL: ACCESS_PROVIDER_TYPE_LOCAL,
|
||||||
z.literal("aliyun"),
|
NAMESILO: ACCESS_PROVIDER_TYPE_NAMESILO,
|
||||||
z.literal("tencent"),
|
POWERDNS: ACCESS_PROVIDER_TYPE_POWERDNS,
|
||||||
z.literal("huaweicloud"),
|
QINIU: ACCESS_PROVIDER_TYPE_QINIU,
|
||||||
z.literal("baiducloud"),
|
SSH: ACCESS_PROVIDER_TYPE_SSH,
|
||||||
z.literal("qiniu"),
|
TENCENTCLOUD: ACCESS_PROVIDER_TYPE_TENCENTCLOUD,
|
||||||
z.literal("dogecloud"),
|
VOLCENGINE: ACCESS_PROVIDER_TYPE_VOLCENGINE,
|
||||||
z.literal("aws"),
|
WEBHOOK: ACCESS_PROVIDER_TYPE_WEBHOOK,
|
||||||
z.literal("cloudflare"),
|
} as const);
|
||||||
z.literal("namesilo"),
|
|
||||||
z.literal("godaddy"),
|
|
||||||
z.literal("pdns"),
|
|
||||||
z.literal("httpreq"),
|
|
||||||
z.literal("local"),
|
|
||||||
z.literal("ssh"),
|
|
||||||
z.literal("webhook"),
|
|
||||||
z.literal("k8s"),
|
|
||||||
z.literal("volcengine"),
|
|
||||||
z.literal("byteplus"),
|
|
||||||
],
|
|
||||||
{ message: "access.authorization.form.type.placeholder" }
|
|
||||||
);
|
|
||||||
|
|
||||||
export interface AccessModel extends Omit<BaseModel, "created" | "updated"> {
|
export interface AccessModel extends Omit<BaseModel, "created" | "updated"> {
|
||||||
name: string;
|
name: string;
|
||||||
configType: string;
|
configType: string;
|
||||||
usage: AccessUsages;
|
usage: AccessUsages;
|
||||||
group?: string;
|
config: /*
|
||||||
config:
|
注意:如果追加新的类型,请保持以 ASCII 排序。
|
||||||
| AliyunConfig
|
NOTICE: If you add new type, please keep ASCII order.
|
||||||
| TencentConfig
|
*/
|
||||||
| HuaweiCloudConfig
|
Record<string, unknown> &
|
||||||
| QiniuConfig
|
(
|
||||||
| DogeCloudConfig
|
| ACMEHttpReqAccessConfig
|
||||||
| AwsConfig
|
| AliyunAccessConfig
|
||||||
| CloudflareConfig
|
| AWSAccessConfig
|
||||||
| NamesiloConfig
|
| BaiduCloudAccessConfig
|
||||||
| GodaddyConfig
|
| BytePlusAccessConfig
|
||||||
| PdnsConfig
|
| CloudflareAccessConfig
|
||||||
| HttpreqConfig
|
| DogeCloudAccessConfig
|
||||||
| LocalConfig
|
| GoDaddyAccessConfig
|
||||||
| SSHConfig
|
| HuaweiCloudAccessConfig
|
||||||
| WebhookConfig
|
| KubernetesAccessConfig
|
||||||
| KubernetesConfig
|
| LocalAccessConfig
|
||||||
| VolcengineConfig
|
| NamesiloAccessConfig
|
||||||
| ByteplusConfig;
|
| PowerDNSAccessConfig
|
||||||
|
| QiniuAccessConfig
|
||||||
|
| SSHAccessConfig
|
||||||
|
| TencentCloudAccessConfig
|
||||||
|
| VolcEngineAccessConfig
|
||||||
|
| WebhookAccessConfig
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AliyunConfig = {
|
export type ACMEHttpReqAccessConfig = {
|
||||||
|
endpoint: string;
|
||||||
|
mode?: string;
|
||||||
|
username?: string;
|
||||||
|
password?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type AliyunAccessConfig = {
|
||||||
accessKeyId: string;
|
accessKeyId: string;
|
||||||
accessKeySecret: string;
|
accessKeySecret: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type TencentConfig = {
|
export type AWSAccessConfig = {
|
||||||
secretId: string;
|
|
||||||
secretKey: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type HuaweiCloudConfig = {
|
|
||||||
region: string;
|
|
||||||
accessKeyId: string;
|
|
||||||
secretAccessKey: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type BaiduCloudConfig = {
|
|
||||||
accessKeyId: string;
|
|
||||||
secretAccessKey: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type QiniuConfig = {
|
|
||||||
accessKey: string;
|
|
||||||
secretKey: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type DogeCloudConfig = {
|
|
||||||
accessKey: string;
|
|
||||||
secretKey: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type AwsConfig = {
|
|
||||||
region: string;
|
|
||||||
accessKeyId: string;
|
accessKeyId: string;
|
||||||
secretAccessKey: string;
|
secretAccessKey: string;
|
||||||
|
region?: string;
|
||||||
hostedZoneId?: string;
|
hostedZoneId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CloudflareConfig = {
|
export type BaiduCloudAccessConfig = {
|
||||||
|
accessKeyId: string;
|
||||||
|
secretAccessKey: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type BytePlusAccessConfig = {
|
||||||
|
accessKey: string;
|
||||||
|
secretKey: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type CloudflareAccessConfig = {
|
||||||
dnsApiToken: string;
|
dnsApiToken: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type NamesiloConfig = {
|
export type DogeCloudAccessConfig = {
|
||||||
apiKey: string;
|
accessKey: string;
|
||||||
|
secretKey: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type GodaddyConfig = {
|
export type GoDaddyAccessConfig = {
|
||||||
apiKey: string;
|
apiKey: string;
|
||||||
apiSecret: string;
|
apiSecret: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PdnsConfig = {
|
export type HuaweiCloudAccessConfig = {
|
||||||
|
region: string;
|
||||||
|
accessKeyId: string;
|
||||||
|
secretAccessKey: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type KubernetesAccessConfig = {
|
||||||
|
kubeConfig: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type LocalAccessConfig = never;
|
||||||
|
|
||||||
|
export type NamesiloAccessConfig = {
|
||||||
|
apiKey: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PowerDNSAccessConfig = {
|
||||||
apiUrl: string;
|
apiUrl: string;
|
||||||
apiKey: string;
|
apiKey: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type HttpreqConfig = {
|
export type QiniuAccessConfig = {
|
||||||
endpoint: string;
|
accessKey: string;
|
||||||
mode: string;
|
secretKey: string;
|
||||||
username: string;
|
|
||||||
password: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type LocalConfig = Record<string, string>;
|
export type SSHAccessConfig = {
|
||||||
|
|
||||||
export type SSHConfig = {
|
|
||||||
host: string;
|
host: string;
|
||||||
port: string;
|
port: string;
|
||||||
username: string;
|
username: string;
|
||||||
@ -157,20 +154,78 @@ export type SSHConfig = {
|
|||||||
keyPassphrase?: string;
|
keyPassphrase?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type WebhookConfig = {
|
export type TencentCloudAccessConfig = {
|
||||||
url: string;
|
secretId: string;
|
||||||
|
secretKey: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type KubernetesConfig = {
|
export type VolcEngineAccessConfig = {
|
||||||
kubeConfig: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type VolcengineConfig = {
|
|
||||||
accessKeyId: string;
|
accessKeyId: string;
|
||||||
secretAccessKey: string;
|
secretAccessKey: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ByteplusConfig = {
|
export type WebhookAccessConfig = {
|
||||||
accessKey: string;
|
url: string;
|
||||||
secretKey: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type AccessTypes = (typeof ACCESS_PROVIDER_TYPES)[keyof typeof ACCESS_PROVIDER_TYPES];
|
||||||
|
|
||||||
|
type AccessUsages = "apply" | "deploy" | "all";
|
||||||
|
|
||||||
|
type AccessProvider = {
|
||||||
|
type: AccessTypes;
|
||||||
|
name: string;
|
||||||
|
icon: string;
|
||||||
|
usage: AccessUsages;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const accessProvidersMap: Map<AccessProvider["type"], AccessProvider> = new Map(
|
||||||
|
/*
|
||||||
|
注意:与定义常量值时不同,此处的顺序决定显示在前端的顺序。
|
||||||
|
NOTICE: The following order determines the order displayed at the frontend.
|
||||||
|
*/
|
||||||
|
[
|
||||||
|
[ACCESS_PROVIDER_TYPE_ALIYUN, "common.provider.aliyun", "/imgs/providers/aliyun.svg", "all"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_TENCENTCLOUD, "common.provider.tencentcloud", "/imgs/providers/tencentcloud.svg", "all"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_HUAWEICLOUD, "common.provider.huaweicloud", "/imgs/providers/huaweicloud.svg", "all"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_BAIDUCLOUD, "common.provider.baiducloud", "/imgs/providers/baiducloud.svg", "all"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_QINIU, "common.provider.qiniu", "/imgs/providers/qiniu.svg", "deploy"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_DOGECLOUD, "common.provider.dogecloud", "/imgs/providers/dogecloud.svg", "deploy"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_VOLCENGINE, "common.provider.volcengine", "/imgs/providers/volcengine.svg", "all"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_BYTEPLUS, "common.provider.byteplus", "/imgs/providers/byteplus.svg", "all"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_AWS, "common.provider.aws", "/imgs/providers/aws.svg", "apply"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_CLOUDFLARE, "common.provider.cloudflare", "/imgs/providers/cloudflare.svg", "apply"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_NAMESILO, "common.provider.namesilo", "/imgs/providers/namesilo.svg", "apply"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_GODADDY, "common.provider.godaddy", "/imgs/providers/godaddy.svg", "apply"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_POWERDNS, "common.provider.powerdns", "/imgs/providers/powerdns.svg", "apply"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_LOCAL, "common.provider.local", "/imgs/providers/local.svg", "deploy"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_SSH, "common.provider.ssh", "/imgs/providers/ssh.svg", "deploy"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_WEBHOOK, "common.provider.webhook", "/imgs/providers/webhook.svg", "deploy"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_KUBERNETES, "common.provider.kubernetes", "/imgs/providers/kubernetes.svg", "deploy"],
|
||||||
|
[ACCESS_PROVIDER_TYPE_ACMEHTTPREQ, "common.provider.acmehttpreq", "/imgs/providers/acmehttpreq.svg", "apply"],
|
||||||
|
].map(([type, name, icon, usage]) => [type as AccessTypes, { type: type as AccessTypes, name, icon, usage: usage as AccessUsages }])
|
||||||
|
);
|
||||||
|
|
||||||
|
export const accessTypeFormSchema = z.union(
|
||||||
|
[
|
||||||
|
z.literal("aliyun"),
|
||||||
|
z.literal("tencentcloud"),
|
||||||
|
z.literal("huaweicloud"),
|
||||||
|
z.literal("baiducloud"),
|
||||||
|
z.literal("qiniu"),
|
||||||
|
z.literal("dogecloud"),
|
||||||
|
z.literal("aws"),
|
||||||
|
z.literal("cloudflare"),
|
||||||
|
z.literal("namesilo"),
|
||||||
|
z.literal("godaddy"),
|
||||||
|
z.literal("powerdns"),
|
||||||
|
z.literal("acmehttpreq"),
|
||||||
|
z.literal("local"),
|
||||||
|
z.literal("ssh"),
|
||||||
|
z.literal("webhook"),
|
||||||
|
z.literal("k8s"),
|
||||||
|
z.literal("volcengine"),
|
||||||
|
z.literal("byteplus"),
|
||||||
|
],
|
||||||
|
{ message: "access.form.type.placeholder" }
|
||||||
|
);
|
||||||
|
@ -70,11 +70,11 @@ export const deployTargetList: string[][] = [
|
|||||||
["aliyun-clb", "common.provider.aliyun.clb", "/imgs/providers/aliyun.svg"],
|
["aliyun-clb", "common.provider.aliyun.clb", "/imgs/providers/aliyun.svg"],
|
||||||
["aliyun-alb", "common.provider.aliyun.alb", "/imgs/providers/aliyun.svg"],
|
["aliyun-alb", "common.provider.aliyun.alb", "/imgs/providers/aliyun.svg"],
|
||||||
["aliyun-nlb", "common.provider.aliyun.nlb", "/imgs/providers/aliyun.svg"],
|
["aliyun-nlb", "common.provider.aliyun.nlb", "/imgs/providers/aliyun.svg"],
|
||||||
["tencent-cdn", "common.provider.tencent.cdn", "/imgs/providers/tencent.svg"],
|
["tencentcloud-cdn", "common.provider.tencentcloud.cdn", "/imgs/providers/tencentcloud.svg"],
|
||||||
["tencent-ecdn", "common.provider.tencent.ecdn", "/imgs/providers/tencent.svg"],
|
["tencentcloud-ecdn", "common.provider.tencentcloud.ecdn", "/imgs/providers/tencentcloud.svg"],
|
||||||
["tencent-clb", "common.provider.tencent.clb", "/imgs/providers/tencent.svg"],
|
["tencentcloud-clb", "common.provider.tencentcloud.clb", "/imgs/providers/tencentcloud.svg"],
|
||||||
["tencent-cos", "common.provider.tencent.cos", "/imgs/providers/tencent.svg"],
|
["tencentcloud-cos", "common.provider.tencentcloud.cos", "/imgs/providers/tencentcloud.svg"],
|
||||||
["tencent-teo", "common.provider.tencent.teo", "/imgs/providers/tencent.svg"],
|
["tencentcloud-eo", "common.provider.tencentcloud.eo", "/imgs/providers/tencentcloud.svg"],
|
||||||
["huaweicloud-cdn", "common.provider.huaweicloud.cdn", "/imgs/providers/huaweicloud.svg"],
|
["huaweicloud-cdn", "common.provider.huaweicloud.cdn", "/imgs/providers/huaweicloud.svg"],
|
||||||
["huaweicloud-elb", "common.provider.huaweicloud.elb", "/imgs/providers/huaweicloud.svg"],
|
["huaweicloud-elb", "common.provider.huaweicloud.elb", "/imgs/providers/huaweicloud.svg"],
|
||||||
["baiducloud-cdn", "common.provider.baiducloud.cdn", "/imgs/providers/baiducloud.svg"],
|
["baiducloud-cdn", "common.provider.baiducloud.cdn", "/imgs/providers/baiducloud.svg"],
|
||||||
@ -83,7 +83,7 @@ export const deployTargetList: string[][] = [
|
|||||||
["local", "common.provider.local", "/imgs/providers/local.svg"],
|
["local", "common.provider.local", "/imgs/providers/local.svg"],
|
||||||
["ssh", "common.provider.ssh", "/imgs/providers/ssh.svg"],
|
["ssh", "common.provider.ssh", "/imgs/providers/ssh.svg"],
|
||||||
["webhook", "common.provider.webhook", "/imgs/providers/webhook.svg"],
|
["webhook", "common.provider.webhook", "/imgs/providers/webhook.svg"],
|
||||||
["k8s-secret", "common.provider.kubernetes.secret", "/imgs/providers/k8s.svg"],
|
["k8s-secret", "common.provider.kubernetes.secret", "/imgs/providers/kubernetes.svg"],
|
||||||
["volcengine-live", "common.provider.volcengine.live", "/imgs/providers/volcengine.svg"],
|
["volcengine-live", "common.provider.volcengine.live", "/imgs/providers/volcengine.svg"],
|
||||||
["volcengine-cdn", "common.provider.volcengine.cdn", "/imgs/providers/volcengine.svg"],
|
["volcengine-cdn", "common.provider.volcengine.cdn", "/imgs/providers/volcengine.svg"],
|
||||||
["byteplus-cdn", "common.provider.byteplus.cdn", "/imgs/providers/byteplus.svg"],
|
["byteplus-cdn", "common.provider.byteplus.cdn", "/imgs/providers/byteplus.svg"],
|
||||||
|
@ -16,67 +16,62 @@
|
|||||||
"access.props.created_at": "Created At",
|
"access.props.created_at": "Created At",
|
||||||
"access.props.updated_at": "Updated At",
|
"access.props.updated_at": "Updated At",
|
||||||
|
|
||||||
"access.authorization.form.name.label": "Name",
|
"access.form.name.label": "Name",
|
||||||
"access.authorization.form.name.placeholder": "Please enter authorization name",
|
"access.form.name.placeholder": "Please enter authorization name",
|
||||||
"access.authorization.form.type.label": "Provider",
|
"access.form.type.label": "Provider",
|
||||||
"access.authorization.form.type.placeholder": "Please select a provider",
|
"access.form.type.placeholder": "Please select a provider",
|
||||||
"access.authorization.form.type.search.notfound": "Provider not found",
|
"access.form.region.label": "Region",
|
||||||
"access.authorization.form.type.list": "Authorization List",
|
"access.form.region.placeholder": "Please enter Region",
|
||||||
"access.authorization.form.config.label": "Configuration Type",
|
"access.form.access_key_id.label": "AccessKeyId",
|
||||||
"access.authorization.form.region.label": "Region",
|
"access.form.access_key_id.placeholder": "Please enter AccessKeyId",
|
||||||
"access.authorization.form.region.placeholder": "Please enter Region",
|
"access.form.access_key_secret.label": "AccessKeySecret",
|
||||||
"access.authorization.form.access_key_id.label": "AccessKeyId",
|
"access.form.access_key_secret.placeholder": "Please enter AccessKeySecret",
|
||||||
"access.authorization.form.access_key_id.placeholder": "Please enter AccessKeyId",
|
"access.form.access_key.label": "AccessKey",
|
||||||
"access.authorization.form.access_key_secret.label": "AccessKeySecret",
|
"access.form.access_key.placeholder": "Please enter AccessKey",
|
||||||
"access.authorization.form.access_key_secret.placeholder": "Please enter AccessKeySecret",
|
"access.form.secret_id.label": "SecretId",
|
||||||
"access.authorization.form.access_key.label": "AccessKey",
|
"access.form.secret_id.placeholder": "Please enter SecretId",
|
||||||
"access.authorization.form.access_key.placeholder": "Please enter AccessKey",
|
"access.form.secret_key.label": "SecretKey",
|
||||||
"access.authorization.form.secret_id.label": "SecretId",
|
"access.form.secret_key.placeholder": "Please enter SecretKey",
|
||||||
"access.authorization.form.secret_id.placeholder": "Please enter SecretId",
|
"access.form.secret_access_key.label": "SecretAccessKey",
|
||||||
"access.authorization.form.secret_key.label": "SecretKey",
|
"access.form.secret_access_key.placeholder": "Please enter SecretAccessKey",
|
||||||
"access.authorization.form.secret_key.placeholder": "Please enter SecretKey",
|
"access.form.cloud_dns_api_token.label": "CLOUD_DNS_API_TOKEN",
|
||||||
"access.authorization.form.secret_access_key.label": "SecretAccessKey",
|
"access.form.cloud_dns_api_token.placeholder": "Please enter CLOUD_DNS_API_TOKEN",
|
||||||
"access.authorization.form.secret_access_key.placeholder": "Please enter SecretAccessKey",
|
"access.form.godaddy_api_key.label": "GO_DADDY_API_KEY",
|
||||||
"access.authorization.form.aws_hosted_zone_id.label": "AWS Hosted Zone ID",
|
"access.form.godaddy_api_key.placeholder": "Please enter GO_DADDY_API_KEY",
|
||||||
"access.authorization.form.aws_hosted_zone_id.placeholder": "Please enter AWS Hosted Zone ID",
|
"access.form.godaddy_api_secret.label": "GO_DADDY_API_SECRET",
|
||||||
"access.authorization.form.cloud_dns_api_token.label": "CLOUD_DNS_API_TOKEN",
|
"access.form.godaddy_api_secret.placeholder": "Please enter GO_DADDY_API_SECRET",
|
||||||
"access.authorization.form.cloud_dns_api_token.placeholder": "Please enter CLOUD_DNS_API_TOKEN",
|
"access.form.namesilo_api_key.label": "NAMESILO_API_KEY",
|
||||||
"access.authorization.form.godaddy_api_key.label": "GO_DADDY_API_KEY",
|
"access.form.namesilo_api_key.placeholder": "Please enter NAMESILO_API_KEY",
|
||||||
"access.authorization.form.godaddy_api_key.placeholder": "Please enter GO_DADDY_API_KEY",
|
"access.form.pdns_api_url.label": "PDNS_API_URL",
|
||||||
"access.authorization.form.godaddy_api_secret.label": "GO_DADDY_API_SECRET",
|
"access.form.pdns_api_url.placeholder": "Please enter PDNS_API_URL",
|
||||||
"access.authorization.form.godaddy_api_secret.placeholder": "Please enter GO_DADDY_API_SECRET",
|
"access.form.pdns_api_key.label": "PDNS_API_KEY",
|
||||||
"access.authorization.form.namesilo_api_key.label": "NAMESILO_API_KEY",
|
"access.form.pdns_api_key.placeholder": "Please enter PDNS_API_KEY",
|
||||||
"access.authorization.form.namesilo_api_key.placeholder": "Please enter NAMESILO_API_KEY",
|
"access.form.httpreq_endpoint.label": "HTTPREQ_ENDPOINT",
|
||||||
"access.authorization.form.pdns_api_url.label": "PDNS_API_URL",
|
"access.form.httpreq_endpoint.placeholder": "Please enter HTTPREQ_ENDPOINT",
|
||||||
"access.authorization.form.pdns_api_url.placeholder": "Please enter PDNS_API_URL",
|
"access.form.httpreq_mode.label": "HTTPREQ_MODE",
|
||||||
"access.authorization.form.pdns_api_key.label": "PDNS_API_KEY",
|
"access.form.httpreq_mode.placeholder": "Please enter HTTPREQ_MODE(RAW or '')",
|
||||||
"access.authorization.form.pdns_api_key.placeholder": "Please enter PDNS_API_KEY",
|
"access.form.username.label": "Username",
|
||||||
"access.authorization.form.httpreq_endpoint.label": "HTTPREQ_ENDPOINT",
|
"access.form.username.placeholder": "Please enter username",
|
||||||
"access.authorization.form.httpreq_endpoint.placeholder": "Please enter HTTPREQ_ENDPOINT",
|
"access.form.password.label": "Password",
|
||||||
"access.authorization.form.httpreq_mode.label": "HTTPREQ_MODE",
|
"access.form.password.placeholder": "Please enter password",
|
||||||
"access.authorization.form.httpreq_mode.placeholder": "Please enter HTTPREQ_MODE(RAW or '')",
|
"access.form.access_group.placeholder": "Please select a group",
|
||||||
"access.authorization.form.username.label": "Username",
|
"access.form.ssh_group.label": "Authorization Configuration Group (used to deploy a single domain certificate to multiple SSH hosts)",
|
||||||
"access.authorization.form.username.placeholder": "Please enter username",
|
"access.form.ssh_host.label": "Server Host",
|
||||||
"access.authorization.form.password.label": "Password",
|
"access.form.ssh_host.placeholder": "Please enter Host",
|
||||||
"access.authorization.form.password.placeholder": "Please enter password",
|
"access.form.ssh_port.label": "SSH Port",
|
||||||
"access.authorization.form.access_group.placeholder": "Please select a group",
|
"access.form.ssh_port.placeholder": "Please enter Port",
|
||||||
"access.authorization.form.ssh_group.label": "Authorization Configuration Group (used to deploy a single domain certificate to multiple SSH hosts)",
|
"access.form.ssh_username.label": "Username",
|
||||||
"access.authorization.form.ssh_host.label": "Server Host",
|
"access.form.ssh_username.placeholder": "Please enter username",
|
||||||
"access.authorization.form.ssh_host.placeholder": "Please enter Host",
|
"access.form.ssh_password.label": "Password (Log-in using password)",
|
||||||
"access.authorization.form.ssh_port.label": "SSH Port",
|
"access.form.ssh_password.placeholder": "Please enter password",
|
||||||
"access.authorization.form.ssh_port.placeholder": "Please enter Port",
|
"access.form.ssh_key.label": "Key (Log-in using private key)",
|
||||||
"access.authorization.form.ssh_username.label": "Username",
|
"access.form.ssh_key.placeholder": "Please enter Key",
|
||||||
"access.authorization.form.ssh_username.placeholder": "Please enter username",
|
"access.form.ssh_key_file.placeholder": "Please select file",
|
||||||
"access.authorization.form.ssh_password.label": "Password (Log-in using password)",
|
"access.form.ssh_key_passphrase.label": "Key Passphrase (Log-in using private key)",
|
||||||
"access.authorization.form.ssh_password.placeholder": "Please enter password",
|
"access.form.ssh_key_passphrase.placeholder": "Please enter Key Passphrase",
|
||||||
"access.authorization.form.ssh_key.label": "Key (Log-in using private key)",
|
"access.form.webhook_url.label": "Webhook URL",
|
||||||
"access.authorization.form.ssh_key.placeholder": "Please enter Key",
|
"access.form.webhook_url.placeholder": "Please enter Webhook URL",
|
||||||
"access.authorization.form.ssh_key_file.placeholder": "Please select file",
|
"access.form.k8s_kubeconfig.label": "KubeConfig (Null will use pod's ServiceAccount)",
|
||||||
"access.authorization.form.ssh_key_passphrase.label": "Key Passphrase (Log-in using private key)",
|
"access.form.k8s_kubeconfig.placeholder": "Please enter KubeConfig",
|
||||||
"access.authorization.form.ssh_key_passphrase.placeholder": "Please enter Key Passphrase",
|
"access.form.k8s_kubeconfig_file.placeholder": "Please select file (Null will use pod's ServiceAccount)"
|
||||||
"access.authorization.form.webhook_url.label": "Webhook URL",
|
|
||||||
"access.authorization.form.webhook_url.placeholder": "Please enter Webhook URL",
|
|
||||||
"access.authorization.form.k8s_kubeconfig.label": "KubeConfig (Null will use pod's ServiceAccount)",
|
|
||||||
"access.authorization.form.k8s_kubeconfig.placeholder": "Please enter KubeConfig",
|
|
||||||
"access.authorization.form.k8s_kubeconfig_file.placeholder": "Please select file (Null will use pod's ServiceAccount)"
|
|
||||||
}
|
}
|
||||||
|
@ -51,27 +51,27 @@
|
|||||||
"common.provider.aliyun.clb": "Alibaba Cloud - CLB",
|
"common.provider.aliyun.clb": "Alibaba Cloud - CLB",
|
||||||
"common.provider.aliyun.alb": "Alibaba Cloud - ALB",
|
"common.provider.aliyun.alb": "Alibaba Cloud - ALB",
|
||||||
"common.provider.aliyun.nlb": "Alibaba Cloud - NLB",
|
"common.provider.aliyun.nlb": "Alibaba Cloud - NLB",
|
||||||
"common.provider.tencent": "Tencent Cloud",
|
"common.provider.tencentcloud": "Tencent Cloud",
|
||||||
"common.provider.tencent.cdn": "Tencent Cloud - CDN",
|
"common.provider.tencentcloud.cdn": "Tencent Cloud - CDN",
|
||||||
"common.provider.tencent.ecdn": "Tencent Cloud - ECDN",
|
"common.provider.tencentcloud.ecdn": "Tencent Cloud - ECDN",
|
||||||
"common.provider.tencent.clb": "Tencent Cloud - CLB",
|
"common.provider.tencentcloud.clb": "Tencent Cloud - CLB",
|
||||||
"common.provider.tencent.cos": "Tencent Cloud - COS",
|
"common.provider.tencentcloud.cos": "Tencent Cloud - COS",
|
||||||
"common.provider.tencent.teo": "Tencent Cloud - EdgeOne",
|
"common.provider.tencentcloud.eo": "Tencent Cloud - EdgeOne",
|
||||||
"common.provider.huaweicloud": "Huawei Cloud",
|
"common.provider.huaweicloud": "Huawei Cloud",
|
||||||
"common.provider.huaweicloud.cdn": "Huawei Cloud - CDN",
|
"common.provider.huaweicloud.cdn": "Huawei Cloud - CDN",
|
||||||
"common.provider.huaweicloud.elb": "Huawei Cloud - ELB",
|
"common.provider.huaweicloud.elb": "Huawei Cloud - ELB",
|
||||||
"common.provider.baiducloud": "Baidu Cloud",
|
"common.provider.baiducloud": "Baidu Cloud",
|
||||||
"common.provider.baiducloud.cdn": "Baidu Cloud - CDN",
|
"common.provider.baiducloud.cdn": "Baidu Cloud - CDN",
|
||||||
"common.provider.qiniu": "Qiniu Cloud",
|
"common.provider.qiniu": "Qiniu",
|
||||||
"common.provider.qiniu.cdn": "Qiniu Cloud - CDN",
|
"common.provider.qiniu.cdn": "Qiniu - CDN",
|
||||||
"common.provider.dogecloud": "Doge Cloud",
|
"common.provider.dogecloud": "Doge Cloud",
|
||||||
"common.provider.dogecloud.cdn": "Doge Cloud - CDN",
|
"common.provider.dogecloud.cdn": "Doge Cloud - CDN",
|
||||||
"common.provider.aws": "AWS",
|
"common.provider.aws": "AWS",
|
||||||
"common.provider.cloudflare": "Cloudflare",
|
"common.provider.cloudflare": "Cloudflare",
|
||||||
"common.provider.namesilo": "Namesilo",
|
"common.provider.namesilo": "Namesilo",
|
||||||
"common.provider.godaddy": "GoDaddy",
|
"common.provider.godaddy": "GoDaddy",
|
||||||
"common.provider.pdns": "PowerDNS",
|
"common.provider.powerdns": "PowerDNS",
|
||||||
"common.provider.httpreq": "Http Request",
|
"common.provider.acmehttpreq": "Http Request (ACME Proxy)",
|
||||||
"common.provider.local": "Local Deployment",
|
"common.provider.local": "Local Deployment",
|
||||||
"common.provider.ssh": "SSH Deployment",
|
"common.provider.ssh": "SSH Deployment",
|
||||||
"common.provider.webhook": "Webhook",
|
"common.provider.webhook": "Webhook",
|
||||||
|
@ -10,73 +10,68 @@
|
|||||||
"access.action.delete.confirm": "确定要删除此授权吗?",
|
"access.action.delete.confirm": "确定要删除此授权吗?",
|
||||||
|
|
||||||
"access.props.name": "名称",
|
"access.props.name": "名称",
|
||||||
"access.props.provider": "服务商",
|
"access.props.provider": "提供商",
|
||||||
"access.props.provider.usage.dns": "DNS 服务商",
|
"access.props.provider.usage.dns": "DNS 提供商",
|
||||||
"access.props.provider.usage.host": "主机服务商",
|
"access.props.provider.usage.host": "主机提供商",
|
||||||
"access.props.created_at": "创建时间",
|
"access.props.created_at": "创建时间",
|
||||||
"access.props.updated_at": "更新时间",
|
"access.props.updated_at": "更新时间",
|
||||||
|
|
||||||
"access.authorization.form.type.label": "服务商",
|
"access.form.name.label": "名称",
|
||||||
"access.authorization.form.type.placeholder": "请选择服务商",
|
"access.form.name.placeholder": "请输入授权名称",
|
||||||
"access.authorization.form.type.search.notfound": "未找到服务商",
|
"access.form.type.label": "提供商",
|
||||||
"access.authorization.form.type.list": "服务商列表",
|
"access.form.type.placeholder": "请选择提供商",
|
||||||
"access.authorization.form.name.label": "名称",
|
"access.form.region.label": "Region",
|
||||||
"access.authorization.form.name.placeholder": "请输入授权名称",
|
"access.form.region.placeholder": "请输入区域",
|
||||||
"access.authorization.form.config.label": "配置类型",
|
"access.form.access_key_id.label": "AccessKeyId",
|
||||||
"access.authorization.form.region.label": "Region",
|
"access.form.access_key_id.placeholder": "请输入 AccessKeyId",
|
||||||
"access.authorization.form.region.placeholder": "请输入区域",
|
"access.form.access_key_secret.label": "AccessKeySecret",
|
||||||
"access.authorization.form.access_key_id.label": "AccessKeyId",
|
"access.form.access_key_secret.placeholder": "请输入 AccessKeySecret",
|
||||||
"access.authorization.form.access_key_id.placeholder": "请输入 AccessKeyId",
|
"access.form.access_key.label": "AccessKey",
|
||||||
"access.authorization.form.access_key_secret.label": "AccessKeySecret",
|
"access.form.access_key.placeholder": "请输入 AccessKey",
|
||||||
"access.authorization.form.access_key_secret.placeholder": "请输入 AccessKeySecret",
|
"access.form.secret_id.label": "SecretId",
|
||||||
"access.authorization.form.access_key.label": "AccessKey",
|
"access.form.secret_id.placeholder": "请输入 SecretId",
|
||||||
"access.authorization.form.access_key.placeholder": "请输入 AccessKey",
|
"access.form.secret_key.label": "SecretKey",
|
||||||
"access.authorization.form.secret_id.label": "SecretId",
|
"access.form.secret_key.placeholder": "请输入 SecretKey",
|
||||||
"access.authorization.form.secret_id.placeholder": "请输入 SecretId",
|
"access.form.secret_access_key.label": "SecretAccessKey",
|
||||||
"access.authorization.form.secret_key.label": "SecretKey",
|
"access.form.secret_access_key.placeholder": "请输入 SecretAccessKey",
|
||||||
"access.authorization.form.secret_key.placeholder": "请输入 SecretKey",
|
"access.form.cloud_dns_api_token.label": "CLOUD_DNS_API_TOKEN",
|
||||||
"access.authorization.form.secret_access_key.label": "SecretAccessKey",
|
"access.form.cloud_dns_api_token.placeholder": "请输入 CLOUD_DNS_API_TOKEN",
|
||||||
"access.authorization.form.secret_access_key.placeholder": "请输入 SecretAccessKey",
|
"access.form.godaddy_api_key.label": "GO_DADDY_API_KEY",
|
||||||
"access.authorization.form.aws_hosted_zone_id.label": "AWS 托管区域 ID",
|
"access.form.godaddy_api_key.placeholder": "请输入 GO_DADDY_API_KEY",
|
||||||
"access.authorization.form.aws_hosted_zone_id.placeholder": "请输入 AWS Hosted Zone ID",
|
"access.form.godaddy_api_secret.label": "GO_DADDY_API_SECRET",
|
||||||
"access.authorization.form.cloud_dns_api_token.label": "CLOUD_DNS_API_TOKEN",
|
"access.form.godaddy_api_secret.placeholder": "请输入 GO_DADDY_API_SECRET",
|
||||||
"access.authorization.form.cloud_dns_api_token.placeholder": "请输入 CLOUD_DNS_API_TOKEN",
|
"access.form.namesilo_api_key.label": "NAMESILO_API_KEY",
|
||||||
"access.authorization.form.godaddy_api_key.label": "GO_DADDY_API_KEY",
|
"access.form.namesilo_api_key.placeholder": "请输入 NAMESILO_API_KEY",
|
||||||
"access.authorization.form.godaddy_api_key.placeholder": "请输入 GO_DADDY_API_KEY",
|
"access.form.pdns_api_url.label": "PDNS_API_URL",
|
||||||
"access.authorization.form.godaddy_api_secret.label": "GO_DADDY_API_SECRET",
|
"access.form.pdns_api_url.placeholder": "请输入 PDNS_API_URL",
|
||||||
"access.authorization.form.godaddy_api_secret.placeholder": "请输入 GO_DADDY_API_SECRET",
|
"access.form.pdns_api_key.label": "PDNS_API_KEY",
|
||||||
"access.authorization.form.namesilo_api_key.label": "NAMESILO_API_KEY",
|
"access.form.pdns_api_key.placeholder": "请输入 PDNS_API_KEY",
|
||||||
"access.authorization.form.namesilo_api_key.placeholder": "请输入 NAMESILO_API_KEY",
|
"access.form.httpreq_endpoint.label": "HTTP 请求端点",
|
||||||
"access.authorization.form.pdns_api_url.label": "PDNS_API_URL",
|
"access.form.httpreq_endpoint.placeholder": "请输入 请求端点",
|
||||||
"access.authorization.form.pdns_api_url.placeholder": "请输入 PDNS_API_URL",
|
"access.form.httpreq_mode.label": "模式",
|
||||||
"access.authorization.form.pdns_api_key.label": "PDNS_API_KEY",
|
"access.form.httpreq_mode.placeholder": "请输入模式( RAW or '')",
|
||||||
"access.authorization.form.pdns_api_key.placeholder": "请输入 PDNS_API_KEY",
|
"access.form.username.label": "用户名",
|
||||||
"access.authorization.form.httpreq_endpoint.label": "HTTP 请求端点",
|
"access.form.username.placeholder": "请输入用户名",
|
||||||
"access.authorization.form.httpreq_endpoint.placeholder": "请输入 请求端点",
|
"access.form.password.label": "密码",
|
||||||
"access.authorization.form.httpreq_mode.label": "模式",
|
"access.form.password.placeholder": "请输入密码",
|
||||||
"access.authorization.form.httpreq_mode.placeholder": "请输入模式( RAW or '')",
|
"access.form.access_group.placeholder": "请选择分组",
|
||||||
"access.authorization.form.username.label": "用户名",
|
"access.form.ssh_group.label": "授权配置组(用于将一个域名证书部署到多个 SSH 主机)",
|
||||||
"access.authorization.form.username.placeholder": "请输入用户名",
|
"access.form.ssh_host.label": "服务器 Host",
|
||||||
"access.authorization.form.password.label": "密码",
|
"access.form.ssh_host.placeholder": "请输入 Host",
|
||||||
"access.authorization.form.password.placeholder": "请输入密码",
|
"access.form.ssh_port.label": "SSH 端口",
|
||||||
"access.authorization.form.access_group.placeholder": "请选择分组",
|
"access.form.ssh_port.placeholder": "请输入 Port",
|
||||||
"access.authorization.form.ssh_group.label": "授权配置组(用于将一个域名证书部署到多个 SSH 主机)",
|
"access.form.ssh_username.label": "用户名",
|
||||||
"access.authorization.form.ssh_host.label": "服务器 Host",
|
"access.form.ssh_username.placeholder": "请输入用户名",
|
||||||
"access.authorization.form.ssh_host.placeholder": "请输入 Host",
|
"access.form.ssh_password.label": "密码(使用密码登录)",
|
||||||
"access.authorization.form.ssh_port.label": "SSH 端口",
|
"access.form.ssh_password.placeholder": "请输入密码",
|
||||||
"access.authorization.form.ssh_port.placeholder": "请输入 Port",
|
"access.form.ssh_key.label": "Key(使用私钥登录)",
|
||||||
"access.authorization.form.ssh_username.label": "用户名",
|
"access.form.ssh_key.placeholder": "请输入 Key",
|
||||||
"access.authorization.form.ssh_username.placeholder": "请输入用户名",
|
"access.form.ssh_key_file.placeholder": "请选择文件",
|
||||||
"access.authorization.form.ssh_password.label": "密码(使用密码登录)",
|
"access.form.ssh_key_passphrase.label": "Key 口令(使用私钥登录)",
|
||||||
"access.authorization.form.ssh_password.placeholder": "请输入密码",
|
"access.form.ssh_key_passphrase.placeholder": "请输入 Key 口令",
|
||||||
"access.authorization.form.ssh_key.label": "Key(使用私钥登录)",
|
"access.form.webhook_url.label": "Webhook URL",
|
||||||
"access.authorization.form.ssh_key.placeholder": "请输入 Key",
|
"access.form.webhook_url.placeholder": "请输入 Webhook URL",
|
||||||
"access.authorization.form.ssh_key_file.placeholder": "请选择文件",
|
"access.form.k8s_kubeconfig.label": "KubeConfig(不选将使用Pod的ServiceAccount)",
|
||||||
"access.authorization.form.ssh_key_passphrase.label": "Key 口令(使用私钥登录)",
|
"access.form.k8s_kubeconfig.placeholder": "请输入 KubeConfig",
|
||||||
"access.authorization.form.ssh_key_passphrase.placeholder": "请输入 Key 口令",
|
"access.form.k8s_kubeconfig_file.placeholder": "请选择文件"
|
||||||
"access.authorization.form.webhook_url.label": "Webhook URL",
|
|
||||||
"access.authorization.form.webhook_url.placeholder": "请输入 Webhook URL",
|
|
||||||
"access.authorization.form.k8s_kubeconfig.label": "KubeConfig(不选将使用Pod的ServiceAccount)",
|
|
||||||
"access.authorization.form.k8s_kubeconfig.placeholder": "请输入 KubeConfig",
|
|
||||||
"access.authorization.form.k8s_kubeconfig_file.placeholder": "请选择文件"
|
|
||||||
}
|
}
|
||||||
|
@ -51,12 +51,12 @@
|
|||||||
"common.provider.aliyun.clb": "阿里云 - 传统型负载均衡 CLB",
|
"common.provider.aliyun.clb": "阿里云 - 传统型负载均衡 CLB",
|
||||||
"common.provider.aliyun.alb": "阿里云 - 应用型负载均衡 ALB",
|
"common.provider.aliyun.alb": "阿里云 - 应用型负载均衡 ALB",
|
||||||
"common.provider.aliyun.nlb": "阿里云 - 网络型负载均衡 NLB",
|
"common.provider.aliyun.nlb": "阿里云 - 网络型负载均衡 NLB",
|
||||||
"common.provider.tencent": "腾讯云",
|
"common.provider.tencentcloud": "腾讯云",
|
||||||
"common.provider.tencent.cos": "腾讯云 - 对象存储 COS",
|
"common.provider.tencentcloud.cos": "腾讯云 - 对象存储 COS",
|
||||||
"common.provider.tencent.cdn": "腾讯云 - 内容分发网络 CDN",
|
"common.provider.tencentcloud.cdn": "腾讯云 - 内容分发网络 CDN",
|
||||||
"common.provider.tencent.ecdn": "腾讯云 - 全站加速网络 ECDN",
|
"common.provider.tencentcloud.ecdn": "腾讯云 - 全站加速网络 ECDN",
|
||||||
"common.provider.tencent.clb": "腾讯云 - 负载均衡 CLB",
|
"common.provider.tencentcloud.clb": "腾讯云 - 负载均衡 CLB",
|
||||||
"common.provider.tencent.teo": "腾讯云 - 边缘安全加速平台 EdgeOne",
|
"common.provider.tencentcloud.eo": "腾讯云 - 边缘安全加速平台 EdgeOne",
|
||||||
"common.provider.huaweicloud": "华为云",
|
"common.provider.huaweicloud": "华为云",
|
||||||
"common.provider.huaweicloud.cdn": "华为云 - 内容分发网络 CDN",
|
"common.provider.huaweicloud.cdn": "华为云 - 内容分发网络 CDN",
|
||||||
"common.provider.huaweicloud.elb": "华为云 - 弹性负载均衡 ELB",
|
"common.provider.huaweicloud.elb": "华为云 - 弹性负载均衡 ELB",
|
||||||
@ -70,8 +70,8 @@
|
|||||||
"common.provider.cloudflare": "Cloudflare",
|
"common.provider.cloudflare": "Cloudflare",
|
||||||
"common.provider.namesilo": "Namesilo",
|
"common.provider.namesilo": "Namesilo",
|
||||||
"common.provider.godaddy": "GoDaddy",
|
"common.provider.godaddy": "GoDaddy",
|
||||||
"common.provider.pdns": "PowerDNS",
|
"common.provider.powerdns": "PowerDNS",
|
||||||
"common.provider.httpreq": "Http Request",
|
"common.provider.acmehttpreq": "Http Request (ACME Proxy)",
|
||||||
"common.provider.local": "本地部署",
|
"common.provider.local": "本地部署",
|
||||||
"common.provider.ssh": "SSH 部署",
|
"common.provider.ssh": "SSH 部署",
|
||||||
"common.provider.webhook": "Webhook",
|
"common.provider.webhook": "Webhook",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user