Add boot image management with ISO extraction and serving
Upload Proxmox ISOs via API or dashboard UI, extract kernel+initrd using pure-Go iso9660 library, store on disk, and serve over HTTP for PXE booting. Dynamic kernel/initrd filenames per image replace the previous hardcoded paths. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,10 +13,12 @@ import (
|
||||
)
|
||||
|
||||
type Deps struct {
|
||||
HostAPI *api.HostAPI
|
||||
BootAPI *api.BootAPI
|
||||
UI *api.UI
|
||||
Hub *events.Hub
|
||||
HostAPI *api.HostAPI
|
||||
BootAPI *api.BootAPI
|
||||
ImageAPI *api.ImageAPI
|
||||
UI *api.UI
|
||||
Hub *events.Hub
|
||||
ImageDir string
|
||||
}
|
||||
|
||||
func NewRouter(d Deps) http.Handler {
|
||||
@@ -29,6 +31,10 @@ func NewRouter(d Deps) http.Handler {
|
||||
staticFS, _ := fs.Sub(web.Static, "static")
|
||||
r.Handle("/static/*", http.StripPrefix("/static/", http.FileServer(http.FS(staticFS))))
|
||||
|
||||
// Boot image files (kernel/initrd served from disk)
|
||||
r.Handle("/images/boot/*", http.StripPrefix("/images/boot/",
|
||||
http.FileServer(http.Dir(d.ImageDir))))
|
||||
|
||||
// SSE
|
||||
r.Get("/events", d.Hub.ServeSSE)
|
||||
|
||||
@@ -40,6 +46,10 @@ func NewRouter(d Deps) http.Handler {
|
||||
r.Post("/hosts/{id}/rebuild", d.UI.TriggerRebuild)
|
||||
r.Post("/hosts/{id}/delete", d.UI.DeleteHost)
|
||||
r.Get("/images", d.UI.ImagesPage)
|
||||
r.Get("/images/new", d.UI.NewImageForm)
|
||||
r.Post("/images/upload", d.UI.UploadImage)
|
||||
r.Post("/images/{id}/default", d.UI.SetDefaultImage)
|
||||
r.Post("/images/{id}/delete", d.UI.DeleteImage)
|
||||
|
||||
// Host JSON API
|
||||
r.Route("/api/hosts", func(r chi.Router) {
|
||||
@@ -50,6 +60,15 @@ func NewRouter(d Deps) http.Handler {
|
||||
r.Post("/{id}/rebuild", d.HostAPI.Rebuild)
|
||||
})
|
||||
|
||||
// Image JSON API
|
||||
r.Route("/api/images", func(r chi.Router) {
|
||||
r.Get("/", d.ImageAPI.List)
|
||||
r.Post("/", d.ImageAPI.Upload)
|
||||
r.Get("/{id}", d.ImageAPI.Get)
|
||||
r.Delete("/{id}", d.ImageAPI.Delete)
|
||||
r.Post("/{id}/default", d.ImageAPI.SetDefault)
|
||||
})
|
||||
|
||||
// Boot / PXE endpoints
|
||||
r.Get("/ipxe/{mac}", d.BootAPI.IPXEScript)
|
||||
r.Post("/api/boot/answer", d.BootAPI.AnswerFile)
|
||||
|
||||
Reference in New Issue
Block a user