mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 10:25:52 +02:00
Fix AutoCert() panic issue.
I forgot to catch the http request error, this might cause an unrecoverable panic.
This commit is contained in:
parent
9d3f35b380
commit
0fe9bf56d6
5 changed files with 19 additions and 14 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "nginx-ui-frontend",
|
||||
"version": "1.2.0",
|
||||
"version": "1.2.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
|
|
@ -6,6 +6,11 @@
|
|||
<meta content="width=device-width,initial-scale=1.0,user-scalable=0" name="viewport">
|
||||
<link href="<%= BASE_URL %>favicon.ico" rel="icon">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
width: 100% !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"version":"1.2.0","build_id":8,"total_build":48}
|
||||
{"version":"1.2.2","build_id":1,"total_build":49}
|
|
@ -24,22 +24,17 @@ type ValidError struct {
|
|||
Message string
|
||||
}
|
||||
|
||||
var trans ut.Translator
|
||||
|
||||
func init() {
|
||||
uni := ut.New(zh.New())
|
||||
trans, _ = uni.GetTranslator("zh")
|
||||
v, ok := binding.Validator.Engine().(*val.Validate)
|
||||
if ok {
|
||||
_ = zhTranslations.RegisterDefaultTranslations(v, trans)
|
||||
}
|
||||
}
|
||||
|
||||
func BindAndValid(c *gin.Context, target interface{}) bool {
|
||||
errs := make(map[string]string)
|
||||
err := c.ShouldBindJSON(target)
|
||||
if err != nil {
|
||||
log.Println("raw err", err)
|
||||
uni := ut.New(zh.New())
|
||||
trans, _ := uni.GetTranslator("zh")
|
||||
v, ok := binding.Validator.Engine().(*val.Validate)
|
||||
if ok {
|
||||
_ = zhTranslations.RegisterDefaultTranslations(v, trans)
|
||||
}
|
||||
|
||||
verrs, ok := err.(val.ValidationErrors)
|
||||
|
||||
|
|
|
@ -14,7 +14,12 @@ import (
|
|||
func CertInfo(c *gin.Context) {
|
||||
domain := c.Param("domain")
|
||||
|
||||
key := tool.GetCertInfo(domain)
|
||||
key, err := tool.GetCertInfo(domain)
|
||||
|
||||
if err != nil {
|
||||
ErrHandler(c, err)
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"subject_name": key.Subject.CommonName,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue