fix: 修改面板设置证书时间显示不一致的问题 (#5267)

This commit is contained in:
ssongliu 2024-06-04 11:41:50 +08:00 committed by GitHub
parent ceca7fade0
commit e638a416ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 22 additions and 8 deletions

View File

@ -303,7 +303,7 @@ type DatabaseUpdate struct {
Address string `json:"address"`
Port uint `json:"port"`
Username string `json:"username" validate:"required"`
Password string `json:"password" validate:"required"`
Password string `json:"password"`
SSL bool `json:"ssl"`
RootCert string `json:"rootCert"`

View File

@ -347,12 +347,18 @@ func (u *SettingService) LoadFromCert() (*dto.SSLInfo, error) {
if err != nil {
return nil, err
}
data, err := loadInfoFromCert()
if err != nil {
return nil, err
}
var data *dto.SSLInfo
switch sslType.Value {
case "self":
data, err = loadInfoFromCert()
if err != nil {
return nil, err
}
case "import":
data, err = loadInfoFromCert()
if err != nil {
return nil, err
}
if _, err := os.Stat(path.Join(global.CONF.System.BaseDir, "1panel/secret/server.crt")); err != nil {
return nil, fmt.Errorf("load server.crt file failed, err: %v", err)
}
@ -370,6 +376,12 @@ func (u *SettingService) LoadFromCert() (*dto.SSLInfo, error) {
return nil, err
}
id, _ := strconv.Atoi(sslID.Value)
ssl, err := websiteSSLRepo.GetFirst(commonRepo.WithByID(uint(id)))
if err != nil {
return nil, err
}
data.Timeout = ssl.ExpireDate.Format("2006-01-02 15:04:05")
data.Domain = ssl.Domains
data.SSLID = uint(id)
}
return data, nil

View File

@ -332,7 +332,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
}
if len(create.FtpUser) != 0 && len(create.FtpPassword) != 0 {
itemID, err := NewIFtpService().Create(dto.FtpCreate{User: create.FtpUser, Password: create.FtpPassword, Path: path.Join(global.CONF.System.BaseDir, "1panel/apps/openresty/openresty/www/sites", create.Alias, "index")})
itemID, err := NewIFtpService().Create(dto.FtpCreate{User: create.FtpUser, Password: create.FtpPassword, Path: path.Join(global.CONF.System.BaseDir, "1panel/apps/openresty/openresty/www/sites", website.Alias, "index")})
if err != nil {
global.LOG.Errorf("create ftp for website failed, err: %v", err)
}

View File

@ -3,6 +3,7 @@ package redis
import (
"fmt"
"github.com/1Panel-dev/1Panel/backend/global"
"github.com/go-redis/redis"
)
@ -20,6 +21,7 @@ func NewRedisClient(conn DBInfo) (*redis.Client, error) {
})
if _, err := client.Ping().Result(); err != nil {
global.LOG.Errorf("check redis conn failed, err: %v", err)
return client, err
}
return client, nil

View File

@ -122,7 +122,7 @@ func (f *Ftp) SetPath(username, path string) error {
if err != nil {
return errors.New(std)
}
std2, err := cmd.Execf("chown %s %s", f.DefaultUser, path)
std2, err := cmd.Execf("chown -R %s:%s %s", f.DefaultUser, f.DefaultGroup, path)
if err != nil {
return errors.New(std2)
}

View File

@ -31,7 +31,7 @@ const hostRouter = {
},
{
path: '/hosts/monitor/setting',
name: 'MonitorSetting',
name: 'HostMonitorSetting',
component: () => import('@/views/host/monitor/setting/index.vue'),
hidden: true,
meta: {