3.5.2
This commit is contained in:
@@ -99,7 +99,7 @@ WJQserver Studio 开源许可证
|
|||||||
* 8.3 版本更新: 授权方可能会发布本许可证的修订版本或新版本。您可以选择是继续使用本许可证的旧版本还是选择适用新版本。
|
* 8.3 版本更新: 授权方可能会发布本许可证的修订版本或新版本。您可以选择是继续使用本许可证的旧版本还是选择适用新版本。
|
||||||
|
|
||||||
WJQserver Studio Open Source License
|
WJQserver Studio Open Source License
|
||||||
Version v2.0
|
Version v2.1
|
||||||
|
|
||||||
Copyright © WJQserver Studio 2024
|
Copyright © WJQserver Studio 2024
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ func HealthcheckHandler(c *app.RequestContext, ctx context.Context) {
|
|||||||
c.Response.Header.Set("Content-Type", "application/json")
|
c.Response.Header.Set("Content-Type", "application/json")
|
||||||
c.JSON(200, (map[string]interface{}{
|
c.JSON(200, (map[string]interface{}{
|
||||||
"Status": "OK",
|
"Status": "OK",
|
||||||
|
"Repo": "WJQSERVER-STUDIO/GHProxy",
|
||||||
|
"Author": "WJQSERVER-STUDIO",
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,6 +101,8 @@ func VersionHandler(c *app.RequestContext, ctx context.Context, version string)
|
|||||||
c.Response.Header.Set("Content-Type", "application/json")
|
c.Response.Header.Set("Content-Type", "application/json")
|
||||||
c.JSON(200, (map[string]interface{}{
|
c.JSON(200, (map[string]interface{}{
|
||||||
"Version": version,
|
"Version": version,
|
||||||
|
"Repo": "WJQSERVER-STUDIO/GHProxy",
|
||||||
|
"Author": "WJQSERVER-STUDIO",
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
11
main.go
11
main.go
@@ -402,6 +402,16 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var viaString string = "WJQSERVER-STUDIO/GHProxy"
|
||||||
|
|
||||||
|
func viaHeader() app.HandlerFunc {
|
||||||
|
return func(ctx context.Context, c *app.RequestContext) {
|
||||||
|
protoVersion := "1.1"
|
||||||
|
c.Header("Via", protoVersion+" "+viaString)
|
||||||
|
c.Next(ctx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if showVersion || showHelp {
|
if showVersion || showHelp {
|
||||||
return
|
return
|
||||||
@@ -450,6 +460,7 @@ func main() {
|
|||||||
|
|
||||||
r.Use(recovery.Recovery()) // Recovery中间件
|
r.Use(recovery.Recovery()) // Recovery中间件
|
||||||
r.Use(loggin.Middleware()) // log中间件
|
r.Use(loggin.Middleware()) // log中间件
|
||||||
|
r.Use(viaHeader())
|
||||||
setupApi(cfg, r, version)
|
setupApi(cfg, r, version)
|
||||||
setupPages(cfg, r)
|
setupPages(cfg, r)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user