feat: add .user.ini for php website (#8782)

This commit is contained in:
CityFun 2025-05-22 15:17:59 +08:00 committed by GitHub
parent 8e808903fc
commit 6bd9bb7c06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 294 additions and 273 deletions

View file

@ -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])
}
}

View file

@ -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 {

View file

@ -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 {

View file

@ -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

View file

@ -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), &param); 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,

View file

@ -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
}

View file

@ -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), &param); 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
}

View file

@ -73,6 +73,7 @@ const handleClose = () => {
em('close', true);
open.value = false;
bus.emit('refreshTask', true);
bus.emit('refreshApp', true);
};
defineExpose({ openWithResourceID, openWithTaskID });

View file

@ -282,7 +282,7 @@ const searchByName = () => {
};
onMounted(async () => {
bus.on('refreshTask', () => {
bus.on('refreshApp', () => {
search(req);
});
if (router.currentRoute.value.query.install) {