Skip to content

Commit 3bbe56c

Browse files
authored
chore: prepare v2.0.0-beta.14
2 parents 4e369ba + 66571bc commit 3bbe56c

File tree

25 files changed

+274
-153
lines changed

25 files changed

+274
-153
lines changed

api/certificate/certificate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func Transformer(certModel *model.Cert) (certificate *APICertificate) {
2525
if certModel.SSLCertificatePath != "" {
2626
if _, err := os.Stat(certModel.SSLCertificatePath); err == nil {
2727
sslCertificationBytes, _ = os.ReadFile(certModel.SSLCertificatePath)
28-
if !cert.IsPublicKey(string(sslCertificationBytes)) {
28+
if !cert.IsCertificate(string(sslCertificationBytes)) {
2929
sslCertificationBytes = []byte{}
3030
}
3131
}
@@ -77,9 +77,9 @@ func GetCert(c *gin.Context) {
7777

7878
type certJson struct {
7979
Name string `json:"name" binding:"required"`
80-
SSLCertificatePath string `json:"ssl_certificate_path" binding:"required,publickey_path"`
80+
SSLCertificatePath string `json:"ssl_certificate_path" binding:"required,certificate_path"`
8181
SSLCertificateKeyPath string `json:"ssl_certificate_key_path" binding:"required,privatekey_path"`
82-
SSLCertificate string `json:"ssl_certificate" binding:"omitempty,publickey"`
82+
SSLCertificate string `json:"ssl_certificate" binding:"omitempty,certificate"`
8383
SSLCertificateKey string `json:"ssl_certificate_key" binding:"omitempty,privatekey"`
8484
ChallengeMethod string `json:"challenge_method"`
8585
DnsCredentialID int `json:"dns_credential_id"`

api/certificate/router.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ func InitDNSCredentialRouter(r *gin.RouterGroup) {
1111
}
1212

1313
func InitCertificateRouter(r *gin.RouterGroup) {
14-
r.GET("domain/:name/cert", IssueCert)
1514
r.GET("certs", GetCertList)
1615
r.GET("cert/:id", GetCert)
1716
r.POST("cert", AddCert)
@@ -20,3 +19,7 @@ func InitCertificateRouter(r *gin.RouterGroup) {
2019
r.GET("certificate/dns_providers", GetDNSProvidersList)
2120
r.GET("certificate/dns_provider/:code", GetDNSProvider)
2221
}
22+
23+
func InitCertificateWebSocketRouter(r *gin.RouterGroup) {
24+
r.GET("domain/:name/cert", IssueCert)
25+
}

api/config/get.go

Lines changed: 45 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,52 @@
11
package config
22

33
import (
4-
"github.com/0xJacky/Nginx-UI/api"
5-
"github.com/0xJacky/Nginx-UI/internal/config"
6-
"github.com/0xJacky/Nginx-UI/internal/nginx"
7-
"github.com/0xJacky/Nginx-UI/query"
8-
"github.com/gin-gonic/gin"
9-
"github.com/sashabaranov/go-openai"
10-
"net/http"
11-
"os"
4+
"github.com/0xJacky/Nginx-UI/api"
5+
"github.com/0xJacky/Nginx-UI/internal/config"
6+
"github.com/0xJacky/Nginx-UI/internal/nginx"
7+
"github.com/0xJacky/Nginx-UI/query"
8+
"github.com/gin-gonic/gin"
9+
"github.com/sashabaranov/go-openai"
10+
"net/http"
11+
"os"
1212
)
1313

1414
func GetConfig(c *gin.Context) {
15-
name := c.Param("name")
16-
path := nginx.GetConfPath("/", name)
17-
18-
stat, err := os.Stat(path)
19-
20-
if err != nil {
21-
api.ErrHandler(c, err)
22-
return
23-
}
24-
25-
content, err := os.ReadFile(path)
26-
27-
if err != nil {
28-
api.ErrHandler(c, err)
29-
return
30-
}
31-
32-
g := query.ChatGPTLog
33-
chatgpt, err := g.Where(g.Name.Eq(path)).FirstOrCreate()
34-
35-
if err != nil {
36-
api.ErrHandler(c, err)
37-
return
38-
}
39-
40-
if chatgpt.Content == nil {
41-
chatgpt.Content = make([]openai.ChatCompletionMessage, 0)
42-
}
43-
44-
c.JSON(http.StatusOK, config.Config{
45-
Name: name,
46-
Content: string(content),
47-
ChatGPTMessages: chatgpt.Content,
48-
FilePath: path,
49-
ModifiedAt: stat.ModTime(),
50-
})
15+
name := c.Param("name")
16+
17+
path := nginx.GetConfPath("/", name)
18+
19+
stat, err := os.Stat(path)
20+
21+
if err != nil {
22+
api.ErrHandler(c, err)
23+
return
24+
}
25+
26+
content, err := os.ReadFile(path)
27+
28+
if err != nil {
29+
api.ErrHandler(c, err)
30+
return
31+
}
32+
33+
g := query.ChatGPTLog
34+
chatgpt, err := g.Where(g.Name.Eq(path)).FirstOrCreate()
35+
36+
if err != nil {
37+
api.ErrHandler(c, err)
38+
return
39+
}
40+
41+
if chatgpt.Content == nil {
42+
chatgpt.Content = make([]openai.ChatCompletionMessage, 0)
43+
}
44+
45+
c.JSON(http.StatusOK, config.Config{
46+
Name: name,
47+
Content: string(content),
48+
ChatGPTMessages: chatgpt.Content,
49+
FilePath: path,
50+
ModifiedAt: stat.ModTime(),
51+
})
5152
}

api/config/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func GetConfigs(c *gin.Context) {
3535
}
3636
case mode&os.ModeSymlink != 0: // is a symbol
3737
var targetPath string
38-
targetPath, err = os.Readlink(nginx.GetConfPath(file.Name()))
38+
targetPath, err = os.Readlink(nginx.GetConfPath(dir, file.Name()))
3939
if err != nil {
4040
logger.Error("Read Symlink Error", targetPath, err)
4141
continue
@@ -47,7 +47,7 @@ func GetConfigs(c *gin.Context) {
4747
logger.Error("Stat Error", targetPath, err)
4848
continue
4949
}
50-
// but target file is not a dir
50+
// hide the file if it's target file is a directory
5151
if targetInfo.IsDir() {
5252
continue
5353
}

api/config/modify.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ func EditConfig(c *gin.Context) {
3030
}
3131

3232
if content != "" && content != string(origContent) {
33-
// model.CreateBackup(path)
3433
err = os.WriteFile(path, []byte(content), 0644)
3534
if err != nil {
3635
api.ErrHandler(c, err)

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nginx-ui-app-next",
3-
"version": "2.0.0-beta.13",
3+
"version": "2.0.0-beta.14",
44
"type": "module",
55
"scripts": {
66
"dev": "vite",

app/src/language/LINGUAS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
es fr_FR ru_RU vi_VN zh_CN zh_TW
1+
en zh_CN zh_TW fr_FR es ru_RU vi_VN

app/src/language/en/app.po

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,14 +1561,15 @@ msgstr ""
15611561
msgid "The input is not a SSL Certificate Key"
15621562
msgstr "Certificate Status"
15631563

1564+
#: src/views/certificate/CertificateEditor.vue:168
1565+
#, fuzzy
1566+
msgid "The path exists, but the file is not a certificate"
1567+
msgstr "Certificate Status"
1568+
15641569
#: src/views/certificate/CertificateEditor.vue:183
15651570
msgid "The path exists, but the file is not a private key"
15661571
msgstr ""
15671572

1568-
#: src/views/certificate/CertificateEditor.vue:168
1569-
msgid "The path exists, but the file is not a public key"
1570-
msgstr ""
1571-
15721573
#: src/views/domain/cert/components/AutoCertStepOne.vue:45
15731574
#, fuzzy
15741575
msgid ""

app/src/language/es/app.po

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,14 +1492,15 @@ msgstr "La entrada no es un Certificado SSL"
14921492
msgid "The input is not a SSL Certificate Key"
14931493
msgstr "La entrada no es una clave de certificado SSL"
14941494

1495+
#: src/views/certificate/CertificateEditor.vue:168
1496+
#, fuzzy
1497+
msgid "The path exists, but the file is not a certificate"
1498+
msgstr "La ruta existe, pero el archivo no es una clave privada"
1499+
14951500
#: src/views/certificate/CertificateEditor.vue:183
14961501
msgid "The path exists, but the file is not a private key"
14971502
msgstr "La ruta existe, pero el archivo no es una clave privada"
14981503

1499-
#: src/views/certificate/CertificateEditor.vue:168
1500-
msgid "The path exists, but the file is not a public key"
1501-
msgstr "La ruta existe, pero el archivo no es una clave pública"
1502-
15031504
#: src/views/domain/cert/components/AutoCertStepOne.vue:45
15041505
msgid ""
15051506
"The server_name in the current configuration must be the domain name you "
@@ -1672,6 +1673,9 @@ msgstr "Estás usando la última versión"
16721673
msgid "You can check Nginx UI upgrade at this page."
16731674
msgstr "Puede consultar la actualización de Nginx UI en esta página."
16741675

1676+
#~ msgid "The path exists, but the file is not a public key"
1677+
#~ msgstr "La ruta existe, pero el archivo no es una clave pública"
1678+
16751679
#, fuzzy
16761680
#~ msgid "Server"
16771681
#~ msgstr "Información del servidor"

app/src/language/fr_FR/app.po

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,14 +1559,15 @@ msgstr ""
15591559
msgid "The input is not a SSL Certificate Key"
15601560
msgstr "Chemin de la clé du certificat SSL"
15611561

1562+
#: src/views/certificate/CertificateEditor.vue:168
1563+
#, fuzzy
1564+
msgid "The path exists, but the file is not a certificate"
1565+
msgstr "Chemin de la clé du certificat SSL"
1566+
15621567
#: src/views/certificate/CertificateEditor.vue:183
15631568
msgid "The path exists, but the file is not a private key"
15641569
msgstr ""
15651570

1566-
#: src/views/certificate/CertificateEditor.vue:168
1567-
msgid "The path exists, but the file is not a public key"
1568-
msgstr ""
1569-
15701571
#: src/views/domain/cert/components/AutoCertStepOne.vue:45
15711572
#, fuzzy
15721573
msgid ""

0 commit comments

Comments
 (0)