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
+22 -5
View File
@@ -8,11 +8,12 @@ import (
// Config represents the application configuration
type Config struct {
mu sync.RWMutex `json:"-"`
FTP FTPConfig `json:"ftp"`
Web WebConfig `json:"web"`
Admin AdminConfig `json:"admin"`
FTPUsers []FTPUser `json:"ftpUsers"`
mu sync.RWMutex `json:"-"`
FTP FTPConfig `json:"ftp"`
Web WebConfig `json:"web"`
HTTPFile HTTPFileConfig `json:"httpFile"`
Admin AdminConfig `json:"admin"`
FTPUsers []FTPUser `json:"ftpUsers"`
}
// FTPConfig holds FTP server settings
@@ -30,6 +31,15 @@ type WebConfig struct {
Port int `json:"port"`
}
// HTTPFileConfig holds HTTP file server settings
type HTTPFileConfig struct {
Enable bool `json:"enable"`
Host string `json:"host"`
Port int `json:"port"`
RootDir string `json:"rootDir"`
Upload bool `json:"upload"`
}
// AdminConfig holds admin credentials
type AdminConfig struct {
Username string `json:"username"`
@@ -58,6 +68,13 @@ func DefaultConfig() *Config {
Host: "0.0.0.0",
Port: 8080,
},
HTTPFile: HTTPFileConfig{
Enable: true,
Host: "0.0.0.0",
Port: 9090,
RootDir: "./ftp_root",
Upload: true,
},
Admin: AdminConfig{
Username: "admin",
Password: "admin123",