Skip to content

Commit 0fe9bf5

Browse files
committed
Fix AutoCert() panic issue.
I forgot to catch the http request error, this might cause an unrecoverable panic.
1 parent 9d3f35b commit 0fe9bf5

File tree

5 files changed

+19
-14
lines changed

5 files changed

+19
-14
lines changed

frontend/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-frontend",
3-
"version": "1.2.0",
3+
"version": "1.2.2",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",

frontend/public/index.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
<meta content="width=device-width,initial-scale=1.0,user-scalable=0" name="viewport">
77
<link href="<%= BASE_URL %>favicon.ico" rel="icon">
88
<title><%= htmlWebpackPlugin.options.title %></title>
9+
<style type="text/css">
10+
body {
11+
width: 100% !important;
12+
}
13+
</style>
914
</head>
1015
<body>
1116
<noscript>

frontend/version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"1.2.0","build_id":8,"total_build":48}
1+
{"version":"1.2.2","build_id":1,"total_build":49}

server/api/api.go

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,17 @@ type ValidError struct {
2424
Message string
2525
}
2626

27-
var trans ut.Translator
28-
29-
func init() {
30-
uni := ut.New(zh.New())
31-
trans, _ = uni.GetTranslator("zh")
32-
v, ok := binding.Validator.Engine().(*val.Validate)
33-
if ok {
34-
_ = zhTranslations.RegisterDefaultTranslations(v, trans)
35-
}
36-
}
37-
3827
func BindAndValid(c *gin.Context, target interface{}) bool {
3928
errs := make(map[string]string)
4029
err := c.ShouldBindJSON(target)
4130
if err != nil {
4231
log.Println("raw err", err)
32+
uni := ut.New(zh.New())
33+
trans, _ := uni.GetTranslator("zh")
34+
v, ok := binding.Validator.Engine().(*val.Validate)
35+
if ok {
36+
_ = zhTranslations.RegisterDefaultTranslations(v, trans)
37+
}
4338

4439
verrs, ok := err.(val.ValidationErrors)
4540

server/api/cert.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ import (
1414
func CertInfo(c *gin.Context) {
1515
domain := c.Param("domain")
1616

17-
key := tool.GetCertInfo(domain)
17+
key, err := tool.GetCertInfo(domain)
18+
19+
if err != nil {
20+
ErrHandler(c, err)
21+
return
22+
}
1823

1924
c.JSON(http.StatusOK, gin.H{
2025
"subject_name": key.Subject.CommonName,

0 commit comments

Comments
 (0)