Compare commits

...

5 commits

22 changed files with 216 additions and 928 deletions

View file

@ -31,8 +31,7 @@ const exec = require('util').promisify(require('child_process').exec);
const tasks = {
js: [
{ source: 'proto.js', target: '/assets', name: 'proto.{hash}.js', vars: { build: 'MAMI_PROTO_JS', html: ':source' } },
{ source: 'mami.js', target: '/assets', name: 'mami.{hash}.js', vars: { build: 'MAMI_MAIN_JS', html: ':source' } },
{ source: 'mami.js', target: '/assets', name: 'mami.{hash}.js', vars: { build: 'MAMI_JS', html: ':source' } },
{ source: 'init.js', target: '/assets', name: 'init.{hash}.js', es: 'es5', vars: { html: ':source' } },
],
css: [

352
package-lock.json generated
View file

@ -51,9 +51,9 @@
}
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.4.15",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz",
"integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==",
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
"integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
"license": "MIT"
},
"node_modules/@jridgewell/trace-mapping": {
@ -80,14 +80,14 @@
}
},
"node_modules/@swc/core": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.6.5.tgz",
"integrity": "sha512-tyVvUK/HDOUUsK6/GmWvnqUtD9oDpPUA4f7f7JCOV8hXxtfjMtAZeBKf93yrB1XZet69TDR7EN0hFC6i4MF0Ig==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core/-/core-1.9.2.tgz",
"integrity": "sha512-dYyEkO6mRYtZFpnOsnYzv9rY69fHAHoawYOjGOEcxk9WYtaJhowMdP/w6NcOKnz2G7GlZaenjkzkMa6ZeQeMsg==",
"hasInstallScript": true,
"license": "Apache-2.0",
"dependencies": {
"@swc/counter": "^0.1.3",
"@swc/types": "^0.1.9"
"@swc/types": "^0.1.15"
},
"engines": {
"node": ">=10"
@ -97,16 +97,16 @@
"url": "https://opencollective.com/swc"
},
"optionalDependencies": {
"@swc/core-darwin-arm64": "1.6.5",
"@swc/core-darwin-x64": "1.6.5",
"@swc/core-linux-arm-gnueabihf": "1.6.5",
"@swc/core-linux-arm64-gnu": "1.6.5",
"@swc/core-linux-arm64-musl": "1.6.5",
"@swc/core-linux-x64-gnu": "1.6.5",
"@swc/core-linux-x64-musl": "1.6.5",
"@swc/core-win32-arm64-msvc": "1.6.5",
"@swc/core-win32-ia32-msvc": "1.6.5",
"@swc/core-win32-x64-msvc": "1.6.5"
"@swc/core-darwin-arm64": "1.9.2",
"@swc/core-darwin-x64": "1.9.2",
"@swc/core-linux-arm-gnueabihf": "1.9.2",
"@swc/core-linux-arm64-gnu": "1.9.2",
"@swc/core-linux-arm64-musl": "1.9.2",
"@swc/core-linux-x64-gnu": "1.9.2",
"@swc/core-linux-x64-musl": "1.9.2",
"@swc/core-win32-arm64-msvc": "1.9.2",
"@swc/core-win32-ia32-msvc": "1.9.2",
"@swc/core-win32-x64-msvc": "1.9.2"
},
"peerDependencies": {
"@swc/helpers": "*"
@ -118,9 +118,9 @@
}
},
"node_modules/@swc/core-darwin-arm64": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.6.5.tgz",
"integrity": "sha512-RGQhMdni2v1/ANQ/2K+F+QYdzaucekYBewZcX1ogqJ8G5sbPaBdYdDN1qQ4kHLCIkPtGP6qC7c71qPEqL2RidQ==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-arm64/-/core-darwin-arm64-1.9.2.tgz",
"integrity": "sha512-nETmsCoY29krTF2PtspEgicb3tqw7Ci5sInTI03EU5zpqYbPjoPH99BVTjj0OsF53jP5MxwnLI5Hm21lUn1d6A==",
"cpu": [
"arm64"
],
@ -134,9 +134,9 @@
}
},
"node_modules/@swc/core-darwin-x64": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.6.5.tgz",
"integrity": "sha512-/pSN0/Jtcbbb9+ovS9rKxR3qertpFAM3OEJr/+Dh/8yy7jK5G5EFPIrfsw/7Q5987ERPIJIH6BspK2CBB2tgcg==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core-darwin-x64/-/core-darwin-x64-1.9.2.tgz",
"integrity": "sha512-9gD+bwBz8ZByjP6nZTXe/hzd0tySIAjpDHgkFiUrc+5zGF+rdTwhcNrzxNHJmy6mw+PW38jqII4uspFHUqqxuQ==",
"cpu": [
"x64"
],
@ -150,9 +150,9 @@
}
},
"node_modules/@swc/core-linux-arm-gnueabihf": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.6.5.tgz",
"integrity": "sha512-B0g/dROCE747RRegs/jPHuKJgwXLracDhnqQa80kFdgWEMjlcb7OMCgs5OX86yJGRS4qcYbiMGD0Pp7Kbqn3yw==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.9.2.tgz",
"integrity": "sha512-kYq8ief1Qrn+WmsTWAYo4r+Coul4dXN6cLFjiPZ29Cv5pyU+GFvSPAB4bEdMzwy99rCR0u2P10UExaeCjurjvg==",
"cpu": [
"arm"
],
@ -166,9 +166,9 @@
}
},
"node_modules/@swc/core-linux-arm64-gnu": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.6.5.tgz",
"integrity": "sha512-W8meapgXTq8AOtSvDG4yKR8ant2WWD++yOjgzAleB5VAC+oC+aa8YJROGxj8HepurU8kurqzcialwoMeq5SZZQ==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.9.2.tgz",
"integrity": "sha512-n0W4XiXlmEIVqxt+rD3ZpkogsEWUk1jJ+i5bQNgB+1JuWh0fBE8c/blDgTQXa0GB5lTPVDZQussgdNOCnAZwiA==",
"cpu": [
"arm64"
],
@ -182,9 +182,9 @@
}
},
"node_modules/@swc/core-linux-arm64-musl": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.6.5.tgz",
"integrity": "sha512-jyCKqoX50Fg8rJUQqh4u5PqnE7nqYKXHjVH2WcYr114/MU21zlsI+YL6aOQU1XP8bJQ2gPQ1rnlnGJdEHiKS/w==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.9.2.tgz",
"integrity": "sha512-8xzrOmsyCC1zrx2Wzx/h8dVsdewO1oMCwBTLc1gSJ/YllZYTb04pNm6NsVbzUX2tKddJVRgSJXV10j/NECLwpA==",
"cpu": [
"arm64"
],
@ -198,9 +198,9 @@
}
},
"node_modules/@swc/core-linux-x64-gnu": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.6.5.tgz",
"integrity": "sha512-G6HmUn/RRIlXC0YYFfBz2qh6OZkHS/KUPkhoG4X9ADcgWXXjOFh6JrefwsYj8VBAJEnr5iewzjNfj+nztwHaeA==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.9.2.tgz",
"integrity": "sha512-kZrNz/PjRQKcchWF6W292jk3K44EoVu1ad5w+zbS4jekIAxsM8WwQ1kd+yjUlN9jFcF8XBat5NKIs9WphJCVXg==",
"cpu": [
"x64"
],
@ -214,9 +214,9 @@
}
},
"node_modules/@swc/core-linux-x64-musl": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.6.5.tgz",
"integrity": "sha512-AQpBjBnelQDSbeTJA50AXdS6+CP66LsXIMNTwhPSgUfE7Bx1ggZV11Fsi4Q5SGcs6a8Qw1cuYKN57ZfZC5QOuA==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.9.2.tgz",
"integrity": "sha512-TTIpR4rjMkhX1lnFR+PSXpaL83TrQzp9znRdp2TzYrODlUd/R20zOwSo9vFLCyH6ZoD47bccY7QeGZDYT3nlRg==",
"cpu": [
"x64"
],
@ -230,9 +230,9 @@
}
},
"node_modules/@swc/core-win32-arm64-msvc": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.6.5.tgz",
"integrity": "sha512-MZTWM8kUwS30pVrtbzSGEXtek46aXNb/mT9D6rsS7NvOuv2w+qZhjR1rzf4LNbbn5f8VnR4Nac1WIOYZmfC5ng==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.9.2.tgz",
"integrity": "sha512-+Eg2d4icItKC0PMjZxH7cSYFLWk0aIp94LNmOw6tPq0e69ax6oh10upeq0D1fjWsKLmOJAWEvnXlayZcijEXDw==",
"cpu": [
"arm64"
],
@ -246,9 +246,9 @@
}
},
"node_modules/@swc/core-win32-ia32-msvc": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.6.5.tgz",
"integrity": "sha512-WZdu4gISAr3yOm1fVwKhhk6+MrP7kVX0KMP7+ZQFTN5zXQEiDSDunEJKVgjMVj3vlR+6mnAqa/L0V9Qa8+zKlQ==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.9.2.tgz",
"integrity": "sha512-nLWBi4vZDdM/LkiQmPCakof8Dh1/t5EM7eudue04V1lIcqx9YHVRS3KMwEaCoHLGg0c312Wm4YgrWQd9vwZ5zQ==",
"cpu": [
"ia32"
],
@ -262,9 +262,9 @@
}
},
"node_modules/@swc/core-win32-x64-msvc": {
"version": "1.6.5",
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.6.5.tgz",
"integrity": "sha512-ezXgucnMTzlFIxQZw7ls/5r2hseFaRoDL04cuXUOs97E8r+nJSmFsRQm/ygH5jBeXNo59nyZCalrjJAjwfgACA==",
"version": "1.9.2",
"resolved": "https://registry.npmjs.org/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.9.2.tgz",
"integrity": "sha512-ik/k+JjRJBFkXARukdU82tSVx0CbExFQoQ78qTO682esbYXzjdB5eLVkoUbwen299pnfr88Kn4kyIqFPTje8Xw==",
"cpu": [
"x64"
],
@ -284,9 +284,9 @@
"license": "Apache-2.0"
},
"node_modules/@swc/types": {
"version": "0.1.9",
"resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.9.tgz",
"integrity": "sha512-qKnCno++jzcJ4lM4NTfYifm1EFSCeIfKiAHAfkENZAV5Kl9PjJIyd2yeeVv6c/2CckuLyv2NmRC5pv6pm2WQBg==",
"version": "0.1.15",
"resolved": "https://registry.npmjs.org/@swc/types/-/types-0.1.15.tgz",
"integrity": "sha512-XKaZ+dzDIQ9Ot9o89oJQ/aluI17+VvUnIpYJTcZtvv1iYX6MzHh3Ik2CSR7MdPKpPwfZXHBeCingb2b4PoDVdw==",
"license": "Apache-2.0",
"dependencies": {
"@swc/counter": "^0.1.3"
@ -302,9 +302,9 @@
}
},
"node_modules/acorn": {
"version": "8.12.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.0.tgz",
"integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==",
"version": "8.14.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz",
"integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==",
"license": "MIT",
"bin": {
"acorn": "bin/acorn"
@ -314,9 +314,9 @@
}
},
"node_modules/autoprefixer": {
"version": "10.4.19",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.19.tgz",
"integrity": "sha512-BaENR2+zBZ8xXhM4pUaKUxlVdxZ0EZhjvbopwnXmxRUfqDmwSpC2lAi/QXvx7NRdPCo1WKEcEF6mV64si1z4Ew==",
"version": "10.4.20",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.20.tgz",
"integrity": "sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g==",
"funding": [
{
"type": "opencollective",
@ -333,11 +333,11 @@
],
"license": "MIT",
"dependencies": {
"browserslist": "^4.23.0",
"caniuse-lite": "^1.0.30001599",
"browserslist": "^4.23.3",
"caniuse-lite": "^1.0.30001646",
"fraction.js": "^4.3.7",
"normalize-range": "^0.1.2",
"picocolors": "^1.0.0",
"picocolors": "^1.0.1",
"postcss-value-parser": "^4.2.0"
},
"bin": {
@ -357,9 +357,9 @@
"license": "ISC"
},
"node_modules/browserslist": {
"version": "4.23.1",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.23.1.tgz",
"integrity": "sha512-TUfofFo/KsK/bWZ9TWQ5O26tsWW4Uhmt8IYklbnUa70udB6P2wA7w7o4PY4muaEPBQaAX+CEnmmIA41NVHtPVw==",
"version": "4.24.2",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.2.tgz",
"integrity": "sha512-ZIc+Q62revdMcqC6aChtW4jz3My3klmCO1fEmINZY/8J3EpBg5/A/D0AKmBveUh6pgoeycoMkVMko84tuYS+Gg==",
"funding": [
{
"type": "opencollective",
@ -376,10 +376,10 @@
],
"license": "MIT",
"dependencies": {
"caniuse-lite": "^1.0.30001629",
"electron-to-chromium": "^1.4.796",
"node-releases": "^2.0.14",
"update-browserslist-db": "^1.0.16"
"caniuse-lite": "^1.0.30001669",
"electron-to-chromium": "^1.5.41",
"node-releases": "^2.0.18",
"update-browserslist-db": "^1.1.1"
},
"bin": {
"browserslist": "cli.js"
@ -417,9 +417,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001636",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz",
"integrity": "sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg==",
"version": "1.0.30001680",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001680.tgz",
"integrity": "sha512-rPQy70G6AGUMnbwS1z6Xg+RkHYPAi18ihs47GH0jcxIG7wArmPgY3XbS2sRdBbxJljp3thdT8BIqv9ccCypiPA==",
"funding": [
{
"type": "opencollective",
@ -529,12 +529,12 @@
}
},
"node_modules/cssnano": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cssnano/-/cssnano-7.0.3.tgz",
"integrity": "sha512-lsekJctOTqdCn4cNrtrSwsuMR/fHC+oiVMHkp/OugBWtwjH8XJag1/OtGaYJGtz0un1fQcRy4ryfYTQsfh+KSQ==",
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cssnano/-/cssnano-7.0.6.tgz",
"integrity": "sha512-54woqx8SCbp8HwvNZYn68ZFAepuouZW4lTwiMVnBErM3VkO7/Sd4oTOt3Zz3bPx3kxQ36aISppyXj2Md4lg8bw==",
"license": "MIT",
"dependencies": {
"cssnano-preset-default": "^7.0.3",
"cssnano-preset-default": "^7.0.6",
"lilconfig": "^3.1.2"
},
"engines": {
@ -549,41 +549,41 @@
}
},
"node_modules/cssnano-preset-default": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-7.0.3.tgz",
"integrity": "sha512-dQ3Ba1p/oewICp/szF1XjFFgql8OlOBrI2YNBUUwhHQnJNoMOcQTa+Bi7jSJN8r/eM1egW0Ud1se/S7qlduWKA==",
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/cssnano-preset-default/-/cssnano-preset-default-7.0.6.tgz",
"integrity": "sha512-ZzrgYupYxEvdGGuqL+JKOY70s7+saoNlHSCK/OGn1vB2pQK8KSET8jvenzItcY+kA7NoWvfbb/YhlzuzNKjOhQ==",
"license": "MIT",
"dependencies": {
"browserslist": "^4.23.1",
"browserslist": "^4.23.3",
"css-declaration-sorter": "^7.2.0",
"cssnano-utils": "^5.0.0",
"postcss-calc": "^10.0.0",
"postcss-colormin": "^7.0.1",
"postcss-convert-values": "^7.0.1",
"postcss-discard-comments": "^7.0.1",
"postcss-discard-duplicates": "^7.0.0",
"postcss-calc": "^10.0.2",
"postcss-colormin": "^7.0.2",
"postcss-convert-values": "^7.0.4",
"postcss-discard-comments": "^7.0.3",
"postcss-discard-duplicates": "^7.0.1",
"postcss-discard-empty": "^7.0.0",
"postcss-discard-overridden": "^7.0.0",
"postcss-merge-longhand": "^7.0.2",
"postcss-merge-rules": "^7.0.2",
"postcss-merge-longhand": "^7.0.4",
"postcss-merge-rules": "^7.0.4",
"postcss-minify-font-values": "^7.0.0",
"postcss-minify-gradients": "^7.0.0",
"postcss-minify-params": "^7.0.1",
"postcss-minify-selectors": "^7.0.2",
"postcss-minify-params": "^7.0.2",
"postcss-minify-selectors": "^7.0.4",
"postcss-normalize-charset": "^7.0.0",
"postcss-normalize-display-values": "^7.0.0",
"postcss-normalize-positions": "^7.0.0",
"postcss-normalize-repeat-style": "^7.0.0",
"postcss-normalize-string": "^7.0.0",
"postcss-normalize-timing-functions": "^7.0.0",
"postcss-normalize-unicode": "^7.0.1",
"postcss-normalize-unicode": "^7.0.2",
"postcss-normalize-url": "^7.0.0",
"postcss-normalize-whitespace": "^7.0.0",
"postcss-ordered-values": "^7.0.1",
"postcss-reduce-initial": "^7.0.1",
"postcss-reduce-initial": "^7.0.2",
"postcss-reduce-transforms": "^7.0.0",
"postcss-svgo": "^7.0.1",
"postcss-unique-selectors": "^7.0.1"
"postcss-unique-selectors": "^7.0.3"
},
"engines": {
"node": "^18.12.0 || ^20.9.0 || >=22.0"
@ -703,9 +703,9 @@
}
},
"node_modules/electron-to-chromium": {
"version": "1.4.811",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.811.tgz",
"integrity": "sha512-CDyzcJ5XW78SHzsIOdn27z8J4ist8eaFLhdto2hSMSJQgsiwvbv2fbizcKUICryw1Wii1TI/FEkvzvJsR3awrA==",
"version": "1.5.57",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.57.tgz",
"integrity": "sha512-xS65H/tqgOwUBa5UmOuNSLuslDo7zho0y/lgQw35pnrqiZh7UOWHCeL/Bt6noJATbA6tpQJGCifsFsIRZj1Fqg==",
"license": "ISC"
},
"node_modules/entities": {
@ -721,9 +721,9 @@
}
},
"node_modules/escalade": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz",
"integrity": "sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==",
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
"license": "MIT",
"engines": {
"node": ">=6"
@ -831,9 +831,9 @@
}
},
"node_modules/node-releases": {
"version": "2.0.14",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",
"integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==",
"version": "2.0.18",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.18.tgz",
"integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==",
"license": "MIT"
},
"node_modules/normalize-range": {
@ -878,15 +878,15 @@
}
},
"node_modules/picocolors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz",
"integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"license": "ISC"
},
"node_modules/postcss": {
"version": "8.4.38",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.38.tgz",
"integrity": "sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==",
"version": "8.4.49",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz",
"integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==",
"funding": [
{
"type": "opencollective",
@ -904,20 +904,20 @@
"license": "MIT",
"dependencies": {
"nanoid": "^3.3.7",
"picocolors": "^1.0.0",
"source-map-js": "^1.2.0"
"picocolors": "^1.1.1",
"source-map-js": "^1.2.1"
},
"engines": {
"node": "^10 || ^12 || >=14"
}
},
"node_modules/postcss-calc": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-10.0.0.tgz",
"integrity": "sha512-OmjhudoNTP0QleZCwl1i6NeBwN+5MZbY5ersLZz69mjJiDVv/p57RjRuKDkHeDWr4T+S97wQfsqRTNoDHB2e3g==",
"version": "10.0.2",
"resolved": "https://registry.npmjs.org/postcss-calc/-/postcss-calc-10.0.2.tgz",
"integrity": "sha512-DT/Wwm6fCKgpYVI7ZEWuPJ4az8hiEHtCUeYjZXqU7Ou4QqYh1Df2yCQ7Ca6N7xqKPFkxN3fhf+u9KSoOCJNAjg==",
"license": "MIT",
"dependencies": {
"postcss-selector-parser": "^6.0.16",
"postcss-selector-parser": "^6.1.2",
"postcss-value-parser": "^4.2.0"
},
"engines": {
@ -928,12 +928,12 @@
}
},
"node_modules/postcss-colormin": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-7.0.1.tgz",
"integrity": "sha512-uszdT0dULt3FQs47G5UHCduYK+FnkLYlpu1HpWu061eGsKZ7setoG7kA+WC9NQLsOJf69D5TxGHgnAdRgylnFQ==",
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-7.0.2.tgz",
"integrity": "sha512-YntRXNngcvEvDbEjTdRWGU606eZvB5prmHG4BF0yLmVpamXbpsRJzevyy6MZVyuecgzI2AWAlvFi8DAeCqwpvA==",
"license": "MIT",
"dependencies": {
"browserslist": "^4.23.1",
"browserslist": "^4.23.3",
"caniuse-api": "^3.0.0",
"colord": "^2.9.3",
"postcss-value-parser": "^4.2.0"
@ -946,12 +946,12 @@
}
},
"node_modules/postcss-convert-values": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-7.0.1.tgz",
"integrity": "sha512-9x2ofb+hYPwHWMlWAzyWys2yMDZYGfkX9LodbaVTmLdlupmtH2AGvj8Up95wzzNPRDEzPIxQIkUaPJew3bT6xA==",
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/postcss-convert-values/-/postcss-convert-values-7.0.4.tgz",
"integrity": "sha512-e2LSXPqEHVW6aoGbjV9RsSSNDO3A0rZLCBxN24zvxF25WknMPpX8Dm9UxxThyEbaytzggRuZxaGXqaOhxQ514Q==",
"license": "MIT",
"dependencies": {
"browserslist": "^4.23.1",
"browserslist": "^4.23.3",
"postcss-value-parser": "^4.2.0"
},
"engines": {
@ -962,12 +962,12 @@
}
},
"node_modules/postcss-discard-comments": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-7.0.1.tgz",
"integrity": "sha512-GVrQxUOhmle1W6jX2SvNLt4kmN+JYhV7mzI6BMnkAWR9DtVvg8e67rrV0NfdWhn7x1zxvzdWkMBPdBDCls+uwQ==",
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-7.0.3.tgz",
"integrity": "sha512-q6fjd4WU4afNhWOA2WltHgCbkRhZPgQe7cXF74fuVB/ge4QbM9HEaOIzGSiMvM+g/cOsNAUGdf2JDzqA2F8iLA==",
"license": "MIT",
"dependencies": {
"postcss-selector-parser": "^6.1.0"
"postcss-selector-parser": "^6.1.2"
},
"engines": {
"node": "^18.12.0 || ^20.9.0 || >=22.0"
@ -977,9 +977,9 @@
}
},
"node_modules/postcss-discard-duplicates": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-7.0.0.tgz",
"integrity": "sha512-bAnSuBop5LpAIUmmOSsuvtKAAKREB6BBIYStWUTGq8oG5q9fClDMMuY8i4UPI/cEcDx2TN+7PMnXYIId20UVDw==",
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-7.0.1.tgz",
"integrity": "sha512-oZA+v8Jkpu1ct/xbbrntHRsfLGuzoP+cpt0nJe5ED2FQF8n8bJtn7Bo28jSmBYwqgqnqkuSXJfSUEE7if4nClQ==",
"license": "MIT",
"engines": {
"node": "^18.12.0 || ^20.9.0 || >=22.0"
@ -1013,13 +1013,13 @@
}
},
"node_modules/postcss-merge-longhand": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-7.0.2.tgz",
"integrity": "sha512-06vrW6ZWi9qeP7KMS9fsa9QW56+tIMW55KYqF7X3Ccn+NI2pIgPV6gFfvXTMQ05H90Y5DvnCDPZ2IuHa30PMUg==",
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/postcss-merge-longhand/-/postcss-merge-longhand-7.0.4.tgz",
"integrity": "sha512-zer1KoZA54Q8RVHKOY5vMke0cCdNxMP3KBfDerjH/BYHh4nCIh+1Yy0t1pAEQF18ac/4z3OFclO+ZVH8azjR4A==",
"license": "MIT",
"dependencies": {
"postcss-value-parser": "^4.2.0",
"stylehacks": "^7.0.2"
"stylehacks": "^7.0.4"
},
"engines": {
"node": "^18.12.0 || ^20.9.0 || >=22.0"
@ -1029,15 +1029,15 @@
}
},
"node_modules/postcss-merge-rules": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-7.0.2.tgz",
"integrity": "sha512-VAR47UNvRsdrTHLe7TV1CeEtF9SJYR5ukIB9U4GZyZOptgtsS20xSxy+k5wMrI3udST6O1XuIn7cjQkg7sDAAw==",
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/postcss-merge-rules/-/postcss-merge-rules-7.0.4.tgz",
"integrity": "sha512-ZsaamiMVu7uBYsIdGtKJ64PkcQt6Pcpep/uO90EpLS3dxJi6OXamIobTYcImyXGoW0Wpugh7DSD3XzxZS9JCPg==",
"license": "MIT",
"dependencies": {
"browserslist": "^4.23.1",
"browserslist": "^4.23.3",
"caniuse-api": "^3.0.0",
"cssnano-utils": "^5.0.0",
"postcss-selector-parser": "^6.1.0"
"postcss-selector-parser": "^6.1.2"
},
"engines": {
"node": "^18.12.0 || ^20.9.0 || >=22.0"
@ -1079,12 +1079,12 @@
}
},
"node_modules/postcss-minify-params": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-7.0.1.tgz",
"integrity": "sha512-e+Xt8xErSRPgSRFxHeBCSxMiO8B8xng7lh8E0A5ep1VfwYhY8FXhu4Q3APMjgx9YDDbSp53IBGENrzygbUvgUQ==",
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/postcss-minify-params/-/postcss-minify-params-7.0.2.tgz",
"integrity": "sha512-nyqVLu4MFl9df32zTsdcLqCFfE/z2+f8GE1KHPxWOAmegSo6lpV2GNy5XQvrzwbLmiU7d+fYay4cwto1oNdAaQ==",
"license": "MIT",
"dependencies": {
"browserslist": "^4.23.1",
"browserslist": "^4.23.3",
"cssnano-utils": "^5.0.0",
"postcss-value-parser": "^4.2.0"
},
@ -1096,13 +1096,13 @@
}
},
"node_modules/postcss-minify-selectors": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-7.0.2.tgz",
"integrity": "sha512-dCzm04wqW1uqLmDZ41XYNBJfjgps3ZugDpogAmJXoCb5oCiTzIX4oPXXKxDpTvWOnKxQKR4EbV4ZawJBLcdXXA==",
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/postcss-minify-selectors/-/postcss-minify-selectors-7.0.4.tgz",
"integrity": "sha512-JG55VADcNb4xFCf75hXkzc1rNeURhlo7ugf6JjiiKRfMsKlDzN9CXHZDyiG6x/zGchpjQS+UAgb1d4nqXqOpmA==",
"license": "MIT",
"dependencies": {
"cssesc": "^3.0.0",
"postcss-selector-parser": "^6.1.0"
"postcss-selector-parser": "^6.1.2"
},
"engines": {
"node": "^18.12.0 || ^20.9.0 || >=22.0"
@ -1199,12 +1199,12 @@
}
},
"node_modules/postcss-normalize-unicode": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-7.0.1.tgz",
"integrity": "sha512-PTPGdY9xAkTw+8ZZ71DUePb7M/Vtgkbbq+EoI33EuyQEzbKemEQMhe5QSr0VP5UfZlreANDPxSfcdSprENcbsg==",
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/postcss-normalize-unicode/-/postcss-normalize-unicode-7.0.2.tgz",
"integrity": "sha512-ztisabK5C/+ZWBdYC+Y9JCkp3M9qBv/XFvDtSw0d/XwfT3UaKeW/YTm/MD/QrPNxuecia46vkfEhewjwcYFjkg==",
"license": "MIT",
"dependencies": {
"browserslist": "^4.23.1",
"browserslist": "^4.23.3",
"postcss-value-parser": "^4.2.0"
},
"engines": {
@ -1261,12 +1261,12 @@
}
},
"node_modules/postcss-reduce-initial": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-7.0.1.tgz",
"integrity": "sha512-0JDUSV4bGB5FGM5g8MkS+rvqKukJZ7OTHw/lcKn7xPNqeaqJyQbUO8/dJpvyTpaVwPsd3Uc33+CfNzdVowp2WA==",
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/postcss-reduce-initial/-/postcss-reduce-initial-7.0.2.tgz",
"integrity": "sha512-pOnu9zqQww7dEKf62Nuju6JgsW2V0KRNBHxeKohU+JkHd/GAH5uvoObqFLqkeB2n20mr6yrlWDvo5UBU5GnkfA==",
"license": "MIT",
"dependencies": {
"browserslist": "^4.23.1",
"browserslist": "^4.23.3",
"caniuse-api": "^3.0.0"
},
"engines": {
@ -1292,9 +1292,9 @@
}
},
"node_modules/postcss-selector-parser": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.0.tgz",
"integrity": "sha512-UMz42UD0UY0EApS0ZL9o1XnLhSTtvvvLe5Dc2H2O56fvRZi+KulDyf5ctDhhtYJBGKStV2FL1fy6253cmLgqVQ==",
"version": "6.1.2",
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz",
"integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==",
"license": "MIT",
"dependencies": {
"cssesc": "^3.0.0",
@ -1321,12 +1321,12 @@
}
},
"node_modules/postcss-unique-selectors": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-7.0.1.tgz",
"integrity": "sha512-MH7QE/eKUftTB5ta40xcHLl7hkZjgDFydpfTK+QWXeHxghVt3VoPqYL5/G+zYZPPIs+8GuqFXSTgxBSoB1RZtQ==",
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/postcss-unique-selectors/-/postcss-unique-selectors-7.0.3.tgz",
"integrity": "sha512-J+58u5Ic5T1QjP/LDV9g3Cx4CNOgB5vz+kM6+OxHHhFACdcDeKhBXjQmB7fnIZM12YSTvsL0Opwco83DmacW2g==",
"license": "MIT",
"dependencies": {
"postcss-selector-parser": "^6.1.0"
"postcss-selector-parser": "^6.1.2"
},
"engines": {
"node": "^18.12.0 || ^20.9.0 || >=22.0"
@ -1360,9 +1360,9 @@
}
},
"node_modules/source-map-js": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.0.tgz",
"integrity": "sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg==",
"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==",
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@ -1379,13 +1379,13 @@
}
},
"node_modules/stylehacks": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-7.0.2.tgz",
"integrity": "sha512-HdkWZS9b4gbgYTdMg4gJLmm7biAUug1qTqXjS+u8X+/pUd+9Px1E+520GnOW3rST9MNsVOVpsJG+mPHNosxjOQ==",
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/stylehacks/-/stylehacks-7.0.4.tgz",
"integrity": "sha512-i4zfNrGMt9SB4xRK9L83rlsFCgdGANfeDAYacO1pkqcE7cRHPdWHwnKZVz7WY17Veq/FvyYsRAU++Ga+qDFIww==",
"license": "MIT",
"dependencies": {
"browserslist": "^4.23.1",
"postcss-selector-parser": "^6.1.0"
"browserslist": "^4.23.3",
"postcss-selector-parser": "^6.1.2"
},
"engines": {
"node": "^18.12.0 || ^20.9.0 || >=22.0"
@ -1429,9 +1429,9 @@
}
},
"node_modules/terser": {
"version": "5.31.1",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.31.1.tgz",
"integrity": "sha512-37upzU1+viGvuFtBo9NPufCb9dwM0+l9hMxYyWfBA+fbwrPqNJAhbZ6W47bBFnZHKHTUBnMvi87434qq+qnxOg==",
"version": "5.36.0",
"resolved": "https://registry.npmjs.org/terser/-/terser-5.36.0.tgz",
"integrity": "sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==",
"license": "BSD-2-Clause",
"dependencies": {
"@jridgewell/source-map": "^0.3.3",
@ -1453,15 +1453,15 @@
"license": "MIT"
},
"node_modules/tslib": {
"version": "2.6.3",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz",
"integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==",
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"license": "0BSD"
},
"node_modules/update-browserslist-db": {
"version": "1.0.16",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.16.tgz",
"integrity": "sha512-KVbTxlBYlckhF5wgfyZXTWnMn7MMZjMu9XG8bPlliUOP9ThaF4QnhP8qrjrH7DRzHfSk0oQv1wToW+iA5GajEQ==",
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz",
"integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==",
"funding": [
{
"type": "opencollective",
@ -1478,8 +1478,8 @@
],
"license": "MIT",
"dependencies": {
"escalade": "^3.1.2",
"picocolors": "^1.0.1"
"escalade": "^3.2.0",
"picocolors": "^1.1.0"
},
"bin": {
"update-browserslist-db": "cli.js"

View file

@ -1,108 +0,0 @@
const fs = require('fs');
const path = require('path');
const readline = require('readline');
const utils = require('./utils.js');
exports.process = async function(root, options) {
const macroPrefix = options.prefix || '#';
const entryPoint = options.entry || '';
root = fs.realpathSync(root);
const included = [];
const processFile = async function(fileName) {
const fullPath = path.join(root, fileName);
if(included.includes(fullPath))
return '';
included.push(fullPath);
if(!fullPath.startsWith(root))
return '/* *** INVALID PATH: ' + fullPath + ' */';
if(!fs.existsSync(fullPath))
return '/* *** FILE NOT FOUND: ' + fullPath + ' */';
const lines = readline.createInterface({
input: fs.createReadStream(fullPath),
crlfDelay: Infinity,
});
let output = '';
let lastWasEmpty = false;
if(options.showPath)
output += "/* *** PATH: " + fullPath + " */\n";
for await(const line of lines) {
const lineTrimmed = utils.trim(line);
if(lineTrimmed === '')
continue;
if(line.startsWith(macroPrefix)) {
const args = lineTrimmed.split(' ');
const macro = utils.trim(utils.trimStart(args.shift(), macroPrefix));
switch(macro) {
case 'comment':
break;
case 'include': {
const includePath = utils.trimEnd(args.join(' '), ';');
output += utils.trim(await processFile(includePath));
output += "\n";
break;
}
case 'buildvars':
if(typeof options.buildVars === 'object') {
const bvTarget = options.buildVarsTarget || 'window';
const bvProps = [];
for(const bvName in options.buildVars)
bvProps.push(`${bvName}: { value: ${JSON.stringify(options.buildVars[bvName])} }`);
if(Object.keys(bvProps).length > 0)
output += `Object.defineProperties(${bvTarget}, { ${bvProps.join(', ')} });\n`;
}
break;
default:
output += line;
output += "\n";
break;
}
} else {
output += line;
output += "\n";
}
}
return output;
};
return await processFile(entryPoint);
};
exports.housekeep = function(assetsPath) {
const files = fs.readdirSync(assetsPath).map(fileName => {
const stats = fs.statSync(path.join(assetsPath, fileName));
return {
name: fileName,
lastMod: stats.mtimeMs,
};
}).sort((a, b) => b.lastMod - a.lastMod).map(info => info.name);
const regex = /^(.+)[\-\.]([a-f0-9]+)\.(.+)$/i;
const counts = {};
for(const fileName of files) {
const match = fileName.match(regex);
if(match) {
const name = match[1] + '-' + match[3];
counts[name] = (counts[name] || 0) + 1;
if(counts[name] > 5)
fs.unlinkSync(path.join(assetsPath, fileName));
} else console.log(`Encountered file name in assets folder with unexpected format: ${fileName}`);
}
};

View file

@ -42,7 +42,7 @@
if(isCompatible) {
(function(script) {
script.src = MAMI_MAIN_JS;
script.src = MAMI_JS;
script.type = 'text/javascript';
script.charset = 'utf-8';
document.body.appendChild(script);

View file

@ -15,8 +15,14 @@ const FutamiCommon = function(vars) {
if(noCache)
options.headers = { 'Cache-Control': 'no-cache' };
const resp = await $x.get(get(name), options);
return resp.body();
return (await $x.get(get(name), options)).body();
},
getApiJson: async (path, noCache) => {
const options = { type: 'json' };
if(noCache)
options.headers = { 'Cache-Control': 'no-cache' };
return (await $x.get(get('api') + path, options)).body();
},
};
};

View file

@ -21,7 +21,6 @@ const MamiContext = function(globalEventTarget, eventTarget) {
let textTriggers;
let eeprom;
let conMan;
let protoWorker;
return {
get globalEvents() { return globalEventTarget; },
@ -88,12 +87,5 @@ const MamiContext = function(globalEventTarget, eventTarget) {
throw 'conMan must be a non-null object';
conMan = value;
},
get protoWorker() { return protoWorker; },
set protoWorker(value) {
if(typeof value !== 'object' || value === null)
throw 'protoWorker must be a non-null object';
protoWorker = value;
},
};
};

View file

@ -9,38 +9,22 @@ const MamiEmotes = (function() {
emotes.push(emote);
};
const addLegacy = function(emoteOld) {
const emote = {
url: emoteOld.Image,
minRank: emoteOld.Hierarchy,
strings: [],
};
for(let i = 0; i < emoteOld.Text.length; ++i)
emote.strings.push(emoteOld.Text[i].slice(1, -1));
add(emote);
};
return {
clear: clear,
add: add,
addLegacy: addLegacy,
load: function(batch) {
for(const emote of batch)
add(emote);
},
loadLegacy: function(batch) {
for(const emote of batch)
addLegacy(emote);
},
forEach: function(minRank, callback) {
for(const emote of emotes)
if(emote.minRank <= minRank)
if(!emote.min_rank || emote.min_rank <= minRank)
callback(emote);
},
all: minRank => {
const items = [];
for(const emote of emotes)
if(emote.minRank <= minRank)
if(!emote.min_rank || emote.min_rank <= minRank)
items.push(emote);
return items;
@ -48,7 +32,7 @@ const MamiEmotes = (function() {
findByName: function(minRank, name, returnString) {
const found = [];
for(const emote of emotes)
if(emote.minRank <= minRank) {
if(!emote.min_rank || emote.min_rank <= minRank) {
for(const string of emote.strings)
if(string.indexOf(name) === 0) {
found.push(returnString ? string : emote);

View file

@ -18,7 +18,6 @@ window.Umi = { UI: {} };
#include users.js
#include utility.js
#include weeb.js
#include worker.js
#include audio/autoplay.js
#include chatform/form.jsx
#include colpick/picker.jsx
@ -227,8 +226,7 @@ const MamiInit = async args => {
// revisit when emote reparsing is implemented
loadingOverlay.message = 'Loading emoticons...';
try {
const emotes = await futami.getJson('emotes');
MamiEmotes.loadLegacy(emotes);
MamiEmotes.load(await futami.getApiJson('/v1/emotes'));
} catch(ex) {
console.error('Failed to load emoticons.', ex);
}
@ -596,9 +594,9 @@ const MamiInit = async args => {
button.disabled = true;
button.textContent = 'Reloading emoticons...';
try {
const emotes = await futami.getJson('emotes', true);
const emotes = await futami.getApiJson('/v1/emotes', true);
MamiEmotes.clear();
MamiEmotes.loadLegacy(emotes);
MamiEmotes.load(emotes);
} finally {
button.textContent = textOrig;
button.disabled = false;
@ -905,10 +903,7 @@ const MamiInit = async args => {
}
};
const protoWorker = new MamiWorker(MAMI_PROTO_JS, ctx.events.scopeTo('worker'));
ctx.protoWorker = protoWorker;
const sockChat = new MamiSockChat(protoWorker);
const sockChat = new MamiSockChat(ctx.events.scopeTo('sockchat'));
const conMan = new MamiConnectionManager(sockChat, settings, futami.get('servers'), ctx.events.scopeTo('conn'));
ctx.conMan = conMan;
@ -982,40 +977,9 @@ const MamiInit = async args => {
conMan.watch('attempt', conManAttempt);
conMan.watch('fail', conManFail);
let workerStarting = false;
const initWorker = async () => {
if(workerStarting)
return;
workerStarting = true;
if(FUTAMI_DEBUG)
console.info('[proto] initialising worker...');
try {
await protoWorker.connect();
await sockChat.create();
conMan.client = sockChat;
await conMan.start();
} finally {
workerStarting = false;
}
};
protoWorker.watch(':timeout', ev => {
console.warn('worker timeout', ev.detail);
initWorker();
});
document.addEventListener('visibilitychange', () => {
if(document.visibilityState === 'visible') {
protoWorker.ping().catch(ex => {
console.warn('worker died', ex);
initWorker();
});
}
});
await initWorker();
await sockChat.create();
conMan.client = sockChat;
await conMan.start();
return ctx;
};

View file

@ -1,4 +1,4 @@
#include sockchat/utils.js
#include proto/sockchat/utils.js
const SockChatS2CPong = ctx => {
const lastPong = Date.now();

View file

@ -1,9 +1,9 @@
#include timedp.js
#include sockchat/authed.js
#include sockchat/ctx.js
#include sockchat/unauthed.js
#include proto/sockchat/authed.js
#include proto/sockchat/ctx.js
#include proto/sockchat/unauthed.js
const SockChatProtocol = function(dispatch, options) {
const SockChatClient = function(dispatch, options) {
if(typeof dispatch !== 'function')
throw 'dispatch must be a function';
if(typeof options !== 'object' || options === null)

View file

@ -1,4 +1,4 @@
#include sockchat/keepalive.js
#include proto/sockchat/keepalive.js
const SockChatContext = function(dispatch, sendPing, pingDelay) {
if(typeof dispatch !== 'function')

View file

@ -1,4 +1,4 @@
#include sockchat/utils.js
#include proto/sockchat/utils.js
const SockChatS2CAuthSuccess = (ctx, userId, userName, userColour, userPerms, chanName, maxLength) => {
ctx.userId = userId;

View file

@ -25,7 +25,7 @@ const MamiSettings = function(storageOrPrefix, eventTarget) {
});
const dispatchUpdate = (name, value, silent, local) => eventTarget.dispatch(createUpdateEvent(name, value, false, silent, local));
const broadcast = new BroadcastChannel(`${MAMI_MAIN_JS}:settings:${storage.name}`);
const broadcast = new BroadcastChannel(`${MAMI_JS}:settings:${storage.name}`);
const broadcastUpdate = (name, value, silent) => {
setTimeout(() => broadcast.postMessage({ act: 'update', name: name, value: value, silent: !!silent }), 0);
};

View file

@ -1,8 +1,8 @@
#include compat.js
#include mszauth.js
#include proto/sockchat/client.js
const MamiSockChat = function(protoWorker) {
const events = protoWorker.eventTarget('sockchat');
const MamiSockChat = function(eventTarget) {
let restarting = false;
let client;
let dumpPackets = false;
@ -10,8 +10,8 @@ const MamiSockChat = function(protoWorker) {
return {
get client() { return client; },
watch: events.watch,
unwatch: events.unwatch,
watch: eventTarget.watch,
unwatch: eventTarget.unwatch,
create: async () => {
if(client !== undefined && typeof client.close === 'function')
@ -19,8 +19,8 @@ const MamiSockChat = function(protoWorker) {
client.close();
restarting = false;
client = await protoWorker.root.create('sockchat', { ping: futami.get('ping') });
await client.setDumpPackets(dumpPackets);
client = new SockChatClient(eventTarget.dispatch, { ping: futami.get('ping') });
client.setDumpPackets(dumpPackets);
MamiCompat('Umi.Server', { get: () => client, configurable: true });
MamiCompat('Umi.Server.SendMessage', { value: text => client.sendMessage(text), configurable: true });
@ -38,11 +38,11 @@ const MamiSockChat = function(protoWorker) {
const authInfo = MamiMisuzuAuth.getInfo();
await client.sendAuth(authInfo.method, authInfo.token);
},
setDumpPackets: async state => {
setDumpPackets: state => {
dumpPackets = !!state;
if(client !== undefined && typeof client.setDumpPackets === 'function')
await client.setDumpPackets(dumpPackets);
client.setDumpPackets(dumpPackets);
},
};
};

View file

@ -100,7 +100,10 @@ const MamiSockChatHandlers = function(
Umi.User.setCurrentUser(userInfo);
Umi.Users.Add(userInfo);
sbUsers.createEntry(ev.detail.user);
if(sbUsers.hasEntry(ev.detail.user.id))
sbUsers.updateEntry(ev.detail.user.id, ev.detail.user);
else
sbUsers.createEntry(ev.detail.user);
if(ctx.views.count > 1)
ctx.views.pop();

View file

@ -1,281 +0,0 @@
#include uniqstr.js
const MamiWorker = function(url, eventTarget) {
const timeOutMs = 30000;
let worker, workerId;
let connectTimeout;
let pingId;
let hasTimedout;
const root = {};
const objects = new Map;
const pending = new Map;
const clearObjects = () => {
for(const [name, object] of objects)
for(const method in object)
delete object[method];
objects.clear();
objects.set('', root);
};
clearObjects();
const broadcastTimeoutZone = body => {
const localWorkerId = workerId;
body(detail => {
if(localWorkerId !== workerId || hasTimedout)
return;
hasTimedout = true;
eventTarget.dispatch(':timeout', detail);
});
};
const handlers = {};
const handleMessage = ev => {
if(typeof ev.data === 'object' && ev.data !== null && typeof ev.data.type === 'string') {
if(ev.data.type in handlers)
handlers[ev.data.type](ev.data.detail);
return;
}
};
const callObjectMethod = (objName, metName, ...args) => {
return new Promise((resolve, reject) => {
if(typeof objName !== 'string')
throw 'objName must be a string';
if(typeof metName !== 'string')
throw 'metName must be a string';
const id = MamiUniqueStr(8);
const info = { id: id, resolve: resolve, reject: reject };
pending.set(id, info);
worker.postMessage({ type: 'metcall', detail: { id: id, object: objName, method: metName, args: args } });
broadcastTimeoutZone(timeout => {
info.timeOut = setTimeout(() => {
const reject = info.reject;
info.resolve = info.reject = undefined;
info.timeOut = undefined;
pending.delete(id);
timeout({ at: 'call', obj: objName, met: metName });
if(typeof reject === 'function')
reject('timeout');
}, timeOutMs);
});
});
};
const defineObjectMethod = (object, objName, method) => object[method] = (...args) => callObjectMethod(objName, method, ...args);
handlers['objdef'] = info => {
let object = objects.get(info.object);
if(object === undefined)
objects.set(info.object, object = {});
if(typeof info.eventPrefix === 'string') {
const scopedTarget = eventTarget.scopeTo(info.eventPrefix);
object.watch = scopedTarget.watch;
object.unwatch = scopedTarget.unwatch;
}
for(const method of info.methods)
defineObjectMethod(object, info.object, method);
};
handlers['objdel'] = info => {
// this should never happen
if(info.object === '') {
console.error('Worker attempted to delete root object!!!!!');
return;
}
const object = objects.get(info.object);
if(object === undefined)
return;
objects.delete(info.object);
const methods = Object.keys(object);
for(const method of methods)
delete object[method];
};
handlers['metdef'] = info => {
const object = objects.get(info.object);
if(object === undefined) {
console.error('Worker attempted to define method on undefined object.');
return;
}
defineObjectMethod(object, info.object, info.method);
};
handlers['metdel'] = info => {
const object = objects.get(info.object);
if(object === undefined) {
console.error('Worker attempted to delete method on undefined object.');
return;
}
delete object[info.method];
};
handlers['funcret'] = resp => {
const info = pending.get(resp.id);
if(info === undefined)
return;
pending.delete(info.id);
if(info.timeOut !== undefined)
clearTimeout(info.timeOut);
const handler = resp.success ? info.resolve : info.reject;
info.resolve = info.reject = undefined;
if(handler !== undefined) {
let result = resp.result;
if(resp.object)
result = objects.get(result);
handler(result);
}
};
handlers['evtdisp'] = resp => {
eventTarget.dispatch(resp.name, resp.detail);
};
return {
get root() { return root; },
watch: eventTarget.watch,
unwatch: eventTarget.unwatch,
eventTarget: prefix => eventTarget.scopeTo(prefix),
ping: () => {
return new Promise((resolve, reject) => {
if(worker === undefined)
throw 'no worker active';
let pingTimeout;
let localPingId = pingId;
const pingHandleMessage = ev => {
if(typeof ev.data === 'string' && ev.data.startsWith('pong:') && ev.data.substring(5) === localPingId)
try {
reject = undefined;
pingId = undefined;
if(pingTimeout !== undefined)
clearTimeout(pingTimeout);
worker?.removeEventListener('message', pingHandleMessage);
if(typeof resolve === 'function')
resolve();
} finally {
resolve = undefined;
}
};
worker.addEventListener('message', pingHandleMessage);
if(localPingId === undefined) {
pingId = localPingId = MamiUniqueStr(8);
broadcastTimeoutZone(timeout => {
pingTimeout = setTimeout(() => {
try {
resolve = undefined;
worker?.removeEventListener('message', pingHandleMessage);
timeout({ at: 'ping' });
if(typeof reject === 'function')
reject('ping timeout');
} finally {
reject = undefined;
}
}, 200);
});
worker.postMessage(`ping:${localPingId}`);
}
});
},
sabotage: () => {
worker?.terminate();
},
connect: () => {
return new Promise((resolve, reject) => {
const connectFinally = () => {
if(connectTimeout !== undefined) {
clearTimeout(connectTimeout);
connectTimeout = undefined;
}
};
const connectHandleMessage = ev => {
worker?.removeEventListener('message', connectHandleMessage);
if(typeof ev.data !== 'object' || ev.data === null || ev.data.type !== 'objdef'
|| typeof ev.data.detail !== 'object' || ev.data.detail.object !== '') {
callReject('data');
} else
callResolve();
};
const callResolve = () => {
reject = undefined;
connectFinally();
try {
if(typeof resolve === 'function')
resolve(root);
} finally {
resolve = undefined;
}
};
const callReject = (...args) => {
resolve = undefined;
connectFinally();
try {
broadcastTimeoutZone(timeout => {
timeout({ at: 'connect' });
});
if(typeof reject === 'function')
reject(...args);
} finally {
reject = undefined;
}
};
if(worker !== undefined) {
worker.terminate();
workerId = worker = undefined;
}
hasTimedout = false;
workerId = MamiUniqueStr(5);
worker = new Worker(url);
worker.addEventListener('message', handleMessage);
worker.addEventListener('message', connectHandleMessage);
connectTimeout = setTimeout(() => callReject('timeout'), timeOutMs);
worker.postMessage({ type: 'init' });
});
},
};
};

View file

@ -1,19 +0,0 @@
#include skel.js
#include sockchat/proto.js
const skel = new WorkerSkeleton;
skel.defineMethod('create', (name, options) => {
if(typeof name !== 'string')
throw 'name must be a string';
let proto, prefix;
if(name === 'sockchat')
proto = new SockChatProtocol(
skel.createDispatcher(prefix = 'sockchat'),
options
);
return skel.defineObject(proto, prefix);
}, true);

View file

@ -1,214 +0,0 @@
#include uniqstr.js
const WorkerSkeletonObject = function(name, defineObjectMethod, deleteObjectMethod, deleteObject) {
if(typeof name !== 'string')
throw 'name must be a string';
if(typeof defineObjectMethod !== 'function')
throw 'defineObjectMethod must be a function';
if(typeof deleteObjectMethod !== 'function')
throw 'deleteObjectMethod must be a function';
if(typeof deleteObject !== 'function')
throw 'deleteObject must be a function';
return {
getObjectName: () => name,
defineMethod: (...args) => defineObjectMethod(name, ...args),
deleteMethod: (...args) => deleteObjectMethod(name, ...args),
destroy: () => deleteObject(name),
};
};
const WorkerSkeleton = function(globalScope) {
if(globalScope === undefined)
globalScope = self;
const objects = new Map;
const handlers = {};
let initialised = false;
const sendPayload = (type, detail) => {
globalScope.postMessage({ type: type, detail: detail });
};
const sendObjectDefinePayload = (objName, objBody, eventPrefix) => {
sendPayload('objdef', { object: objName, methods: Object.keys(objBody), eventPrefix: eventPrefix });
};
const defineObject = (objName, objBody, eventPrefix) => {
if(typeof objName !== 'string')
throw 'objName must be a string';
if(typeof eventPrefix !== 'string' && eventPrefix !== undefined)
throw 'eventPrefix must be string or undefined';
if(objects.has(objName))
throw 'objName is already defined';
const object = {};
for(const name in objBody) {
const item = objBody[name];
if(typeof item === 'function')
object[name] = { body: item };
}
objects.set(objName, object);
if(initialised)
sendObjectDefinePayload(objName, object, eventPrefix);
};
const deleteObject = objName => {
if(typeof objName !== 'string')
throw 'objName must be a string';
if(!objects.has(objName))
throw 'objName is not defined';
objects.delete(objName);
if(initialised)
sendPayload('objdel', { object: objName });
};
const defineObjectMethod = (objName, metName, metBody, returnsObject) => {
if(typeof objName !== 'string')
throw 'objName must be a string';
if(typeof metName !== 'string')
throw 'metName must be a string';
if(typeof metBody !== 'function')
throw 'metBody must be a function';
const objBody = objects.get(objName);
if(objBody === undefined)
throw 'objName has not been defined';
objBody[metName] = { body: metBody, returnsObject: returnsObject === true };
if(initialised)
sendPayload('metdef', { object: objName, method: metName });
};
const deleteObjectMethod = (objName, metName) => {
if(typeof objName !== 'string')
throw 'objName must be a string';
if(typeof metName !== 'string')
throw 'metName must be a string';
const objBody = objects.get(objName);
if(objBody === undefined)
throw 'objName has not been defined';
delete objBody[objName];
if(initialised)
sendPayload('metdel', { object: objName, method: metName });
};
const createDispatcher = prefix => {
if(prefix === undefined)
prefix = '';
else if(typeof prefix !== 'string')
throw 'prefix must be a string or undefined';
if(prefix !== '' && !prefix.endsWith(':'))
prefix += ':';
return (name, detail) => sendPayload('evtdisp', { name: prefix + name, detail: detail });
};
defineObject('', {});
const defineHandler = (name, handler) => {
if(typeof name !== 'string')
throw 'name must be a string';
if(typeof handler !== 'function')
throw 'handler must be a function';
if(name in handlers)
throw 'name is already defined';
handlers[name] = handler;
};
defineHandler('init', () => {
if(initialised)
return;
initialised = true;
sendObjectDefinePayload('', objects.get(''));
});
defineHandler('metcall', req => {
if(typeof req.id !== 'string')
throw 'call id is not a string';
const respond = (id, success, result, mightBeObject) => {
let isObject = false;
if(mightBeObject) {
const resultType = typeof result;
if(resultType === 'string' && objects.has(result))
isObject = true;
else if(resultType === 'object' && result !== null && typeof result.getObjectName === 'function') {
const objectName = result.getObjectName();
if(objects.has(objectName)) {
isObject = true;
result = objectName;
}
}
}
sendPayload('funcret', {
id: id,
success: success,
result: result,
object: isObject,
});
};
try {
if(typeof req.object !== 'string')
throw 'object name is not a string';
if(typeof req.method !== 'string')
throw 'method name is not a string';
const object = objects.get(req.object);
if(object === undefined)
throw 'object is not defined';
if(!(req.method in object))
throw 'method is not defined in object';
const args = Array.isArray(req.args) ? req.args : [];
const info = object[req.method];
let result = info.body(...args);
if(result instanceof Promise) {
result.then(result => respond(req.id, true, result, info.returnsObject)).catch(ex => respond(req.id, false, ex));
} else
respond(req.id, true, result, info.returnsObject);
} catch(ex) {
respond(req.id, false, ex);
}
});
globalScope.addEventListener('message', ev => {
if(typeof ev.data === 'string') {
if(ev.data.startsWith('ping:')) {
globalScope.postMessage(`pong:${ev.data.substring(5)}`);
return;
}
}
if(typeof ev.data === 'object' && ev.data !== null && typeof ev.data.type === 'string') {
if(ev.data.type in handlers)
handlers[ev.data.type](ev.data.detail);
return;
}
});
return {
sendPayload: sendPayload,
createDispatcher: createDispatcher,
defineObject: (object, eventPrefix) => {
if(typeof object !== 'object' || object === null)
return undefined;
const name = MamiUniqueStr(8);
defineObject(name, object, eventPrefix);
return new WorkerSkeletonObject(name, defineObjectMethod, deleteObjectMethod, deleteObject);
},
defineMethod: (...args) => defineObjectMethod('', ...args),
deleteMethod: (...args) => deleteObjectMethod('', ...args),
};
};

View file

@ -1,38 +0,0 @@
const MamiRandomInt = (min, max) => {
let ret = 0;
const range = max - min;
const bitsNeeded = Math.ceil(Math.log2(range));
if(bitsNeeded > 53)
return -1;
const bytesNeeded = Math.ceil(bitsNeeded / 8),
mask = Math.pow(2, bitsNeeded) - 1;
const bytes = new Uint8Array(bytesNeeded);
crypto.getRandomValues(bytes);
let p = (bytesNeeded - 1) * 8;
for(let i = 0; i < bytesNeeded; ++i) {
ret += bytes[i] * Math.pow(2, p);
p -= 8;
}
ret &= mask;
if(ret >= range)
return MamiRandomInt(min, max);
return min + ret;
};
const MamiUniqueStr = (() => {
const chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789';
return length => {
let str = '';
for(let i = 0; i < length; ++i)
str += chars[MamiRandomInt(0, chars.length)];
return str;
};
})();