From 6bd9bb7c063fea5a6e0da739d36a57596ed7ab5b Mon Sep 17 00:00:00 2001 From: CityFun <31820853+zhengkunwang223@users.noreply.github.com> Date: Thu, 22 May 2025 15:17:59 +0800 Subject: [PATCH] feat: add .user.ini for php website (#8782) --- agent/app/service/runtime_utils.go | 1 + agent/app/service/website.go | 9 + agent/app/service/website_utils.go | 7 + agent/utils/ssl/acme.go | 17 ++ agent/utils/ssl/client.go | 274 +------------------- agent/utils/ssl/custom_manual_provider.go | 33 +++ agent/utils/ssl/dns_provider.go | 223 ++++++++++++++++ frontend/src/components/log/task/index.vue | 1 + frontend/src/views/app-store/apps/index.vue | 2 +- 9 files changed, 294 insertions(+), 273 deletions(-) create mode 100644 agent/utils/ssl/custom_manual_provider.go create mode 100644 agent/utils/ssl/dns_provider.go diff --git a/agent/app/service/runtime_utils.go b/agent/app/service/runtime_utils.go index 0c283938f..fdaadf224 100644 --- a/agent/app/service/runtime_utils.go +++ b/agent/app/service/runtime_utils.go @@ -188,6 +188,7 @@ func SyncRuntimesStatus(runtimes []model.Runtime) error { case "restarting": runtimes[index].Status = constant.StatusRestarting } + _ = runtimeRepo.Save(&runtimes[index]) delete(runtimeContainer, contain.Names[0]) } } diff --git a/agent/app/service/website.go b/agent/app/service/website.go index d7b8817ba..cc0cabaa1 100644 --- a/agent/app/service/website.go +++ b/agent/app/service/website.go @@ -422,6 +422,15 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error) if err = createWafConfig(website, domains); err != nil { return err } + if create.Type == constant.Runtime { + runtime, err = runtimeRepo.GetFirst(context.Background(), repo.WithByID(create.RuntimeID)) + if err != nil { + return err + } + if runtime.Type == constant.RuntimePHP && runtime.Resource == constant.ResourceAppstore { + createPHPConfig(website) + } + } tx, ctx := helper.GetTxAndContext() defer tx.Rollback() if err = websiteRepo.Create(ctx, website); err != nil { diff --git a/agent/app/service/website_utils.go b/agent/app/service/website_utils.go index 42425c17d..38ee4b579 100644 --- a/agent/app/service/website_utils.go +++ b/agent/app/service/website_utils.go @@ -349,6 +349,13 @@ func createAllWebsitesWAFConfig(websites []model.Website) error { return nil } +func createPHPConfig(website *model.Website) { + fileOp := files.NewFileOp() + userIniPath := path.Join(GetSitePath(*website, SiteIndexDir), ".user.ini") + _ = fileOp.CreateFile(userIniPath) + _ = fileOp.SaveFile(userIniPath, fmt.Sprintf("open_basedir=/www/sites/%s/index", website.Alias), 0644) +} + func createWafConfig(website *model.Website, domains []model.WebsiteDomain) error { nginxInstall, err := getAppInstallByKey(constant.AppOpenresty) if err != nil { diff --git a/agent/utils/ssl/acme.go b/agent/utils/ssl/acme.go index 9e0b05ea4..8adb04e4b 100644 --- a/agent/utils/ssl/acme.go +++ b/agent/utils/ssl/acme.go @@ -46,6 +46,23 @@ const ( KeyRSA4096 = certcrypto.RSA4096 ) +type AcmeUser struct { + Email string + Registration *registration.Resource + Key crypto.PrivateKey +} + +func (u *AcmeUser) GetEmail() string { + return u.Email +} + +func (u *AcmeUser) GetRegistration() *registration.Resource { + return u.Registration +} +func (u *AcmeUser) GetPrivateKey() crypto.PrivateKey { + return u.Key +} + func GetPrivateKey(priKey crypto.PrivateKey, keyType KeyType) ([]byte, error) { var ( marshal []byte diff --git a/agent/utils/ssl/client.go b/agent/utils/ssl/client.go index 28b5d5214..f50b261a0 100644 --- a/agent/utils/ssl/client.go +++ b/agent/utils/ssl/client.go @@ -2,25 +2,7 @@ package ssl import ( "crypto" - "encoding/json" "github.com/1Panel-dev/1Panel/agent/app/dto" - "github.com/go-acme/lego/v4/providers/dns/alidns" - "github.com/go-acme/lego/v4/providers/dns/clouddns" - "github.com/go-acme/lego/v4/providers/dns/cloudflare" - "github.com/go-acme/lego/v4/providers/dns/cloudns" - "github.com/go-acme/lego/v4/providers/dns/dnspod" - "github.com/go-acme/lego/v4/providers/dns/freemyip" - "github.com/go-acme/lego/v4/providers/dns/godaddy" - "github.com/go-acme/lego/v4/providers/dns/huaweicloud" - "github.com/go-acme/lego/v4/providers/dns/namecheap" - "github.com/go-acme/lego/v4/providers/dns/namedotcom" - "github.com/go-acme/lego/v4/providers/dns/namesilo" - "github.com/go-acme/lego/v4/providers/dns/rainyun" - "github.com/go-acme/lego/v4/providers/dns/spaceship" - "github.com/go-acme/lego/v4/providers/dns/tencentcloud" - "github.com/go-acme/lego/v4/providers/dns/vercel" - "github.com/go-acme/lego/v4/providers/dns/volcengine" - "github.com/go-acme/lego/v4/providers/dns/westcn" "os" "strings" "time" @@ -33,39 +15,15 @@ import ( "github.com/go-acme/lego/v4/challenge/dns01" "github.com/go-acme/lego/v4/lego" "github.com/go-acme/lego/v4/providers/http/webroot" - "github.com/go-acme/lego/v4/registration" "github.com/pkg/errors" ) -type AcmeUser struct { - Email string - Registration *registration.Resource - Key crypto.PrivateKey -} - -func (u *AcmeUser) GetEmail() string { - return u.Email -} - -func (u *AcmeUser) GetRegistration() *registration.Resource { - return u.Registration -} -func (u *AcmeUser) GetPrivateKey() crypto.PrivateKey { - return u.Key -} - type AcmeClientOption func(*AcmeClientOptions) type AcmeClientOptions struct { SystemProxy *dto.SystemProxy } -func WithSystemProxy(proxy *dto.SystemProxy) AcmeClientOption { - return func(opts *AcmeClientOptions) { - opts.SystemProxy = proxy - } -} - type AcmeClient struct { Config *lego.Config Client *lego.Client @@ -85,205 +43,6 @@ func NewAcmeClient(acmeAccount *model.WebsiteAcmeAccount, systemProxy *dto.Syste return client, nil } -type DnsType string - -const ( - DnsPod DnsType = "DnsPod" - AliYun DnsType = "AliYun" - CloudFlare DnsType = "CloudFlare" - CloudDns DnsType = "CloudDns" - NameSilo DnsType = "NameSilo" - NameCheap DnsType = "NameCheap" - NameCom DnsType = "NameCom" - Godaddy DnsType = "Godaddy" - TencentCloud DnsType = "TencentCloud" - RainYun DnsType = "RainYun" - Volcengine DnsType = "Volcengine" - HuaweiCloud DnsType = "HuaweiCloud" - FreeMyIP DnsType = "FreeMyIP" - Vercel DnsType = "Vercel" - Spaceship DnsType = "Spaceship" - WestCN DnsType = "WestCN" - ClouDNS DnsType = "ClouDNS" -) - -type DNSParam struct { - ID string `json:"id"` - Token string `json:"token"` - AccessKey string `json:"accessKey"` - SecretKey string `json:"secretKey"` - Email string `json:"email"` - APIkey string `json:"apiKey"` - APIUser string `json:"apiUser"` - APISecret string `json:"apiSecret"` - SecretID string `json:"secretID"` - ClientID string `json:"clientID"` - Password string `json:"password"` - Region string `json:"region"` - Username string `json:"username"` - AuthID string `json:"authID"` - SubAuthID string `json:"subAuthID"` - AuthPassword string `json:"authPassword"` -} - -var ( - propagationTimeout = 30 * time.Minute - pollingInterval = 10 * time.Second - ttl = 3600 - dnsTimeOut = 30 * time.Minute - manualDnsTimeout = 10 * time.Minute -) - -func getDNSProviderConfig(dnsType DnsType, params string) (challenge.Provider, error) { - var ( - param DNSParam - p challenge.Provider - err error - ) - if err := json.Unmarshal([]byte(params), ¶m); err != nil { - return nil, err - } - switch dnsType { - case DnsPod: - dnsPodConfig := dnspod.NewDefaultConfig() - dnsPodConfig.LoginToken = param.ID + "," + param.Token - dnsPodConfig.PropagationTimeout = propagationTimeout - dnsPodConfig.PollingInterval = pollingInterval - dnsPodConfig.TTL = ttl - p, err = dnspod.NewDNSProviderConfig(dnsPodConfig) - case AliYun: - alidnsConfig := alidns.NewDefaultConfig() - alidnsConfig.SecretKey = param.SecretKey - alidnsConfig.APIKey = param.AccessKey - alidnsConfig.PropagationTimeout = propagationTimeout - alidnsConfig.PollingInterval = pollingInterval - alidnsConfig.TTL = ttl - p, err = alidns.NewDNSProviderConfig(alidnsConfig) - case CloudFlare: - cloudflareConfig := cloudflare.NewDefaultConfig() - cloudflareConfig.AuthEmail = param.Email - cloudflareConfig.AuthToken = param.APIkey - cloudflareConfig.PropagationTimeout = propagationTimeout - cloudflareConfig.PollingInterval = pollingInterval - cloudflareConfig.TTL = ttl - p, err = cloudflare.NewDNSProviderConfig(cloudflareConfig) - case CloudDns: - clouddnsConfig := clouddns.NewDefaultConfig() - clouddnsConfig.ClientID = param.ClientID - clouddnsConfig.Email = param.Email - clouddnsConfig.Password = param.Password - clouddnsConfig.PropagationTimeout = propagationTimeout - clouddnsConfig.PollingInterval = pollingInterval - clouddnsConfig.TTL = ttl - p, err = clouddns.NewDNSProviderConfig(clouddnsConfig) - case NameCheap: - namecheapConfig := namecheap.NewDefaultConfig() - namecheapConfig.APIKey = param.APIkey - namecheapConfig.APIUser = param.APIUser - namecheapConfig.PropagationTimeout = propagationTimeout - namecheapConfig.PollingInterval = pollingInterval - namecheapConfig.TTL = ttl - p, err = namecheap.NewDNSProviderConfig(namecheapConfig) - case NameSilo: - nameSiloConfig := namesilo.NewDefaultConfig() - nameSiloConfig.APIKey = param.APIkey - nameSiloConfig.PropagationTimeout = propagationTimeout - nameSiloConfig.PollingInterval = pollingInterval - nameSiloConfig.TTL = ttl - p, err = namesilo.NewDNSProviderConfig(nameSiloConfig) - case Godaddy: - godaddyConfig := godaddy.NewDefaultConfig() - godaddyConfig.APIKey = param.APIkey - godaddyConfig.APISecret = param.APISecret - godaddyConfig.PropagationTimeout = propagationTimeout - godaddyConfig.PollingInterval = pollingInterval - godaddyConfig.TTL = ttl - p, err = godaddy.NewDNSProviderConfig(godaddyConfig) - case NameCom: - nameComConfig := namedotcom.NewDefaultConfig() - nameComConfig.APIToken = param.Token - nameComConfig.Username = param.APIUser - nameComConfig.PropagationTimeout = propagationTimeout - nameComConfig.PollingInterval = pollingInterval - nameComConfig.TTL = ttl - p, err = namedotcom.NewDNSProviderConfig(nameComConfig) - case TencentCloud: - tencentCloudConfig := tencentcloud.NewDefaultConfig() - tencentCloudConfig.SecretID = param.SecretID - tencentCloudConfig.SecretKey = param.SecretKey - tencentCloudConfig.PropagationTimeout = propagationTimeout - tencentCloudConfig.PollingInterval = pollingInterval - tencentCloudConfig.TTL = ttl - p, err = tencentcloud.NewDNSProviderConfig(tencentCloudConfig) - case RainYun: - rainyunConfig := rainyun.NewDefaultConfig() - rainyunConfig.APIKey = param.APIkey - rainyunConfig.PropagationTimeout = propagationTimeout - rainyunConfig.PollingInterval = pollingInterval - rainyunConfig.TTL = ttl - p, err = rainyun.NewDNSProviderConfig(rainyunConfig) - case Volcengine: - volcConfig := volcengine.NewDefaultConfig() - volcConfig.SecretKey = param.SecretKey - volcConfig.AccessKey = param.AccessKey - volcConfig.PropagationTimeout = propagationTimeout - volcConfig.PollingInterval = pollingInterval - volcConfig.TTL = ttl - p, err = volcengine.NewDNSProviderConfig(volcConfig) - case HuaweiCloud: - huaweiCloudConfig := huaweicloud.NewDefaultConfig() - huaweiCloudConfig.AccessKeyID = param.AccessKey - huaweiCloudConfig.SecretAccessKey = param.SecretKey - huaweiCloudConfig.Region = param.Region - huaweiCloudConfig.PropagationTimeout = propagationTimeout - huaweiCloudConfig.PollingInterval = pollingInterval - huaweiCloudConfig.TTL = int32(ttl) - p, err = huaweicloud.NewDNSProviderConfig(huaweiCloudConfig) - case FreeMyIP: - freeMyIpConfig := freemyip.NewDefaultConfig() - freeMyIpConfig.Token = param.Token - freeMyIpConfig.PropagationTimeout = propagationTimeout - freeMyIpConfig.PollingInterval = pollingInterval - p, err = freemyip.NewDNSProviderConfig(freeMyIpConfig) - case Vercel: - vercelConfig := vercel.NewDefaultConfig() - vercelConfig.AuthToken = param.Token - vercelConfig.PropagationTimeout = propagationTimeout - vercelConfig.PollingInterval = pollingInterval - p, err = vercel.NewDNSProviderConfig(vercelConfig) - case Spaceship: - spaceshipConfig := spaceship.NewDefaultConfig() - spaceshipConfig.APIKey = param.APIkey - spaceshipConfig.APISecret = param.APISecret - spaceshipConfig.PropagationTimeout = propagationTimeout - spaceshipConfig.PollingInterval = pollingInterval - spaceshipConfig.TTL = ttl - p, err = spaceship.NewDNSProviderConfig(spaceshipConfig) - case WestCN: - westcnConfig := westcn.NewDefaultConfig() - westcnConfig.Username = param.Username - westcnConfig.Password = param.Password - westcnConfig.PropagationTimeout = propagationTimeout - westcnConfig.PollingInterval = pollingInterval - westcnConfig.TTL = ttl - p, err = westcn.NewDNSProviderConfig(westcnConfig) - - case ClouDNS: - cloudnsConfig := cloudns.NewDefaultConfig() - cloudnsConfig.AuthID = param.AuthID - cloudnsConfig.SubAuthID = param.SubAuthID - cloudnsConfig.AuthPassword = param.AuthPassword - cloudnsConfig.PropagationTimeout = propagationTimeout - cloudnsConfig.PollingInterval = pollingInterval - cloudnsConfig.TTL = ttl - p, err = cloudns.NewDNSProviderConfig(cloudnsConfig) - } - if err != nil { - return nil, err - } - return p, nil -} - func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.WebsiteSSL) error { p, err := getDNSProviderConfig(dnsType, params) if err != nil { @@ -313,7 +72,7 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web func (c *AcmeClient) UseManualDns(websiteSSL model.WebsiteSSL) error { p, err := NewCustomDNSProviderManual(&ManualConfig{ - PropagationTimeout: propagationTimeout, + PropagationTimeout: 20 * time.Minute, PollingInterval: pollingInterval, TTL: ttl, }) @@ -381,36 +140,6 @@ type Resolve struct { Err string } -type ManualConfig struct { - TTL int - PropagationTimeout time.Duration - PollingInterval time.Duration -} - -type CustomManualDnsProvider struct { - config *ManualConfig -} - -func NewCustomDNSProviderManual(config *ManualConfig) (*CustomManualDnsProvider, error) { - return &CustomManualDnsProvider{config}, nil -} - -func (p *CustomManualDnsProvider) Present(domain, token, keyAuth string) error { - return nil -} - -func (p *CustomManualDnsProvider) CleanUp(domain, token, keyAuth string) error { - return nil -} - -func (p *CustomManualDnsProvider) Sequential() time.Duration { - return manualDnsTimeout -} - -func (p *CustomManualDnsProvider) Timeout() (timeout, interval time.Duration) { - return p.config.PropagationTimeout, p.config.PollingInterval -} - func (c *AcmeClient) GetDNSResolve(domains []string) (map[string]Resolve, error) { core, err := api.New(c.Config.HTTPClient, c.Config.UserAgent, c.Config.CADirURL, c.User.Registration.URI, c.User.Key) if err != nil { @@ -462,6 +191,7 @@ func (c *AcmeClient) GetDNSResolve(domains []string) (map[string]Resolve, error) if strings.HasPrefix(domain, "*.") && strings.Contains(fqdn, "*.") { fqdn = strings.Replace(fqdn, "*.", "", 1) } + _, _ = dns01.FindZoneByFqdn(challengeInfo.EffectiveFQDN) resolves[domain] = Resolve{ Key: fqdn, Value: challengeInfo.Value, diff --git a/agent/utils/ssl/custom_manual_provider.go b/agent/utils/ssl/custom_manual_provider.go new file mode 100644 index 000000000..1b0d25292 --- /dev/null +++ b/agent/utils/ssl/custom_manual_provider.go @@ -0,0 +1,33 @@ +package ssl + +import "time" + +type ManualConfig struct { + TTL int + PropagationTimeout time.Duration + PollingInterval time.Duration +} + +type CustomManualDnsProvider struct { + config *ManualConfig +} + +func NewCustomDNSProviderManual(config *ManualConfig) (*CustomManualDnsProvider, error) { + return &CustomManualDnsProvider{config}, nil +} + +func (p *CustomManualDnsProvider) Present(domain, token, keyAuth string) error { + return nil +} + +func (p *CustomManualDnsProvider) CleanUp(domain, token, keyAuth string) error { + return nil +} + +func (p *CustomManualDnsProvider) Sequential() time.Duration { + return manualDnsTimeout +} + +func (p *CustomManualDnsProvider) Timeout() (timeout, interval time.Duration) { + return p.config.PropagationTimeout, p.config.PollingInterval +} diff --git a/agent/utils/ssl/dns_provider.go b/agent/utils/ssl/dns_provider.go new file mode 100644 index 000000000..cacd0bc56 --- /dev/null +++ b/agent/utils/ssl/dns_provider.go @@ -0,0 +1,223 @@ +package ssl + +import ( + "encoding/json" + "github.com/go-acme/lego/v4/challenge" + "github.com/go-acme/lego/v4/providers/dns/alidns" + "github.com/go-acme/lego/v4/providers/dns/clouddns" + "github.com/go-acme/lego/v4/providers/dns/cloudflare" + "github.com/go-acme/lego/v4/providers/dns/cloudns" + "github.com/go-acme/lego/v4/providers/dns/dnspod" + "github.com/go-acme/lego/v4/providers/dns/freemyip" + "github.com/go-acme/lego/v4/providers/dns/godaddy" + "github.com/go-acme/lego/v4/providers/dns/huaweicloud" + "github.com/go-acme/lego/v4/providers/dns/namecheap" + "github.com/go-acme/lego/v4/providers/dns/namedotcom" + "github.com/go-acme/lego/v4/providers/dns/namesilo" + "github.com/go-acme/lego/v4/providers/dns/rainyun" + "github.com/go-acme/lego/v4/providers/dns/spaceship" + "github.com/go-acme/lego/v4/providers/dns/tencentcloud" + "github.com/go-acme/lego/v4/providers/dns/vercel" + "github.com/go-acme/lego/v4/providers/dns/volcengine" + "github.com/go-acme/lego/v4/providers/dns/westcn" + "time" +) + +type DnsType string + +const ( + DnsPod DnsType = "DnsPod" + AliYun DnsType = "AliYun" + CloudFlare DnsType = "CloudFlare" + CloudDns DnsType = "CloudDns" + NameSilo DnsType = "NameSilo" + NameCheap DnsType = "NameCheap" + NameCom DnsType = "NameCom" + Godaddy DnsType = "Godaddy" + TencentCloud DnsType = "TencentCloud" + RainYun DnsType = "RainYun" + Volcengine DnsType = "Volcengine" + HuaweiCloud DnsType = "HuaweiCloud" + FreeMyIP DnsType = "FreeMyIP" + Vercel DnsType = "Vercel" + Spaceship DnsType = "Spaceship" + WestCN DnsType = "WestCN" + ClouDNS DnsType = "ClouDNS" +) + +type DNSParam struct { + ID string `json:"id"` + Token string `json:"token"` + AccessKey string `json:"accessKey"` + SecretKey string `json:"secretKey"` + Email string `json:"email"` + APIkey string `json:"apiKey"` + APIUser string `json:"apiUser"` + APISecret string `json:"apiSecret"` + SecretID string `json:"secretID"` + ClientID string `json:"clientID"` + Password string `json:"password"` + Region string `json:"region"` + Username string `json:"username"` + AuthID string `json:"authID"` + SubAuthID string `json:"subAuthID"` + AuthPassword string `json:"authPassword"` +} + +var ( + propagationTimeout = 30 * time.Minute + pollingInterval = 10 * time.Second + ttl = 3600 + dnsTimeOut = 30 * time.Minute + manualDnsTimeout = 10 * time.Minute +) + +func getDNSProviderConfig(dnsType DnsType, params string) (challenge.Provider, error) { + var ( + param DNSParam + p challenge.Provider + err error + ) + if err := json.Unmarshal([]byte(params), ¶m); err != nil { + return nil, err + } + switch dnsType { + case DnsPod: + dnsPodConfig := dnspod.NewDefaultConfig() + dnsPodConfig.LoginToken = param.ID + "," + param.Token + dnsPodConfig.PropagationTimeout = propagationTimeout + dnsPodConfig.PollingInterval = pollingInterval + dnsPodConfig.TTL = ttl + p, err = dnspod.NewDNSProviderConfig(dnsPodConfig) + case AliYun: + alidnsConfig := alidns.NewDefaultConfig() + alidnsConfig.SecretKey = param.SecretKey + alidnsConfig.APIKey = param.AccessKey + alidnsConfig.PropagationTimeout = propagationTimeout + alidnsConfig.PollingInterval = pollingInterval + alidnsConfig.TTL = ttl + p, err = alidns.NewDNSProviderConfig(alidnsConfig) + case CloudFlare: + cloudflareConfig := cloudflare.NewDefaultConfig() + cloudflareConfig.AuthEmail = param.Email + cloudflareConfig.AuthToken = param.APIkey + cloudflareConfig.PropagationTimeout = propagationTimeout + cloudflareConfig.PollingInterval = pollingInterval + cloudflareConfig.TTL = ttl + p, err = cloudflare.NewDNSProviderConfig(cloudflareConfig) + case CloudDns: + clouddnsConfig := clouddns.NewDefaultConfig() + clouddnsConfig.ClientID = param.ClientID + clouddnsConfig.Email = param.Email + clouddnsConfig.Password = param.Password + clouddnsConfig.PropagationTimeout = propagationTimeout + clouddnsConfig.PollingInterval = pollingInterval + clouddnsConfig.TTL = ttl + p, err = clouddns.NewDNSProviderConfig(clouddnsConfig) + case NameCheap: + namecheapConfig := namecheap.NewDefaultConfig() + namecheapConfig.APIKey = param.APIkey + namecheapConfig.APIUser = param.APIUser + namecheapConfig.PropagationTimeout = propagationTimeout + namecheapConfig.PollingInterval = pollingInterval + namecheapConfig.TTL = ttl + p, err = namecheap.NewDNSProviderConfig(namecheapConfig) + case NameSilo: + nameSiloConfig := namesilo.NewDefaultConfig() + nameSiloConfig.APIKey = param.APIkey + nameSiloConfig.PropagationTimeout = propagationTimeout + nameSiloConfig.PollingInterval = pollingInterval + nameSiloConfig.TTL = ttl + p, err = namesilo.NewDNSProviderConfig(nameSiloConfig) + case Godaddy: + godaddyConfig := godaddy.NewDefaultConfig() + godaddyConfig.APIKey = param.APIkey + godaddyConfig.APISecret = param.APISecret + godaddyConfig.PropagationTimeout = propagationTimeout + godaddyConfig.PollingInterval = pollingInterval + godaddyConfig.TTL = ttl + p, err = godaddy.NewDNSProviderConfig(godaddyConfig) + case NameCom: + nameComConfig := namedotcom.NewDefaultConfig() + nameComConfig.APIToken = param.Token + nameComConfig.Username = param.APIUser + nameComConfig.PropagationTimeout = propagationTimeout + nameComConfig.PollingInterval = pollingInterval + nameComConfig.TTL = ttl + p, err = namedotcom.NewDNSProviderConfig(nameComConfig) + case TencentCloud: + tencentCloudConfig := tencentcloud.NewDefaultConfig() + tencentCloudConfig.SecretID = param.SecretID + tencentCloudConfig.SecretKey = param.SecretKey + tencentCloudConfig.PropagationTimeout = propagationTimeout + tencentCloudConfig.PollingInterval = pollingInterval + tencentCloudConfig.TTL = ttl + p, err = tencentcloud.NewDNSProviderConfig(tencentCloudConfig) + case RainYun: + rainyunConfig := rainyun.NewDefaultConfig() + rainyunConfig.APIKey = param.APIkey + rainyunConfig.PropagationTimeout = propagationTimeout + rainyunConfig.PollingInterval = pollingInterval + rainyunConfig.TTL = ttl + p, err = rainyun.NewDNSProviderConfig(rainyunConfig) + case Volcengine: + volcConfig := volcengine.NewDefaultConfig() + volcConfig.SecretKey = param.SecretKey + volcConfig.AccessKey = param.AccessKey + volcConfig.PropagationTimeout = propagationTimeout + volcConfig.PollingInterval = pollingInterval + volcConfig.TTL = ttl + p, err = volcengine.NewDNSProviderConfig(volcConfig) + case HuaweiCloud: + huaweiCloudConfig := huaweicloud.NewDefaultConfig() + huaweiCloudConfig.AccessKeyID = param.AccessKey + huaweiCloudConfig.SecretAccessKey = param.SecretKey + huaweiCloudConfig.Region = param.Region + huaweiCloudConfig.PropagationTimeout = propagationTimeout + huaweiCloudConfig.PollingInterval = pollingInterval + huaweiCloudConfig.TTL = int32(ttl) + p, err = huaweicloud.NewDNSProviderConfig(huaweiCloudConfig) + case FreeMyIP: + freeMyIpConfig := freemyip.NewDefaultConfig() + freeMyIpConfig.Token = param.Token + freeMyIpConfig.PropagationTimeout = propagationTimeout + freeMyIpConfig.PollingInterval = pollingInterval + p, err = freemyip.NewDNSProviderConfig(freeMyIpConfig) + case Vercel: + vercelConfig := vercel.NewDefaultConfig() + vercelConfig.AuthToken = param.Token + vercelConfig.PropagationTimeout = propagationTimeout + vercelConfig.PollingInterval = pollingInterval + p, err = vercel.NewDNSProviderConfig(vercelConfig) + case Spaceship: + spaceshipConfig := spaceship.NewDefaultConfig() + spaceshipConfig.APIKey = param.APIkey + spaceshipConfig.APISecret = param.APISecret + spaceshipConfig.PropagationTimeout = propagationTimeout + spaceshipConfig.PollingInterval = pollingInterval + spaceshipConfig.TTL = ttl + p, err = spaceship.NewDNSProviderConfig(spaceshipConfig) + case WestCN: + westcnConfig := westcn.NewDefaultConfig() + westcnConfig.Username = param.Username + westcnConfig.Password = param.Password + westcnConfig.PropagationTimeout = propagationTimeout + westcnConfig.PollingInterval = pollingInterval + westcnConfig.TTL = ttl + p, err = westcn.NewDNSProviderConfig(westcnConfig) + + case ClouDNS: + cloudnsConfig := cloudns.NewDefaultConfig() + cloudnsConfig.AuthID = param.AuthID + cloudnsConfig.SubAuthID = param.SubAuthID + cloudnsConfig.AuthPassword = param.AuthPassword + cloudnsConfig.PropagationTimeout = propagationTimeout + cloudnsConfig.PollingInterval = pollingInterval + cloudnsConfig.TTL = ttl + p, err = cloudns.NewDNSProviderConfig(cloudnsConfig) + } + if err != nil { + return nil, err + } + return p, nil +} diff --git a/frontend/src/components/log/task/index.vue b/frontend/src/components/log/task/index.vue index ceb3368bc..4137e6f67 100644 --- a/frontend/src/components/log/task/index.vue +++ b/frontend/src/components/log/task/index.vue @@ -73,6 +73,7 @@ const handleClose = () => { em('close', true); open.value = false; bus.emit('refreshTask', true); + bus.emit('refreshApp', true); }; defineExpose({ openWithResourceID, openWithTaskID }); diff --git a/frontend/src/views/app-store/apps/index.vue b/frontend/src/views/app-store/apps/index.vue index 1d38c2ecb..db62d9dc6 100644 --- a/frontend/src/views/app-store/apps/index.vue +++ b/frontend/src/views/app-store/apps/index.vue @@ -282,7 +282,7 @@ const searchByName = () => { }; onMounted(async () => { - bus.on('refreshTask', () => { + bus.on('refreshApp', () => { search(req); }); if (router.currentRoute.value.query.install) {