From b63dbe1e5004714a42ba909d068353162832b88c Mon Sep 17 00:00:00 2001 From: Jacky Date: Sat, 19 Apr 2025 17:55:17 +0800 Subject: [PATCH] refactor: refresh 25.04 --- api/certificate/certificate.go | 289 ++++++------ api/config/rename.go | 6 + app/components.d.ts | 19 + app/package.json | 1 + app/pnpm-lock.yaml | 125 +++++ app/src/api/auto_cert.ts | 7 +- app/src/api/cert.ts | 3 +- app/src/api/template.ts | 6 +- .../AutoCertForm/AutoCertForm.vue} | 15 +- .../AutoCertForm}/DNSChallenge.vue | 0 app/src/components/AutoCertForm/index.ts | 3 + .../cert => components/CertInfo}/CertInfo.vue | 0 app/src/components/CertInfo/index.ts | 3 + app/src/components/ChatGPT/ChatGPT.vue | 2 +- app/src/components/ChatGPT/index.ts | 3 + app/src/components/CodeEditor/CodeEditor.vue | 5 +- .../NgxConfigEditor/LocationEditor.vue | 180 ++++++++ .../NgxConfigEditor}/LogEntry.vue | 15 +- .../NgxConfigEditor}/NginxStatusAlert.vue | 0 .../NgxConfigEditor/NgxConfigEditor.vue | 73 +++ .../components/NgxConfigEditor/NgxServer.vue | 121 +++++ .../NgxConfigEditor}/NgxUpstream.vue | 71 +-- app/src/components/NgxConfigEditor/README.md | 3 + .../directive/DirectiveAdd.vue | 49 +- .../directive/DirectiveDocuments.vue | 29 ++ .../directive/DirectiveEditor.vue | 80 ++++ .../directive/DirectiveEditorItem.vue | 49 +- .../NgxConfigEditor/directive/index.ts | 2 + .../NgxConfigEditor/directive/store.ts | 21 + app/src/components/NgxConfigEditor/index.ts | 28 ++ app/src/components/NgxConfigEditor/store.ts | 69 +++ app/src/constants/index.ts | 8 + app/src/language/ar/app.po | 404 +++++++++-------- app/src/language/de_DE/app.po | 406 +++++++++-------- app/src/language/en/app.po | 389 ++++++++-------- app/src/language/es/app.po | 409 +++++++++-------- app/src/language/fr_FR/app.po | 397 ++++++++-------- app/src/language/ko_KR/app.po | 393 ++++++++-------- app/src/language/messages.pot | 381 ++++++++-------- app/src/language/ru_RU/app.po | 394 ++++++++-------- app/src/language/tr_TR/app.po | 393 ++++++++-------- app/src/language/uk_UA/app.po | 389 ++++++++-------- app/src/language/vi_VN/app.po | 392 ++++++++-------- app/src/language/zh_CN/app.po | 428 +++++++++--------- app/src/language/zh_TW/app.po | 402 ++++++++-------- app/src/version.json | 2 +- .../components/CertificateEditor.vue | 8 +- .../certificate/components/RenewCert.vue | 6 +- .../components/WildcardCertificate.vue | 8 +- app/src/views/preference/ServerSettings.vue | 2 +- app/src/views/site/cert/IssueCert.vue | 78 ---- .../views/site/ngx_conf/LocationEditor.vue | 178 -------- .../views/site/ngx_conf/NgxConfigEditor.vue | 219 --------- app/src/views/site/ngx_conf/NgxServer.vue | 175 ------- .../config_template/ConfigTemplate.vue | 163 ------- .../ngx_conf/directive/DirectiveDocuments.vue | 28 -- .../ngx_conf/directive/DirectiveEditor.vue | 68 --- app/src/views/site/ngx_conf/index.ts | 1 - app/src/views/site/site_add/SiteAdd.vue | 66 +-- .../views/site/site_edit/RightSettings.vue | 133 ------ app/src/views/site/site_edit/SiteEdit.vue | 380 ++-------------- .../components/Cert}/Cert.vue | 25 +- .../components/Cert}/ChangeCert.vue | 0 .../site_edit/components/Cert/IssueCert.vue | 103 +++++ .../components/Cert}/ObtainCert.vue | 91 ++-- .../components/Cert}/ObtainCertLive.vue | 6 +- .../site/site_edit/components/Cert/index.ts | 3 + .../{ => ConfigName}/ConfigName.vue | 0 .../site_edit/components/ConfigName/index.ts | 3 + .../ConfigTemplate/ConfigTemplate.vue | 125 +++++ .../ConfigTemplate}/TemplateForm.vue | 2 +- .../ConfigTemplate}/TemplateFormItem.vue | 14 +- .../components/ConfigTemplate/index.ts | 3 + .../components/ConfigTemplate/store.ts | 26 ++ .../components/EnableTLS/EnableTLS.vue | 120 +++++ .../site_edit/components/EnableTLS/index.ts | 3 + .../site_edit/components/RightPanel/Basic.vue | 92 ++++ .../site_edit/components/RightPanel/Chat.vue | 31 ++ .../components/RightPanel/ConfigTemplate.vue | 9 + .../components/RightPanel/RightPanel.vue | 72 +++ .../site_edit/components/RightPanel/index.ts | 3 + .../components/SiteEditor/SiteEditor.vue | 214 +++++++++ .../site_edit/components/SiteEditor/index.ts | 4 + .../site_edit/components/SiteEditor/store.ts | 174 +++++++ app/src/views/stream/StreamEdit.vue | 296 +----------- .../views/stream/components/ConfigName.vue | 2 +- .../stream/components/RightPanel/Basic.vue | 116 +++++ .../stream/components/RightPanel/Chat.vue | 17 + .../components/RightPanel/RightPanel.vue | 54 +++ .../stream/components/RightPanel/index.ts | 3 + .../views/stream/components/RightSettings.vue | 166 ------- .../views/stream/components/StreamEditor.vue | 135 ++++++ app/src/views/stream/store.ts | 160 +++++++ app/vite.config.ts | 2 + internal/site/rename.go | 11 + internal/stream/rename.go | 20 +- template/block/letsencrypt.conf | 2 +- template/block/nginx-ui.conf | 16 +- 98 files changed, 5283 insertions(+), 4817 deletions(-) rename app/src/{views/site/cert/components/AutoCertStepOne.vue => components/AutoCertForm/AutoCertForm.vue} (91%) rename app/src/{views/site/cert/components => components/AutoCertForm}/DNSChallenge.vue (100%) create mode 100644 app/src/components/AutoCertForm/index.ts rename app/src/{views/site/cert => components/CertInfo}/CertInfo.vue (100%) create mode 100644 app/src/components/CertInfo/index.ts create mode 100644 app/src/components/ChatGPT/index.ts create mode 100644 app/src/components/NgxConfigEditor/LocationEditor.vue rename app/src/{views/site/ngx_conf => components/NgxConfigEditor}/LogEntry.vue (83%) rename app/src/{views/site/ngx_conf => components/NgxConfigEditor}/NginxStatusAlert.vue (100%) create mode 100644 app/src/components/NgxConfigEditor/NgxConfigEditor.vue create mode 100644 app/src/components/NgxConfigEditor/NgxServer.vue rename app/src/{views/site/ngx_conf => components/NgxConfigEditor}/NgxUpstream.vue (68%) create mode 100644 app/src/components/NgxConfigEditor/README.md rename app/src/{views/site/ngx_conf => components/NgxConfigEditor}/directive/DirectiveAdd.vue (67%) create mode 100644 app/src/components/NgxConfigEditor/directive/DirectiveDocuments.vue create mode 100644 app/src/components/NgxConfigEditor/directive/DirectiveEditor.vue rename app/src/{views/site/ngx_conf => components/NgxConfigEditor}/directive/DirectiveEditorItem.vue (73%) create mode 100644 app/src/components/NgxConfigEditor/directive/index.ts create mode 100644 app/src/components/NgxConfigEditor/directive/store.ts create mode 100644 app/src/components/NgxConfigEditor/index.ts create mode 100644 app/src/components/NgxConfigEditor/store.ts delete mode 100644 app/src/views/site/cert/IssueCert.vue delete mode 100644 app/src/views/site/ngx_conf/LocationEditor.vue delete mode 100644 app/src/views/site/ngx_conf/NgxConfigEditor.vue delete mode 100644 app/src/views/site/ngx_conf/NgxServer.vue delete mode 100644 app/src/views/site/ngx_conf/config_template/ConfigTemplate.vue delete mode 100644 app/src/views/site/ngx_conf/directive/DirectiveDocuments.vue delete mode 100644 app/src/views/site/ngx_conf/directive/DirectiveEditor.vue delete mode 100644 app/src/views/site/ngx_conf/index.ts delete mode 100644 app/src/views/site/site_edit/RightSettings.vue rename app/src/views/site/{cert => site_edit/components/Cert}/Cert.vue (76%) rename app/src/views/site/{cert/components/ChangeCert => site_edit/components/Cert}/ChangeCert.vue (100%) create mode 100644 app/src/views/site/site_edit/components/Cert/IssueCert.vue rename app/src/views/site/{cert/components => site_edit/components/Cert}/ObtainCert.vue (66%) rename app/src/views/site/{cert/components => site_edit/components/Cert}/ObtainCertLive.vue (94%) create mode 100644 app/src/views/site/site_edit/components/Cert/index.ts rename app/src/views/site/site_edit/components/{ => ConfigName}/ConfigName.vue (100%) create mode 100644 app/src/views/site/site_edit/components/ConfigName/index.ts create mode 100644 app/src/views/site/site_edit/components/ConfigTemplate/ConfigTemplate.vue rename app/src/views/site/{ngx_conf/config_template => site_edit/components/ConfigTemplate}/TemplateForm.vue (81%) rename app/src/views/site/{ngx_conf/config_template => site_edit/components/ConfigTemplate}/TemplateFormItem.vue (80%) create mode 100644 app/src/views/site/site_edit/components/ConfigTemplate/index.ts create mode 100644 app/src/views/site/site_edit/components/ConfigTemplate/store.ts create mode 100644 app/src/views/site/site_edit/components/EnableTLS/EnableTLS.vue create mode 100644 app/src/views/site/site_edit/components/EnableTLS/index.ts create mode 100644 app/src/views/site/site_edit/components/RightPanel/Basic.vue create mode 100644 app/src/views/site/site_edit/components/RightPanel/Chat.vue create mode 100644 app/src/views/site/site_edit/components/RightPanel/ConfigTemplate.vue create mode 100644 app/src/views/site/site_edit/components/RightPanel/RightPanel.vue create mode 100644 app/src/views/site/site_edit/components/RightPanel/index.ts create mode 100644 app/src/views/site/site_edit/components/SiteEditor/SiteEditor.vue create mode 100644 app/src/views/site/site_edit/components/SiteEditor/index.ts create mode 100644 app/src/views/site/site_edit/components/SiteEditor/store.ts create mode 100644 app/src/views/stream/components/RightPanel/Basic.vue create mode 100644 app/src/views/stream/components/RightPanel/Chat.vue create mode 100644 app/src/views/stream/components/RightPanel/RightPanel.vue create mode 100644 app/src/views/stream/components/RightPanel/index.ts delete mode 100644 app/src/views/stream/components/RightSettings.vue create mode 100644 app/src/views/stream/components/StreamEditor.vue create mode 100644 app/src/views/stream/store.ts diff --git a/api/certificate/certificate.go b/api/certificate/certificate.go index ceab0d0b..18de621b 100644 --- a/api/certificate/certificate.go +++ b/api/certificate/certificate.go @@ -57,21 +57,25 @@ func Transformer(certModel *model.Cert) (certificate *APICertificate) { } func GetCertList(c *gin.Context) { - cosy.Core[model.Cert](c).SetFussy("name", "domain").SetTransformer(func(m *model.Cert) any { - - info, _ := cert.GetCertInfo(m.SSLCertificatePath) - - return APICertificate{ - Cert: m, - CertificateInfo: info, - } - }).PagingList() + cosy.Core[model.Cert](c).SetFussy("name", "domain"). + SetTransformer(func(m *model.Cert) any { + info, _ := cert.GetCertInfo(m.SSLCertificatePath) + return APICertificate{ + Cert: m, + CertificateInfo: info, + } + }).PagingList() } func GetCert(c *gin.Context) { q := query.Cert - certModel, err := q.FirstByID(cast.ToUint64(c.Param("id"))) + id := cast.ToUint64(c.Param("id")) + if contextId, ok := c.Get("id"); ok { + id = cast.ToUint64(contextId) + } + + certModel, err := q.FirstByID(id) if err != nil { cosy.ErrHandler(c, err) @@ -81,167 +85,128 @@ func GetCert(c *gin.Context) { c.JSON(http.StatusOK, Transformer(certModel)) } -type certJson struct { - Name string `json:"name" binding:"required"` - SSLCertificatePath string `json:"ssl_certificate_path" binding:"required,certificate_path"` - SSLCertificateKeyPath string `json:"ssl_certificate_key_path" binding:"required,privatekey_path"` - SSLCertificate string `json:"ssl_certificate" binding:"omitempty,certificate"` - SSLCertificateKey string `json:"ssl_certificate_key" binding:"omitempty,privatekey"` - KeyType certcrypto.KeyType `json:"key_type" binding:"omitempty,auto_cert_key_type"` - ChallengeMethod string `json:"challenge_method"` - DnsCredentialID uint64 `json:"dns_credential_id"` - ACMEUserID uint64 `json:"acme_user_id"` - SyncNodeIds []uint64 `json:"sync_node_ids"` - RevokeOld bool `json:"revoke_old"` -} - func AddCert(c *gin.Context) { - var json certJson - - if !cosy.BindAndValid(c, &json) { - return - } - - certModel := &model.Cert{ - Name: json.Name, - SSLCertificatePath: json.SSLCertificatePath, - SSLCertificateKeyPath: json.SSLCertificateKeyPath, - KeyType: json.KeyType, - ChallengeMethod: json.ChallengeMethod, - DnsCredentialID: json.DnsCredentialID, - ACMEUserID: json.ACMEUserID, - SyncNodeIds: json.SyncNodeIds, - } - - err := certModel.Insert() - if err != nil { - cosy.ErrHandler(c, err) - return - } - - content := &cert.Content{ - SSLCertificatePath: json.SSLCertificatePath, - SSLCertificateKeyPath: json.SSLCertificateKeyPath, - SSLCertificate: json.SSLCertificate, - SSLCertificateKey: json.SSLCertificateKey, - } - - err = content.WriteFile() - if err != nil { - cosy.ErrHandler(c, err) - return - } - - // Detect and set certificate type - if len(json.SSLCertificate) > 0 { - keyType, err := cert.GetKeyType(json.SSLCertificate) - if err == nil && keyType != "" { - // Set KeyType based on certificate type - switch keyType { - case "2048": - certModel.KeyType = certcrypto.RSA2048 - case "3072": - certModel.KeyType = certcrypto.RSA3072 - case "4096": - certModel.KeyType = certcrypto.RSA4096 - case "P256": - certModel.KeyType = certcrypto.EC256 - case "P384": - certModel.KeyType = certcrypto.EC384 + cosy.Core[model.Cert](c). + SetValidRules(gin.H{ + "name": "omitempty", + "ssl_certificate_path": "required,certificate_path", + "ssl_certificate_key_path": "required,privatekey_path", + "ssl_certificate": "omitempty,certificate", + "ssl_certificate_key": "omitempty,privatekey", + "key_type": "omitempty,auto_cert_key_type", + "challenge_method": "omitempty,oneof=http01 dns01", + "dns_credential_id": "omitempty", + "acme_user_id": "omitempty", + "sync_node_ids": "omitempty", + "must_staple": "omitempty", + "lego_disable_cname_support": "omitempty", + "revoke_old": "omitempty", + }). + BeforeExecuteHook(func(ctx *cosy.Ctx[model.Cert]) { + sslCertificate := ctx.Payload["ssl_certificate"].(string) + // Detect and set certificate type + if sslCertificate != "" { + keyType, err := cert.GetKeyType(sslCertificate) + if err == nil && keyType != "" { + // Set KeyType based on certificate type + switch keyType { + case "2048": + ctx.Model.KeyType = certcrypto.RSA2048 + case "3072": + ctx.Model.KeyType = certcrypto.RSA3072 + case "4096": + ctx.Model.KeyType = certcrypto.RSA4096 + case "P256": + ctx.Model.KeyType = certcrypto.EC256 + case "P384": + ctx.Model.KeyType = certcrypto.EC384 + } + } } - // Update certificate model - err = certModel.Updates(&model.Cert{KeyType: certModel.KeyType}) + }). + ExecutedHook(func(ctx *cosy.Ctx[model.Cert]) { + content := &cert.Content{ + SSLCertificatePath: ctx.Model.SSLCertificatePath, + SSLCertificateKeyPath: ctx.Model.SSLCertificateKeyPath, + SSLCertificate: ctx.Payload["ssl_certificate"].(string), + SSLCertificateKey: ctx.Payload["ssl_certificate_key"].(string), + } + err := content.WriteFile() if err != nil { - notification.Error("Update Certificate Type Error", err.Error(), nil) + ctx.AbortWithError(err) + return } - } - } - - err = cert.SyncToRemoteServer(certModel) - if err != nil { - notification.Error("Sync Certificate Error", err.Error(), nil) - return - } - - c.JSON(http.StatusOK, Transformer(certModel)) + err = cert.SyncToRemoteServer(&ctx.Model) + if err != nil { + notification.Error("Sync Certificate Error", err.Error(), nil) + return + } + ctx.Context.Set("id", ctx.Model.ID) + }). + SetNextHandler(GetCert). + Create() } func ModifyCert(c *gin.Context) { - id := cast.ToUint64(c.Param("id")) - - var json certJson - - if !cosy.BindAndValid(c, &json) { - return - } - - q := query.Cert - - certModel, err := q.FirstByID(id) - if err != nil { - cosy.ErrHandler(c, err) - return - } - - // Create update data object - updateData := &model.Cert{ - Name: json.Name, - SSLCertificatePath: json.SSLCertificatePath, - SSLCertificateKeyPath: json.SSLCertificateKeyPath, - ChallengeMethod: json.ChallengeMethod, - KeyType: json.KeyType, - DnsCredentialID: json.DnsCredentialID, - ACMEUserID: json.ACMEUserID, - SyncNodeIds: json.SyncNodeIds, - RevokeOld: json.RevokeOld, - } - - content := &cert.Content{ - SSLCertificatePath: json.SSLCertificatePath, - SSLCertificateKeyPath: json.SSLCertificateKeyPath, - SSLCertificate: json.SSLCertificate, - SSLCertificateKey: json.SSLCertificateKey, - } - - err = content.WriteFile() - if err != nil { - cosy.ErrHandler(c, err) - return - } - - // Detect and set certificate type - if len(json.SSLCertificate) > 0 { - keyType, err := cert.GetKeyType(json.SSLCertificate) - if err == nil && keyType != "" { - // Set KeyType based on certificate type - switch keyType { - case "2048": - updateData.KeyType = certcrypto.RSA2048 - case "3072": - updateData.KeyType = certcrypto.RSA3072 - case "4096": - updateData.KeyType = certcrypto.RSA4096 - case "P256": - updateData.KeyType = certcrypto.EC256 - case "P384": - updateData.KeyType = certcrypto.EC384 + cosy.Core[model.Cert](c). + SetValidRules(gin.H{ + "name": "omitempty", + "ssl_certificate_path": "required,certificate_path", + "ssl_certificate_key_path": "required,privatekey_path", + "ssl_certificate": "omitempty,certificate", + "ssl_certificate_key": "omitempty,privatekey", + "key_type": "omitempty,auto_cert_key_type", + "challenge_method": "omitempty,oneof=http01 dns01", + "dns_credential_id": "omitempty", + "acme_user_id": "omitempty", + "sync_node_ids": "omitempty", + "must_staple": "omitempty", + "lego_disable_cname_support": "omitempty", + "revoke_old": "omitempty", + }). + BeforeExecuteHook(func(ctx *cosy.Ctx[model.Cert]) { + sslCertificate := ctx.Payload["ssl_certificate"].(string) + // Detect and set certificate type + if sslCertificate != "" { + keyType, err := cert.GetKeyType(sslCertificate) + if err == nil && keyType != "" { + // Set KeyType based on certificate type + switch keyType { + case "2048": + ctx.Model.KeyType = certcrypto.RSA2048 + case "3072": + ctx.Model.KeyType = certcrypto.RSA3072 + case "4096": + ctx.Model.KeyType = certcrypto.RSA4096 + case "P256": + ctx.Model.KeyType = certcrypto.EC256 + case "P384": + ctx.Model.KeyType = certcrypto.EC384 + } + } + } + }). + ExecutedHook(func(ctx *cosy.Ctx[model.Cert]) { + content := &cert.Content{ + SSLCertificatePath: ctx.Model.SSLCertificatePath, + SSLCertificateKeyPath: ctx.Model.SSLCertificateKeyPath, + SSLCertificate: ctx.Payload["ssl_certificate"].(string), + SSLCertificateKey: ctx.Payload["ssl_certificate_key"].(string), + } + err := content.WriteFile() + if err != nil { + ctx.AbortWithError(err) + return + } + err = cert.SyncToRemoteServer(&ctx.Model) + if err != nil { + notification.Error("Sync Certificate Error", err.Error(), nil) + return } - } - } - err = certModel.Updates(updateData) - if err != nil { - cosy.ErrHandler(c, err) - return - } - - err = cert.SyncToRemoteServer(certModel) - if err != nil { - notification.Error("Sync Certificate Error", err.Error(), nil) - return - } - - GetCert(c) + }). + SetNextHandler(GetCert). + Modify() } func RemoveCert(c *gin.Context) { diff --git a/api/config/rename.go b/api/config/rename.go index e81a8d12..4231aeb9 100644 --- a/api/config/rename.go +++ b/api/config/rename.go @@ -110,6 +110,12 @@ func Rename(c *gin.Context) { return } + b := query.ConfigBackup + _, _ = b.Where(b.FilePath.Eq(origFullPath)).Updates(map[string]interface{}{ + "filepath": newFullPath, + "name": json.NewName, + }) + if len(json.SyncNodeIds) > 0 { err = config.SyncRenameOnRemoteServer(origFullPath, newFullPath, json.SyncNodeIds) if err != nil { diff --git a/app/components.d.ts b/app/components.d.ts index ebd20dba..ce0ef936 100644 --- a/app/components.d.ts +++ b/app/components.d.ts @@ -72,7 +72,11 @@ declare module 'vue' { ATextarea: typeof import('ant-design-vue/es')['Textarea'] ATooltip: typeof import('ant-design-vue/es')['Tooltip'] AUploadDragger: typeof import('ant-design-vue/es')['UploadDragger'] + AutoCertFormAutoCertForm: typeof import('./src/components/AutoCertForm/AutoCertForm.vue')['default'] + AutoCertFormDNSChallenge: typeof import('./src/components/AutoCertForm/DNSChallenge.vue')['default'] BreadcrumbBreadcrumb: typeof import('./src/components/Breadcrumb/Breadcrumb.vue')['default'] + CertInfoCertInfo: typeof import('./src/components/CertInfo/CertInfo.vue')['default'] + ChangeCertChangeCert: typeof import('./src/views/site/NgxConfigEditor/cert/ChangeCert.vue')['default'] ChartAreaChart: typeof import('./src/components/Chart/AreaChart.vue')['default'] ChartRadialBarChart: typeof import('./src/components/Chart/RadialBarChart.vue')['default'] ChartUsageProgressLine: typeof import('./src/components/Chart/UsageProgressLine.vue')['default'] @@ -86,6 +90,21 @@ declare module 'vue' { ICPICP: typeof import('./src/components/ICP/ICP.vue')['default'] LogoLogo: typeof import('./src/components/Logo/Logo.vue')['default'] NginxControlNginxControl: typeof import('./src/components/NginxControl/NginxControl.vue')['default'] + NgxConfigEditorCertCert: typeof import('./src/components/NgxConfigEditor/cert/Cert.vue')['default'] + NgxConfigEditorCertChangeCert: typeof import('./src/components/NgxConfigEditor/cert/ChangeCert.vue')['default'] + NgxConfigEditorCertIssueCert: typeof import('./src/components/NgxConfigEditor/cert/IssueCert.vue')['default'] + NgxConfigEditorCertObtainCert: typeof import('./src/components/NgxConfigEditor/cert/ObtainCert.vue')['default'] + NgxConfigEditorCertObtainCertLive: typeof import('./src/components/NgxConfigEditor/cert/ObtainCertLive.vue')['default'] + NgxConfigEditorDirectiveDirectiveAdd: typeof import('./src/components/NgxConfigEditor/directive/DirectiveAdd.vue')['default'] + NgxConfigEditorDirectiveDirectiveDocuments: typeof import('./src/components/NgxConfigEditor/directive/DirectiveDocuments.vue')['default'] + NgxConfigEditorDirectiveDirectiveEditor: typeof import('./src/components/NgxConfigEditor/directive/DirectiveEditor.vue')['default'] + NgxConfigEditorDirectiveDirectiveEditorItem: typeof import('./src/components/NgxConfigEditor/directive/DirectiveEditorItem.vue')['default'] + NgxConfigEditorLocationEditor: typeof import('./src/components/NgxConfigEditor/LocationEditor.vue')['default'] + NgxConfigEditorLogEntry: typeof import('./src/components/NgxConfigEditor/LogEntry.vue')['default'] + NgxConfigEditorNginxStatusAlert: typeof import('./src/components/NgxConfigEditor/NginxStatusAlert.vue')['default'] + NgxConfigEditorNgxConfigEditor: typeof import('./src/components/NgxConfigEditor/NgxConfigEditor.vue')['default'] + NgxConfigEditorNgxServer: typeof import('./src/components/NgxConfigEditor/NgxServer.vue')['default'] + NgxConfigEditorNgxUpstream: typeof import('./src/components/NgxConfigEditor/NgxUpstream.vue')['default'] NodeSelectorNodeSelector: typeof import('./src/components/NodeSelector/NodeSelector.vue')['default'] NotificationNotification: typeof import('./src/components/Notification/Notification.vue')['default'] OTPInputOTPInput: typeof import('./src/components/OTPInput/OTPInput.vue')['default'] diff --git a/app/package.json b/app/package.json index a7789ee9..09403fda 100644 --- a/app/package.json +++ b/app/package.json @@ -80,6 +80,7 @@ "unplugin-vue-components": "^28.5.0", "unplugin-vue-define-options": "^1.5.5", "vite": "^6.3.2", + "vite-plugin-inspect": "^11.0.1", "vite-svg-loader": "^5.1.0", "vue-tsc": "^2.2.8" } diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 0e099f45..315f48d9 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -204,6 +204,9 @@ importers: vite: specifier: ^6.3.2 version: 6.3.2(@types/node@22.14.1)(jiti@2.4.2)(less@4.3.0)(tsx@4.19.2)(yaml@2.7.1) + vite-plugin-inspect: + specifier: ^11.0.1 + version: 11.0.1(@nuxt/kit@3.16.2)(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(less@4.3.0)(tsx@4.19.2)(yaml@2.7.1)) vite-svg-loader: specifier: ^5.1.0 version: 5.1.0(vue@3.5.13(typescript@5.8.2)) @@ -1668,6 +1671,10 @@ packages: resolution: {integrity: sha512-bkXY9WsVpY7CvMhKSR6pZilZu9Ln5WDrKVBUXf2S443etkmEO4V58heTecXcUIsNsi4Rx8JUO4NfX1IcQl4deg==} engines: {node: '>=18.20'} + bundle-name@4.1.0: + resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==} + engines: {node: '>=18'} + bytes@3.1.2: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} engines: {node: '>= 0.8'} @@ -1908,10 +1915,22 @@ packages: deep-pick-omit@1.2.1: resolution: {integrity: sha512-2J6Kc/m3irCeqVG42T+SaUMesaK7oGWaedGnQQK/+O0gYc+2SP5bKh/KKTE7d7SJ+GCA9UUE1GRzh6oDe0EnGw==} + default-browser-id@5.0.0: + resolution: {integrity: sha512-A6p/pu/6fyBcA1TRz/GqWYPViplrftcW2gZC9q79ngNCKAeR/X3gcEdXQHl4KNXV+3wgIJ1CPkJQ3IHM6lcsyA==} + engines: {node: '>=18'} + + default-browser@5.2.1: + resolution: {integrity: sha512-WY/3TUME0x3KPYdRRxEJJvXRHV4PyPoUsxtZa78lwItwRQRHhd2U9xOscaT/YTf8uCXIAjeJOFBVEh/7FtD8Xg==} + engines: {node: '>=18'} + define-data-property@1.1.4: resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} engines: {node: '>= 0.4'} + define-lazy-prop@3.0.0: + resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} + engines: {node: '>=12'} + define-properties@1.2.1: resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} engines: {node: '>= 0.4'} @@ -2010,6 +2029,9 @@ packages: error-ex@1.3.2: resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} + error-stack-parser-es@1.0.5: + resolution: {integrity: sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==} + errx@0.1.0: resolution: {integrity: sha512-fZmsRiDNv07K6s2KkKFTiD2aIvECa7++PKyD5NC32tpRw46qZA3sOz+aM+/V9V0GDHxVTKLziveV4JhzBHDp9Q==} @@ -2605,6 +2627,11 @@ packages: resolution: {integrity: sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==} engines: {node: '>= 0.4'} + is-docker@3.0.0: + resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + hasBin: true + is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -2625,6 +2652,11 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} + is-inside-container@1.0.0: + resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} + engines: {node: '>=14.16'} + hasBin: true + is-map@2.0.3: resolution: {integrity: sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==} engines: {node: '>= 0.4'} @@ -2684,6 +2716,10 @@ packages: resolution: {integrity: sha512-ZhMwEosbFJkA0YhFnNDgTM4ZxDRsS6HqTo7qsZM08fehyRYIYa0yHu5R6mgo1n/8MgaPBXiPimPD77baVFYg+A==} engines: {node: '>=12.13'} + is-wsl@3.1.0: + resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==} + engines: {node: '>=16'} + isarray@2.0.5: resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} @@ -3141,6 +3177,10 @@ packages: once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + open@10.1.1: + resolution: {integrity: sha512-zy1wx4+P3PfhXSEPJNtZmJXfhkkIaxU1VauWIrDZw1O7uJRDRJtKr9n3Ic4NgbA16KyOxOXO2ng9gYwCdXuSXA==} + engines: {node: '>=18'} + optionator@0.9.4: resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} engines: {node: '>= 0.8.0'} @@ -3415,6 +3455,10 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + run-applescript@7.0.0: + resolution: {integrity: sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==} + engines: {node: '>=18'} + run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} @@ -3850,9 +3894,29 @@ packages: validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} + vite-dev-rpc@1.0.7: + resolution: {integrity: sha512-FxSTEofDbUi2XXujCA+hdzCDkXFG1PXktMjSk1efq9Qb5lOYaaM9zNSvKvPPF7645Bak79kSp1PTooMW2wktcA==} + peerDependencies: + vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0-0 || ^5.0.0-0 || ^6.0.1 + + vite-hot-client@2.0.4: + resolution: {integrity: sha512-W9LOGAyGMrbGArYJN4LBCdOC5+Zwh7dHvOHC0KmGKkJhsOzaKbpo/jEjpPKVHIW0/jBWj8RZG0NUxfgA8BxgAg==} + peerDependencies: + vite: ^2.6.0 || ^3.0.0 || ^4.0.0 || ^5.0.0-0 || ^6.0.0-0 + vite-plugin-build-id@0.5.0: resolution: {integrity: sha512-dvf3PSSjzSZSCoWodOjDSDei7wRgQKTYHBKfAZAEoIDTuQtxIVFNzKPHuWETFDOE3pnOa76BUjbTOKxRjMKD9Q==} + vite-plugin-inspect@11.0.1: + resolution: {integrity: sha512-aABw7eGTr9Cmbn9RAs76e0BztVUFDl6a2R+/IJXpoUZxjx5YHB0P+Em3ZTWzpIPZzuRj28tAMblvcUyhgJc4aQ==} + engines: {node: '>=14'} + peerDependencies: + '@nuxt/kit': '*' + vite: ^6.0.0 + peerDependenciesMeta: + '@nuxt/kit': + optional: true + vite-svg-loader@5.1.0: resolution: {integrity: sha512-M/wqwtOEjgb956/+m5ZrYT/Iq6Hax0OakWbokj8+9PXOnB7b/4AxESHieEtnNEy7ZpjsjYW1/5nK8fATQMmRxw==} peerDependencies: @@ -5541,6 +5605,10 @@ snapshots: builtin-modules@5.0.0: {} + bundle-name@4.1.0: + dependencies: + run-applescript: 7.0.0 + bytes@3.1.2: {} c12@3.0.3: @@ -5788,12 +5856,21 @@ snapshots: deep-pick-omit@1.2.1: {} + default-browser-id@5.0.0: {} + + default-browser@5.2.1: + dependencies: + bundle-name: 4.1.0 + default-browser-id: 5.0.0 + define-data-property@1.1.4: dependencies: es-define-property: 1.0.1 es-errors: 1.3.0 gopd: 1.2.0 + define-lazy-prop@3.0.0: {} + define-properties@1.2.1: dependencies: define-data-property: 1.1.4 @@ -5889,6 +5966,8 @@ snapshots: dependencies: is-arrayish: 0.2.1 + error-stack-parser-es@1.0.5: {} + errx@0.1.0: {} es-abstract@1.23.9: @@ -6694,6 +6773,8 @@ snapshots: call-bound: 1.0.4 has-tostringtag: 1.0.2 + is-docker@3.0.0: {} + is-extglob@2.1.1: {} is-finalizationregistry@1.1.1: @@ -6713,6 +6794,10 @@ snapshots: dependencies: is-extglob: 2.1.1 + is-inside-container@1.0.0: + dependencies: + is-docker: 3.0.0 + is-map@2.0.3: {} is-number-object@1.1.1: @@ -6767,6 +6852,10 @@ snapshots: is-what@4.1.16: {} + is-wsl@3.1.0: + dependencies: + is-inside-container: 1.0.0 + isarray@2.0.5: {} isexe@2.0.0: {} @@ -7387,6 +7476,13 @@ snapshots: dependencies: wrappy: 1.0.2 + open@10.1.1: + dependencies: + default-browser: 5.2.1 + define-lazy-prop: 3.0.0 + is-inside-container: 1.0.0 + is-wsl: 3.1.0 + optionator@0.9.4: dependencies: deep-is: 0.1.4 @@ -7681,6 +7777,8 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.40.0 fsevents: 2.3.3 + run-applescript@7.0.0: {} + run-parallel@1.2.0: dependencies: queue-microtask: 1.2.3 @@ -8227,6 +8325,16 @@ snapshots: spdx-correct: 3.2.0 spdx-expression-parse: 3.0.1 + vite-dev-rpc@1.0.7(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(less@4.3.0)(tsx@4.19.2)(yaml@2.7.1)): + dependencies: + birpc: 2.3.0 + vite: 6.3.2(@types/node@22.14.1)(jiti@2.4.2)(less@4.3.0)(tsx@4.19.2)(yaml@2.7.1) + vite-hot-client: 2.0.4(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(less@4.3.0)(tsx@4.19.2)(yaml@2.7.1)) + + vite-hot-client@2.0.4(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(less@4.3.0)(tsx@4.19.2)(yaml@2.7.1)): + dependencies: + vite: 6.3.2(@types/node@22.14.1)(jiti@2.4.2)(less@4.3.0)(tsx@4.19.2)(yaml@2.7.1) + vite-plugin-build-id@0.5.0: dependencies: isomorphic-git: 1.30.1 @@ -8234,6 +8342,23 @@ snapshots: picocolors: 1.1.1 typescript: 5.8.2 + vite-plugin-inspect@11.0.1(@nuxt/kit@3.16.2)(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(less@4.3.0)(tsx@4.19.2)(yaml@2.7.1)): + dependencies: + ansis: 3.17.0 + debug: 4.4.0 + error-stack-parser-es: 1.0.5 + ohash: 2.0.11 + open: 10.1.1 + perfect-debounce: 1.0.0 + sirv: 3.0.1 + unplugin-utils: 0.2.4 + vite: 6.3.2(@types/node@22.14.1)(jiti@2.4.2)(less@4.3.0)(tsx@4.19.2)(yaml@2.7.1) + vite-dev-rpc: 1.0.7(vite@6.3.2(@types/node@22.14.1)(jiti@2.4.2)(less@4.3.0)(tsx@4.19.2)(yaml@2.7.1)) + optionalDependencies: + '@nuxt/kit': 3.16.2 + transitivePeerDependencies: + - supports-color + vite-svg-loader@5.1.0(vue@3.5.13(typescript@5.8.2)): dependencies: svgo: 3.3.2 diff --git a/app/src/api/auto_cert.ts b/app/src/api/auto_cert.ts index 21962191..9b7aa2f0 100644 --- a/app/src/api/auto_cert.ts +++ b/app/src/api/auto_cert.ts @@ -1,5 +1,10 @@ import http from '@/lib/http' +export const AutoCertChallengeMethod = { + http01: 'http01', + dns01: 'dns01', +} as const + export interface DNSProvider { name?: string code?: string @@ -19,7 +24,7 @@ export interface AutoCertOptions { domains: string[] code?: string dns_credential_id?: number | null - challenge_method?: string + challenge_method: keyof typeof AutoCertChallengeMethod configuration?: DNSProvider['configuration'] key_type: string acme_user_id?: number diff --git a/app/src/api/cert.ts b/app/src/api/cert.ts index 3db40810..e5e34f8f 100644 --- a/app/src/api/cert.ts +++ b/app/src/api/cert.ts @@ -2,6 +2,7 @@ import type { AcmeUser } from '@/api/acme_user' import type { ModelBase } from '@/api/curd' import type { DnsCredential } from '@/api/dns_credential' import type { PrivateKeyType } from '@/constants' +import type { AutoCertChallengeMethod } from './auto_cert' import Curd from '@/api/curd' export interface Cert extends ModelBase { @@ -13,7 +14,7 @@ export interface Cert extends ModelBase { ssl_certificate_key_path: string ssl_certificate_key: string auto_cert: number - challenge_method: string + challenge_method: keyof typeof AutoCertChallengeMethod dns_credential_id: number dns_credential?: DnsCredential acme_user_id: number diff --git a/app/src/api/template.ts b/app/src/api/template.ts index 187a44e6..fab780c2 100644 --- a/app/src/api/template.ts +++ b/app/src/api/template.ts @@ -27,7 +27,9 @@ class TemplateApi extends Curd