1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 00:09:16 +08:00

fix: 解决网站导入自签证书报错的问题 (#1278)

This commit is contained in:
zhengkunwang223 2023-06-07 16:09:25 +08:00 committed by GitHub
parent 6b3093aa09
commit b7495a63e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 14 deletions

View File

@ -162,7 +162,13 @@ func (a AppService) GetAppDetail(appId uint, version, appType string) (response.
return appDetailDTO, err
}
fileOp := files.NewFileOp()
buildPath := path.Join(constant.AppResourceDir, app.Key, "versions", detail.Version, "build")
versionPath := path.Join(constant.AppResourceDir, app.Resource, app.Key, detail.Version)
if !fileOp.Stat(versionPath) {
if err = downloadApp(app, detail, nil); err != nil {
return appDetailDTO, err
}
}
buildPath := path.Join(versionPath, "build")
paramsPath := path.Join(buildPath, "config.json")
if !fileOp.Stat(paramsPath) {
return appDetailDTO, buserr.New(constant.ErrFileNotExist)

View File

@ -681,7 +681,11 @@ func (w WebsiteService) OpWebsiteHTTPS(ctx context.Context, req request.WebsiteH
websiteSSL.ExpireDate = cert.NotAfter
websiteSSL.StartDate = cert.NotBefore
websiteSSL.Type = cert.Issuer.CommonName
websiteSSL.Organization = cert.Issuer.Organization[0]
if len(cert.Issuer.Organization) > 0 {
websiteSSL.Organization = cert.Issuer.Organization[0]
} else {
websiteSSL.Organization = cert.Issuer.CommonName
}
if len(cert.DNSNames) > 0 {
websiteSSL.PrimaryDomain = cert.DNSNames[0]
websiteSSL.Domains = strings.Join(cert.DNSNames, ",")

View File

@ -213,13 +213,18 @@ const changeApp = (appId: number) => {
};
const changeVersion = () => {
loading.value = true;
initParam.value = false;
GetAppDetail(runtime.value.appId, runtime.value.version, 'runtime').then((res) => {
runtime.value.appDetailId = res.data.id;
runtime.value.image = res.data.image + ':' + runtime.value.version;
appParams.value = res.data.params;
initParam.value = true;
});
GetAppDetail(runtime.value.appId, runtime.value.version, 'runtime')
.then((res) => {
runtime.value.appDetailId = res.data.id;
runtime.value.image = res.data.image + ':' + runtime.value.version;
appParams.value = res.data.params;
initParam.value = true;
})
.finally(() => {
loading.value = false;
});
};
const getApp = (appkey: string, mode: string) => {
@ -228,12 +233,7 @@ const getApp = (appkey: string, mode: string) => {
if (res.data.versions.length > 0) {
runtime.value.version = res.data.versions[0];
if (mode === 'create') {
GetAppDetail(runtime.value.appId, runtime.value.version, 'runtime').then((res) => {
runtime.value.appDetailId = res.data.id;
runtime.value.image = res.data.image + ':' + runtime.value.version;
appParams.value = res.data.params;
initParam.value = true;
});
changeVersion();
} else {
initParam.value = true;
}