From b0e84f6aa8d7d1d3b61129dcc1fededa6cf0d7cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mika=C3=ABl=20Cluseau?=
Date: Fri, 8 May 2026 15:01:44 +0200
Subject: [PATCH] adapt ui to new assets
---
cmd/dkl-local-server/ws-download-set.go | 21 +++++--
cmd/dkl-local-server/ws-downloads.go | 10 +++-
cmd/dkl-local-server/ws-host.go | 55 +++++++++++++------
go.mod | 2 +-
go.sum | 2 +
...2c46d.js => Downloads-29497c61f1fe9bf0.js} | 8 +--
html/ui/app.css | 9 ++-
html/ui/index.html | 2 +-
html/ui/style.css | 6 +-
ui/app.css | 9 ++-
ui/js/Downloads.js | 8 +--
ui/style.css | 6 +-
12 files changed, 97 insertions(+), 41 deletions(-)
rename html/ui/{Downloads-c9374f19f52c46d.js => Downloads-29497c61f1fe9bf0.js} (97%)
diff --git a/cmd/dkl-local-server/ws-download-set.go b/cmd/dkl-local-server/ws-download-set.go
index 1bf5734..bfc2ee1 100644
--- a/cmd/dkl-local-server/ws-download-set.go
+++ b/cmd/dkl-local-server/ws-download-set.go
@@ -262,14 +262,17 @@ func wsDownloadSet(req *restful.Request, resp *restful.Response) {
for _, item := range set.Items {
names := make([]string, 0)
+ section := ""
switch item.Kind {
case "cluster":
+ section = "Cluster"
for _, c := range cfg.Clusters {
if globMatch(item.Name, c.Name) {
names = append(names, c.Name)
}
}
case "host":
+ section = "Host"
for _, h := range cfg.Hosts {
if globMatch(item.Name, h.Name) {
names = append(names, h.Name)
@@ -278,12 +281,22 @@ func wsDownloadSet(req *restful.Request, resp *restful.Response) {
}
for _, name := range names {
- fmt.Fprintf(buf, "%s %s
", strings.Title(item.Kind), name)
- fmt.Fprintf(buf, "\n")
+ buf.WriteString("
")
+ fmt.Fprintf(buf, "%s %s:", section, name)
+ buf.WriteString(" ")
for _, asset := range item.Assets {
- fmt.Fprintf(buf, " %s\n", item.Kind, name, asset, setStr, asset)
+ for _, v := range hostAssetVariants(asset) {
+ url := fmt.Sprintf("/public/download-set/%s/%s/%s", item.Kind, name, v.url)
+ if strings.Contains(url, "?") {
+ url += "&"
+ } else {
+ url += "?"
+ }
+ url += "set=" + setStr
+ fmt.Fprintf(buf, " %s\n", url, v.name)
+ }
}
- fmt.Fprintf(buf, `
`)
+ buf.WriteString("
\n")
}
}
diff --git a/cmd/dkl-local-server/ws-downloads.go b/cmd/dkl-local-server/ws-downloads.go
index 54b8991..b22a549 100644
--- a/cmd/dkl-local-server/ws-downloads.go
+++ b/cmd/dkl-local-server/ws-downloads.go
@@ -188,11 +188,15 @@ func wsDownloadPage(req *restful.Request, resp *restful.Response) {
buf := new(bytes.Buffer)
buf.WriteString(htmlHeader(fmt.Sprintf("Token assets: %s %s", spec.Kind, spec.Name)))
- buf.WriteString("")
+ buf.WriteString("")
for _, asset := range spec.Assets {
- fmt.Fprintf(buf, "- %s
\n", asset, asset)
+ buf.WriteString("")
+ for _, v := range hostAssetVariants(asset) {
+ fmt.Fprintf(buf, "| %s | ", v.url, v.name)
+ }
+ buf.WriteString("
\n")
}
- buf.WriteString("")
+ buf.WriteString("
")
buf.WriteString(htmlFooter)
buf.WriteTo(resp)
diff --git a/cmd/dkl-local-server/ws-host.go b/cmd/dkl-local-server/ws-host.go
index d0e76f8..20fa6df 100644
--- a/cmd/dkl-local-server/ws-host.go
+++ b/cmd/dkl-local-server/ws-host.go
@@ -1,7 +1,6 @@
package main
import (
- "flag"
"io"
"log"
"net/http"
@@ -14,10 +13,36 @@ import (
"novit.tech/direktil/local-server/pkg/mime"
)
-var (
- allowDetectedHost = flag.Bool("allow-detected-host", false, "Allow access to host assets from its IP (insecure but enables unattended netboot)")
- trustXFF = flag.Bool("trust-xff", false, "Trust the X-Forwarded-For header")
-)
+type AssetVariant struct {
+ name string
+ url string
+}
+
+func hostAssetVariants(asset string) []AssetVariant {
+ switch asset {
+ case "uki":
+ return []AssetVariant{
+ {asset, asset},
+ {asset + " (serial)", asset + "?serial=0"},
+ }
+ case "boot.img",
+ "boot.img.gz",
+ "boot.qcow2",
+ "boot.qed",
+ "boot.vdi",
+ "boot.vmdk",
+ "boot.vpc",
+ "boot.iso",
+ "boot.tar":
+ return []AssetVariant{
+ {asset, asset},
+ {asset + " (UKI)", asset + "?uki"},
+ {asset + " (UKI+serial)", asset + "?uki&serial=0"},
+ }
+ default:
+ return []AssetVariant{{asset, asset}}
+ }
+}
type wsHost struct {
hostDoc string
@@ -52,9 +77,6 @@ func (ws wsHost) register(rws *restful.WebService, alterRB func(*restful.RouteBu
b("boot.img.gz").
Produces(mime.DISK + "+gzip").
Doc("Get the " + ws.hostDoc + "'s boot disk image, gzip compressed"),
- b("boot.img.lz4").
- Produces(mime.DISK + "+lz4").
- Doc("Get the " + ws.hostDoc + "'s boot disk image, lz4 compressed"),
// - other formats
b("boot.qcow2").
@@ -188,19 +210,12 @@ func renderHost(w http.ResponseWriter, r *http.Request, what string, host *local
}
switch what {
- case "config":
- err = renderConfig(w, r, ctx, false)
- case "config.json":
- err = renderConfig(w, r, ctx, true)
-
- case "ipxe":
- err = renderIPXE(w, ctx)
-
case "kernel":
err = renderKernel(w, r, ctx)
case "initrd":
err = renderCtx(w, r, ctx, what, buildInitrd)
case "uki":
+ uki = true
err = renderCtx(w, r, ctx, what, withUki(buildUki))
case "bootstrap.tar":
@@ -230,6 +245,14 @@ func renderHost(w http.ResponseWriter, r *http.Request, what string, host *local
case "bootstrap-config":
err = renderBootstrapConfig(w, ctx)
+ case "config":
+ err = renderConfig(w, r, ctx, false)
+ case "config.json":
+ err = renderConfig(w, r, ctx, true)
+
+ case "ipxe":
+ err = renderIPXE(w, ctx)
+
default:
http.NotFound(w, r)
}
diff --git a/go.mod b/go.mod
index fdb7682..62f6402 100644
--- a/go.mod
+++ b/go.mod
@@ -25,7 +25,7 @@ require (
gopkg.in/yaml.v2 v2.4.0
k8s.io/apimachinery v0.33.2
m.cluseau.fr/go v0.0.0-20230809064045-12c5a121c766
- novit.tech/direktil/pkg v0.0.0-20260221072850-b72bed72bb51
+ novit.tech/direktil/pkg v0.0.0-20260508111456-5a75785cfbbf
)
replace github.com/zmap/zlint/v3 => github.com/zmap/zlint/v3 v3.3.1
diff --git a/go.sum b/go.sum
index 12c0fef..ff36f66 100644
--- a/go.sum
+++ b/go.sum
@@ -350,3 +350,5 @@ novit.tech/direktil/pkg v0.0.0-20260210141740-4d5661fa8ecd h1:proGf8Cid9tzJzoRbq
novit.tech/direktil/pkg v0.0.0-20260210141740-4d5661fa8ecd/go.mod h1:zjezU6tELE880oYHs/WAauGBupKIEQQ7KqWTB69RW10=
novit.tech/direktil/pkg v0.0.0-20260221072850-b72bed72bb51 h1:NBcpvWcTBMzFos0pkuLsbVCQ+mHf8KqNOdVywMX6FFk=
novit.tech/direktil/pkg v0.0.0-20260221072850-b72bed72bb51/go.mod h1:zjezU6tELE880oYHs/WAauGBupKIEQQ7KqWTB69RW10=
+novit.tech/direktil/pkg v0.0.0-20260508111456-5a75785cfbbf h1:Qt4aaB1R/BjQGEAhhNoIhzQwzaycxPgxHiA9M7aEujk=
+novit.tech/direktil/pkg v0.0.0-20260508111456-5a75785cfbbf/go.mod h1:zjezU6tELE880oYHs/WAauGBupKIEQQ7KqWTB69RW10=
diff --git a/html/ui/Downloads-c9374f19f52c46d.js b/html/ui/Downloads-29497c61f1fe9bf0.js
similarity index 97%
rename from html/ui/Downloads-c9374f19f52c46d.js
rename to html/ui/Downloads-29497c61f1fe9bf0.js
index 0e64c8e..77798e3 100644
--- a/html/ui/Downloads-c9374f19f52c46d.js
+++ b/html/ui/Downloads-29497c61f1fe9bf0.js
@@ -10,17 +10,17 @@ const Downloads = {
host: [
"kernel",
"initrd",
+ "uki",
"bootstrap.tar",
- "boot.img.lz4",
"boot.img.gz",
+ "boot.img",
"boot.qcow2",
"boot.vmdk",
- "boot.img",
"boot.iso",
"boot.tar",
- "boot-efi.tar",
- "config",
"bootstrap-config",
+ "config",
+ "config.json",
"ipxe",
],
}[this.kind]
diff --git a/html/ui/app.css b/html/ui/app.css
index f3a6bab..bee1bd9 100644
--- a/html/ui/app.css
+++ b/html/ui/app.css
@@ -10,18 +10,23 @@
cursor: pointer;
}
-.downloads, .download-links {
+.downloads, .download-links, .download-table td {
& > * {
display: inline-block;
margin-right: 1ex;
margin-bottom: 1ex;
padding: 0.5ex;
- border: 1px solid;
+ border: 1px solid !important;
border-radius: 1ex;
cursor: pointer;
}
}
+.download-table th,
+.download-table td {
+ border: none !important;
+}
+
.downloads, .view-links {
& > .selected {
color: var(--link);
diff --git a/html/ui/index.html b/html/ui/index.html
index bcba6f0..042e2c9 100644
--- a/html/ui/index.html
+++ b/html/ui/index.html
@@ -11,7 +11,7 @@
-
+
diff --git a/html/ui/style.css b/html/ui/style.css
index 9c02019..98af93b 100644
--- a/html/ui/style.css
+++ b/html/ui/style.css
@@ -48,8 +48,10 @@ th, td {
border-bottom: dotted 1pt;
padding: 2pt 4pt;
}
-tr:first-child > th {
- border-top: dotted 1pt;
+tr:first-child {
+ th, td {
+ border-top: dotted 1pt;
+ }
}
th, tr:last-child > td {
border-bottom: solid 1pt;
diff --git a/ui/app.css b/ui/app.css
index f3a6bab..bee1bd9 100644
--- a/ui/app.css
+++ b/ui/app.css
@@ -10,18 +10,23 @@
cursor: pointer;
}
-.downloads, .download-links {
+.downloads, .download-links, .download-table td {
& > * {
display: inline-block;
margin-right: 1ex;
margin-bottom: 1ex;
padding: 0.5ex;
- border: 1px solid;
+ border: 1px solid !important;
border-radius: 1ex;
cursor: pointer;
}
}
+.download-table th,
+.download-table td {
+ border: none !important;
+}
+
.downloads, .view-links {
& > .selected {
color: var(--link);
diff --git a/ui/js/Downloads.js b/ui/js/Downloads.js
index 0e64c8e..77798e3 100644
--- a/ui/js/Downloads.js
+++ b/ui/js/Downloads.js
@@ -10,17 +10,17 @@ const Downloads = {
host: [
"kernel",
"initrd",
+ "uki",
"bootstrap.tar",
- "boot.img.lz4",
"boot.img.gz",
+ "boot.img",
"boot.qcow2",
"boot.vmdk",
- "boot.img",
"boot.iso",
"boot.tar",
- "boot-efi.tar",
- "config",
"bootstrap-config",
+ "config",
+ "config.json",
"ipxe",
],
}[this.kind]
diff --git a/ui/style.css b/ui/style.css
index 9c02019..98af93b 100644
--- a/ui/style.css
+++ b/ui/style.css
@@ -48,8 +48,10 @@ th, td {
border-bottom: dotted 1pt;
padding: 2pt 4pt;
}
-tr:first-child > th {
- border-top: dotted 1pt;
+tr:first-child {
+ th, td {
+ border-top: dotted 1pt;
+ }
}
th, tr:last-child > td {
border-bottom: solid 1pt;