feat: 内部署名改为编译期注入(构建机本地文件,不进仓库);关于页展示
This commit is contained in:
1 parent
d288e2bb22
commit
76e725ca96
6 files changed
+66
-1
No files matched your search
@@ -0,0 +1,20 @@
|
||||
package httpapi
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"git.yeij.top/AskaEth/Scoreboard/server/internal/auth"
|
||||
"git.yeij.top/AskaEth/Scoreboard/server/internal/version"
|
||||
)
|
||||
|
||||
// systemRoutes 挂载系统级只读信息。
|
||||
func (s *server) systemRoutes(mux *http.ServeMux) {
|
||||
// 内部署名是编译期注入的,不暴露给匿名访客:至少要登录(recorder 及以上)才能读到
|
||||
mux.HandleFunc("GET /api/system/about", s.read(auth.RoleRecorder, s.systemAbout))
|
||||
}
|
||||
|
||||
func (s *server) systemAbout(w http.ResponseWriter, r *http.Request) (any, error) {
|
||||
return map[string]any{
|
||||
"internalSignature": version.InternalSignature,
|
||||
}, nil
|
||||
}
|
||||
@@ -76,6 +76,7 @@ func New(opts Options) http.Handler {
|
||||
s.routes(mux)
|
||||
s.exportRoutes(mux)
|
||||
s.rulesRoutes(mux)
|
||||
s.systemRoutes(mux)
|
||||
if opts.WS != nil {
|
||||
mux.Handle("/ws", opts.WS)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user