mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
parent
11e460765a
commit
b3486a42a5
41 changed files with 2429 additions and 1649 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
AutoCertSync = 2
|
||||
AutoCertEnabled = 1
|
||||
AutoCertDisabled = -1
|
||||
CertChallengeMethodHTTP01 = "http01"
|
||||
|
@ -42,6 +43,7 @@ type Cert struct {
|
|||
KeyType certcrypto.KeyType `json:"key_type"`
|
||||
Log string `json:"log"`
|
||||
Resource *CertificateResource `json:"-" gorm:"serializer:json"`
|
||||
SyncNodeIds []int `json:"sync_node_ids" gorm:"serializer:json"`
|
||||
}
|
||||
|
||||
func FirstCert(confName string) (c Cert, err error) {
|
||||
|
@ -94,10 +96,6 @@ func (c *Cert) Updates(n *Cert) error {
|
|||
return db.Model(&Cert{}).Where("id", c.ID).Updates(n).Error
|
||||
}
|
||||
|
||||
func (c *Cert) ClearLog() {
|
||||
db.Model(&Cert{}).Where("id", c.ID).Update("log", "")
|
||||
}
|
||||
|
||||
func (c *Cert) Remove() error {
|
||||
if c.Filename == "" {
|
||||
return db.Delete(c).Error
|
||||
|
|
|
@ -15,6 +15,25 @@ type Environment struct {
|
|||
SyncApiRegex string `json:"sync_api_regex"`
|
||||
}
|
||||
|
||||
func (e *Environment) GetUrl(uri string) (decodedUri string, err error) {
|
||||
baseUrl, err := url.Parse(e.URL)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
u, err := url.JoinPath(baseUrl.String(), uri)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
decodedUri, err = url.QueryUnescape(u)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func (e *Environment) GetWebSocketURL(uri string) (decodedUri string, err error) {
|
||||
baseUrl, err := url.Parse(e.URL)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue