Harden web/download pipeline and split handler modules

Replace shell-based downloader execution with validated arguments, enforce request hardening and safer defaults, and refactor handlers/router/state so job control is safer and easier to maintain.
This commit is contained in:
2026-04-14 10:21:11 +02:00
parent 6e016b802b
commit 1c82b619c4
25 changed files with 1722 additions and 667 deletions

19
src/router.go Normal file
View File

@@ -0,0 +1,19 @@
package main
import "net/http"
func newRouter() http.Handler {
mux := http.NewServeMux()
mux.HandleFunc("/", handleRoot)
mux.HandleFunc("/upload", handleUpload)
mux.HandleFunc("/select", handleSelect)
mux.HandleFunc("/process", handleProcess)
mux.HandleFunc("/progress", handleProgress)
mux.HandleFunc("/abort", handleAbort)
mux.HandleFunc("/pause", handlePause)
mux.HandleFunc("/resume", handleResume)
mux.HandleFunc("/clear-completed", handleClearCompleted)
mux.HandleFunc("/ws", handleWebSocket)
mux.HandleFunc("/set-speed-limit", handleSetSpeedLimit)
return withSecurityHeaders(mux)
}