mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-01-05 22:54:26 +08:00
feat: 自签证书和手动上传证书增加备注 (#3113)
This commit is contained in:
parent
ed89f8fdd7
commit
7c3c4db81b
10 changed files with 43 additions and 24 deletions
|
|
@ -77,6 +77,7 @@ type WebsiteSSLUpload struct {
|
|||
CertificatePath string `json:"certificatePath"`
|
||||
Type string `json:"type" validate:"required,oneof=paste local"`
|
||||
SSLID uint `json:"sslID"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
type WebsiteCASearch struct {
|
||||
|
|
@ -95,16 +96,17 @@ type WebsiteCACreate struct {
|
|||
}
|
||||
|
||||
type WebsiteCAObtain struct {
|
||||
ID uint `json:"id" validate:"required"`
|
||||
Domains string `json:"domains" validate:"required"`
|
||||
KeyType string `json:"keyType" validate:"required,oneof=P256 P384 2048 3072 4096 8192"`
|
||||
Time int `json:"time" validate:"required"`
|
||||
Unit string `json:"unit" validate:"required"`
|
||||
PushDir bool `json:"pushDir"`
|
||||
Dir string `json:"dir"`
|
||||
AutoRenew bool `json:"autoRenew"`
|
||||
Renew bool `json:"renew"`
|
||||
SSLID uint `json:"sslID"`
|
||||
ID uint `json:"id" validate:"required"`
|
||||
Domains string `json:"domains" validate:"required"`
|
||||
KeyType string `json:"keyType" validate:"required,oneof=P256 P384 2048 3072 4096 8192"`
|
||||
Time int `json:"time" validate:"required"`
|
||||
Unit string `json:"unit" validate:"required"`
|
||||
PushDir bool `json:"pushDir"`
|
||||
Dir string `json:"dir"`
|
||||
AutoRenew bool `json:"autoRenew"`
|
||||
Renew bool `json:"renew"`
|
||||
SSLID uint `json:"sslID"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
type WebsiteCARenew struct {
|
||||
|
|
|
|||
|
|
@ -213,11 +213,12 @@ func (w WebsiteCAService) ObtainSSL(req request.WebsiteCAObtain) (*model.Website
|
|||
return nil, err
|
||||
}
|
||||
websiteSSL = &model.WebsiteSSL{
|
||||
Provider: constant.SelfSigned,
|
||||
KeyType: req.KeyType,
|
||||
PushDir: req.PushDir,
|
||||
CaID: ca.ID,
|
||||
AutoRenew: req.AutoRenew,
|
||||
Provider: constant.SelfSigned,
|
||||
KeyType: req.KeyType,
|
||||
PushDir: req.PushDir,
|
||||
CaID: ca.ID,
|
||||
AutoRenew: req.AutoRenew,
|
||||
Description: req.Description,
|
||||
}
|
||||
if req.PushDir {
|
||||
if !files.NewFileOp().Stat(req.Dir) {
|
||||
|
|
|
|||
|
|
@ -376,7 +376,8 @@ func (w WebsiteSSLService) Update(update request.WebsiteSSLUpdate) error {
|
|||
|
||||
func (w WebsiteSSLService) Upload(req request.WebsiteSSLUpload) error {
|
||||
websiteSSL := &model.WebsiteSSL{
|
||||
Provider: constant.Manual,
|
||||
Provider: constant.Manual,
|
||||
Description: req.Description,
|
||||
}
|
||||
var err error
|
||||
if req.SSLID > 0 {
|
||||
|
|
@ -384,6 +385,7 @@ func (w WebsiteSSLService) Upload(req request.WebsiteSSLUpload) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
websiteSSL.Description = req.Description
|
||||
}
|
||||
if req.Type == "local" {
|
||||
fileOp := files.NewFileOp()
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ var UpdateAcmeAccount = &gormigrate.Migration{
|
|||
}
|
||||
|
||||
var AddWebsiteCA = &gormigrate.Migration{
|
||||
ID: "20231125-add-website-ca",
|
||||
ID: "20231130-add-website-ca",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
if err := tx.AutoMigrate(&model.WebsiteCA{}); err != nil {
|
||||
return err
|
||||
|
|
@ -59,7 +59,7 @@ var AddDatabaseSSL = &gormigrate.Migration{
|
|||
}
|
||||
|
||||
var AddDefaultCA = &gormigrate.Migration{
|
||||
ID: "20231129-add-default-ca",
|
||||
ID: "20231130-add-default-ca",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
caService := service.NewIWebsiteCAService()
|
||||
if _, err := caService.Create(request.WebsiteCACreate{
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@ export namespace Website {
|
|||
unit: string;
|
||||
pushDir: boolean;
|
||||
dir: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
export interface RenewSSLByCA {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
</template>
|
||||
<div v-loading="loading">
|
||||
<el-radio-group v-model="curr">
|
||||
<el-radio-button label="detail">{{ $t('ssl.msg') }}</el-radio-button>
|
||||
<el-radio-button label="detail">{{ $t('ssl.organizationDetail') }}</el-radio-button>
|
||||
<el-radio-button label="ssl">csr</el-radio-button>
|
||||
<el-radio-button label="key">{{ $t('ssl.key') }}</el-radio-button>
|
||||
</el-radio-group>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
:placeholder="$t('ssl.domainHelper')"
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.remark')" prop="description">
|
||||
<el-input v-model="obtain.description"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.keyType')" prop="keyType">
|
||||
<el-select v-model="obtain.keyType">
|
||||
<el-option
|
||||
|
|
@ -97,6 +100,7 @@ const initData = () => ({
|
|||
pushDir: false,
|
||||
dir: '',
|
||||
autoRenew: true,
|
||||
description: '',
|
||||
});
|
||||
const obtain = ref(initData());
|
||||
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ const buttons = [
|
|||
{
|
||||
label: i18n.global.t('commons.operate.update'),
|
||||
click: function (row: Website.SSLDTO) {
|
||||
sslUploadRef.value.acceptParams(row.id);
|
||||
sslUploadRef.value.acceptParams(row);
|
||||
},
|
||||
show: function (row: Website.SSLDTO) {
|
||||
return row.provider == 'manual';
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@
|
|||
</el-input>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item :label="$t('website.remark')" prop="description">
|
||||
<el-input v-model="ssl.description"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
|
@ -58,6 +61,7 @@ import i18n from '@/lang';
|
|||
import { FormInstance } from 'element-plus';
|
||||
import { ref } from 'vue';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { Website } from '@/api/interface/website';
|
||||
|
||||
const open = ref(false);
|
||||
const loading = ref(false);
|
||||
|
|
@ -77,6 +81,7 @@ const initData = () => ({
|
|||
certificatePath: '',
|
||||
type: 'paste',
|
||||
sslID: 0,
|
||||
description: '',
|
||||
});
|
||||
const ssl = ref(initData());
|
||||
|
||||
|
|
@ -91,10 +96,11 @@ const resetForm = () => {
|
|||
ssl.value = initData();
|
||||
};
|
||||
|
||||
const acceptParams = (id: number) => {
|
||||
const acceptParams = (websiteSSL: Website.SSLDTO) => {
|
||||
resetForm();
|
||||
if (id && id > 0) {
|
||||
ssl.value.sslID = id;
|
||||
if (websiteSSL && websiteSSL.id > 0) {
|
||||
ssl.value.sslID = websiteSSL.id;
|
||||
ssl.value.description = websiteSSL.description;
|
||||
}
|
||||
open.value = true;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<el-form-item :label="' '" v-if="websiteSSL && websiteSSL.id > 0">
|
||||
<el-descriptions :column="5" border direction="vertical">
|
||||
<el-descriptions :column="6" border direction="vertical">
|
||||
<el-descriptions-item :label="$t('website.primaryDomain')">
|
||||
{{ websiteSSL.primaryDomain }}
|
||||
</el-descriptions-item>
|
||||
|
|
@ -110,6 +110,9 @@
|
|||
<el-descriptions-item :label="$t('website.expireDate')">
|
||||
{{ dateFormatSimple(websiteSSL.expireDate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="$t('website.remark')">
|
||||
{{ websiteSSL.description }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-form-item>
|
||||
<el-divider content-position="left">{{ $t('website.SSLProConfig') }}</el-divider>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue