diff --git a/internal/component/control/html/instance.html b/internal/component/control/html/instance.html
index e5cbae1..2c2017f 100644
--- a/internal/component/control/html/instance.html
+++ b/internal/component/control/html/instance.html
@@ -13,15 +13,16 @@
URL: {{ .Info.URL }}
{{ .Info.Running }} {{ .Info.LastRebuild }} {{ .Instance.Created }} {{ .Instance.OwnerEmail }} {{ .Instance.Created.Format "2006-01-02T15:04:05Z07:00" }} {{ .Info.LastRebuild.Format "2006-01-02T15:04:05Z07:00" }} {{ .Instance.FilesystemBase }} {{ .Instance.AutoBlindUpdateEnabled }} {{ .Info.Pathbuilders }} {{ .Info.Pathbuilders }}{{ .Instance.SqlDatabase }} {{ .Instance.SqlUsername }} {{ .Time }}
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/internal/component/control/html/static/autolink.js b/internal/component/control/html/static/autolink.js
index 970d570..0c0b396 100644
--- a/internal/component/control/html/static/autolink.js
+++ b/internal/component/control/html/static/autolink.js
@@ -1,24 +1,19 @@
-/** adding links to each item, see http://blog.parkermoore.de/2014/08/01/header-anchor-links-in-vanilla-javascript-for-github-pages-and-jekyll/ */
-var anchorForId = function (id) {
- var anchor = document.createElement("a");
- anchor.className = "header-link";
- anchor.href = "#" + id;
- anchor.innerHTML = "#";
- return anchor;
-};
+/** Adapted from http://blog.parkermoore.de/2014/08/01/header-anchor-links-in-vanilla-javascript-for-github-pages-and-jekyll/ */
+const anchorForId = (id) => {
+ const anchor = document.createElement("a")
+ anchor.className = "header-link"
+ anchor.href = "#" + id
+ anchor.innerHTML = "#"
+ return anchor
+}
-var linkifyAnchors = function (level) {
- var headers = document.getElementsByTagName("h" + level);
- for (var h = 0; h < headers.length; h++) {
- var header = headers[h];
+const linkifyAnchors = (level) => {
+ const headers = document.getElementsByTagName("h" + level);
+ Array.from(headers).forEach((header) => {
+ if (typeof header.id === "undefined" || header.id === "") return
+ header.appendChild(anchorForId(header.id))
+ })
+}
- if (typeof header.id !== "undefined" && header.id !== "") {
- header.appendChild(anchorForId(header.id));
- }
- }
-};
-
-
-for (var level = 1; level <= 6; level++) {
- linkifyAnchors(level);
-}
\ No newline at end of file
+// linkify all the anchors from 1 ... 6
+Array(6).forEach((_, i) => linkifyAnchors(i + 1))
\ No newline at end of file
diff --git a/internal/component/control/html/static/instance.js b/internal/component/control/html/static/instance.js
new file mode 100644
index 0000000..b97e27c
--- /dev/null
+++ b/internal/component/control/html/static/instance.js
@@ -0,0 +1,60 @@
+const types = {
+ "date": (element) => {
+ return (new Date(element.innerText)).toString()
+ },
+ "pathbuilders": (element) => {
+ const pathbuilders = window.pathbuilders; // read from context!
+ const wrapper = document.createElement("span");
+
+ let found_one = false
+ Object.keys(pathbuilders).forEach(name => {
+ found_one = true
+
+ const filename = name + ".xml"
+ const data = pathbuilders[name]
+ const mime = "application/xml"
+ wrapper.append(make_download_link(filename, name, data, mime))
+ wrapper.append(document.createTextNode(" "))
+ })
+
+ if (!found_one) return '(none)';
+
+ const small = document.createElement('small')
+ small.append(document.createTextNode("(click to download)"))
+ wrapper.append(small)
+
+ return wrapper
+ }
+}
+
+const make_download_link = (filename, title, content, type) => {
+ const blob = new Blob(
+ [content],
+ {
+ type: type ?? "text/plain"
+ }
+ );
+
+ const link = document.createElement("a")
+ link.target = "_blank"
+ link.download = filename
+ link.href = URL.createObjectURL(blob)
+ link.append(document.createTextNode(title))
+
+ return link
+}
+
+Object.keys(types).forEach(key => {
+ const f = types[key];
+ const elements = document.querySelectorAll("code." + key)
+ elements.forEach(element => {
+ const newElement = f(element)
+ if (typeof newElement === 'string') {
+ element.innerHTML = ""
+ element.appendChild(document.createTextNode(newElement))
+ return
+ }
+
+ element.parentNode.replaceChild(newElement, element)
+ })
+})
\ No newline at end of file
diff --git a/internal/component/instances/wisski_status.go b/internal/component/instances/wisski_status.go
index 00827d8..b8a83b3 100644
--- a/internal/component/instances/wisski_status.go
+++ b/internal/component/instances/wisski_status.go
@@ -15,8 +15,8 @@ type Info struct {
LastRebuild time.Time
- Running bool // is the instance running?
- Pathbuilders []string // list of pathbuilders
+ Running bool // is the instance running?
+ Pathbuilders map[string]string // list of pathbuilders
}
// Info returns information about this WissKI instance.
@@ -39,7 +39,7 @@ func (wisski *WissKI) Info(quick bool) (info Info, err error) {
// these might execute php code or require additional database queries.
if !quick {
group.Go(func() error {
- info.Pathbuilders, _ = wisski.Pathbuilders()
+ info.Pathbuilders, _ = wisski.AllPathbuilders()
return nil
})
group.Go(func() (err error) {