diff --git a/Cargo.lock b/Cargo.lock index 20cda91..b460950 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,7 +14,7 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" dependencies = [ - "crypto-common", + "crypto-common 0.1.7", "generic-array", ] @@ -26,7 +26,7 @@ checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", - "cpufeatures", + "cpufeatures 0.2.17", ] [[package]] @@ -77,14 +77,14 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e7e126d41c3e0a6c85db7ba216bce5e41d53c156191c67d993613685fcc9410" dependencies = [ - "digest", + "digest 0.10.7", "hex", "hmac", "pbkdf2", "rand", "serde", "serde_json", - "sha2", + "sha2 0.10.9", "subtle", "thiserror 2.0.18", ] @@ -355,6 +355,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + [[package]] name = "bs58" version = "0.5.1" @@ -418,7 +427,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" dependencies = [ - "crypto-common", + "crypto-common 0.1.7", "inout", ] @@ -445,6 +454,12 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +[[package]] +name = "const-oid" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6ef517f0926dd24a1582492c791b6a4818a4d94e789a334894aa15b0d12f55c" + [[package]] name = "core-foundation" version = "0.9.4" @@ -480,6 +495,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2a41393f66f16b0823bb79094d54ac5fbd34ab292ddafb9a0456ac9f87d201" +dependencies = [ + "libc", +] + [[package]] name = "crc" version = "3.4.0" @@ -548,6 +572,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + [[package]] name = "ctr" version = "0.9.2" @@ -564,9 +597,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "curve25519-dalek-derive", - "digest", + "digest 0.10.7", "fiat-crypto", "rustc_version", "subtle", @@ -609,7 +642,7 @@ version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" dependencies = [ - "const-oid", + "const-oid 0.9.6", "pem-rfc7468", "zeroize", ] @@ -626,12 +659,23 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", + "block-buffer 0.10.4", + "const-oid 0.9.6", + "crypto-common 0.1.7", "subtle", ] +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer 0.12.1", + "const-oid 0.10.2", + "crypto-common 0.2.2", +] + [[package]] name = "displaydoc" version = "0.2.6" @@ -662,7 +706,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", @@ -688,7 +732,7 @@ dependencies = [ "curve25519-dalek", "ed25519", "serde", - "sha2", + "sha2 0.10.9", "subtle", "zeroize", ] @@ -710,7 +754,7 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", @@ -1202,7 +1246,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -1281,6 +1325,15 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +[[package]] +name = "hybrid-array" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "818356c5132c1fede50f837ca96afbe78ff42413047f4abb886217845e1b6c8c" +dependencies = [ + "typenum", +] + [[package]] name = "hyper" version = "0.14.32" @@ -1627,7 +1680,7 @@ dependencies = [ "ecdsa", "elliptic-curve", "once_cell", - "sha2", + "sha2 0.10.9", "signature", ] @@ -1724,7 +1777,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ "cfg-if", - "digest", + "digest 0.10.7", ] [[package]] @@ -1739,6 +1792,16 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + [[package]] name = "minimal-lexical" version = "0.2.1" @@ -2038,7 +2101,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest", + "digest 0.10.7", "hmac", ] @@ -2143,7 +2206,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", - "cpufeatures", + "cpufeatures 0.2.17", "opaque-debug", "universal-hash", ] @@ -2580,8 +2643,8 @@ version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" dependencies = [ - "const-oid", - "digest", + "const-oid 0.9.6", + "digest 0.10.7", "num-bigint-dig", "num-integer", "num-traits", @@ -2594,6 +2657,41 @@ dependencies = [ "zeroize", ] +[[package]] +name = "rust-embed" +version = "8.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9e7760e252aaba7b09f4be00e36476cf585bdb68a53552ac954cdf504ab4bc9" +dependencies = [ + "rust-embed-impl", + "rust-embed-utils", + "walkdir", +] + +[[package]] +name = "rust-embed-impl" +version = "8.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bcfc4d6f53af43755f7a723e4b6b8794fcce052a178dd8c6c1dadc5f5343097" +dependencies = [ + "mime_guess", + "proc-macro2", + "quote", + "rust-embed-utils", + "syn 2.0.118", + "walkdir", +] + +[[package]] +name = "rust-embed-utils" +version = "8.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ffa149f6aa81b58a5b3011d01a857c4ed12c7a732d2c51947a4c7c692185f0" +dependencies = [ + "sha2 0.11.0", + "walkdir", +] + [[package]] name = "rustc-hex" version = "2.1.0" @@ -2699,6 +2797,15 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + [[package]] name = "schannel" version = "0.1.29" @@ -2852,8 +2959,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.2.17", + "digest 0.10.7", ] [[package]] @@ -2863,8 +2970,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ "cfg-if", - "cpufeatures", - "digest", + "cpufeatures 0.2.17", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "446ba717509524cb3f22f17ecc096f10f4822d76ab5c0b9822c5f9c284e825f4" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.0", + "digest 0.11.3", ] [[package]] @@ -2898,7 +3016,7 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ - "digest", + "digest 0.10.7", "rand_core", ] @@ -2962,11 +3080,12 @@ dependencies = [ "rand", "reqwest", "rmp-serde", + "rust-embed", "rustls 0.22.4", "rustls-pki-types", "serde", "serde_json", - "sha2", + "sha2 0.10.9", "sqlx", "subtle", "tokio", @@ -3093,7 +3212,7 @@ dependencies = [ "rustls-pemfile", "serde", "serde_json", - "sha2", + "sha2 0.10.9", "smallvec", "sqlformat", "thiserror 1.0.69", @@ -3133,7 +3252,7 @@ dependencies = [ "quote", "serde", "serde_json", - "sha2", + "sha2 0.10.9", "sqlx-core", "sqlx-mysql", "sqlx-postgres", @@ -3157,7 +3276,7 @@ dependencies = [ "bytes", "chrono", "crc", - "digest", + "digest 0.10.7", "dotenvy", "either", "futures-channel", @@ -3178,7 +3297,7 @@ dependencies = [ "rsa", "serde", "sha1", - "sha2", + "sha2 0.10.9", "smallvec", "sqlx-core", "stringprep", @@ -3219,7 +3338,7 @@ dependencies = [ "rand", "serde", "serde_json", - "sha2", + "sha2 0.10.9", "smallvec", "sqlx-core", "stringprep", @@ -3822,6 +3941,12 @@ version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + [[package]] name = "unicode-bidi" version = "0.3.18" @@ -3867,7 +3992,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" dependencies = [ - "crypto-common", + "crypto-common 0.1.7", "subtle", ] @@ -4003,6 +4128,16 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + [[package]] name = "want" version = "0.3.1" @@ -4161,6 +4296,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" diff --git a/Cargo.toml b/Cargo.toml index c15d243..b0bef83 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ tower_governor = "0.4" governor = "0.6" # Database +rust-embed = { version = "8", features = ["debug-embed"] } arc-swap = "1" sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "postgres", "chrono", "uuid", "ipnetwork", "migrate", "json"] } ipnetwork = "0.20" diff --git a/admin-ui/.gitignore b/admin-ui/.gitignore new file mode 100644 index 0000000..d830e9c --- /dev/null +++ b/admin-ui/.gitignore @@ -0,0 +1,6 @@ +# Node deps β€” reproducible from package-lock.json (`npm ci`). +node_modules/ + +# NOTE: dist/ is intentionally NOT ignored. rust-embed bakes admin-ui/dist/ into +# the server binary at compile time, so the built console is committed. Rebuild it +# with `npm run build` in this directory whenever src/ changes (CI checks freshness). diff --git a/admin-ui/dist/assets/index-DLOlKNyc.js b/admin-ui/dist/assets/index-DLOlKNyc.js new file mode 100644 index 0000000..3f375ba --- /dev/null +++ b/admin-ui/dist/assets/index-DLOlKNyc.js @@ -0,0 +1,5 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))o(i);new MutationObserver(i=>{for(const r of i)if(r.type==="childList")for(const l of r.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&o(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const r={};return i.integrity&&(r.integrity=i.integrity),i.referrerPolicy&&(r.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?r.credentials="include":i.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function o(i){if(i.ep)return;i.ep=!0;const r=n(i);fetch(i.href,r)}})();var G,m,xe,E,ce,Se,Te,Y,D,M,Ce,_e,ee,te,j={},z=[],De=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,J=Array.isArray;function P(t,e){for(var n in e)t[n]=e[n];return t}function ie(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Fe(t,e,n){var o,i,r,l={};for(r in e)r=="key"?o=e[r]:r=="ref"?i=e[r]:l[r]=e[r];if(arguments.length>2&&(l.children=arguments.length>3?G.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(r in t.defaultProps)l[r]===void 0&&(l[r]=t.defaultProps[r]);return F(t,l,o,i,null)}function F(t,e,n,o,i){var r={type:t,props:e,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++xe,__i:-1,__u:0};return i==null&&m.vnode!=null&&m.vnode(r),r}function V(t){return t.children}function W(t,e){this.props=t,this.context=e}function I(t,e){if(e==null)return t.__?I(t.__,t.__i+1):null;for(var n;ee&&E.sort(Te),t=E.shift(),e=E.length,We(t)}finally{E.length=q.__r=0}}function Pe(t,e,n,o,i,r,l,a,d,s,u){var p,_,f,y,w,k,b,h=o&&o.__k||z,S=e.length;for(d=Re(n,e,h,d,S),p=0;p0?l=t.__k[r]=F(l.type,l.props,l.key,l.ref?l.ref:null,l.__v):t.__k[r]=l,d=r+_,l.__=t,l.__b=t.__b+1,a=null,(s=l.__i=je(l,n,d,p))!=-1&&(p--,(a=n[s])&&(a.__u|=2)),a==null||a.__v==null?(s==-1&&(i>u?_--:id?_--:_++,l.__u|=4))):t.__k[r]=null;if(p)for(r=0;r(u?1:0)){for(i=n-1,r=n+1;i>=0||r=0?i--:r++])!=null&&!(2&s.__u)&&a==s.key&&d==s.type)return l}return-1}function de(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||De.test(e)?n:n+"px"}function U(t,e,n,o,i){var r,l;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof o=="string"&&(t.style.cssText=o=""),o)for(e in o)n&&e in n||de(t.style,e,"");if(n)for(e in n)o&&n[e]==o[e]||de(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(Ce,"$1")),l=e.toLowerCase(),e=l in t||e=="onFocusOut"||e=="onFocusIn"?l.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=n,n?o?n[M]=o[M]:(n[M]=_e,t.addEventListener(e,r?te:ee,r)):t.removeEventListener(e,r?te:ee,r);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function fe(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e[D]==null)e[D]=_e++;else if(e[D]0?t:J(t)?t.map(He):t.constructor!==void 0?null:P({},t)}function ze(t,e,n,o,i,r,l,a,d){var s,u,p,_,f,y,w,k=n.props||j,b=e.props,h=e.type;if(h=="svg"?i="http://www.w3.org/2000/svg":h=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),r!=null){for(s=0;s=n.__.length&&n.__.push({}),n.__[t]}function x(t){return ne=1,Je(Be,t)}function Je(t,e,n){var o=Le(K++,2);if(o.t=t,!o.__c&&(o.__=[Be(void 0,e),function(a){var d=o.__N?o.__N[0]:o.__[0],s=o.t(d,a);d!==s&&(o.__N=[s,o.__[1]],o.__c.setState({}))}],o.__c=v,!v.__f)){var i=function(a,d,s){if(!o.__c.__H)return!0;var u=!1,p=o.__c.props!==a;if(o.__c.__H.__.some(function(f){if(f.__N){u=!0;var y=f.__[0];f.__=f.__N,f.__N=void 0,y!==f.__[0]&&(p=!0)}}),r){var _=r.call(this,a,d,s);return u?_||p:_}return!u||p};v.__f=!0;var r=v.shouldComponentUpdate,l=v.componentWillUpdate;v.componentWillUpdate=function(a,d,s){if(this.__e){var u=r;r=void 0,i(a,d,s),r=u}l&&l.call(this,a,d,s)},v.shouldComponentUpdate=i}return o.__N||o.__}function Me(t,e){var n=Le(K++,3);!g.__s&&Xe(n.__H,e)&&(n.__=t,n.u=e,v.__H.__h.push(n))}function Ve(){for(var t;t=Oe.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(R),e.__h.some(re),e.__h=[]}catch(n){e.__h=[],g.__e(n,t.__v)}}}g.__b=function(t){v=null,he&&he(t)},g.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),be&&be(t,e)},g.__r=function(t){me&&me(t),K=0;var e=(v=t.__c).__H;e&&(Z===v?(e.__h=[],v.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.some(R),e.__h.some(re),e.__h=[],K=0)),Z=v},g.diffed=function(t){ye&&ye(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Oe.push(e)!==1&&pe===g.requestAnimationFrame||((pe=g.requestAnimationFrame)||Qe)(Ve)),e.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Z=v=null},g.__c=function(t,e){e.some(function(n){try{n.__h.some(R),n.__h=n.__h.filter(function(o){return!o.__||re(o)})}catch(o){e.some(function(i){i.__h&&(i.__h=[])}),e=[],g.__e(o,n.__v)}}),ve&&ve(t,e)},g.unmount=function(t){ge&&ge(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(o){try{R(o)}catch(i){e=i}}),n.__H=void 0,e&&g.__e(e,n.__v))};var ke=typeof requestAnimationFrame=="function";function Qe(t){var e,n=function(){clearTimeout(o),ke&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(n,35);ke&&(e=requestAnimationFrame(n))}function R(t){var e=v,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),v=e}function re(t){var e=v;t.__c=t.__(),v=e}function Xe(t,e){return!t||t.length!==e.length||e.some(function(n,o){return n!==t[o]})}function Be(t,e){return typeof e=="function"?e(t):e}let oe=null;function Ue(t){oe=t}async function T(t,e,n){const o={};oe&&(o.Authorization=`Bearer ${oe}`),n!==void 0&&(o["Content-Type"]="application/json");const i=await fetch(e,{method:t,headers:o,body:n!==void 0?JSON.stringify(n):void 0}),r=await i.text(),l=r?JSON.parse(r):null;if(!i.ok){const a=l?.error??l?.message??`${i.status} ${i.statusText}`;throw new Error(a)}return l}const C={challenge:()=>T("GET","/admin/auth/challenge"),verify:(t,e)=>T("POST","/admin/auth/verify",{admin_token:t,challenge:e}),logout:()=>T("POST","/admin/auth/logout",{}),me:()=>T("GET","/admin/me"),features:()=>T("GET","/admin/features"),keys:()=>T("GET","/admin/keys"),addKey:(t,e)=>T("POST","/admin/keys",e?{pubkey:t,label:e}:{pubkey:t}),revokeKey:t=>T("DELETE",`/admin/keys/${t}`),config:()=>T("GET","/admin/config"),putConfig:(t,e)=>T("PUT","/admin/config",{patch:t,expected_versions:e}),invites:()=>T("GET","/admin/invites"),mintInvites:(t,e)=>T("POST","/admin/invites",e?{count:t,label:e}:{count:t})};async function we(t){const e=await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return[...new Uint8Array(e)].map(n=>n.toString(16).padStart(2,"0")).join("")}async function Ye(t,e){const o=`POST +/admin/auth/verify + +${await we("")}`,i=await we(o),r=await e.signEvent({kind:27235,created_at:Math.floor(Date.now()/1e3),content:"",tags:[["u",t.url],["method","POST"],["purpose","admin_login"],["challenge",t.challenge],["payload",i],["instance_id",t.instance_id]]});return`Nostr ${btoa(JSON.stringify(r))}`}function Ze(){const t=window.nostr;return t&&typeof t.signEvent=="function"?t:null}function et({onDone:t}){const[e,n]=x(!1),[o,i]=x(null);return c("div",{style:{maxWidth:420,margin:"12vh auto",padding:24,textAlign:"center"},children:[c("div",{style:{fontSize:40},children:"🐸"}),c("h1",{children:"Smirk Operator Console"}),c("p",{style:{color:"var(--smirk-fg-muted)"},children:"Sign in with an admin Nostr key on your instance's allowlist."}),c("button",{class:"primary",style:{padding:"12px 20px",fontSize:16},disabled:e,onClick:async()=>{n(!0),i(null);try{const l=Ze();if(!l)throw new Error("No NIP-07 signer found. Enable your Smirk wallet (or nos2x/Alby) on this origin, then reload.");const a=await C.challenge(),d=await Ye(a,l),{access_token:s}=await C.verify(d,a.challenge);Ue(s),t()}catch(l){i(l instanceof Error?l.message:"Sign-in failed")}finally{n(!1)}},children:e?"Signing in…":"Sign in with Smirk"}),o&&c("p",{style:{color:"var(--smirk-danger)",marginTop:16},children:o})]})}function H({title:t,children:e}){return c("div",{style:{background:"var(--smirk-bg-elevated)",border:"1px solid var(--smirk-border)",borderRadius:"var(--smirk-radius)",padding:16,marginBottom:16},children:[c("h3",{style:{marginTop:0},children:t}),e]})}function Q(t,e=[]){const[n,o]=x(null),[i,r]=x(null),l=()=>{r(null),t().then(o).catch(a=>r(a instanceof Error?a.message:String(a)))};return Me(l,e),{data:n,err:i,reload:l}}function tt(){const{data:t,err:e}=Q(()=>C.features());return c(H,{title:"Instance features",children:[e&&c("p",{style:{color:"var(--smirk-danger)"},children:e}),c("pre",{style:{overflow:"auto",fontSize:12},children:JSON.stringify(t,null,2)})]})}function nt(){const{data:t,err:e,reload:n}=Q(()=>C.keys()),[o,i]=x(""),[r,l]=x(!1),[a,d]=x(null),s=async()=>{l(!0),d(null);try{await C.addKey(o.trim().toLowerCase()),i(""),n()}catch(p){d(p instanceof Error?p.message:String(p))}finally{l(!1)}},u=async p=>{confirm("Revoke this admin key?")&&(await C.revokeKey(p),n())};return c(H,{title:"Admin keys",children:[e&&c("p",{style:{color:"var(--smirk-danger)"},children:e}),c("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:c("tbody",{children:(t??[]).map(p=>c("tr",{style:{borderTop:"1px solid var(--smirk-border)"},children:[c("td",{style:{fontFamily:"monospace",padding:"6px 4px"},children:[p.pubkey.slice(0,16),"…"]}),c("td",{style:{padding:"6px 4px"},children:p.status}),c("td",{style:{padding:"6px 4px",textAlign:"right"},children:p.status!=="revoked"&&c("button",{class:"danger",onClick:()=>u(p.id),children:"Revoke"})})]}))})}),c("div",{style:{display:"flex",gap:8,marginTop:12},children:[c("input",{style:{flex:1},placeholder:"new admin pubkey (64 hex)",value:o,onInput:p=>i(p.target.value)}),c("button",{class:"primary",disabled:r||o.trim().length!==64,onClick:s,children:"Add key"})]}),a&&c("p",{style:{color:"var(--smirk-danger)"},children:a})]})}function rt(){const{data:t,err:e,reload:n}=Q(()=>C.invites()),[o,i]=x(5),[r,l]=x(""),[a,d]=x(null),[s,u]=x(!1),p=async()=>{u(!0);try{const _=await C.mintInvites(o,r.trim()||void 0);d(_.codes),n()}finally{u(!1)}};return c(H,{title:`Invite codes${t?` β€” ${t.unused_count} unused`:""}`,children:[e&&c("p",{style:{color:"var(--smirk-danger)"},children:e}),c("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:12},children:[c("input",{type:"number",min:1,max:1e3,style:{width:80},value:o,onInput:_=>i(Number(_.target.value))}),c("input",{style:{flex:1},placeholder:"label (optional)",value:r,onInput:_=>l(_.target.value)}),c("button",{class:"primary",disabled:s,onClick:p,children:"Mint"})]}),a&&c("div",{style:{background:"var(--smirk-bg-sunken)",padding:12,borderRadius:8,marginBottom:12},children:[c("b",{children:"New codes β€” copy now, they are shown once:"}),c("pre",{style:{margin:"6px 0 0",whiteSpace:"pre-wrap"},children:a.join(` +`)})]}),c("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:c("tbody",{children:(t?.invites??[]).map(_=>c("tr",{style:{borderTop:"1px solid var(--smirk-border)"},children:[c("td",{style:{fontFamily:"monospace",padding:"6px 4px"},children:[_.code_prefix,"…"]}),c("td",{style:{padding:"6px 4px"},children:_.label??""}),c("td",{style:{padding:"6px 4px",color:"var(--smirk-fg-muted)"},children:_.created_at.slice(0,10)}),c("td",{style:{padding:"6px 4px"},children:_.status})]}))})})]})}function ot(){const{data:t,err:e,reload:n}=Q(()=>C.config()),[o,i]=x({}),[r,l]=x(null);if(Me(()=>{t&&i(structuredClone(t.effective))},[t]),e)return c(H,{title:"Config",children:c("p",{style:{color:"var(--smirk-danger)"},children:e})});if(!t)return c(H,{title:"Config",children:"Loading…"});const a=(s,u,p)=>i(_=>({..._,[s]:{..._[s]??{},[u]:p}})),d=async s=>{l(null);try{await C.putConfig({[s]:o[s]},{[s]:t.versions[s]??0}),l(`Saved ${s}.`),n()}catch(u){l(u instanceof Error?u.message:String(u))}};return c("div",{children:[t.restart_pending&&c("div",{style:{background:"rgba(245,158,11,0.12)",border:"1px solid var(--smirk-warn)",borderRadius:8,padding:10,marginBottom:16},children:"⚠ A saved change needs a restart to take effect (systemctl restart, or auto mode)."}),r&&c("p",{style:{color:"var(--smirk-accent)"},children:r}),Object.keys(o).sort().map(s=>c(H,{title:s,children:[Object.entries(o[s]??{}).map(([u,p])=>{const _=t.runtime_class[`${s}.${u}`]??"restart-required",f=t.overlay[s]?.[u]!==void 0;return c("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"4px 0"},children:[c("label",{style:{flex:1,minWidth:0},children:[u," ",c("span",{style:{fontSize:11,color:"var(--smirk-fg-muted)"},children:["Β· ",_==="restart-required"?"restart":"live",f?" Β· db":""]})]}),typeof p=="boolean"?c("input",{type:"checkbox",checked:p,onChange:y=>a(s,u,y.target.checked)}):c("input",{style:{width:220},value:String(p??""),onInput:y=>{const w=y.target.value;a(s,u,typeof p=="number"?Number(w):w)}})]})}),c("button",{class:"primary",style:{marginTop:8},onClick:()=>d(s),children:["Save ",s]})]}))]})}const _t=["Status","Keys","Invites","Config"];function it({onLogout:t}){const[e,n]=x("Status");return c("div",{style:{maxWidth:760,margin:"0 auto",padding:20},children:[c("header",{style:{display:"flex",alignItems:"center",marginBottom:16},children:[c("h2",{style:{margin:0,flex:1},children:"🐸 Smirk Operator Console"}),c("button",{onClick:()=>{C.logout().catch(()=>{}),Ue(null),t()},children:"Sign out"})]}),c("nav",{style:{display:"flex",gap:6,marginBottom:16},children:_t.map(o=>c("button",{class:o===e?"primary":"",onClick:()=>n(o),children:o}))}),e==="Status"&&c(tt,{}),e==="Keys"&&c(nt,{}),e==="Invites"&&c(rt,{}),e==="Config"&&c(ot,{})]})}function lt(){const[t,e]=x(!1);return t?c(it,{onLogout:()=>e(!1)}):c(et,{onDone:()=>e(!0)})}Ke(c(lt,{}),document.getElementById("app")); diff --git a/admin-ui/dist/assets/index-uKG4VNAS.css b/admin-ui/dist/assets/index-uKG4VNAS.css new file mode 100644 index 0000000..d25cc27 --- /dev/null +++ b/admin-ui/dist/assets/index-uKG4VNAS.css @@ -0,0 +1 @@ +:root{--smirk-bg: #2c1e12;--smirk-bg-elevated: #3a2a1b;--smirk-bg-sunken: #241810;--smirk-fg: #f3e9dd;--smirk-fg-muted: #b9a891;--smirk-accent: #f5c542;--smirk-accent-fg: #2c1e12;--smirk-border: rgba(255, 255, 255, .12);--smirk-border-strong: rgba(255, 255, 255, .22);--smirk-danger: #ef4444;--smirk-ok: #22c55e;--smirk-warn: #f59e0b;--smirk-radius: 10px;--smirk-font: system-ui, -apple-system, Segoe UI, Roboto, sans-serif}*{box-sizing:border-box}body{margin:0;background:var(--smirk-bg);color:var(--smirk-fg);font-family:var(--smirk-font);font-size:14px;line-height:1.5}h1,h2,h3{font-weight:700}button{font:inherit;cursor:pointer;border-radius:8px;border:1px solid var(--smirk-border);background:var(--smirk-bg-elevated);color:inherit;padding:8px 14px}button.primary{background:var(--smirk-accent);color:var(--smirk-accent-fg);border:none;font-weight:700}button.danger{color:var(--smirk-danger);border-color:var(--smirk-danger)}button:disabled{opacity:.5;cursor:default}input,textarea,select{font:inherit;color:inherit;background:var(--smirk-bg-sunken);border:1px solid var(--smirk-border);border-radius:8px;padding:8px 10px}code,pre{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}a{color:var(--smirk-accent)} diff --git a/admin-ui/dist/index.html b/admin-ui/dist/index.html new file mode 100644 index 0000000..12b7ad9 --- /dev/null +++ b/admin-ui/dist/index.html @@ -0,0 +1,14 @@ + + + + + + + Smirk Operator Console + + + + +
+ + diff --git a/admin-ui/index.html b/admin-ui/index.html new file mode 100644 index 0000000..93bba08 --- /dev/null +++ b/admin-ui/index.html @@ -0,0 +1,13 @@ + + + + + + + Smirk Operator Console + + +
+ + + diff --git a/admin-ui/package-lock.json b/admin-ui/package-lock.json new file mode 100644 index 0000000..de5db9e --- /dev/null +++ b/admin-ui/package-lock.json @@ -0,0 +1,1023 @@ +{ + "name": "smirk-admin-ui", + "version": "0.3.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "smirk-admin-ui", + "version": "0.3.0", + "dependencies": { + "preact": "^10.24.3" + }, + "devDependencies": { + "typescript": "^5.6.3", + "vite": "^5.4.10" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.62.2.tgz", + "integrity": "sha512-6o7ZLZK+BeenkZCFNDXqpbjw9bD6nuWonvS/lwQJp7NoVVxm6p3qE7qQ5jGuBjiFsgvqjD8mZAU5oWxTmbOeOg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.62.2.tgz", + "integrity": "sha512-BaH7BllCACHoH1LguOU56UItGfUWjujlO65kS9LAodViaN4bwIKd7oeW/ZHJ/4ljr/7MIiENnNy3HJ0zXv8Zkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.62.2.tgz", + "integrity": "sha512-v39RCCvj4He82I9sFmk+M1VZ0PLM9sfsLVikjfx2hYBNALhrrOR2D3JjQA6AhlaSOgcR+RzrKY7e1+bT6SUO/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.62.2.tgz", + "integrity": "sha512-yl0y2vq3S3lHeuXhEdss6TWfKW8vkujImO12tn4ZkG/4oghr09LvdYm2RElVjokTQiUvDUGXLGsYeLqUMCKpGA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.62.2.tgz", + "integrity": "sha512-tT4pvt4qXD+vEoezupCWi+a1F0vvDiksiHc+PxRlYTOH1I6/X4id9jPxTP+Fg+545euaFT1jJVs4CEdHZAU1vw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.62.2.tgz", + "integrity": "sha512-6nU5F2wCW+qvCBhTn1pdIU3bzsIoF7EUwsCDRxilWGprQR6yd508YnH9+OKFCwpfS8pjZqDUmnCAr7exax0XCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.62.2.tgz", + "integrity": "sha512-n1GJHPOvpIfhi3TmrCeh6S6URt9BFCt0KQE3qvexyGCTAKpR4Lg+eWvNZEqu7epxwus/8ElT3hacYEucm49SZg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.62.2.tgz", + "integrity": "sha512-JqgflS8wEB+UXV/vS1RpRbifGBeN4D5lz8D8oOFbFZw4vedvdOgCFAjfBmIMdW3yL10XpQQ0Ambepw6MXrhOnA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.62.2.tgz", + "integrity": "sha512-wnFJkogWvN4jm/hQRF2UBaeUmk20j5+DmHvoyWii2b8HJDyvz1MF2OU/6ynXt2KR63rbZLWkFpoytpdc/yBuSA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.62.2.tgz", + "integrity": "sha512-HVu2bp0zhvJ8xHEV9+UUs7S90VadmBSY3LcIMvozbPo4AuMGDWlz3ymHLHZPX4hR67TKTt8Qp5PJ5RBg/i+RMQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.62.2.tgz", + "integrity": "sha512-mQqqAV8QaoSgr9I2fKDLY2BAVvmKjWoGiu/cSYQonsLvtqwEn1E4QYfnCOcp5zoEqNhsDYin1s6jx/VJmrxlZg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.62.2.tgz", + "integrity": "sha512-IxKLoxCQ2IWi6bT2akyDUBGsOImDKB+sPp4EsTmwFQ/fMwpCKm8uLSSgP/Kx/QYUgKis6SEZ5/Nlhup0DIA0PQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.62.2.tgz", + "integrity": "sha512-Mk5ha2RQSgyFfmYYLkBpPnUk8D8FriBxesO1u9O75X0mHgXL1UQcH5Itl2lurWL2tj0RxV9b9tJgipac0hRY9A==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.62.2.tgz", + "integrity": "sha512-CjvEnqJL/0/TQ3TXX3OPIJ/kmBellrWd4heXUmHeJlTnmwjKpSJzoehLaL6Xk0ZnMHBu9dZuFADNOrtjF4v+2w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.62.2.tgz", + "integrity": "sha512-1SiZbzwdkaDURsew/tSOrooKiYy7EQGT6m8ufavAi9NEyQb/6VuIxFXAL1fqa4iZe3g4NbNk4P7J32z2tw5Mgg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.62.2.tgz", + "integrity": "sha512-nQts12zJ3NQRoE6uYljOH89v7szzLDvG2JD/vsX+vGXU8w/At1GowTZ5/7qeFQ8m7L55rpR8Okugnuo5bgjy2Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.62.2.tgz", + "integrity": "sha512-E9/ll019jhPIJgpzfZoIkBGhcz+kKNgVWYRY0zr9srBdPPFVpvOKW8VaJKUbeK+eZXyQF9ltME+Kk6affeaPgg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.62.2.tgz", + "integrity": "sha512-5BqxR/pshjey51iliyzTD5Xi3EN0aLmQ2lZ3lvefVV9c82BvrLo2/6OT55iifpWBufs6kdwWbuOKS841DrmK9A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.62.2.tgz", + "integrity": "sha512-uNN83XxQrRAh/w0/pmAfibcwyb6YWt4gP+dpnQKPVJshAloQ785ii8CT8ZCIxkGg9opVsvAlGhFitSm6D1Jjpg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.62.2.tgz", + "integrity": "sha512-srjEIxSH3LRnJN6THczDHWQplqEMFiAJrTab0msUryh9kwNpkICf3Ea6q6MN/2cZwRFUNx5w+h6Hpi4QuHS6Zg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.62.2.tgz", + "integrity": "sha512-8hOJnxgbyObnCm5AlRA3A931xX19xq80RjVTKgJOvEKWqJruP/Uf12IbAOaDjjEXYRewwHLfmF0YRIdK3OwKWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.62.2.tgz", + "integrity": "sha512-mmF4AY1i0hG/bLWUctUq59gtmgaSIRa3cu/A3JFRp/sCNEme2bgDEiDS22P9FbnJB8NJNF4jPJiSP5RHQpUTDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.62.2.tgz", + "integrity": "sha512-DZgkknc6jhHrk46V25vbAM0zZkyP0nSDkJB8/dRkLTxv470dOmWDqGoEJl/9A0dFfS7yE3REOwNDxpHwSLSt0Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.62.2.tgz", + "integrity": "sha512-T6xr6ucWSFto+VGajA8YH26LdpHRuP4YLHEKAtCWvJDOlnmWcDZVCI2Jmjr+IFHDlt2zRaTAKE4tfjTaWLgJBg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.62.2.tgz", + "integrity": "sha512-BfzEnDJOt9T8M989/lA37EcJgat01wLRnoi5dQf3QzOH7jzpqTAzdDbVfRljVr5r+jzKqpbHeyOfAaXxAd0PAA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.16", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.16.tgz", + "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/postcss": { + "version": "8.5.19", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.19.tgz", + "integrity": "sha512-Mz8SaolMd8nB+G13WkORcxQKHZ/NE4xXevtkJHVuG+guo9/wYKlIMTKAqGdEmYOXR2ijPjTYNHssizdaVSUNdQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.12", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/preact": { + "version": "10.29.7", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.29.7.tgz", + "integrity": "sha512-DCHYrK/B10yUD3ZjLfhZ3WIE/9Vf9VFUODcRE2dRomTYDpJk6z6L9wecSfhfE6M9ZTHUdyQkoC46arIDhEV84Q==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + }, + "peerDependencies": { + "preact-render-to-string": ">=5" + }, + "peerDependenciesMeta": { + "preact-render-to-string": { + "optional": true + } + } + }, + "node_modules/rollup": { + "version": "4.62.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.62.2.tgz", + "integrity": "sha512-RFnrW4lhXA3s3eqHDZvN654g8OTjzRfqpIRJYczCGB6HzphckVAi/Qh4tbPUbRuDi7s1Llv8g/NspLkttY3gTA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.62.2", + "@rollup/rollup-android-arm64": "4.62.2", + "@rollup/rollup-darwin-arm64": "4.62.2", + "@rollup/rollup-darwin-x64": "4.62.2", + "@rollup/rollup-freebsd-arm64": "4.62.2", + "@rollup/rollup-freebsd-x64": "4.62.2", + "@rollup/rollup-linux-arm-gnueabihf": "4.62.2", + "@rollup/rollup-linux-arm-musleabihf": "4.62.2", + "@rollup/rollup-linux-arm64-gnu": "4.62.2", + "@rollup/rollup-linux-arm64-musl": "4.62.2", + "@rollup/rollup-linux-loong64-gnu": "4.62.2", + "@rollup/rollup-linux-loong64-musl": "4.62.2", + "@rollup/rollup-linux-ppc64-gnu": "4.62.2", + "@rollup/rollup-linux-ppc64-musl": "4.62.2", + "@rollup/rollup-linux-riscv64-gnu": "4.62.2", + "@rollup/rollup-linux-riscv64-musl": "4.62.2", + "@rollup/rollup-linux-s390x-gnu": "4.62.2", + "@rollup/rollup-linux-x64-gnu": "4.62.2", + "@rollup/rollup-linux-x64-musl": "4.62.2", + "@rollup/rollup-openbsd-x64": "4.62.2", + "@rollup/rollup-openharmony-arm64": "4.62.2", + "@rollup/rollup-win32-arm64-msvc": "4.62.2", + "@rollup/rollup-win32-ia32-msvc": "4.62.2", + "@rollup/rollup-win32-x64-gnu": "4.62.2", + "@rollup/rollup-win32-x64-msvc": "4.62.2", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/vite": { + "version": "5.4.21", + "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz", + "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.21.3", + "postcss": "^8.4.43", + "rollup": "^4.20.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || >=20.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || >=20.0.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.4.0" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + } + } + } + } +} diff --git a/admin-ui/package.json b/admin-ui/package.json new file mode 100644 index 0000000..b41b5be --- /dev/null +++ b/admin-ui/package.json @@ -0,0 +1,18 @@ +{ + "name": "smirk-admin-ui", + "private": true, + "version": "0.3.0", + "type": "module", + "description": "Operator console SPA, embedded into smirk-backend-core and served at /admin.", + "scripts": { + "dev": "vite", + "build": "vite build" + }, + "dependencies": { + "preact": "^10.24.3" + }, + "devDependencies": { + "typescript": "^5.6.3", + "vite": "^5.4.10" + } +} diff --git a/admin-ui/src/api.ts b/admin-ui/src/api.ts new file mode 100644 index 0000000..08d979d --- /dev/null +++ b/admin-ui/src/api.ts @@ -0,0 +1,78 @@ +// Fetch layer for the /admin JSON API. Same-origin (the SPA is served from the admin +// plane), bearer access token held in memory only (never localStorage). Admin routes +// are outside the public OpenAPI, so this is hand-written. + +let accessToken: string | null = null; + +export function setToken(t: string | null): void { + accessToken = t; +} +export function hasToken(): boolean { + return accessToken !== null; +} + +async function req(method: string, path: string, body?: unknown): Promise { + const headers: Record = {}; + if (accessToken) headers['Authorization'] = `Bearer ${accessToken}`; + if (body !== undefined) headers['Content-Type'] = 'application/json'; + const res = await fetch(path, { + method, + headers, + body: body !== undefined ? JSON.stringify(body) : undefined, + }); + const text = await res.text(); + const data: unknown = text ? JSON.parse(text) : null; + if (!res.ok) { + const msg = + (data as { error?: string; message?: string })?.error ?? + (data as { message?: string })?.message ?? + `${res.status} ${res.statusText}`; + throw new Error(msg); + } + return data; +} + +export interface ChallengeResp { + challenge: string; + url: string; + instance_id: string; + expires_in: number; +} +export interface TokenResp { + access_token: string; + refresh_token?: string; + expires_in: number; +} +export interface KeyRow { + id: string; + pubkey: string; + status: string; +} +export interface InviteView { + code_prefix: string; + label: string | null; + created_at: string; + status: string; +} + +export const api = { + challenge: () => req('GET', '/admin/auth/challenge') as Promise, + verify: (admin_token: string, challenge: string) => + req('POST', '/admin/auth/verify', { admin_token, challenge }) as Promise, + logout: () => req('POST', '/admin/auth/logout', {}), + me: () => req('GET', '/admin/me'), + features: () => req('GET', '/admin/features'), + keys: () => req('GET', '/admin/keys') as Promise, + addKey: (pubkey: string, label?: string) => + req('POST', '/admin/keys', label ? { pubkey, label } : { pubkey }), + revokeKey: (id: string) => req('DELETE', `/admin/keys/${id}`), + config: () => req('GET', '/admin/config'), + putConfig: (patch: unknown, expected_versions: Record) => + req('PUT', '/admin/config', { patch, expected_versions }), + invites: () => + req('GET', '/admin/invites') as Promise<{ invites: InviteView[]; unused_count: number }>, + mintInvites: (count: number, label?: string) => + req('POST', '/admin/invites', label ? { count, label } : { count }) as Promise<{ + codes: string[]; + }>, +}; diff --git a/admin-ui/src/main.tsx b/admin-ui/src/main.tsx new file mode 100644 index 0000000..af9e09b --- /dev/null +++ b/admin-ui/src/main.tsx @@ -0,0 +1,363 @@ +import { render } from 'preact'; +import { useEffect, useState } from 'preact/hooks'; +import './tokens.css'; +import { api, setToken, type KeyRow, type InviteView } from './api'; +import { buildAdminToken, nip07 } from './nip98'; + +// ── login ───────────────────────────────────────────────────────────────────── + +function Login({ onDone }: { onDone: () => void }) { + const [busy, setBusy] = useState(false); + const [err, setErr] = useState(null); + + const signIn = async () => { + setBusy(true); + setErr(null); + try { + const signer = nip07(); + if (!signer) { + throw new Error( + 'No NIP-07 signer found. Enable your Smirk wallet (or nos2x/Alby) on this origin, then reload.', + ); + } + const c = await api.challenge(); + const token = await buildAdminToken(c, signer); + const { access_token } = await api.verify(token, c.challenge); + setToken(access_token); + onDone(); + } catch (e) { + setErr(e instanceof Error ? e.message : 'Sign-in failed'); + } finally { + setBusy(false); + } + }; + + return ( +
+
🐸
+

Smirk Operator Console

+

+ Sign in with an admin Nostr key on your instance's allowlist. +

+ + {err &&

{err}

} +
+ ); +} + +// ── shared ──────────────────────────────────────────────────────────────────── + +function Section({ title, children }: { title: string; children: unknown }) { + return ( +
+

{title}

+ {children} +
+ ); +} + +function useAsync(fn: () => Promise, deps: unknown[] = []) { + const [data, setData] = useState(null); + const [err, setErr] = useState(null); + const reload = () => { + setErr(null); + fn() + .then(setData) + .catch((e) => setErr(e instanceof Error ? e.message : String(e))); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + useEffect(reload, deps); + return { data, err, reload }; +} + +// ── status ──────────────────────────────────────────────────────────────────── + +function StatusTab() { + const { data, err } = useAsync(() => api.features()); + return ( +
+ {err &&

{err}

} +
{JSON.stringify(data, null, 2)}
+
+ ); +} + +// ── admin keys ──────────────────────────────────────────────────────────────── + +function KeysTab() { + const { data, err, reload } = useAsync(() => api.keys()); + const [pubkey, setPubkey] = useState(''); + const [busy, setBusy] = useState(false); + const [msg, setMsg] = useState(null); + + const add = async () => { + setBusy(true); + setMsg(null); + try { + await api.addKey(pubkey.trim().toLowerCase()); + setPubkey(''); + reload(); + } catch (e) { + setMsg(e instanceof Error ? e.message : String(e)); + } finally { + setBusy(false); + } + }; + const revoke = async (id: string) => { + if (!confirm('Revoke this admin key?')) return; + await api.revokeKey(id); + reload(); + }; + + return ( +
+ {err &&

{err}

} + + + {(data ?? []).map((k: KeyRow) => ( + + + + + + ))} + +
{k.pubkey.slice(0, 16)}…{k.status} + {k.status !== 'revoked' && ( + + )} +
+
+ setPubkey((e.target as HTMLInputElement).value)} + /> + +
+ {msg &&

{msg}

} +
+ ); +} + +// ── invites ─────────────────────────────────────────────────────────────────── + +function InvitesTab() { + const { data, err, reload } = useAsync(() => api.invites()); + const [count, setCount] = useState(5); + const [label, setLabel] = useState(''); + const [minted, setMinted] = useState(null); + const [busy, setBusy] = useState(false); + + const mint = async () => { + setBusy(true); + try { + const r = await api.mintInvites(count, label.trim() || undefined); + setMinted(r.codes); + reload(); + } finally { + setBusy(false); + } + }; + + return ( +
+ {err &&

{err}

} +
+ setCount(Number((e.target as HTMLInputElement).value))} + /> + setLabel((e.target as HTMLInputElement).value)} + /> + +
+ {minted && ( +
+ New codes β€” copy now, they are shown once: +
{minted.join('\n')}
+
+ )} + + + {(data?.invites ?? []).map((i: InviteView) => ( + + + + + + + ))} + +
{i.code_prefix}…{i.label ?? ''}{i.created_at.slice(0, 10)}{i.status}
+
+ ); +} + +// ── config ──────────────────────────────────────────────────────────────────── + +type Overlay = Record>; +interface ConfigResp { + effective: Overlay; + overlay: Overlay; + versions: Record; + runtime_class: Record; + restart_pending: boolean; +} + +function ConfigTab() { + const { data, err, reload } = useAsync(() => api.config() as Promise); + const [edit, setEdit] = useState({}); + const [msg, setMsg] = useState(null); + + useEffect(() => { + if (data) setEdit(structuredClone(data.effective)); + }, [data]); + + if (err) return
{

{err}

}
; + if (!data) return
Loading…
; + + const setField = (section: string, field: string, value: unknown) => + setEdit((e) => ({ ...e, [section]: { ...(e[section] ?? {}), [field]: value } })); + + const save = async (section: string) => { + setMsg(null); + try { + await api.putConfig( + { [section]: edit[section] }, + { [section]: data.versions[section] ?? 0 }, + ); + setMsg(`Saved ${section}.`); + reload(); + } catch (e) { + setMsg(e instanceof Error ? e.message : String(e)); + } + }; + + return ( +
+ {data.restart_pending && ( +
+ ⚠ A saved change needs a restart to take effect (systemctl restart, or auto mode). +
+ )} + {msg &&

{msg}

} + {Object.keys(edit) + .sort() + .map((section) => ( +
+ {Object.entries(edit[section] ?? {}).map(([field, value]) => { + const cls = data.runtime_class[`${section}.${field}`] ?? 'restart-required'; + const overridden = data.overlay[section]?.[field] !== undefined; + return ( +
+ + {typeof value === 'boolean' ? ( + setField(section, field, (e.target as HTMLInputElement).checked)} + /> + ) : ( + { + const v = (e.target as HTMLInputElement).value; + setField(section, field, typeof value === 'number' ? Number(v) : v); + }} + /> + )} +
+ ); + })} + +
+ ))} +
+ ); +} + +// ── shell ───────────────────────────────────────────────────────────────────── + +const TABS = ['Status', 'Keys', 'Invites', 'Config'] as const; +type Tab = (typeof TABS)[number]; + +function Console({ onLogout }: { onLogout: () => void }) { + const [tab, setTab] = useState('Status'); + return ( +
+
+

