Various fix and wip

This commit is contained in:
John Livingston 2023-09-19 15:54:56 +02:00
parent f97e54d499
commit 2289d79c28
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
8 changed files with 231 additions and 122 deletions

173
package-lock.json generated
View File

@ -15,7 +15,7 @@
"http-proxy": "^1.18.1", "http-proxy": "^1.18.1",
"log-rotate": "^0.2.8", "log-rotate": "^0.2.8",
"validate-color": "^2.2.1", "validate-color": "^2.2.1",
"xmppjs-chat-bot": "^0.2.2" "xmppjs-chat-bot": "^0.2.3"
}, },
"devDependencies": { "devDependencies": {
"@peertube/feed": "^5.1.0", "@peertube/feed": "^5.1.0",
@ -53,49 +53,6 @@
"npm": ">=7" "npm": ">=7"
} }
}, },
"../xmppjs-chat-bot": {
"version": "0.2.0",
"extraneous": true,
"funding": [
"https://paypal.me/JohnXLivingston",
"https://liberapay.com/JohnLivingston/"
],
"license": "AGPL-3.0",
"dependencies": {
"@xmpp/client": "^0.13.1",
"@xmpp/component": "^0.13.1",
"@xmpp/debug": "^0.13.0",
"@xmpp/jid": "^0.13.1",
"@xmpp/xml": "^0.13.1",
"commander": "^11.0.0"
},
"bin": {
"xmppjs-chat-bot": "lib/cli/cli.js"
},
"devDependencies": {
"@tsconfig/node14": "^14.1.0",
"@types/node": "^14.18.0",
"@types/xmpp__client": "^0.13.0",
"@types/xmpp__component": "^0.13.0",
"@types/xmpp__connection": "^0.13.0",
"@types/xmpp__debug": "^0.13.0",
"@types/xmpp__jid": "^1.3.3",
"@types/xmpp__xml": "^0.13.1",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"eslint": "^7.32.0",
"eslint-config-standard": "^16.0.3",
"eslint-config-standard-with-typescript": "^20.0.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^5.1.1",
"eslint-plugin-standard": "^5.0.0",
"typescript": "^4.9.5"
},
"engines": {
"node": ">= 14.4.0"
}
},
"node_modules/@aashutoshrathi/word-wrap": { "node_modules/@aashutoshrathi/word-wrap": {
"version": "1.2.6", "version": "1.2.6",
"resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz", "resolved": "https://registry.npmjs.org/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz",
@ -1223,27 +1180,27 @@
} }
}, },
"node_modules/@babel/compat-data": { "node_modules/@babel/compat-data": {
"version": "7.22.9", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.9.tgz", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.20.tgz",
"integrity": "sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ==", "integrity": "sha512-BQYjKbpXjoXwFW5jGqiizJQQT/aC7pFm9Ok1OWssonuguICi264lbgMzRp2ZMmRSlfkX6DsWDDcsrctK8Rwfiw==",
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
} }
}, },
"node_modules/@babel/core": { "node_modules/@babel/core": {
"version": "7.22.19", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.19.tgz", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.20.tgz",
"integrity": "sha512-Q8Yj5X4LHVYTbLCKVz0//2D2aDmHF4xzCdEttYvKOnWvErGsa6geHXD6w46x64n5tP69VfeH+IfSrdyH3MLhwA==", "integrity": "sha512-Y6jd1ahLubuYweD/zJH+vvOY141v4f9igNQAQ+MBgq9JlHS2iTsZKn1aMsb3vGccZsXI16VzTBw52Xx0DWmtnA==",
"dependencies": { "dependencies": {
"@ampproject/remapping": "^2.2.0", "@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.22.13", "@babel/code-frame": "^7.22.13",
"@babel/generator": "^7.22.15", "@babel/generator": "^7.22.15",
"@babel/helper-compilation-targets": "^7.22.15", "@babel/helper-compilation-targets": "^7.22.15",
"@babel/helper-module-transforms": "^7.22.19", "@babel/helper-module-transforms": "^7.22.20",
"@babel/helpers": "^7.22.15", "@babel/helpers": "^7.22.15",
"@babel/parser": "^7.22.16", "@babel/parser": "^7.22.16",
"@babel/template": "^7.22.15", "@babel/template": "^7.22.15",
"@babel/traverse": "^7.22.19", "@babel/traverse": "^7.22.20",
"@babel/types": "^7.22.19", "@babel/types": "^7.22.19",
"convert-source-map": "^1.7.0", "convert-source-map": "^1.7.0",
"debug": "^4.1.0", "debug": "^4.1.0",
@ -1373,9 +1330,9 @@
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="
}, },
"node_modules/@babel/helper-environment-visitor": { "node_modules/@babel/helper-environment-visitor": {
"version": "7.22.5", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz",
"integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==", "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==",
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
} }
@ -1415,15 +1372,15 @@
} }
}, },
"node_modules/@babel/helper-module-transforms": { "node_modules/@babel/helper-module-transforms": {
"version": "7.22.19", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.19.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.20.tgz",
"integrity": "sha512-m6h1cJvn+OJ+R3jOHp30faq5xKJ7VbjwDj5RGgHuRlU9hrMeKsGC+JpihkR5w1g7IfseCPPtZ0r7/hB4UKaYlA==", "integrity": "sha512-dLT7JVWIUUxKOs1UnJUBR3S70YK+pKX6AbJgB2vMIvEkZkrfJDbYDJesnPshtKV4LhDOR3Oc5YULeDizRek+5A==",
"dependencies": { "dependencies": {
"@babel/helper-environment-visitor": "^7.22.5", "@babel/helper-environment-visitor": "^7.22.20",
"@babel/helper-module-imports": "^7.22.15", "@babel/helper-module-imports": "^7.22.15",
"@babel/helper-simple-access": "^7.22.5", "@babel/helper-simple-access": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.22.6", "@babel/helper-split-export-declaration": "^7.22.6",
"@babel/helper-validator-identifier": "^7.22.19" "@babel/helper-validator-identifier": "^7.22.20"
}, },
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
@ -1471,9 +1428,9 @@
} }
}, },
"node_modules/@babel/helper-validator-identifier": { "node_modules/@babel/helper-validator-identifier": {
"version": "7.22.19", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.19.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz",
"integrity": "sha512-Tinq7ybnEPFFXhlYOYFiSjespWQk0dq2dRNAiMdRTOYQzEGqnnNyrTxPYHP5r6wGjlF1rFgABdDV0g8EwD6Qbg==", "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==",
"engines": { "engines": {
"node": ">=6.9.0" "node": ">=6.9.0"
} }
@ -1629,13 +1586,13 @@
} }
}, },
"node_modules/@babel/traverse": { "node_modules/@babel/traverse": {
"version": "7.22.19", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.19.tgz", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.20.tgz",
"integrity": "sha512-ZCcpVPK64krfdScRbpxF6xA5fz7IOsfMwx1tcACvCzt6JY+0aHkBk7eIU8FRDSZRU5Zei6Z4JfgAxN1bqXGECg==", "integrity": "sha512-eU260mPZbU7mZ0N+X10pxXhQFMGTeLb9eFS0mxehS8HZp9o1uSnFeWQuG1UPrlxgA7QoUzFhOnilHDp0AXCyHw==",
"dependencies": { "dependencies": {
"@babel/code-frame": "^7.22.13", "@babel/code-frame": "^7.22.13",
"@babel/generator": "^7.22.15", "@babel/generator": "^7.22.15",
"@babel/helper-environment-visitor": "^7.22.5", "@babel/helper-environment-visitor": "^7.22.20",
"@babel/helper-function-name": "^7.22.5", "@babel/helper-function-name": "^7.22.5",
"@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-hoist-variables": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.22.6", "@babel/helper-split-export-declaration": "^7.22.6",
@ -5056,9 +5013,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001534", "version": "1.0.30001538",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001534.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001538.tgz",
"integrity": "sha512-vlPVrhsCS7XaSh2VvWluIQEzVhefrUQcEsQWSS5A5V+dM07uv1qHeQzAOTGIMy9i3e9bH15+muvI/UHojVgS/Q==", "integrity": "sha512-HWJnhnID+0YMtGlzcp3T9drmBJUVDchPJ08tpUGFLs9CYlwWPH2uLgpHn8fND5pCgXVtnGS3H4QR9XLMHVNkHw==",
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -5801,9 +5758,9 @@
"dev": true "dev": true
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.4.522", "version": "1.4.523",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.522.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.523.tgz",
"integrity": "sha512-KGKjcafTpOxda0kqwQ72M0tDmX6RsGhUJTy0Hr7slt0+CgHh9Oex8JdjY9Og68dUkTLUlBOJC0A5W5Mw3QSGCg==" "integrity": "sha512-9AreocSUWnzNtvLcbpng6N+GkXnCcBR80IQkxRC9Dfdyg4gaWNUPBujAHUpKkiUkoSoR9UlhA4zD/IgBklmhzg=="
}, },
"node_modules/emoji-regex": { "node_modules/emoji-regex": {
"version": "8.0.0", "version": "8.0.0",
@ -12069,9 +12026,9 @@
} }
}, },
"node_modules/xmppjs-chat-bot": { "node_modules/xmppjs-chat-bot": {
"version": "0.2.2", "version": "0.2.3",
"resolved": "https://registry.npmjs.org/xmppjs-chat-bot/-/xmppjs-chat-bot-0.2.2.tgz", "resolved": "https://registry.npmjs.org/xmppjs-chat-bot/-/xmppjs-chat-bot-0.2.3.tgz",
"integrity": "sha512-/t1L2fSW04M/5zEGYQzXqgTa7CVaE1dAT9kO1C5iSOrd4HzksQ6vVsk0PlAbEZere08pbea8Kw8uxBSwGlTiXw==", "integrity": "sha512-yoCozt3Qezrb/F8UMAYj21FqV5Jzu58x9M6d7eCSD2yNz1O04qkTc5c1oXR288HXpwVQCWcEP6vfH+Ij2AoJAA==",
"funding": [ "funding": [
"https://paypal.me/JohnXLivingston", "https://paypal.me/JohnXLivingston",
"https://liberapay.com/JohnLivingston/" "https://liberapay.com/JohnLivingston/"
@ -13182,24 +13139,24 @@
} }
}, },
"@babel/compat-data": { "@babel/compat-data": {
"version": "7.22.9", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.9.tgz", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.20.tgz",
"integrity": "sha512-5UamI7xkUcJ3i9qVDS+KFDEK8/7oJ55/sJMB1Ge7IEapr7KfdfV/HErR+koZwOfd+SgtFKOKRhRakdg++DcJpQ==" "integrity": "sha512-BQYjKbpXjoXwFW5jGqiizJQQT/aC7pFm9Ok1OWssonuguICi264lbgMzRp2ZMmRSlfkX6DsWDDcsrctK8Rwfiw=="
}, },
"@babel/core": { "@babel/core": {
"version": "7.22.19", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.19.tgz", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.22.20.tgz",
"integrity": "sha512-Q8Yj5X4LHVYTbLCKVz0//2D2aDmHF4xzCdEttYvKOnWvErGsa6geHXD6w46x64n5tP69VfeH+IfSrdyH3MLhwA==", "integrity": "sha512-Y6jd1ahLubuYweD/zJH+vvOY141v4f9igNQAQ+MBgq9JlHS2iTsZKn1aMsb3vGccZsXI16VzTBw52Xx0DWmtnA==",
"requires": { "requires": {
"@ampproject/remapping": "^2.2.0", "@ampproject/remapping": "^2.2.0",
"@babel/code-frame": "^7.22.13", "@babel/code-frame": "^7.22.13",
"@babel/generator": "^7.22.15", "@babel/generator": "^7.22.15",
"@babel/helper-compilation-targets": "^7.22.15", "@babel/helper-compilation-targets": "^7.22.15",
"@babel/helper-module-transforms": "^7.22.19", "@babel/helper-module-transforms": "^7.22.20",
"@babel/helpers": "^7.22.15", "@babel/helpers": "^7.22.15",
"@babel/parser": "^7.22.16", "@babel/parser": "^7.22.16",
"@babel/template": "^7.22.15", "@babel/template": "^7.22.15",
"@babel/traverse": "^7.22.19", "@babel/traverse": "^7.22.20",
"@babel/types": "^7.22.19", "@babel/types": "^7.22.19",
"convert-source-map": "^1.7.0", "convert-source-map": "^1.7.0",
"debug": "^4.1.0", "debug": "^4.1.0",
@ -13294,9 +13251,9 @@
} }
}, },
"@babel/helper-environment-visitor": { "@babel/helper-environment-visitor": {
"version": "7.22.5", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz",
"integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==" "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA=="
}, },
"@babel/helper-function-name": { "@babel/helper-function-name": {
"version": "7.22.5", "version": "7.22.5",
@ -13324,15 +13281,15 @@
} }
}, },
"@babel/helper-module-transforms": { "@babel/helper-module-transforms": {
"version": "7.22.19", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.19.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.22.20.tgz",
"integrity": "sha512-m6h1cJvn+OJ+R3jOHp30faq5xKJ7VbjwDj5RGgHuRlU9hrMeKsGC+JpihkR5w1g7IfseCPPtZ0r7/hB4UKaYlA==", "integrity": "sha512-dLT7JVWIUUxKOs1UnJUBR3S70YK+pKX6AbJgB2vMIvEkZkrfJDbYDJesnPshtKV4LhDOR3Oc5YULeDizRek+5A==",
"requires": { "requires": {
"@babel/helper-environment-visitor": "^7.22.5", "@babel/helper-environment-visitor": "^7.22.20",
"@babel/helper-module-imports": "^7.22.15", "@babel/helper-module-imports": "^7.22.15",
"@babel/helper-simple-access": "^7.22.5", "@babel/helper-simple-access": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.22.6", "@babel/helper-split-export-declaration": "^7.22.6",
"@babel/helper-validator-identifier": "^7.22.19" "@babel/helper-validator-identifier": "^7.22.20"
} }
}, },
"@babel/helper-plugin-utils": { "@babel/helper-plugin-utils": {
@ -13362,9 +13319,9 @@
"integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==" "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw=="
}, },
"@babel/helper-validator-identifier": { "@babel/helper-validator-identifier": {
"version": "7.22.19", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.19.tgz", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz",
"integrity": "sha512-Tinq7ybnEPFFXhlYOYFiSjespWQk0dq2dRNAiMdRTOYQzEGqnnNyrTxPYHP5r6wGjlF1rFgABdDV0g8EwD6Qbg==" "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A=="
}, },
"@babel/helper-validator-option": { "@babel/helper-validator-option": {
"version": "7.22.15", "version": "7.22.15",
@ -13470,13 +13427,13 @@
} }
}, },
"@babel/traverse": { "@babel/traverse": {
"version": "7.22.19", "version": "7.22.20",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.19.tgz", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.20.tgz",
"integrity": "sha512-ZCcpVPK64krfdScRbpxF6xA5fz7IOsfMwx1tcACvCzt6JY+0aHkBk7eIU8FRDSZRU5Zei6Z4JfgAxN1bqXGECg==", "integrity": "sha512-eU260mPZbU7mZ0N+X10pxXhQFMGTeLb9eFS0mxehS8HZp9o1uSnFeWQuG1UPrlxgA7QoUzFhOnilHDp0AXCyHw==",
"requires": { "requires": {
"@babel/code-frame": "^7.22.13", "@babel/code-frame": "^7.22.13",
"@babel/generator": "^7.22.15", "@babel/generator": "^7.22.15",
"@babel/helper-environment-visitor": "^7.22.5", "@babel/helper-environment-visitor": "^7.22.20",
"@babel/helper-function-name": "^7.22.5", "@babel/helper-function-name": "^7.22.5",
"@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-hoist-variables": "^7.22.5",
"@babel/helper-split-export-declaration": "^7.22.6", "@babel/helper-split-export-declaration": "^7.22.6",
@ -16118,9 +16075,9 @@
} }
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30001534", "version": "1.0.30001538",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001534.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001538.tgz",
"integrity": "sha512-vlPVrhsCS7XaSh2VvWluIQEzVhefrUQcEsQWSS5A5V+dM07uv1qHeQzAOTGIMy9i3e9bH15+muvI/UHojVgS/Q==" "integrity": "sha512-HWJnhnID+0YMtGlzcp3T9drmBJUVDchPJ08tpUGFLs9CYlwWPH2uLgpHn8fND5pCgXVtnGS3H4QR9XLMHVNkHw=="
}, },
"chalk": { "chalk": {
"version": "2.4.2", "version": "2.4.2",
@ -16686,9 +16643,9 @@
"dev": true "dev": true
}, },
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.4.522", "version": "1.4.523",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.522.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.523.tgz",
"integrity": "sha512-KGKjcafTpOxda0kqwQ72M0tDmX6RsGhUJTy0Hr7slt0+CgHh9Oex8JdjY9Og68dUkTLUlBOJC0A5W5Mw3QSGCg==" "integrity": "sha512-9AreocSUWnzNtvLcbpng6N+GkXnCcBR80IQkxRC9Dfdyg4gaWNUPBujAHUpKkiUkoSoR9UlhA4zD/IgBklmhzg=="
}, },
"emoji-regex": { "emoji-regex": {
"version": "8.0.0", "version": "8.0.0",
@ -21291,9 +21248,9 @@
} }
}, },
"xmppjs-chat-bot": { "xmppjs-chat-bot": {
"version": "0.2.2", "version": "0.2.3",
"resolved": "https://registry.npmjs.org/xmppjs-chat-bot/-/xmppjs-chat-bot-0.2.2.tgz", "resolved": "https://registry.npmjs.org/xmppjs-chat-bot/-/xmppjs-chat-bot-0.2.3.tgz",
"integrity": "sha512-/t1L2fSW04M/5zEGYQzXqgTa7CVaE1dAT9kO1C5iSOrd4HzksQ6vVsk0PlAbEZere08pbea8Kw8uxBSwGlTiXw==", "integrity": "sha512-yoCozt3Qezrb/F8UMAYj21FqV5Jzu58x9M6d7eCSD2yNz1O04qkTc5c1oXR288HXpwVQCWcEP6vfH+Ij2AoJAA==",
"requires": { "requires": {
"@xmpp/client": "^0.13.1", "@xmpp/client": "^0.13.1",
"@xmpp/component": "^0.13.1", "@xmpp/component": "^0.13.1",

View File

@ -38,7 +38,7 @@
"http-proxy": "^1.18.1", "http-proxy": "^1.18.1",
"log-rotate": "^0.2.8", "log-rotate": "^0.2.8",
"validate-color": "^2.2.1", "validate-color": "^2.2.1",
"xmppjs-chat-bot": "^0.2.2" "xmppjs-chat-bot": "^0.2.3"
}, },
"devDependencies": { "devDependencies": {
"@peertube/feed": "^5.1.0", "@peertube/feed": "^5.1.0",

View File

@ -0,0 +1,9 @@
# mod_bot_peertubelivechat
This module is a custom module for the Peertube livechat plugin, that handle the bot virtualhost.
It provide several functions:
* bot authentication
* bot vcards (TODO)
This module is part of peertube-plugin-livechat, and is under the same LICENSE.

View File

@ -0,0 +1,99 @@
-- Prosody IM
-- Copyright (C) 2008-2013 Matthew Wild
-- Copyright (C) 2008-2013 Waqas Hussain
-- Copyright (C) 2014 Kim Alvefur
--
-- This project is MIT/X11 licensed. Please see the
-- COPYING file in the source package for more information.
--
local new_sasl = require "util.sasl".new;
local path = require "util.paths";
local json = require "util.json";
-- local have_async, async = pcall(require, "util.async");
-- if not have_async then
-- error("Your version of Prosody does not support async and is incompatible");
-- end
local host = module.host;
local provider = {};
local bot_conf_folder = module:get_option_string('livechat_bot_conf_folder', '');
function read_global_conf(filename)
local file = io.open(path.join(bot_conf_folder, filename), "r");
if file == nil then
module:log("debug", "Cant read global conf file", filename);
return nil;
end
local content = file:read("*all");
io.close(file);
local o = json.decode(content);
if (not o) then
module:log("error", "Cant json-decode file", filename);
return nil;
end
if (not o["connection"]) then
return nil;
end
if (not o["connection"]["username"]) then
return nil;
end
if (not o["connection"]["password"]) then
return nil;
end
result = {
username= o["connection"]["username"];
password= o["connection"]["password"];
};
return result;
end
function provider.test_password(username, password)
-- FIXME: adapt the code for multiple bots
credentials = read_global_conf("moderator.json")
if (credentials and credentials["username"] == username and credentials["password"] == password) then
return true;
end
return false;
end
function provider.users()
return function()
return nil;
end
end
function provider.set_password(username, password)
return false;
end
function provider.user_exists(username)
-- FIXME: adapt the code for multiple bots
credentials = read_global_conf("moderator.json")
if (credentials and credentials["username"] == username) then
return true;
end
return false;
end
function provider.create_user(username, password)
return false;
end
function provider.delete_user(username)
return false;
end
function provider.get_sasl_handler()
return new_sasl(host, {
--luacheck: ignore 212/sasl 212/realm
plain_test = function(sasl, username, password, realm)
return provider.test_password(username, password), true;
end;
});
end
module:provides("auth", provider);

View File

@ -71,7 +71,8 @@ class BotsCtl {
const moderationBotProcess = child_process.spawn('npm', execArgs, { const moderationBotProcess = child_process.spawn('npm', execArgs, {
cwd: __dirname, // must be in the livechat plugin tree, so that npm can found the package. cwd: __dirname, // must be in the livechat plugin tree, so that npm can found the package.
env: { env: {
...process.env // will include NODE_ENV and co ...process.env, // will include NODE_ENV and co
NODE_TLS_REJECT_UNAUTHORIZED: '0' // Prosody use self-signed certificates, the bot must accept themp
} }
}) })
moderationBotProcess.stdout?.on('data', (data) => { moderationBotProcess.stdout?.on('data', (data) => {
@ -114,25 +115,27 @@ class BotsCtl {
this.moderationBotProcess as ReturnType<typeof child_process.spawn> this.moderationBotProcess as ReturnType<typeof child_process.spawn>
let resolved = false let resolved = false
// Trying to kill, and force kill if it takes more than 2 seconds // Trying to kill, and force kill if it takes more than 1 seconds
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
this.logger.error('Moderation bot was not killed within 2 seconds, force killing') try {
this.logger.error('Moderation bot was not killed within 1 seconds, force killing')
moderationBotProcess.kill('SIGKILL') moderationBotProcess.kill('SIGKILL')
} catch (_err) {}
resolved = true resolved = true
resolve() resolve()
}, 2000) }, 1000)
moderationBotProcess.on('exit', () => { moderationBotProcess.on('exit', () => {
if (resolved) { return } if (resolved) { return }
resolved = true resolved = true
if (timeout) { clearTimeout(timeout) }
resolve() resolve()
if (timeout) { clearTimeout(timeout) }
}) })
moderationBotProcess.on('close', () => { moderationBotProcess.on('close', () => {
if (resolved) { return } if (resolved) { return }
resolved = true resolved = true
if (timeout) { clearTimeout(timeout) }
resolve() resolve()
if (timeout) { clearTimeout(timeout) }
}) })
moderationBotProcess.kill() moderationBotProcess.kill()
} catch (err) { } catch (err) {

View File

@ -204,12 +204,14 @@ class BotConfiguration {
public configurationPaths (): { public configurationPaths (): {
moderation: { moderation: {
globalFile: string globalFile: string
globalDir: string
roomConfDir: string roomConfDir: string
} }
} { } {
return { return {
moderation: { moderation: {
globalFile: this.moderationBotGlobalConf, globalFile: this.moderationBotGlobalConf,
globalDir: this.confDir,
roomConfDir: this.roomConfDir roomConfDir: this.roomConfDir
} }
} }

View File

@ -174,8 +174,14 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise<Pros
// enableRemoteChatConnections: local users can communicate with external rooms // enableRemoteChatConnections: local users can communicate with external rooms
const enableRemoteChatConnections = !(settings['federation-dont-publish-remotely'] as boolean) const enableRemoteChatConnections = !(settings['federation-dont-publish-remotely'] as boolean)
let certificates: ProsodyConfigCertificates = false let certificates: ProsodyConfigCertificates = false
const useBots = !settings['disable-channel-configuration']
const bots: ProsodyConfig['bots'] = {} const bots: ProsodyConfig['bots'] = {}
// Note: for the bots to connect, we must allow multiplexing.
// This will be done on the http (BOSH/Websocket) port, as it only listen on localhost.
// TODO: to improve performance, try to avoid multiplexing, and find a better way for bots to connect.
const useMultiplexing = useBots
const apikey = await getAPIKey(options) const apikey = await getAPIKey(options)
valuesToHideInDiagnostic.set('APIKey', apikey) valuesToHideInDiagnostic.set('APIKey', apikey)
@ -222,7 +228,7 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise<Pros
} }
config.useHttpAuthentication(authApiUrl) config.useHttpAuthentication(authApiUrl)
const useWS = !!options.registerWebSocketRoute // this comes with Peertube >=5.0.0, and is a prerequisite to websocket const useWS = !!options.registerWebSocketRoute // this comes with Peertube >=5.0.0, and is a prerequisite to websocket
config.usePeertubeBoshAndWebsocket(prosodyDomain, port, publicServerUrl, useWS) config.usePeertubeBoshAndWebsocket(prosodyDomain, port, publicServerUrl, useWS, useMultiplexing)
config.useMucHttpDefault(roomApiUrl) config.useMucHttpDefault(roomApiUrl)
if (enableC2S) { if (enableC2S) {
@ -294,11 +300,13 @@ async function getProsodyConfig (options: RegisterServerOptionsV5): Promise<Pros
config.usePeertubeVCards(basePeertubeUrl) config.usePeertubeVCards(basePeertubeUrl)
config.useAnonymousRandomVCards(paths.avatars) config.useAnonymousRandomVCards(paths.avatars)
if (!settings['disable-channel-configuration']) { if (useBots) {
config.useBotsVirtualHost() config.useBotsVirtualHost()
bots.moderation = await BotConfiguration.singleton().getModerationBotGlobalConf() bots.moderation = await BotConfiguration.singleton().getModerationBotGlobalConf()
if (bots.moderation?.connection?.password) {
valuesToHideInDiagnostic.set('BotPassword', bots.moderation.connection.password) valuesToHideInDiagnostic.set('BotPassword', bots.moderation.connection.password)
} }
}
config.useTestModule(apikey, testApiUrl) config.useTestModule(apikey, testApiUrl)

View File

@ -1,5 +1,6 @@
import type { ProsodyFilePaths } from './paths' import type { ProsodyFilePaths } from './paths'
import type { ExternalComponent } from './components' import type { ExternalComponent } from './components'
import { BotConfiguration } from '../../configuration/bot'
import { userInfo } from 'os' import { userInfo } from 'os'
type ConfigEntryValue = boolean | number | string | ConfigEntryValue[] type ConfigEntryValue = boolean | number | string | ConfigEntryValue[]
@ -221,14 +222,39 @@ class ProsodyConfigContent {
this.authenticated.set('http_auth_url', url) this.authenticated.set('http_auth_url', url)
} }
usePeertubeBoshAndWebsocket (prosodyDomain: string, port: string, publicServerUrl: string, useWS: boolean): void { /**
* Activate BOSH (and optionnaly Websocket).
* @param prosodyDomain prosody domain
* @param port port to use for BOSH and Websocket interfaces
* @param publicServerUrl public server url
* @param useWS activate Websocket or not
* @param multiplexing activate multiplexing on port. Note: it will only listen on localhost interfaces.
*/
usePeertubeBoshAndWebsocket (
prosodyDomain: string,
port: string,
publicServerUrl: string,
useWS: boolean,
multiplexing: boolean
): void {
// Note: don't activate other http_interface or https_interfaces than localhost.
// Elsewhere it would be a security issue.
this.global.set('c2s_require_encryption', false) this.global.set('c2s_require_encryption', false)
this.global.set('interfaces', ['127.0.0.1', '::1']) this.global.set('interfaces', ['127.0.0.1', '::1'])
this.global.set('c2s_ports', []) this.global.set('c2s_ports', [])
this.global.set('c2s_interfaces', ['127.0.0.1', '::1']) this.global.set('c2s_interfaces', ['127.0.0.1', '::1'])
this.global.set('s2s_ports', []) this.global.set('s2s_ports', [])
this.global.set('s2s_interfaces', ['127.0.0.1', '::1']) this.global.set('s2s_interfaces', ['127.0.0.1', '::1'])
if (!multiplexing) {
this.global.set('http_ports', [port]) this.global.set('http_ports', [port])
} else {
// Note: don't activate other http_interface or https_interfaces than localhost.
// Elsewhere it would be a security issue.
this.global.add('modules_enabled', 'net_multiplex')
this.global.set('ports', [port])
// FIXME: this generates Prosody error logs saying that BOSH/Websocket won't work... even if it is not true.
this.global.set('http_ports', [])
}
this.global.set('http_interfaces', ['127.0.0.1', '::1']) this.global.set('http_interfaces', ['127.0.0.1', '::1'])
this.global.set('https_ports', []) this.global.set('https_ports', [])
this.global.set('https_interfaces', ['127.0.0.1', '::1']) this.global.set('https_interfaces', ['127.0.0.1', '::1'])
@ -410,7 +436,12 @@ class ProsodyConfigContent {
*/ */
useBotsVirtualHost (): void { useBotsVirtualHost (): void {
this.bot = new ProsodyConfigVirtualHost('bot.' + this.prosodyDomain) this.bot = new ProsodyConfigVirtualHost('bot.' + this.prosodyDomain)
this.bot.set('modules_enabled', ['ping']) this.bot.set('modules_enabled', ['ping', 'bot_peertubelivechat'])
const configurationPaths = BotConfiguration.singleton().configurationPaths()
if (configurationPaths.moderation?.globalDir) {
this.bot.set('livechat_bot_conf_folder', configurationPaths.moderation.globalDir)
}
// TODO: bot vcards // TODO: bot vcards
} }