feat: add HTTP file server with beautiful file browser UI

This commit is contained in:
Your Name
2026-04-28 22:11:41 +08:00
parent 2459122c0e
commit 8cfa25f0f3
5 changed files with 630 additions and 7 deletions
+6 -2
View File
@@ -136,13 +136,17 @@ func (s *Server) handleLogout(w http.ResponseWriter, r *http.Request) {
func (s *Server) handleStatus(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(map[string]interface{}{
data := map[string]interface{}{
"status": "running",
"ftpPort": s.config.FTP.Port,
"webPort": s.config.Web.Port,
"rootDir": s.config.FTP.RootDir,
"userCount": len(s.config.GetFTPUsers()),
})
}
if s.config.HTTPFile.Enable {
data["httpFilePort"] = s.config.HTTPFile.Port
}
json.NewEncoder(w).Encode(data)
}
func (s *Server) handleUsers(w http.ResponseWriter, r *http.Request) {