🐸 Smirk Operator Console

+ +
+ + {tab === 'Status' && } + {tab === 'Keys' && } + {tab === 'Invites' && } + {tab === 'Config' && } +
+ ); +} + +function App() { + const [authed, setAuthed] = useState(false); + return authed ? setAuthed(false)} /> : setAuthed(true)} />; +} + +render(, document.getElementById('app')!); diff --git a/admin-ui/src/nip98.ts b/admin-ui/src/nip98.ts new file mode 100644 index 0000000..2f5a9cc --- /dev/null +++ b/admin-ui/src/nip98.ts @@ -0,0 +1,60 @@ +// Admin login = a NIP-98 kind-27235 "signed action" over a server-issued nonce. +// The backend (admin_verify) binds SIX tags exactly once and a request-descriptor +// hash over an EMPTY body. Get any of this wrong and verify returns an opaque 401, +// so this mirrors src/core/crypto/nip98.rs precisely. + +async function sha256Hex(input: string): Promise { + const buf = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(input)); + return [...new Uint8Array(buf)].map((b) => b.toString(16).padStart(2, '0')).join(''); +} + +export interface Challenge { + challenge: string; + url: string; + instance_id: string; + expires_in: number; +} + +/** A NIP-07 signer: `window.nostr` (Smirk / Alby / nos2x). */ +export interface Nip07 { + getPublicKey(): Promise; + signEvent(event: { + kind: number; + created_at: number; + content: string; + tags: string[][]; + }): Promise<{ id: string; pubkey: string; sig: string; [k: string]: unknown }>; +} + +/** + * Build + sign the admin_login event for a challenge and return the + * `Nostr ` token the backend's `admin_token` field expects. + */ +export async function buildAdminToken(c: Challenge, signer: Nip07): Promise { + // request_descriptor("POST", "/admin/auth/verify", "", b"") then its sha256. + const emptyBodyHash = await sha256Hex(''); + const descriptor = `POST\n/admin/auth/verify\n\n${emptyBodyHash}`; + const payload = await sha256Hex(descriptor); + + const signed = await signer.signEvent({ + kind: 27235, + created_at: Math.floor(Date.now() / 1000), + content: '', + tags: [ + ['u', c.url], + ['method', 'POST'], + ['purpose', 'admin_login'], + ['challenge', c.challenge], + ['payload', payload], + ['instance_id', c.instance_id], + ], + }); + + return `Nostr ${btoa(JSON.stringify(signed))}`; +} + +/** The page-injected NIP-07 provider, or null. Smirk installs `window.nostr`. */ +export function nip07(): Nip07 | null { + const n = (window as unknown as { nostr?: Nip07 }).nostr; + return n && typeof n.signEvent === 'function' ? n : null; +} diff --git a/admin-ui/src/tokens.css b/admin-ui/src/tokens.css new file mode 100644 index 0000000..81dcf0e --- /dev/null +++ b/admin-ui/src/tokens.css @@ -0,0 +1,50 @@ +/* Smirk brand tokens (vendored β€” the admin-ui is standalone, no @smirk/ui dep). */ +:root { + --smirk-bg: #2c1e12; + --smirk-bg-elevated: #3a2a1b; + --smirk-bg-sunken: #241810; + --smirk-fg: #f3e9dd; + --smirk-fg-muted: #b9a891; + --smirk-accent: #f5c542; + --smirk-accent-fg: #2c1e12; + --smirk-border: rgba(255, 255, 255, 0.12); + --smirk-border-strong: rgba(255, 255, 255, 0.22); + --smirk-danger: #ef4444; + --smirk-ok: #22c55e; + --smirk-warn: #f59e0b; + --smirk-radius: 10px; + --smirk-font: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; +} + +* { box-sizing: border-box; } +body { + margin: 0; + background: var(--smirk-bg); + color: var(--smirk-fg); + font-family: var(--smirk-font); + font-size: 14px; + line-height: 1.5; +} +h1, h2, h3 { font-weight: 700; } +button { + font: inherit; + cursor: pointer; + border-radius: 8px; + border: 1px solid var(--smirk-border); + background: var(--smirk-bg-elevated); + color: inherit; + padding: 8px 14px; +} +button.primary { background: var(--smirk-accent); color: var(--smirk-accent-fg); border: none; font-weight: 700; } +button.danger { color: var(--smirk-danger); border-color: var(--smirk-danger); } +button:disabled { opacity: 0.5; cursor: default; } +input, textarea, select { + font: inherit; + color: inherit; + background: var(--smirk-bg-sunken); + border: 1px solid var(--smirk-border); + border-radius: 8px; + padding: 8px 10px; +} +code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; } +a { color: var(--smirk-accent); } diff --git a/admin-ui/tsconfig.json b/admin-ui/tsconfig.json new file mode 100644 index 0000000..6bfd734 --- /dev/null +++ b/admin-ui/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "bundler", + "jsx": "react-jsx", + "jsxImportSource": "preact", + "strict": true, + "noUnusedLocals": true, + "skipLibCheck": true, + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "types": [] + }, + "include": ["src"] +} diff --git a/admin-ui/vite.config.ts b/admin-ui/vite.config.ts new file mode 100644 index 0000000..1c83d17 --- /dev/null +++ b/admin-ui/vite.config.ts @@ -0,0 +1,18 @@ +import { defineConfig } from 'vite'; + +// Served by the Rust backend at /admin (rust-embed). `base: '/admin/'` makes the +// built asset URLs absolute under /admin/assets/ so they resolve regardless of the +// trailing slash. Preact JSX via esbuild (no plugin, keeps the toolchain tiny). +export default defineConfig({ + base: '/admin/', + build: { + outDir: 'dist', + target: 'es2022', + emptyOutDir: true, + assetsDir: 'assets', + }, + esbuild: { + jsx: 'automatic', + jsxImportSource: 'preact', + }, +}); diff --git a/src/api/admin.rs b/src/api/admin.rs index ac5c6ab..f629ef1 100644 --- a/src/api/admin.rs +++ b/src/api/admin.rs @@ -1032,8 +1032,61 @@ pub async fn admin_invites_list( })) } +// ── Operator console SPA (embedded, served at /admin) ───────────────────────── +// The Preact console built from admin-ui/ and embedded via rust-embed (single-binary +// self-host, no separate deploy). Served UNAUTHENTICATED (no admin_guard) β€” the shell +// loads without a session and runs the NIP-98 login client-side against the guarded +// JSON routes. Only exact /admin, /admin/, /admin/assets/*path are added, so the JSON +// routes (/admin/keys, /admin/config, ...) are never shadowed. + +#[derive(rust_embed::RustEmbed)] +#[folder = "admin-ui/dist/"] +struct AdminAssets; + +pub async fn admin_index() -> Response { + match AdminAssets::get("index.html") { + Some(f) => ( + [(axum::http::header::CONTENT_TYPE, "text/html; charset=utf-8")], + f.data.into_owned(), + ) + .into_response(), + None => ( + StatusCode::NOT_FOUND, + "operator console not built (run: npm --prefix admin-ui run build)", + ) + .into_response(), + } +} + +pub async fn admin_asset(Path(path): Path) -> Response { + match AdminAssets::get(&format!("assets/{path}")) { + Some(f) => { + let mime = if path.ends_with(".js") || path.ends_with(".mjs") { + "application/javascript; charset=utf-8" + } else if path.ends_with(".css") { + "text/css; charset=utf-8" + } else if path.ends_with(".svg") { + "image/svg+xml" + } else if path.ends_with(".woff2") { + "font/woff2" + } else if path.ends_with(".png") { + "image/png" + } else if path.ends_with(".json") { + "application/json" + } else { + "application/octet-stream" + }; + ([(axum::http::header::CONTENT_TYPE, mime)], f.data.into_owned()).into_response() + } + None => StatusCode::NOT_FOUND.into_response(), + } +} + pub fn routes() -> Router> { Router::new() + .route("/admin", get(admin_index)) + .route("/admin/", get(admin_index)) + .route("/admin/assets/*path", get(admin_asset)) .route("/admin/auth/challenge", post(admin_challenge)) .route("/admin/auth/verify", post(admin_verify)) .route("/admin/auth/refresh", post(admin_refresh)) @@ -1049,7 +1102,23 @@ pub fn routes() -> Router> { #[cfg(test)] mod tests { - use super::host_allowed; + use super::{host_allowed, AdminAssets}; + + // The Operator Console SPA must be built into admin-ui/dist/ and embedded at + // compile time (rust-embed). If admin-ui was never built, index.html is absent + // and /admin serves nothing β€” this catches that before it reaches an operator. + #[test] + fn admin_console_is_embedded() { + let index = AdminAssets::get("index.html").expect("admin-ui/dist/index.html embedded"); + let html = std::str::from_utf8(&index.data).expect("index.html is utf-8"); + assert!(html.contains("Smirk Operator Console"), "console title missing"); + // Vite rewrites asset URLs to the /admin/ base; the served route matches. + assert!(html.contains("/admin/assets/"), "asset base not rewritten to /admin/"); + assert!( + AdminAssets::iter().any(|p| p.starts_with("assets/")), + "no built JS/CSS assets embedded", + ); + } #[test] fn host_allowlist() {