diff --git a/README.md b/README.md index cff6526..d9cac5c 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,10 @@ To run the minimal UI use: $ npm run ui ``` +> The minimal UI is not meant for general use. It is there just to aid development. +> +> Remember to replace the _token_ in `./minimal-ui/index.html` with a valid token for your instalation. + ## Setup inside Patchfox diff --git a/bun.lockb b/bun.lockb new file mode 100644 index 0000000..3e0bffd Binary files /dev/null and b/bun.lockb differ diff --git a/minimal-ui/app.js b/minimal-ui/app.js new file mode 100644 index 0000000..bd012b3 --- /dev/null +++ b/minimal-ui/app.js @@ -0,0 +1,263 @@ +const root = document.body + +let server = "http://localhost:3000/jsonrpc" +let token = "85b2ae37-0be4-4faa-b1f0-d02189a31cfa" // replace with your token. +let identity = "@fu9wRz7+UwjDcvW6TZrvbNDT0cEPgWBh/ZZq5dKGEyY=.ed25519" + +function md(content) { + let opts = { + html: true, + linkify: true, + typographer: true + } + let markdown = window.markdownit(opts) + let result = markdown.render(content) + + function replaceMsgID(match, id, offset, string) { + let eid = encodeURIComponent(`%${id}`); + + return `/gi, '
')
+  .replace(/ {
+    return m("label", { for: id }, [`${label}: `, m("input", { type, value, id, ...events })])
+}
+
+const header = {
+    view: vnode => {
+        return m("header", [
+            m("h3", "Minimal Debugging UI"),
+            m("section.tool-bar", [
+                makeInput({
+                    id: "server-address",
+                    label: "RPC Server",
+                    value: server,
+                    events: {
+                        oninput: e => {
+                            server = e.target.value
+                            console.log(server)
+                        },
+                    },
+                }),
+                makeInput({
+                    id: "text",
+                    value: token,
+                    label: "Token",
+                }),
+                makeInput({
+                    id: "identity",
+                    label: "identity",
+                    value: identity,
+                    events: {
+                        oninput: e => {
+                            identity = e.target.value
+                            console.log(identity)
+                        },
+                    },
+                }),
+                m("hr", {"aria-orientation": "vertical"}),
+                m(m.route.Link, {selector: "a.