mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
fix: auto certificate may be blocked by errors #182
This commit is contained in:
parent
50b4fbcda4
commit
b475d8b609
8 changed files with 99 additions and 95 deletions
|
@ -1,70 +1,70 @@
|
|||
package router
|
||||
|
||||
import (
|
||||
"github.com/0xJacky/Nginx-UI/api/analytic"
|
||||
"github.com/0xJacky/Nginx-UI/api/certificate"
|
||||
"github.com/0xJacky/Nginx-UI/api/cluster"
|
||||
"github.com/0xJacky/Nginx-UI/api/config"
|
||||
"github.com/0xJacky/Nginx-UI/api/nginx"
|
||||
"github.com/0xJacky/Nginx-UI/api/openai"
|
||||
"github.com/0xJacky/Nginx-UI/api/sites"
|
||||
"github.com/0xJacky/Nginx-UI/api/system"
|
||||
"github.com/0xJacky/Nginx-UI/api/template"
|
||||
"github.com/0xJacky/Nginx-UI/api/terminal"
|
||||
"github.com/0xJacky/Nginx-UI/api/user"
|
||||
"github.com/gin-contrib/static"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
"github.com/0xJacky/Nginx-UI/api/analytic"
|
||||
"github.com/0xJacky/Nginx-UI/api/certificate"
|
||||
"github.com/0xJacky/Nginx-UI/api/cluster"
|
||||
"github.com/0xJacky/Nginx-UI/api/config"
|
||||
"github.com/0xJacky/Nginx-UI/api/nginx"
|
||||
"github.com/0xJacky/Nginx-UI/api/openai"
|
||||
"github.com/0xJacky/Nginx-UI/api/sites"
|
||||
"github.com/0xJacky/Nginx-UI/api/system"
|
||||
"github.com/0xJacky/Nginx-UI/api/template"
|
||||
"github.com/0xJacky/Nginx-UI/api/terminal"
|
||||
"github.com/0xJacky/Nginx-UI/api/user"
|
||||
"github.com/gin-contrib/static"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func InitRouter() *gin.Engine {
|
||||
r := gin.New()
|
||||
r.Use(gin.Logger())
|
||||
r := gin.New()
|
||||
r.Use(gin.Logger())
|
||||
|
||||
r.Use(recovery())
|
||||
r.Use(recovery())
|
||||
|
||||
r.Use(cacheJs())
|
||||
r.Use(cacheJs())
|
||||
|
||||
//r.Use(OperationSync())
|
||||
//r.Use(OperationSync())
|
||||
|
||||
r.Use(static.Serve("/", mustFS("")))
|
||||
r.Use(static.Serve("/", mustFS("")))
|
||||
|
||||
r.NoRoute(func(c *gin.Context) {
|
||||
c.JSON(http.StatusNotFound, gin.H{
|
||||
"message": "not found",
|
||||
})
|
||||
})
|
||||
r.NoRoute(func(c *gin.Context) {
|
||||
c.JSON(http.StatusNotFound, gin.H{
|
||||
"message": "not found",
|
||||
})
|
||||
})
|
||||
|
||||
root := r.Group("/api")
|
||||
{
|
||||
system.InitPublicRouter(root)
|
||||
user.InitAuthRouter(root)
|
||||
root := r.Group("/api")
|
||||
{
|
||||
system.InitPublicRouter(root)
|
||||
user.InitAuthRouter(root)
|
||||
|
||||
// Authorization required not websocket request
|
||||
g := root.Group("/", authRequired(), proxy())
|
||||
{
|
||||
analytic.InitRouter(g)
|
||||
user.InitManageUserRouter(g)
|
||||
nginx.InitRouter(g)
|
||||
sites.InitRouter(g)
|
||||
config.InitRouter(g)
|
||||
template.InitRouter(g)
|
||||
certificate.InitCertificateRouter(g)
|
||||
certificate.InitDNSCredentialRouter(g)
|
||||
system.InitPrivateRouter(g)
|
||||
openai.InitRouter(g)
|
||||
cluster.InitRouter(g)
|
||||
}
|
||||
// Authorization required not websocket request
|
||||
g := root.Group("/", authRequired(), proxy())
|
||||
{
|
||||
analytic.InitRouter(g)
|
||||
user.InitManageUserRouter(g)
|
||||
nginx.InitRouter(g)
|
||||
sites.InitRouter(g)
|
||||
config.InitRouter(g)
|
||||
template.InitRouter(g)
|
||||
certificate.InitCertificateRouter(g)
|
||||
certificate.InitDNSCredentialRouter(g)
|
||||
system.InitPrivateRouter(g)
|
||||
openai.InitRouter(g)
|
||||
cluster.InitRouter(g)
|
||||
}
|
||||
|
||||
// Authorization required and websocket request
|
||||
w := root.Group("/", authRequired(), proxyWs())
|
||||
{
|
||||
analytic.InitWebSocketRouter(w)
|
||||
terminal.InitRouter(w)
|
||||
nginx.InitNginxLogRouter(w)
|
||||
}
|
||||
// Authorization required and websocket request
|
||||
w := root.Group("/", authRequired(), proxyWs())
|
||||
{
|
||||
analytic.InitWebSocketRouter(w)
|
||||
terminal.InitRouter(w)
|
||||
nginx.InitNginxLogRouter(w)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return r
|
||||
return r
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue