mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
fix: 修改面板设置证书时间显示不一致的问题 (#5267)
This commit is contained in:
parent
ceca7fade0
commit
e638a416ff
@ -303,7 +303,7 @@ type DatabaseUpdate struct {
|
|||||||
Address string `json:"address"`
|
Address string `json:"address"`
|
||||||
Port uint `json:"port"`
|
Port uint `json:"port"`
|
||||||
Username string `json:"username" validate:"required"`
|
Username string `json:"username" validate:"required"`
|
||||||
Password string `json:"password" validate:"required"`
|
Password string `json:"password"`
|
||||||
|
|
||||||
SSL bool `json:"ssl"`
|
SSL bool `json:"ssl"`
|
||||||
RootCert string `json:"rootCert"`
|
RootCert string `json:"rootCert"`
|
||||||
|
@ -347,12 +347,18 @@ func (u *SettingService) LoadFromCert() (*dto.SSLInfo, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
data, err := loadInfoFromCert()
|
var data *dto.SSLInfo
|
||||||
|
switch sslType.Value {
|
||||||
|
case "self":
|
||||||
|
data, err = loadInfoFromCert()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
switch sslType.Value {
|
|
||||||
case "import":
|
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 {
|
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)
|
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
|
return nil, err
|
||||||
}
|
}
|
||||||
id, _ := strconv.Atoi(sslID.Value)
|
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)
|
data.SSLID = uint(id)
|
||||||
}
|
}
|
||||||
return data, nil
|
return data, nil
|
||||||
|
@ -332,7 +332,7 @@ func (w WebsiteService) CreateWebsite(create request.WebsiteCreate) (err error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(create.FtpUser) != 0 && len(create.FtpPassword) != 0 {
|
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 {
|
if err != nil {
|
||||||
global.LOG.Errorf("create ftp for website failed, err: %v", err)
|
global.LOG.Errorf("create ftp for website failed, err: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package redis
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/1Panel-dev/1Panel/backend/global"
|
||||||
"github.com/go-redis/redis"
|
"github.com/go-redis/redis"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -20,6 +21,7 @@ func NewRedisClient(conn DBInfo) (*redis.Client, error) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if _, err := client.Ping().Result(); err != nil {
|
if _, err := client.Ping().Result(); err != nil {
|
||||||
|
global.LOG.Errorf("check redis conn failed, err: %v", err)
|
||||||
return client, err
|
return client, err
|
||||||
}
|
}
|
||||||
return client, nil
|
return client, nil
|
||||||
|
@ -122,7 +122,7 @@ func (f *Ftp) SetPath(username, path string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.New(std)
|
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 {
|
if err != nil {
|
||||||
return errors.New(std2)
|
return errors.New(std2)
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ const hostRouter = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/hosts/monitor/setting',
|
path: '/hosts/monitor/setting',
|
||||||
name: 'MonitorSetting',
|
name: 'HostMonitorSetting',
|
||||||
component: () => import('@/views/host/monitor/setting/index.vue'),
|
component: () => import('@/views/host/monitor/setting/index.vue'),
|
||||||
hidden: true,
|
hidden: true,
|
||||||
meta: {
|
meta: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user