diff --git a/go.mod b/go.mod
index c9cdb902..7e824cad 100644
--- a/go.mod
+++ b/go.mod
@@ -108,6 +108,7 @@ require (
github.com/mailru/easyjson v0.9.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04 // indirect
+ github.com/nrdcg/bunny-go v0.0.0-20240207213615-dde5bf4577a3 // indirect
github.com/nrdcg/desec v0.10.0 // indirect
github.com/nrdcg/mailinabox v0.2.0 // indirect
github.com/nrdcg/porkbun v0.4.0 // indirect
diff --git a/go.sum b/go.sum
index f7267783..a5cf6ac3 100644
--- a/go.sum
+++ b/go.sum
@@ -651,6 +651,8 @@ github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJm
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nikoksr/notify v1.3.0 h1:UxzfxzAYGQD9a5JYLBTVx0lFMxeHCke3rPCkfWdPgLs=
github.com/nikoksr/notify v1.3.0/go.mod h1:Xor2hMmkvrCfkCKvXGbcrESez4brac2zQjhd6U2BbeM=
+github.com/nrdcg/bunny-go v0.0.0-20240207213615-dde5bf4577a3 h1:ouZ2JWDl8IW5k1qugYbmpbmW8hn85Ig6buSMBRlz3KI=
+github.com/nrdcg/bunny-go v0.0.0-20240207213615-dde5bf4577a3/go.mod h1:ZwadWt7mVhMHMbAQ1w8IhDqtWO3eWqWq72W7trnaiE8=
github.com/nrdcg/desec v0.10.0 h1:qrEDiqnsvNU9QE7lXIXi/tIHAfyaFXKxF2/8/52O8uM=
github.com/nrdcg/desec v0.10.0/go.mod h1:5+4vyhMRTs49V9CNoODF/HwT8Mwxv9DJ6j+7NekUnBs=
github.com/nrdcg/mailinabox v0.2.0 h1:IKq8mfKiVwNW2hQii/ng1dJ4yYMMv3HAP3fMFIq2CFk=
diff --git a/internal/applicant/providers.go b/internal/applicant/providers.go
index 74a12678..ddecad7c 100644
--- a/internal/applicant/providers.go
+++ b/internal/applicant/providers.go
@@ -11,6 +11,7 @@ import (
pAWSRoute53 "github.com/usual2970/certimate/internal/pkg/core/applicant/acme-dns-01/lego-providers/aws-route53"
pAzureDNS "github.com/usual2970/certimate/internal/pkg/core/applicant/acme-dns-01/lego-providers/azure-dns"
pBaiduCloud "github.com/usual2970/certimate/internal/pkg/core/applicant/acme-dns-01/lego-providers/baiducloud"
+ pBunny "github.com/usual2970/certimate/internal/pkg/core/applicant/acme-dns-01/lego-providers/bunny"
pCloudflare "github.com/usual2970/certimate/internal/pkg/core/applicant/acme-dns-01/lego-providers/cloudflare"
pClouDNS "github.com/usual2970/certimate/internal/pkg/core/applicant/acme-dns-01/lego-providers/cloudns"
pCMCCCloud "github.com/usual2970/certimate/internal/pkg/core/applicant/acme-dns-01/lego-providers/cmcccloud"
@@ -128,6 +129,21 @@ func createApplicant(options *applicantOptions) (challenge.Provider, error) {
return applicant, err
}
+ case domain.ApplyDNSProviderTypeBunny:
+ {
+ access := domain.AccessConfigForBunny{}
+ if err := maputil.Populate(options.ProviderAccessConfig, &access); err != nil {
+ return nil, fmt.Errorf("failed to populate provider access config: %w", err)
+ }
+
+ applicant, err := pBunny.NewChallengeProvider(&pBunny.ChallengeProviderConfig{
+ ApiKey: access.ApiKey,
+ DnsPropagationTimeout: options.DnsPropagationTimeout,
+ DnsTTL: options.DnsTTL,
+ })
+ return applicant, err
+ }
+
case domain.ApplyDNSProviderTypeCloudflare:
{
access := domain.AccessConfigForCloudflare{}
diff --git a/internal/deployer/providers.go b/internal/deployer/providers.go
index c2136d20..cbe52426 100644
--- a/internal/deployer/providers.go
+++ b/internal/deployer/providers.go
@@ -31,6 +31,7 @@ import (
pBaishanCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/baishan-cdn"
pBaotaPanelConsole "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/baotapanel-console"
pBaotaPanelSite "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/baotapanel-site"
+ pBunnyCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/bunny-cdn"
pBytePlusCDN "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/byteplus-cdn"
pCacheFly "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/cachefly"
pCdnfly "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/cdnfly"
@@ -416,6 +417,21 @@ func createDeployer(options *deployerOptions) (deployer.Deployer, error) {
}
}
+ case domain.DeployProviderTypeBunnyCDN:
+ {
+ access := domain.AccessConfigForBunny{}
+ if err := maputil.Populate(options.ProviderAccessConfig, &access); err != nil {
+ return nil, fmt.Errorf("failed to populate provider access config: %w", err)
+ }
+
+ deployer, err := pBunnyCDN.NewDeployer(&pBunnyCDN.DeployerConfig{
+ ApiKey: access.ApiKey,
+ PullZoneId: maputil.GetString(options.ProviderDeployConfig, "pullZoneId"),
+ HostName: maputil.GetString(options.ProviderDeployConfig, "hostName"),
+ })
+ return deployer, err
+ }
+
case domain.DeployProviderTypeBytePlusCDN:
{
access := domain.AccessConfigForBytePlus{}
diff --git a/internal/domain/access.go b/internal/domain/access.go
index 9e419eaa..0571eb84 100644
--- a/internal/domain/access.go
+++ b/internal/domain/access.go
@@ -64,6 +64,10 @@ type AccessConfigForBytePlus struct {
SecretKey string `json:"secretKey"`
}
+type AccessConfigForBunny struct {
+ ApiKey string `json:"apiKey"`
+}
+
type AccessConfigForCacheFly struct {
ApiToken string `json:"apiToken"`
}
diff --git a/internal/domain/provider.go b/internal/domain/provider.go
index 668612f7..4abaca96 100644
--- a/internal/domain/provider.go
+++ b/internal/domain/provider.go
@@ -104,6 +104,7 @@ const (
ApplyDNSProviderTypeAzureDNS = ApplyDNSProviderType("azure-dns")
ApplyDNSProviderTypeBaiduCloud = ApplyDNSProviderType("baiducloud") // 兼容旧值,等同于 [ApplyDNSProviderTypeBaiduCloudDNS]
ApplyDNSProviderTypeBaiduCloudDNS = ApplyDNSProviderType("baiducloud-dns")
+ ApplyDNSProviderTypeBunny = ApplyDNSProviderType("bunny")
ApplyDNSProviderTypeCloudflare = ApplyDNSProviderType("cloudflare")
ApplyDNSProviderTypeClouDNS = ApplyDNSProviderType("cloudns")
ApplyDNSProviderTypeCMCCCloud = ApplyDNSProviderType("cmcccloud")
@@ -168,6 +169,7 @@ const (
DeployProviderTypeBaishanCDN = DeployProviderType("baishan-cdn")
DeployProviderTypeBaotaPanelConsole = DeployProviderType("baotapanel-console")
DeployProviderTypeBaotaPanelSite = DeployProviderType("baotapanel-site")
+ DeployProviderTypeBunnyCDN = DeployProviderType("bunny-cdn")
DeployProviderTypeBytePlusCDN = DeployProviderType("byteplus-cdn")
DeployProviderTypeCacheFly = DeployProviderType("cachefly")
DeployProviderTypeCdnfly = DeployProviderType("cdnfly")
diff --git a/internal/pkg/core/applicant/acme-dns-01/lego-providers/bunny/bunny.go b/internal/pkg/core/applicant/acme-dns-01/lego-providers/bunny/bunny.go
new file mode 100644
index 00000000..558f7773
--- /dev/null
+++ b/internal/pkg/core/applicant/acme-dns-01/lego-providers/bunny/bunny.go
@@ -0,0 +1,36 @@
+package bunny
+
+import (
+ "time"
+
+ "github.com/go-acme/lego/v4/challenge"
+ "github.com/go-acme/lego/v4/providers/dns/bunny"
+)
+
+type ChallengeProviderConfig struct {
+ ApiKey string `json:"apiKey"`
+ DnsPropagationTimeout int32 `json:"dnsPropagationTimeout,omitempty"`
+ DnsTTL int32 `json:"dnsTTL,omitempty"`
+}
+
+func NewChallengeProvider(config *ChallengeProviderConfig) (challenge.Provider, error) {
+ if config == nil {
+ panic("config is nil")
+ }
+
+ providerConfig := bunny.NewDefaultConfig()
+ providerConfig.APIKey = config.ApiKey
+ if config.DnsPropagationTimeout != 0 {
+ providerConfig.PropagationTimeout = time.Duration(config.DnsPropagationTimeout) * time.Second
+ }
+ if config.DnsTTL != 0 {
+ providerConfig.TTL = int(config.DnsTTL)
+ }
+
+ provider, err := bunny.NewDNSProviderConfig(providerConfig)
+ if err != nil {
+ return nil, err
+ }
+
+ return provider, nil
+}
diff --git a/internal/pkg/core/deployer/providers/bunny-cdn/bunny_cdn.go b/internal/pkg/core/deployer/providers/bunny-cdn/bunny_cdn.go
new file mode 100644
index 00000000..bcf22635
--- /dev/null
+++ b/internal/pkg/core/deployer/providers/bunny-cdn/bunny_cdn.go
@@ -0,0 +1,70 @@
+package bunnycdn
+
+import (
+ "context"
+ "encoding/base64"
+ "log/slog"
+
+ xerrors "github.com/pkg/errors"
+
+ "github.com/usual2970/certimate/internal/pkg/core/deployer"
+ bunnysdk "github.com/usual2970/certimate/internal/pkg/vendors/bunny-sdk"
+)
+
+type DeployerConfig struct {
+ // Bunny API Key
+ ApiKey string `json:"apiKey"`
+ // Bunny Pull Zone ID
+ PullZoneId string `json:"pullZoneId"`
+ // Bunny CDN Hostname(支持泛域名)
+ HostName string `json:"hostName"`
+}
+
+type DeployerProvider struct {
+ config *DeployerConfig
+ logger *slog.Logger
+ sdkClient *bunnysdk.Client
+}
+
+var _ deployer.Deployer = (*DeployerProvider)(nil)
+
+func NewDeployer(config *DeployerConfig) (*DeployerProvider, error) {
+ if config == nil {
+ panic("config is nil")
+ }
+
+ return &DeployerProvider{
+ config: config,
+ logger: slog.Default(),
+ sdkClient: bunnysdk.NewClient(config.ApiKey),
+ }, nil
+}
+
+func (d *DeployerProvider) WithLogger(logger *slog.Logger) deployer.Deployer {
+ if logger == nil {
+ d.logger = slog.Default()
+ } else {
+ d.logger = logger
+ }
+ return d
+}
+
+func (d *DeployerProvider) Deploy(ctx context.Context, certPem string, privkeyPem string) (*deployer.DeployResult, error) {
+ // Prepare
+ certPemBase64 := base64.StdEncoding.EncodeToString([]byte(certPem))
+ privkeyPemBase64 := base64.StdEncoding.EncodeToString([]byte(privkeyPem))
+ // 上传证书
+ createCertificateReq := &bunnysdk.AddCustomCertificateRequest{
+ Hostname: d.config.HostName,
+ PullZoneId: d.config.PullZoneId,
+ Certificate: certPemBase64,
+ CertificateKey: privkeyPemBase64,
+ }
+ createCertificateResp, err := d.sdkClient.AddCustomCertificate(createCertificateReq)
+ d.logger.Debug("sdk request 'bunny-cdn.AddCustomCertificate'", slog.Any("request", createCertificateReq), slog.Any("response", createCertificateResp))
+ if err != nil {
+ return nil, xerrors.Wrap(err, "failed to execute sdk request 'bunny-cdn.AddCustomCertificate'")
+ }
+
+ return &deployer.DeployResult{}, nil
+}
diff --git a/internal/pkg/core/deployer/providers/bunny-cdn/bunny_cdn_test.go b/internal/pkg/core/deployer/providers/bunny-cdn/bunny_cdn_test.go
new file mode 100644
index 00000000..e4e54a20
--- /dev/null
+++ b/internal/pkg/core/deployer/providers/bunny-cdn/bunny_cdn_test.go
@@ -0,0 +1,75 @@
+package bunnycdn_test
+
+import (
+ "context"
+ "flag"
+ "fmt"
+ "os"
+ "strings"
+ "testing"
+
+ provider "github.com/usual2970/certimate/internal/pkg/core/deployer/providers/bunny-cdn"
+)
+
+var (
+ fInputCertPath string
+ fInputKeyPath string
+ fApiKey string
+ fPullZoneId string
+ fHostName string
+)
+
+func init() {
+ argsPrefix := "CERTIMATE_DEPLOYER_BUNNYCDN_"
+
+ flag.StringVar(&fInputCertPath, argsPrefix+"INPUTCERTPATH", "", "")
+ flag.StringVar(&fInputKeyPath, argsPrefix+"INPUTKEYPATH", "", "")
+ flag.StringVar(&fApiKey, argsPrefix+"APIKEY", "", "")
+ flag.StringVar(&fPullZoneId, argsPrefix+"PULLZONEID", "", "")
+ flag.StringVar(&fHostName, argsPrefix+"HOSTNAME", "", "")
+}
+
+/*
+Shell command to run this test:
+
+ go test -v ./bunny_cdn_test.go -args \
+ --CERTIMATE_DEPLOYER_BUNNYCDN_INPUTCERTPATH="/path/to/your-input-cert.pem" \
+ --CERTIMATE_DEPLOYER_BUNNYCDN_INPUTKEYPATH="/path/to/your-input-key.pem" \
+ --CERTIMATE_DEPLOYER_BUNNYCDN_APITOKEN="your-api-token" \
+ --CERTIMATE_DEPLOYER_BUNNYCDN_PULLZONEID="your-pull-zone-id" \
+ --CERTIMATE_DEPLOYER_BUNNYCDN_HOSTNAME="example.com"
+*/
+func TestDeploy(t *testing.T) {
+ flag.Parse()
+
+ t.Run("Deploy", func(t *testing.T) {
+ t.Log(strings.Join([]string{
+ "args:",
+ fmt.Sprintf("INPUTCERTPATH: %v", fInputCertPath),
+ fmt.Sprintf("INPUTKEYPATH: %v", fInputKeyPath),
+ fmt.Sprintf("APIKEY: %v", fApiKey),
+ fmt.Sprintf("PULLZONEID: %v", fPullZoneId),
+ fmt.Sprintf("HOSTNAME: %v", fHostName),
+ }, "\n"))
+
+ deployer, err := provider.NewDeployer(&provider.DeployerConfig{
+ ApiKey: fApiKey,
+ PullZoneId: fPullZoneId,
+ HostName: fHostName,
+ })
+ if err != nil {
+ t.Errorf("err: %+v", err)
+ return
+ }
+
+ fInputCertData, _ := os.ReadFile(fInputCertPath)
+ fInputKeyData, _ := os.ReadFile(fInputKeyPath)
+ res, err := deployer.Deploy(context.Background(), string(fInputCertData), string(fInputKeyData))
+ if err != nil {
+ t.Errorf("err: %+v", err)
+ return
+ }
+
+ t.Logf("ok: %v", res)
+ })
+}
diff --git a/internal/pkg/vendors/bunny-sdk/api.go b/internal/pkg/vendors/bunny-sdk/api.go
new file mode 100644
index 00000000..8cff90b4
--- /dev/null
+++ b/internal/pkg/vendors/bunny-sdk/api.go
@@ -0,0 +1,11 @@
+package bunnysdk
+
+import (
+ "fmt"
+ "net/http"
+)
+
+func (c *Client) AddCustomCertificate(req *AddCustomCertificateRequest) ([]byte, error) {
+ resp, err := c.sendRequest(http.MethodPost, fmt.Sprintf("/pullzone/%s/addCertificate", req.PullZoneId), req)
+ return resp.Body(), err
+}
diff --git a/internal/pkg/vendors/bunny-sdk/client.go b/internal/pkg/vendors/bunny-sdk/client.go
new file mode 100644
index 00000000..398d5cb2
--- /dev/null
+++ b/internal/pkg/vendors/bunny-sdk/client.go
@@ -0,0 +1,66 @@
+package bunnysdk
+
+import (
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "strings"
+ "time"
+
+ "github.com/go-resty/resty/v2"
+)
+
+type Client struct {
+ apiToken string
+
+ client *resty.Client
+}
+
+func NewClient(apiToken string) *Client {
+ client := resty.New()
+
+ return &Client{
+ apiToken: apiToken,
+ client: client,
+ }
+}
+
+func (c *Client) WithTimeout(timeout time.Duration) *Client {
+ c.client.SetTimeout(timeout)
+ return c
+}
+
+func (c *Client) sendRequest(method string, path string, params interface{}) (*resty.Response, error) {
+ req := c.client.R()
+ req.Method = method
+ req.URL = "https://api.bunny.net" + path
+ req = req.SetHeader("AccessKey", c.apiToken)
+ if strings.EqualFold(method, http.MethodGet) {
+ qs := make(map[string]string)
+ if params != nil {
+ temp := make(map[string]any)
+ jsonb, _ := json.Marshal(params)
+ json.Unmarshal(jsonb, &temp)
+ for k, v := range temp {
+ if v != nil {
+ qs[k] = fmt.Sprintf("%v", v)
+ }
+ }
+ }
+
+ req = req.SetQueryParams(qs)
+ } else {
+ req = req.
+ SetHeader("Content-Type", "application/json").
+ SetBody(params)
+ }
+
+ resp, err := req.Send()
+ if err != nil {
+ return resp, fmt.Errorf("bunny api error: failed to send request: %w", err)
+ } else if resp.IsError() {
+ return resp, fmt.Errorf("bunny api error: unexpected status code: %d, %s", resp.StatusCode(), resp.Body())
+ }
+
+ return resp, nil
+}
diff --git a/internal/pkg/vendors/bunny-sdk/models.go b/internal/pkg/vendors/bunny-sdk/models.go
new file mode 100644
index 00000000..3306cf5b
--- /dev/null
+++ b/internal/pkg/vendors/bunny-sdk/models.go
@@ -0,0 +1,8 @@
+package bunnysdk
+
+type AddCustomCertificateRequest struct {
+ Hostname string `json:"Hostname"`
+ PullZoneId string `json:"-"`
+ Certificate string `json:"Certificate"`
+ CertificateKey string `json:"CertificateKey"`
+}
diff --git a/migrations/1744459000_upgrade.go b/migrations/1744459000_upgrade.go
new file mode 100644
index 00000000..d2f95004
--- /dev/null
+++ b/migrations/1744459000_upgrade.go
@@ -0,0 +1,98 @@
+package migrations
+
+import (
+ "github.com/pocketbase/pocketbase/core"
+ m "github.com/pocketbase/pocketbase/migrations"
+)
+
+func init() {
+ m.Register(func(app core.App) error {
+ // update collection `access`
+ {
+ collection, err := app.FindCollectionByNameOrId("4yzbv8urny5ja1e")
+ if err != nil {
+ return err
+ }
+
+ // update field
+ if err := collection.Fields.AddMarshaledJSONAt(2, []byte(`{
+ "hidden": false,
+ "id": "hwy7m03o",
+ "maxSelect": 1,
+ "name": "provider",
+ "presentable": false,
+ "required": false,
+ "system": false,
+ "type": "select",
+ "values": [
+ "1panel",
+ "acmehttpreq",
+ "akamai",
+ "aliyun",
+ "aws",
+ "azure",
+ "baiducloud",
+ "baishan",
+ "baotapanel",
+ "bunny",
+ "byteplus",
+ "buypass",
+ "cachefly",
+ "cdnfly",
+ "cloudflare",
+ "cloudns",
+ "cmcccloud",
+ "ctcccloud",
+ "cucccloud",
+ "desec",
+ "dnsla",
+ "dogecloud",
+ "dynv6",
+ "edgio",
+ "fastly",
+ "gname",
+ "gcore",
+ "godaddy",
+ "goedge",
+ "googletrustservices",
+ "huaweicloud",
+ "jdcloud",
+ "k8s",
+ "letsencrypt",
+ "letsencryptstaging",
+ "local",
+ "namecheap",
+ "namedotcom",
+ "namesilo",
+ "ns1",
+ "porkbun",
+ "powerdns",
+ "qiniu",
+ "qingcloud",
+ "rainyun",
+ "safeline",
+ "ssh",
+ "sslcom",
+ "tencentcloud",
+ "ucloud",
+ "upyun",
+ "vercel",
+ "volcengine",
+ "webhook",
+ "westcn",
+ "zerossl"
+ ]
+ }`)); err != nil {
+ return err
+ }
+
+ if err := app.Save(collection); err != nil {
+ return err
+ }
+ }
+
+ return nil
+ }, func(app core.App) error {
+ return nil
+ })
+}
diff --git a/ui/public/imgs/providers/bunny.svg b/ui/public/imgs/providers/bunny.svg
new file mode 100644
index 00000000..edbbab32
--- /dev/null
+++ b/ui/public/imgs/providers/bunny.svg
@@ -0,0 +1,108 @@
+
\ No newline at end of file
diff --git a/ui/src/components/access/AccessForm.tsx b/ui/src/components/access/AccessForm.tsx
index bffb1f49..a00b0f2e 100644
--- a/ui/src/components/access/AccessForm.tsx
+++ b/ui/src/components/access/AccessForm.tsx
@@ -17,6 +17,7 @@ import AccessFormAzureConfig from "./AccessFormAzureConfig";
import AccessFormBaiduCloudConfig from "./AccessFormBaiduCloudConfig";
import AccessFormBaishanConfig from "./AccessFormBaishanConfig";
import AccessFormBaotaPanelConfig from "./AccessFormBaotaPanelConfig";
+import AccessFormBunnyConfig from "./AccessFormBunnyConfig";
import AccessFormBytePlusConfig from "./AccessFormBytePlusConfig";
import AccessFormCacheFlyConfig from "./AccessFormCacheFlyConfig";
import AccessFormCdnflyConfig from "./AccessFormCdnflyConfig";
@@ -162,6 +163,8 @@ const AccessForm = forwardRef(({ className,
return ;
case ACCESS_PROVIDERS.BAOTAPANEL:
return ;
+ case ACCESS_PROVIDERS.BUNNY:
+ return ;
case ACCESS_PROVIDERS.BYTEPLUS:
return ;
case ACCESS_PROVIDERS.CACHEFLY:
diff --git a/ui/src/components/access/AccessFormBunnyConfig.tsx b/ui/src/components/access/AccessFormBunnyConfig.tsx
new file mode 100644
index 00000000..0906d3d0
--- /dev/null
+++ b/ui/src/components/access/AccessFormBunnyConfig.tsx
@@ -0,0 +1,62 @@
+import { useTranslation } from "react-i18next";
+import { Form, type FormInstance, Input } from "antd";
+import { createSchemaFieldRule } from "antd-zod";
+import { z } from "zod";
+
+import { type AccessConfigForBunny } from "@/domain/access";
+
+type AccessFormBunnyConfigFieldValues = Nullish;
+
+export type AccessFormBunnyConfigProps = {
+ form: FormInstance;
+ formName: string;
+ disabled?: boolean;
+ initialValues?: AccessFormBunnyConfigFieldValues;
+ onValuesChange?: (values: AccessFormBunnyConfigFieldValues) => void;
+};
+
+const initFormModel = (): AccessFormBunnyConfigFieldValues => {
+ return {
+ apiKey: "",
+ };
+};
+
+const AccessFormBunnyConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: AccessFormBunnyConfigProps) => {
+ const { t } = useTranslation();
+
+ const formSchema = z.object({
+ apiKey: z
+ .string()
+ .nonempty(t("access.form.bunny_api_key.placeholder"))
+ .trim(),
+ });
+ const formRule = createSchemaFieldRule(formSchema);
+
+ const handleFormChange = (_: unknown, values: z.infer) => {
+ onValuesChange?.(values);
+ };
+
+ return (
+ }
+ >
+
+
+
+
+ );
+};
+
+export default AccessFormBunnyConfig;
diff --git a/ui/src/components/workflow/node/DeployNodeConfigForm.tsx b/ui/src/components/workflow/node/DeployNodeConfigForm.tsx
index 5565c985..636ff5ac 100644
--- a/ui/src/components/workflow/node/DeployNodeConfigForm.tsx
+++ b/ui/src/components/workflow/node/DeployNodeConfigForm.tsx
@@ -39,6 +39,7 @@ import DeployNodeConfigFormBaiduCloudCDNConfig from "./DeployNodeConfigFormBaidu
import DeployNodeConfigFormBaishanCDNConfig from "./DeployNodeConfigFormBaishanCDNConfig";
import DeployNodeConfigFormBaotaPanelConsoleConfig from "./DeployNodeConfigFormBaotaPanelConsoleConfig";
import DeployNodeConfigFormBaotaPanelSiteConfig from "./DeployNodeConfigFormBaotaPanelSiteConfig";
+import DeployNodeConfigFormBunnyCDNConfig from "./DeployNodeConfigFormBunnyCDNConfig.tsx";
import DeployNodeConfigFormBytePlusCDNConfig from "./DeployNodeConfigFormBytePlusCDNConfig";
import DeployNodeConfigFormCdnflyConfig from "./DeployNodeConfigFormCdnflyConfig";
import DeployNodeConfigFormDogeCloudCDNConfig from "./DeployNodeConfigFormDogeCloudCDNConfig";
@@ -219,6 +220,8 @@ const DeployNodeConfigForm = forwardRef;
case DEPLOY_PROVIDERS.BAOTAPANEL_SITE:
return ;
+ case DEPLOY_PROVIDERS.BUNNY_CDN:
+ return ;
case DEPLOY_PROVIDERS.BYTEPLUS_CDN:
return ;
case DEPLOY_PROVIDERS.CDNFLY:
diff --git a/ui/src/components/workflow/node/DeployNodeConfigFormBunnyCDNConfig.tsx b/ui/src/components/workflow/node/DeployNodeConfigFormBunnyCDNConfig.tsx
new file mode 100644
index 00000000..3b68f811
--- /dev/null
+++ b/ui/src/components/workflow/node/DeployNodeConfigFormBunnyCDNConfig.tsx
@@ -0,0 +1,76 @@
+import { useTranslation } from "react-i18next";
+import { Form, type FormInstance, Input } from "antd";
+import { createSchemaFieldRule } from "antd-zod";
+import { z } from "zod";
+import { validDomainName } from "@/utils/validators";
+
+type DeployNodeConfigFormBunnyCDNConfigFieldValues = Nullish<{
+ pullZoneId: string | number;
+ hostName: string;
+}>;
+
+export type DeployNodeConfigFormBunnyCDNConfigProps = {
+ form: FormInstance;
+ formName: string;
+ disabled?: boolean;
+ initialValues?: DeployNodeConfigFormBunnyCDNConfigFieldValues;
+ onValuesChange?: (values: DeployNodeConfigFormBunnyCDNConfigFieldValues) => void;
+};
+
+const initFormModel = (): DeployNodeConfigFormBunnyCDNConfigFieldValues => {
+ return {};
+};
+
+const DeployNodeConfigFormBunnyCDNConfig = ({ form: formInst, formName, disabled, initialValues, onValuesChange }: DeployNodeConfigFormBunnyCDNConfigProps) => {
+ const { t } = useTranslation();
+
+ const formSchema = z.object({
+ pullZoneId: z
+ .union([z.string(), z.number().int()])
+ .refine((v) => {
+ return /^\d+$/.test(v + "") && +v! > 0;
+ }, t("workflow_node.deploy.form.bunny_cdn_pull_zone_id.placeholder")),
+ hostName: z
+ .string({ message: t("workflow_node.deploy.form.bunny_cdn_host_name.placeholder") })
+ .nonempty(t("workflow_node.deploy.form.bunny_cdn_host_name.placeholder"))
+ .refine((v) => {
+ return !v || validDomainName(v!, { allowWildcard: true });
+ }, t("common.errmsg.domain_invalid")),
+ });
+ const formRule = createSchemaFieldRule(formSchema);
+
+ const handleFormChange = (_: unknown, values: z.infer) => {
+ onValuesChange?.(values);
+ };
+
+ return (
+ }
+ >
+
+
+
+ }
+ >
+
+
+
+ );
+};
+
+export default DeployNodeConfigFormBunnyCDNConfig;
diff --git a/ui/src/domain/access.ts b/ui/src/domain/access.ts
index 3015e4d0..036ccc28 100644
--- a/ui/src/domain/access.ts
+++ b/ui/src/domain/access.ts
@@ -14,6 +14,7 @@ export interface AccessModel extends BaseModel {
| AccessConfigForBaiduCloud
| AccessConfigForBaishan
| AccessConfigForBaotaPanel
+ | AccessConfigForBunny
| AccessConfigForBytePlus
| AccessConfigForCacheFly
| AccessConfigForCdnfly
@@ -100,6 +101,10 @@ export type AccessConfigForBaotaPanel = {
allowInsecureConnections?: boolean;
};
+export type AccessConfigForBunny = {
+ apiKey: string;
+};
+
export type AccessConfigForBytePlus = {
accessKey: string;
secretKey: string;
diff --git a/ui/src/domain/provider.ts b/ui/src/domain/provider.ts
index dbd81a0f..73c7c06c 100644
--- a/ui/src/domain/provider.ts
+++ b/ui/src/domain/provider.ts
@@ -12,6 +12,7 @@ export const ACCESS_PROVIDERS = Object.freeze({
BAIDUCLOUD: "baiducloud",
BAISHAN: "baishan",
BAOTAPANEL: "baotapanel",
+ BUNNY: "bunny",
BYTEPLUS: "byteplus",
BUYPASS: "buypass",
CACHEFLY: "cachefly",
@@ -94,6 +95,7 @@ export const accessProvidersMap: Maphttps://intl.cloud.baidu.com/doc/Reference/s/jjwvz2e3p-en",
+ "access.form.bunny_api_key.label": "Bunny API Key",
+ "access.form.bunny_api_key.placeholder": "Please enter Bunny API key",
+ "access.form.bunny_api_key.tooltip": "For more information, see https://docs.bunny.net/reference/bunnynet-api-overview",
"access.form.upyun_username.label": "UPYUN subaccount username",
"access.form.upyun_username.placeholder": "Please enter UPYUN subaccount username",
"access.form.upyun_username.tooltip": "For more information, see https://console.upyun.com/account/subaccount/",
diff --git a/ui/src/i18n/locales/en/nls.provider.json b/ui/src/i18n/locales/en/nls.provider.json
index b4c866d9..f7f770af 100644
--- a/ui/src/i18n/locales/en/nls.provider.json
+++ b/ui/src/i18n/locales/en/nls.provider.json
@@ -38,6 +38,8 @@
"provider.baotapanel": "aaPanel (aka BaoTaPanel)",
"provider.baotapanel.console": "aaPanel (aka BaoTaPanel) - Console",
"provider.baotapanel.site": "aaPanel (aka BaoTaPanel) - Website",
+ "provider.bunny": "Bunny",
+ "provider.bunny.cdn": "Bunny - CDN (Content Delivery Network)",
"provider.byteplus": "BytePlus",
"provider.byteplus.cdn": "BytePlus - CDN (Content Delivery Network)",
"provider.buypass": "Buypass AS",
diff --git a/ui/src/i18n/locales/en/nls.workflow.nodes.json b/ui/src/i18n/locales/en/nls.workflow.nodes.json
index 4ac796b3..b3a18f0d 100644
--- a/ui/src/i18n/locales/en/nls.workflow.nodes.json
+++ b/ui/src/i18n/locales/en/nls.workflow.nodes.json
@@ -289,6 +289,12 @@
"workflow_node.deploy.form.baotapanel_site_names.tooltip": "Usually equal to the websites domain name.",
"workflow_node.deploy.form.baotapanel_site_names.multiple_input_modal.title": "Change aaPanel site names",
"workflow_node.deploy.form.baotapanel_site_names.multiple_input_modal.placeholder": "Please enter aaPanel site name",
+ "workflow_node.deploy.form.bunny_cdn_pull_zone_id.label": "Bunny CDN pull zone ID",
+ "workflow_node.deploy.form.bunny_cdn_pull_zone_id.placeholder": "Please enter Bunny CDN pull zone ID",
+ "workflow_node.deploy.form.bunny_cdn_pull_zone_id.tooltip": "What is this? See https://dash.bunny.net/cdn",
+ "workflow_node.deploy.form.bunny_cdn_host_name.label": "Bunny CDN hostname",
+ "workflow_node.deploy.form.bunny_cdn_host_name.placeholder": "Please enter Bunny CDN hostname",
+ "workflow_node.deploy.form.bunny_cdn_host_name.tooltip": "What is this? See https://dash.bunny.net/cdn",
"workflow_node.deploy.form.byteplus_cdn_domain.label": "BytePlus CDN domain",
"workflow_node.deploy.form.byteplus_cdn_domain.placeholder": "Please enter BytePlus CDN domain name",
"workflow_node.deploy.form.byteplus_cdn_domain.tooltip": "For more information, see https://console.byteplus.com/cdn",
diff --git a/ui/src/i18n/locales/zh/nls.access.json b/ui/src/i18n/locales/zh/nls.access.json
index bf068260..dec57ed1 100644
--- a/ui/src/i18n/locales/zh/nls.access.json
+++ b/ui/src/i18n/locales/zh/nls.access.json
@@ -97,6 +97,9 @@
"access.form.baotapanel_allow_insecure_conns.tooltip": "忽略 SSL/TLS 证书错误可能导致数据泄露或被篡改。建议仅在可信网络下启用。",
"access.form.baotapanel_allow_insecure_conns.switch.on": "允许",
"access.form.baotapanel_allow_insecure_conns.switch.off": "不允许",
+ "access.form.bunny_api_key.label": "Bunny API Key",
+ "access.form.bunny_api_key.placeholder": "请输入 Bunny API Key",
+ "access.form.bunny_api_key.tooltip": "这是什么?请参阅 https://docs.bunny.net/reference/bunnynet-api-overview",
"access.form.byteplus_access_key.label": "BytePlus AccessKey",
"access.form.byteplus_access_key.placeholder": "请输入 BytePlus AccessKey",
"access.form.byteplus_access_key.tooltip": "这是什么?请参阅 https://docs.byteplus.com/zh-CN/docs/byteplus-platform/docs-managing-keys",
diff --git a/ui/src/i18n/locales/zh/nls.provider.json b/ui/src/i18n/locales/zh/nls.provider.json
index 216d3363..8443edc7 100644
--- a/ui/src/i18n/locales/zh/nls.provider.json
+++ b/ui/src/i18n/locales/zh/nls.provider.json
@@ -38,6 +38,8 @@
"provider.baotapanel": "宝塔面板",
"provider.baotapanel.console": "宝塔面板 - 面板",
"provider.baotapanel.site": "宝塔面板 - 网站",
+ "provider.bunny": "Bunny",
+ "provider.bunny.cdn": "Bunny - 内容分发网络 CDN",
"provider.byteplus": "BytePlus",
"provider.byteplus.cdn": "BytePlus - 内容分发网络 CDN",
"provider.buypass": "Buypass AS",
diff --git a/ui/src/i18n/locales/zh/nls.workflow.nodes.json b/ui/src/i18n/locales/zh/nls.workflow.nodes.json
index 5fcb201d..f6e2d67e 100644
--- a/ui/src/i18n/locales/zh/nls.workflow.nodes.json
+++ b/ui/src/i18n/locales/zh/nls.workflow.nodes.json
@@ -288,6 +288,12 @@
"workflow_node.deploy.form.baotapanel_site_names.tooltip": "通常为网站域名。",
"workflow_node.deploy.form.baotapanel_site_names.multiple_input_modal.title": "修改宝塔面板网站名称",
"workflow_node.deploy.form.baotapanel_site_names.multiple_input_modal.placeholder": "请输入宝塔面板网站名称",
+ "workflow_node.deploy.form.bunny_cdn_pull_zone_id.label": "Bunny CDN 拉取区域 ID",
+ "workflow_node.deploy.form.bunny_cdn_pull_zone_id.placeholder": "请输入 Bunny CDN 拉取区域 ID",
+ "workflow_node.deploy.form.bunny_cdn_pull_zone_id.tooltip": "这是什么?请参阅 https://dash.bunny.net/cdn",
+ "workflow_node.deploy.form.bunny_cdn_host_name.label": "Bunny CDN 主机名",
+ "workflow_node.deploy.form.bunny_cdn_host_name.placeholder": "请输入 Bunny CDN 主机名",
+ "workflow_node.deploy.form.bunny_cdn_host_name.tooltip": "这是什么?请参阅 https://dash.bunny.net/cdn",
"workflow_node.deploy.form.byteplus_cdn_domain.label": "BytePlus CDN 域名",
"workflow_node.deploy.form.byteplus_cdn_domain.placeholder": "请输入 BytePlus CDN 域名(支持泛域名)",
"workflow_node.deploy.form.byteplus_cdn_domain.tooltip": "这是什么?请参阅 https://console.byteplus.com/cdn",