增加日志查询页面跟踪器显示

This commit is contained in:
Alex Yang
2025-12-24 10:08:35 +08:00
parent 1f8bd6b97f
commit fe77539da1
11 changed files with 50975 additions and 8762 deletions

View File

@@ -154,6 +154,17 @@ func (s *Server) Start() error {
http.ServeFile(w, r, "./static/login.html")
})
// Tracker目录静态文件服务
trackerFileServer := http.FileServer(http.Dir("./tracker"))
mux.HandleFunc("/tracker/", s.loginRequired(func(w http.ResponseWriter, r *http.Request) {
// 添加Cache-Control头禁用浏览器缓存
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Header().Set("Pragma", "no-cache")
w.Header().Set("Expires", "Thu, 01 Jan 1970 00:00:00 GMT")
// 使用StripPrefix处理路径
http.StripPrefix("/tracker", trackerFileServer).ServeHTTP(w, r)
}))
// 其他静态文件需要登录
mux.HandleFunc("/", s.loginRequired(func(w http.ResponseWriter, r *http.Request) {
// 添加Cache-Control头禁用浏览器缓存