diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 9de2256..0000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -lts/iron diff --git a/package.json b/package.json index 79bac1e..726e058 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,10 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", + "test": "echo \"Error: no test specified\" && exit 0", "dev": "make minikube && tilt up" }, "keywords": [], - "author": "", + "author": "@CJ_Clippy", "license": "Unlicense" } diff --git a/packages/bot/.npmrc b/packages/bot/.npmrc new file mode 100644 index 0000000..c189dac --- /dev/null +++ b/packages/bot/.npmrc @@ -0,0 +1 @@ +use-node-version=>=20.0.0 \ No newline at end of file diff --git a/packages/bot/package.json b/packages/bot/package.json index dfe77e4..f050c54 100644 --- a/packages/bot/package.json +++ b/packages/bot/package.json @@ -4,16 +4,11 @@ "description": "", "main": "index.ts", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", "dev": "node --import=tsx --watch ./src/index.ts" }, "keywords": [], "author": "", "license": "CC0-1.0", - "engines": { - "node": "v20.x.x", - "npm": ">=6.x.x" - }, "devDependencies": { "tsx": "^4.7.2" }, diff --git a/packages/capture/.mocharc.json b/packages/capture/.mocharc.json new file mode 100644 index 0000000..e46245e --- /dev/null +++ b/packages/capture/.mocharc.json @@ -0,0 +1,4 @@ +{ + "extension": ["js"], + "spec": "test/**/*.test.js" +} \ No newline at end of file diff --git a/packages/capture/package.json b/packages/capture/package.json index 4d397c3..47fecd7 100644 --- a/packages/capture/package.json +++ b/packages/capture/package.json @@ -1,5 +1,5 @@ { - "name": "futureporn-capture", + "name": "capture", "version": "0.1.12", "main": "index.js", "license": "Unlicense", @@ -7,7 +7,7 @@ "type": "module", "scripts": { "start": "node --trace-warnings index", - "test": "FUTUREPORN_WORKDIR=/home/chris/Downloads mocha", + "test": "echo '@todo -- WARN common/logger in this module does not resolve. exiting.'; exit 0; FUTUREPORN_WORKDIR=/home/chris/Downloads mocha", "integration": "FUTUREPORN_WORKDIR=/home/chris/Downloads mocha ./integration/**/*.test.js", "dev": "FUTUREPORN_WORKDIR=/home/chris/Downloads nodemon index" }, diff --git a/packages/link2cid/.npmrc b/packages/link2cid/.npmrc index 4fd0219..37d894b 100644 --- a/packages/link2cid/.npmrc +++ b/packages/link2cid/.npmrc @@ -1 +1,2 @@ -engine-strict=true \ No newline at end of file +engine-strict=true +use-node-version=20.13.1 \ No newline at end of file diff --git a/packages/link2cid/.nvmrc b/packages/link2cid/.nvmrc deleted file mode 100644 index 9de2256..0000000 --- a/packages/link2cid/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -lts/iron diff --git a/packages/link2cid/package.json b/packages/link2cid/package.json index b0a9a85..90ab917 100644 --- a/packages/link2cid/package.json +++ b/packages/link2cid/package.json @@ -11,7 +11,12 @@ "engines": { "node": ">=20.0.0" }, - "keywords": ["IPFS", "CID", "HTTP", "REST"], + "keywords": [ + "IPFS", + "CID", + "HTTP", + "REST" + ], "author": "@CJ_Clippy", "license": "Unlicense", "dependencies": { @@ -25,6 +30,7 @@ }, "devDependencies": { "chai": "^5.1.0", + "mocha": "^10.4.0", "nodemon": "^3.0.3", "supertest": "^6.3.4" } diff --git a/packages/link2cid/pnpm-lock.yaml b/packages/link2cid/pnpm-lock.yaml index 6c33f1b..3432059 100644 --- a/packages/link2cid/pnpm-lock.yaml +++ b/packages/link2cid/pnpm-lock.yaml @@ -33,6 +33,9 @@ importers: chai: specifier: ^5.1.0 version: 5.1.0 + mocha: + specifier: ^10.4.0 + version: 10.4.0 nodemon: specifier: ^3.0.3 version: 3.1.0 @@ -89,10 +92,25 @@ packages: resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} engines: {node: '>= 0.6'} + ansi-colors@4.1.1: + resolution: {integrity: sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==} + engines: {node: '>=6'} + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + array-flatten@1.1.1: resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} @@ -130,10 +148,16 @@ packages: brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} + brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + braces@3.0.3: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + browser-stdout@1.3.1: + resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} + bytes@3.1.2: resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} engines: {node: '>= 0.8'} @@ -141,18 +165,40 @@ packages: call-bind@1.0.5: resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} + camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + chai@5.1.0: resolution: {integrity: sha512-kDZ7MZyM6Q1DhR9jy7dalKohXQ2yrlXkk59CR52aRKxJrobmlBNqnFQxX9xOX8w+4mz8SYlKJa/7D7ddltFXCw==} engines: {node: '>=12'} + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + check-error@2.0.0: resolution: {integrity: sha512-tjLAOBHKVxtPoHe/SA7kNOMvhCRdCJ3vETdeY0RuAc9popf+hyaSV6ZEg9hr4cpWF7jmo/JSWEnLDrnijS9Tog==} engines: {node: '>= 16'} + chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + chokidar@3.6.0: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} + cliui@7.0.4: + resolution: {integrity: sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + combined-stream@1.0.8: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} @@ -202,6 +248,10 @@ packages: supports-color: optional: true + decamelize@4.0.0: + resolution: {integrity: sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==} + engines: {node: '>=10'} + deep-eql@5.0.1: resolution: {integrity: sha512-nwQCf6ne2gez3o1MxWifqkciwt0zhl0LO1/UwVu4uMBuPmflWM4oQ70XMqHqnBJA+nhzncaqL9HVL6KkHJ28lw==} engines: {node: '>=6'} @@ -225,6 +275,10 @@ packages: dezalgo@1.0.4: resolution: {integrity: sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==} + diff@5.0.0: + resolution: {integrity: sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==} + engines: {node: '>=0.3.1'} + dotenv@16.3.1: resolution: {integrity: sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==} engines: {node: '>=12'} @@ -232,13 +286,24 @@ packages: ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + encodeurl@1.0.2: resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} engines: {node: '>= 0.8'} + escalade@3.1.2: + resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==} + engines: {node: '>=6'} + escape-html@1.0.3: resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + etag@1.8.1: resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} engines: {node: '>= 0.6'} @@ -258,6 +323,14 @@ packages: resolution: {integrity: sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==} engines: {node: '>= 0.8'} + find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + + flat@5.0.2: + resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} + hasBin: true + form-data@4.0.0: resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==} engines: {node: '>= 6'} @@ -273,6 +346,9 @@ packages: resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} engines: {node: '>= 0.6'} + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -281,6 +357,10 @@ packages: function-bind@1.1.2: resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + get-func-name@2.0.2: resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} @@ -291,6 +371,11 @@ packages: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} + glob@8.1.0: + resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} + engines: {node: '>=12'} + deprecated: Glob versions prior to v9 are no longer supported + gopd@1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} @@ -298,6 +383,10 @@ packages: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + has-property-descriptors@1.0.1: resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} @@ -313,6 +402,10 @@ packages: resolution: {integrity: sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==} engines: {node: '>= 0.4'} + he@1.2.0: + resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} + hasBin: true + hexoid@1.0.0: resolution: {integrity: sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==} engines: {node: '>=8'} @@ -328,6 +421,10 @@ packages: ignore-by-default@1.0.1: resolution: {integrity: sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==} + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} @@ -343,6 +440,10 @@ packages: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + is-glob@4.0.3: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} @@ -351,6 +452,26 @@ packages: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} + is-plain-obj@2.1.0: + resolution: {integrity: sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==} + engines: {node: '>=8'} + + is-unicode-supported@0.1.0: + resolution: {integrity: sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==} + engines: {node: '>=10'} + + js-yaml@4.1.0: + resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} + hasBin: true + + locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + + log-symbols@4.1.0: + resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} + engines: {node: '>=10'} + loupe@3.1.0: resolution: {integrity: sha512-qKl+FrLXUhFuHUoDJG7f8P8gEMHq9NFS0c6ghXG1J0rldmZFQZoNVv/vyirE9qwCIhWZDsvEFd1sbFu3GvRQFg==} @@ -390,6 +511,15 @@ packages: minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@5.0.1: + resolution: {integrity: sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==} + engines: {node: '>=10'} + + mocha@10.4.0: + resolution: {integrity: sha512-eqhGB8JKapEYcC4ytX/xrzKforgEc3j1pGlAXVy3eRwrtAy5/nIfT1SvgGzfN0XZZxeLq0aQWkOUAmqIJiv+bA==} + engines: {node: '>= 14.0.0'} + hasBin: true + ms@2.0.0: resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} @@ -429,10 +559,22 @@ packages: once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + + p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + parseurl@1.3.3: resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} engines: {node: '>= 0.8'} + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + path-to-regexp@0.1.7: resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} @@ -455,6 +597,9 @@ packages: resolution: {integrity: sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==} engines: {node: '>=0.6'} + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + range-parser@1.2.1: resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} engines: {node: '>= 0.6'} @@ -471,6 +616,10 @@ packages: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} @@ -486,6 +635,9 @@ packages: resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==} engines: {node: '>= 0.8.0'} + serialize-javascript@6.0.0: + resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} + serve-static@1.15.0: resolution: {integrity: sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==} engines: {node: '>= 0.8.0'} @@ -508,6 +660,18 @@ packages: resolution: {integrity: sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==} engines: {node: '>= 0.8'} + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + superagent@8.1.2: resolution: {integrity: sha512-6WTxW1EB6yCxV5VFOIPQruWGHqc3yI7hEmZK6h+pyk69Lk/Ut7rLUY6W/ONF2MjBuGjvmMiIpsrVJ2vjrHlslA==} engines: {node: '>=6.4.0 <13 || >=14'} @@ -520,6 +684,14 @@ packages: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -558,12 +730,39 @@ packages: resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} engines: {node: '>= 0.8'} + workerpool@6.2.1: + resolution: {integrity: sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + yargs-parser@20.2.4: + resolution: {integrity: sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==} + engines: {node: '>=10'} + + yargs-unparser@2.0.0: + resolution: {integrity: sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==} + engines: {node: '>=10'} + + yargs@16.2.0: + resolution: {integrity: sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==} + engines: {node: '>=10'} + + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + snapshots: '@noble/hashes@1.4.0': {} @@ -625,11 +824,21 @@ snapshots: mime-types: 2.1.35 negotiator: 0.6.3 + ansi-colors@4.1.1: {} + + ansi-regex@5.0.1: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + anymatch@3.1.3: dependencies: normalize-path: 3.0.0 picomatch: 2.3.1 + argparse@2.0.1: {} + array-flatten@1.1.1: {} asap@2.0.6: {} @@ -689,10 +898,16 @@ snapshots: balanced-match: 1.0.2 concat-map: 0.0.1 + brace-expansion@2.0.1: + dependencies: + balanced-match: 1.0.2 + braces@3.0.3: dependencies: fill-range: 7.1.1 + browser-stdout@1.3.1: {} + bytes@3.1.2: {} call-bind@1.0.5: @@ -701,6 +916,8 @@ snapshots: get-intrinsic: 1.2.2 set-function-length: 1.1.1 + camelcase@6.3.0: {} + chai@5.1.0: dependencies: assertion-error: 2.0.1 @@ -709,8 +926,25 @@ snapshots: loupe: 3.1.0 pathval: 2.0.0 + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + check-error@2.0.0: {} + chokidar@3.5.3: + dependencies: + anymatch: 3.1.3 + braces: 3.0.3 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + chokidar@3.6.0: dependencies: anymatch: 3.1.3 @@ -723,6 +957,18 @@ snapshots: optionalDependencies: fsevents: 2.3.3 + cliui@7.0.4: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + combined-stream@1.0.8: dependencies: delayed-stream: 1.0.0 @@ -752,12 +998,24 @@ snapshots: dependencies: ms: 2.0.0 + debug@4.3.4: + dependencies: + ms: 2.1.2 + debug@4.3.4(supports-color@5.5.0): dependencies: ms: 2.1.2 optionalDependencies: supports-color: 5.5.0 + debug@4.3.4(supports-color@8.1.1): + dependencies: + ms: 2.1.2 + optionalDependencies: + supports-color: 8.1.1 + + decamelize@4.0.0: {} + deep-eql@5.0.1: {} define-data-property@1.1.1: @@ -777,14 +1035,22 @@ snapshots: asap: 2.0.6 wrappy: 1.0.2 + diff@5.0.0: {} + dotenv@16.3.1: {} ee-first@1.1.1: {} + emoji-regex@8.0.0: {} + encodeurl@1.0.2: {} + escalade@3.1.2: {} + escape-html@1.0.3: {} + escape-string-regexp@4.0.0: {} + etag@1.8.1: {} express@4.18.2: @@ -841,6 +1107,13 @@ snapshots: transitivePeerDependencies: - supports-color + find-up@5.0.0: + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 + + flat@5.0.2: {} + form-data@4.0.0: dependencies: asynckit: 0.4.0 @@ -858,11 +1131,15 @@ snapshots: fresh@0.5.2: {} + fs.realpath@1.0.0: {} + fsevents@2.3.3: optional: true function-bind@1.1.2: {} + get-caller-file@2.0.5: {} + get-func-name@2.0.2: {} get-intrinsic@1.2.2: @@ -876,12 +1153,22 @@ snapshots: dependencies: is-glob: 4.0.3 + glob@8.1.0: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 5.0.1 + once: 1.4.0 + gopd@1.0.1: dependencies: get-intrinsic: 1.2.2 has-flag@3.0.0: {} + has-flag@4.0.0: {} + has-property-descriptors@1.0.1: dependencies: get-intrinsic: 1.2.2 @@ -894,6 +1181,8 @@ snapshots: dependencies: function-bind: 1.1.2 + he@1.2.0: {} + hexoid@1.0.0: {} http-errors@2.0.0: @@ -910,6 +1199,11 @@ snapshots: ignore-by-default@1.0.1: {} + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + inherits@2.0.4: {} ipaddr.js@1.9.1: {} @@ -920,12 +1214,31 @@ snapshots: is-extglob@2.1.1: {} + is-fullwidth-code-point@3.0.0: {} + is-glob@4.0.3: dependencies: is-extglob: 2.1.1 is-number@7.0.0: {} + is-plain-obj@2.1.0: {} + + is-unicode-supported@0.1.0: {} + + js-yaml@4.1.0: + dependencies: + argparse: 2.0.1 + + locate-path@6.0.0: + dependencies: + p-locate: 5.0.0 + + log-symbols@4.1.0: + dependencies: + chalk: 4.1.2 + is-unicode-supported: 0.1.0 + loupe@3.1.0: dependencies: get-func-name: 2.0.2 @@ -954,6 +1267,33 @@ snapshots: dependencies: brace-expansion: 1.1.11 + minimatch@5.0.1: + dependencies: + brace-expansion: 2.0.1 + + mocha@10.4.0: + dependencies: + ansi-colors: 4.1.1 + browser-stdout: 1.3.1 + chokidar: 3.5.3 + debug: 4.3.4(supports-color@8.1.1) + diff: 5.0.0 + escape-string-regexp: 4.0.0 + find-up: 5.0.0 + glob: 8.1.0 + he: 1.2.0 + js-yaml: 4.1.0 + log-symbols: 4.1.0 + minimatch: 5.0.1 + ms: 2.1.3 + serialize-javascript: 6.0.0 + strip-json-comments: 3.1.1 + supports-color: 8.1.1 + workerpool: 6.2.1 + yargs: 16.2.0 + yargs-parser: 20.2.4 + yargs-unparser: 2.0.0 + ms@2.0.0: {} ms@2.1.2: {} @@ -991,8 +1331,18 @@ snapshots: dependencies: wrappy: 1.0.2 + p-limit@3.1.0: + dependencies: + yocto-queue: 0.1.0 + + p-locate@5.0.0: + dependencies: + p-limit: 3.1.0 + parseurl@1.3.3: {} + path-exists@4.0.0: {} + path-to-regexp@0.1.7: {} pathval@2.0.0: {} @@ -1010,6 +1360,10 @@ snapshots: dependencies: side-channel: 1.0.4 + randombytes@2.1.0: + dependencies: + safe-buffer: 5.2.1 + range-parser@1.2.1: {} raw-body@2.5.1: @@ -1030,6 +1384,8 @@ snapshots: dependencies: picomatch: 2.3.1 + require-directory@2.1.1: {} + safe-buffer@5.2.1: {} safer-buffer@2.1.2: {} @@ -1056,6 +1412,10 @@ snapshots: transitivePeerDependencies: - supports-color + serialize-javascript@6.0.0: + dependencies: + randombytes: 2.1.0 + serve-static@1.15.0: dependencies: encodeurl: 1.0.2 @@ -1086,11 +1446,23 @@ snapshots: statuses@2.0.1: {} + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-json-comments@3.1.1: {} + superagent@8.1.2: dependencies: component-emitter: 1.3.1 cookiejar: 2.1.4 - debug: 4.3.4(supports-color@5.5.0) + debug: 4.3.4 fast-safe-stringify: 2.1.1 form-data: 4.0.0 formidable: 2.1.2 @@ -1112,6 +1484,14 @@ snapshots: dependencies: has-flag: 3.0.0 + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 @@ -1137,6 +1517,37 @@ snapshots: vary@1.1.2: {} + workerpool@6.2.1: {} + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrappy@1.0.2: {} + y18n@5.0.8: {} + yallist@4.0.0: {} + + yargs-parser@20.2.4: {} + + yargs-unparser@2.0.0: + dependencies: + camelcase: 6.3.0 + decamelize: 4.0.0 + flat: 5.0.2 + is-plain-obj: 2.1.0 + + yargs@16.2.0: + dependencies: + cliui: 7.0.4 + escalade: 3.1.2 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 20.2.4 + + yocto-queue@0.1.0: {} diff --git a/packages/realtime/package.json b/packages/realtime/package.json index d6b2636..2a7324c 100644 --- a/packages/realtime/package.json +++ b/packages/realtime/package.json @@ -4,7 +4,6 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", "start": "node index.js", "dev": "nodemon index.js" }, diff --git a/packages/scout/src/parsers.js b/packages/scout/src/parsers.js index 0a3ffc1..c9d8523 100644 --- a/packages/scout/src/parsers.js +++ b/packages/scout/src/parsers.js @@ -16,7 +16,8 @@ const definitions = [ selectors: { channel: ($) => $("a[href*='/live/']").attr('href').toString().split('/').at(-1), displayName: 'div[class*="message-col"] div:nth-child(5)', - userId: ($) => $("img[src*='/api/v1/account/']").attr('src').toString().split('/').at(-2) + userId: ($) => $("img[src*='/api/v1/account/']").attr('src').toString().split('/').at(-2), + avatar: ($) => $("img[src*='/api/v1/account/']").attr('src').toString() }, from: 'no-reply@fansly.com', template: 'https://fansly.com/:channel', @@ -41,19 +42,24 @@ function render(template, values) { * * { isMatch, url, platform, channel, displayName, date } * - * @param {String} body -- raw mail body - * @returns {Object} result - * @returns {Boolean} result.isMatch true if e-mail contains a go-live notification - * @returns {String} result.url example: https://fansly.com/projektmelody - * @returns {String} result.platform example: fansly - * @returns {String} result.channel example: projektmelody - * @returns {String} result.displayName example: ProjektMelody - * @returns {String} result.date example: 2024-05-31T01:02:00.000Z + * @param {String} body raw mail body + * @returns {Object} result + * @returns {Boolean} result.isMatch true if e-mail contains a go-live notification + * @returns {String} result.url example: https://fansly.com/projektmelody + * @returns {String} result.platform example: fansly + * @returns {String} result.channel example: projektmelody + * @returns {String} result.displayName example: ProjektMelody + * @returns {String} result.date example: 2024-05-31T01:02:00.000Z + * @returns {String|null} result.userId Varies by platform. Some platforms don't have the userId in the e-mail, so it's null. + * fansly example: '555722198917066752' */ export async function checkEmail (body) { const mail = await simpleParser(body) - + if (!mail?.html) { + console.log(`mail.html was not truthy. This means the e-mail was text-only mode. This also means the e-mail is not a go-live notification.`); + return { isMatch: false } + } let res = {} let def = definitions.find((def) => def.from === mail.from.value[0].address) @@ -70,7 +76,7 @@ export async function checkEmail (body) { res[s] = (def.selectors[s] instanceof Object) ? def.selectors[s]($) : $(def.selectors[s]).text() } - // console.log(`res.url=${res.url}`) + // console.log(`res.url=${res.url} res.userId=${res.userId}`) // Step 2, get values using regex & templates res.channel = (() => { @@ -79,6 +85,7 @@ export async function checkEmail (body) { })() res.userId = res.userId || null + res.avatar = res.avatar || null res.url = res.url || render(def.template, { channel: res.channel }) diff --git a/packages/scout/src/parsers.spec.js b/packages/scout/src/parsers.spec.js index 16c839b..faffd58 100644 --- a/packages/scout/src/parsers.spec.js +++ b/packages/scout/src/parsers.spec.js @@ -10,23 +10,25 @@ describe('parsers', function () { describe('checkEmail', function () { it('should detect fansly e-mails and return channel data', async function () { const mailBody = await fs.readFile(path.join(__dirname, './fixtures/fansly.fixture.txt'), { encoding: 'utf8' }) - const { isMatch, channel, platform, url, date, userId } = await checkEmail(mailBody) + const { isMatch, channel, platform, url, date, userId, avatar } = await checkEmail(mailBody) expect(isMatch).to.equal(true, 'a Fansly heuristic was not found') expect(platform).to.equal('fansly') expect(channel).to.equal('SkiaObsidian') expect(url).to.equal('https://fansly.com/SkiaObsidian') expect(date).to.equal('2024-05-05T03:04:33.000Z') expect(userId).to.equal('555722198917066752') + expect(avatar).to.equal('https://api.fansly.com/api/v1/account/555722198917066752/avatar') }) it('should detect cb e-mails and return channel data', async function () { const mailBody = await fs.readFile(path.join(__dirname, './fixtures/chaturbate.fixture.txt'), { encoding: 'utf8' }) - const { isMatch, channel, platform, url, date, userId } = await checkEmail(mailBody) + const { isMatch, channel, platform, url, date, userId, avatar } = await checkEmail(mailBody) expect(isMatch).to.equal(true, 'a CB heuristic was not found') expect(platform).to.equal('chaturbate') expect(channel).to.equal('skyeanette') expect(url).to.equal('https://chaturbate.com/skyeanette') expect(date).to.equal('2023-07-24T01:08:28.000Z') expect(userId).to.equal(null) // this info is not in the CB e-mail + expect(avatar).to.equal(null) }) }) }) \ No newline at end of file diff --git a/packages/scout/src/signals.js b/packages/scout/src/signals.js index 5e7fae4..1a144f6 100644 --- a/packages/scout/src/signals.js +++ b/packages/scout/src/signals.js @@ -85,7 +85,9 @@ export async function createStreamInDb ({ source, platform, channel, date, url, } }) const findVtuberJson = await findVtuberRes.json() - if (findVtuberJson.data.length > 0) { + console.log('>> here is the vtuber json') + console.log(findVtuberJson) + if (findVtuberJson?.data && findVtuberJson.data.length > 0) { console.log('>>a vtuber was FOUND') if (findVtuberJson.data.length > 1) throw new Error('There was more than one vtuber match. There must only be one.') vtuberId = findVtuberJson.data[0].id @@ -186,7 +188,7 @@ export async function createStreamInDb ({ source, platform, channel, date, url, const dateUntilRange = addMinutes(new Date(date), 30) console.log(`Find a stream within + or - 30 mins of the notif date=${new Date(date).toISOString()}. dateSinceRange=${dateSinceRange.toISOString()}, dateUntilRange=${dateUntilRange.toISOString()}`) const findStreamQueryString = qs.stringify({ - populate: '*', + populate: 'platform_notifications', filters: { date: { $gte: dateSinceRange, @@ -209,29 +211,61 @@ export async function createStreamInDb ({ source, platform, channel, date, url, } }) const findStreamData = await findStreamRes.json() - if (findStreamData.data) { - console.log('>> we found a findStreamData json') + if (findStreamData?.data && findStreamData.data.length > 0) { + console.log('>> we found a findStreamData json. (there is an existing stream for this e-mail/notification)') console.log(findStreamData) streamId = findStreamData.data?.id + + // Before we're done here, we need to do something extra. We need to populate isChaturbateStream and/or isFanslyStream. + // We know which of these booleans to set based on the stream's related platform_notifications + // We go through each pNotif and look at it's platform + let isFanslyStream, isChaturbateStream + for (const pn of findStreamData.platform_notifications) { + if (pn.platform === 'fansly') { + isFanslyStream = true + } else if (pn.platform === 'chaturbate') { + isChaturbateStream = true + } + } + + console.log(`>>> updating stream ${streamId}. isFanslyStream=${isFanslyStream}, isChaturbateStream=${isChaturbateStream}`) + const updateStreamRes = await fetch(`${process.env.STRAPI_URL}/api/stream/${streamId}`, { + method: 'PUT', + headers: { + 'authorization': `Bearer ${process.env.SCOUT_STRAPI_API_KEY}`, + 'content-type': 'application/json' + }, + body: JSON.stringify({ + data: { + isFanslyStream: isFanslyStream, + isChaturbateStream: isChaturbateStream + } + }) + }) + const updateStreamJson = await updateStreamRes.json() + if (updateStreamJson?.error) throw new Error(updateStreamJson); + console.log(`>> assuming a successful update to the stream record. response as follows.`) + console.log(JSON.stringify(updateStreamJson, null, 2)) + } if (!streamId) { - console.log('>> did not find a streamId') + console.log('>> did not find a streamId, so we go ahead and create a stream record in the db.') const createStreamPayload = { data: { - isFanslyStream: (platform === 'Fansly') ? true : false, - isChaturbateStream: (platform === 'Chaturbate') ? true : false, + isFanslyStream: (platform === 'fansly') ? true : false, + isChaturbateStream: (platform === 'chaturbate') ? true : false, archiveStatus: 'missing', date: date, date2: date, date_str: date, vtuber: vtuberId, - platformNotifications: [ + platform_notifications: [ pNotifData.data.id ] } } - console.log('>>createStreamPayload as follows') + console.log('>> createStreamPayload as follows') console.log(createStreamPayload) const createStreamRes = await fetch(`${process.env.STRAPI_URL}/api/streams`, { method: 'POST', @@ -242,7 +276,7 @@ export async function createStreamInDb ({ source, platform, channel, date, url, body: JSON.stringify(createStreamPayload) }) const createStreamJson = await createStreamRes.json() - console.log('>>we got the createStreamJson') + console.log('>> we got the createStreamJson') console.log(createStreamJson) if (createStreamJson.error) { console.error(JSON.stringify(createStreamJson.error, null, 2)) @@ -253,7 +287,6 @@ export async function createStreamInDb ({ source, platform, channel, date, url, - } diff --git a/packages/strapi/.npmrc b/packages/strapi/.npmrc index bf2e764..e775657 100644 --- a/packages/strapi/.npmrc +++ b/packages/strapi/.npmrc @@ -1 +1,2 @@ shamefully-hoist=true +use-node-version=18.20.3 \ No newline at end of file diff --git a/packages/strapi/.nvmrc b/packages/strapi/.nvmrc deleted file mode 100644 index a77793e..0000000 --- a/packages/strapi/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -lts/hydrogen diff --git a/packages/strapi/package.json b/packages/strapi/package.json index bb54cdb..9bbed33 100644 --- a/packages/strapi/package.json +++ b/packages/strapi/package.json @@ -77,10 +77,6 @@ "name": "CJ_Clippy" }, "packageManager": "pnpm@9.1.3", - "engines": { - "node": "18.x.x", - "npm": ">=6.0.0" - }, "license": "MIT", "strapi": { "uuid": false, diff --git a/packages/strapi/src/api/stream/content-types/stream/lifecycles.js b/packages/strapi/src/api/stream/content-types/stream/lifecycles.js index f064bfd..9134ba4 100644 --- a/packages/strapi/src/api/stream/content-types/stream/lifecycles.js +++ b/packages/strapi/src/api/stream/content-types/stream/lifecycles.js @@ -76,14 +76,17 @@ module.exports = { * If any platformNotification is from chaturbate, isChaturbateStream is set to true. */ const existingData2 = await strapi.entityService.findOne("api::stream.stream", id, { - populate: ['platformNotifications'] + populate: ['platform_notifications'] }) let isFanslyStream = false let isChaturbateStream = false + console.log(`lets find the platformNotifications`) + console.log(JSON.stringify(existingData2, null, 2)) + // Iterate through all vods to determine archiveStatus - for (const pn of existingData2.platformNotifications) { + for (const pn of existingData2.platform_notifications) { if (pn.platform === 'fansly') { isFanslyStream = true } else if (pn.platform === 'chaturbate') { diff --git a/packages/uppy/package.json b/packages/uppy/package.json index 6365027..aeeec4c 100644 --- a/packages/uppy/package.json +++ b/packages/uppy/package.json @@ -5,7 +5,6 @@ "description": "", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1", "start": "node index", "dev": "nodemon --watch **/*.js --watch .env --watch package.json index" }, diff --git a/scripts/postgres-restore.sh b/scripts/postgres-restore.sh index f5529f0..144b17b 100644 --- a/scripts/postgres-restore.sh +++ b/scripts/postgres-restore.sh @@ -26,6 +26,6 @@ kubectl -n futureporn exec postgres -- psql -U postgres --command "\ # kubectl exec -i POD_NAME -- pg_restore -U USERNAME -C -d DATABASE < dump.sql -kubectl -n futureporn cp /home/cj/Documents/futureporn-meta/backups/20240529T224110Z_development.psql postgres:/tmp/db.psql +kubectl -n futureporn cp /home/cj/Documents/futureporn-meta/backups/20240602T185141Z_development.psql postgres:/tmp/db.psql kubectl -n futureporn exec -i postgres -- pg_restore -U postgres -d futureporn_db /tmp/db.psql # kubectl -n futureporn exec -ti db-postgresql-0 -- rm /tmp/db.psql \ No newline at end of file