feat: add admin login page with session auth
Build and Push to GHCR / build-and-push (push) Has been cancelled

Replace HTTP Basic Auth with a dedicated login page using
cookie-based session authentication.

- Add web/static/login.html with form-based login UI
- Add in-memory session store with configurable timeout
- Add /api/auth/login, /api/auth/logout, /api/auth/me endpoints
- Replace BasicAuth middleware with SessionAuth
- Add session_timeout config field (default 24h)
- Remove listen_addr from settings UI

via [HAPI](https://hapi.run)

Co-Authored-By: HAPI <[email protected]>
This commit is contained in:
Agent
2026-05-24 16:43:06 +08:00
co-authored by HAPI
parent fdbb824b7e
commit bea74a6316
6 changed files with 480 additions and 63 deletions
+11 -9
View File
@@ -18,15 +18,16 @@ func GetConfigFilePath() string {
}
type Config struct {
ListenAddr string `json:"listen_addr"`
AdminPath string `json:"admin_path"`
AdminUser string `json:"admin_user"`
AdminPass string `json:"admin_pass"`
DockerHubHost string `json:"docker_hub_host"`
GHCRCacheEnabled bool `json:"ghcr_cache_enabled"`
CacheDir string `json:"cache_dir"`
MaxCacheSize int64 `json:"max_cache_size"`
Links map[string]*Link `json:"links"`
ListenAddr string `json:"listen_addr"`
AdminPath string `json:"admin_path"`
AdminUser string `json:"admin_user"`
AdminPass string `json:"admin_pass"`
SessionTimeout int `json:"session_timeout"` // hours
DockerHubHost string `json:"docker_hub_host"`
GHCRCacheEnabled bool `json:"ghcr_cache_enabled"`
CacheDir string `json:"cache_dir"`
MaxCacheSize int64 `json:"max_cache_size"`
Links map[string]*Link `json:"links"`
mu sync.RWMutex
}
@@ -74,6 +75,7 @@ func defaultConfig() *Config {
AdminPath: "/admin",
AdminUser: "admin",
AdminPass: "admin123",
SessionTimeout: 24,
DockerHubHost: "registry-1.docker.io",
GHCRCacheEnabled: true,
CacheDir: "./cache",