Merge pull request #69 from DiegoMagdaleno/master

Config updates and StrictNullChecks
This commit is contained in:
Flam3rboy 2021-05-23 20:48:51 +02:00 committed by GitHub
commit f756b20a2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 205 additions and 45 deletions

185
package-lock.json generated
View File

@ -9,7 +9,8 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@fosscord/server-util": "^1.2.6", "@fosscord/server-util": "^1.3.1",
"ajv": "^8.5.0",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"lambert-server": "^1.1.7", "lambert-server": "^1.1.7",
@ -30,14 +31,17 @@
} }
}, },
"node_modules/@fosscord/server-util": { "node_modules/@fosscord/server-util": {
"version": "1.2.6", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.2.6.tgz", "resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.3.1.tgz",
"integrity": "sha512-HFa/DX+4Ze9e8j/tT/Je6at2UEygAH4xsHYay/SObFQKC1Oo+G5aIYvak0kwyzO12lg91i0FBRUEHuMviwNe8A==", "integrity": "sha512-NmrJ8HcZmOHyIUDMoQ+UnjoeMMi/HSbN2p/EMt1penTDSBvWcD8YS5m2NljuH0QxSmhuA2yLgSEpV1ydvJmOIw==",
"dependencies": { "dependencies": {
"@types/jsonwebtoken": "^8.5.0", "@types/jsonwebtoken": "^8.5.0",
"@types/mongoose-autopopulate": "^0.10.1", "@types/mongoose-autopopulate": "^0.10.1",
"@types/mongoose-lean-virtuals": "^0.5.1", "@types/mongoose-lean-virtuals": "^0.5.1",
"@types/node": "^14.14.25", "@types/node": "^14.14.25",
"ajv": "^8.5.0",
"dot-prop": "^6.0.1",
"env-paths": "^2.2.1",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"missing-native-js-functions": "^1.2.2", "missing-native-js-functions": "^1.2.2",
"mongodb": "^3.6.6", "mongodb": "^3.6.6",
@ -140,6 +144,21 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/ajv": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.5.0.tgz",
"integrity": "sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ==",
"dependencies": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/epoberezkin"
}
},
"node_modules/anymatch": { "node_modules/anymatch": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
@ -457,6 +476,20 @@
"node": ">=0.3.1" "node": ">=0.3.1"
} }
}, },
"node_modules/dot-prop": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz",
"integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==",
"dependencies": {
"is-obj": "^2.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/dotenv": { "node_modules/dotenv": {
"version": "8.2.0", "version": "8.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
@ -495,6 +528,14 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/env-paths": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
"integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",
"engines": {
"node": ">=6"
}
},
"node_modules/erlpack": { "node_modules/erlpack": {
"version": "0.1.3", "version": "0.1.3",
"resolved": "https://registry.npmjs.org/erlpack/-/erlpack-0.1.3.tgz", "resolved": "https://registry.npmjs.org/erlpack/-/erlpack-0.1.3.tgz",
@ -581,6 +622,11 @@
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
}, },
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
},
"node_modules/file-uri-to-path": { "node_modules/file-uri-to-path": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
@ -877,6 +923,14 @@
"node": ">=0.12.0" "node": ">=0.12.0"
} }
}, },
"node_modules/is-obj": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==",
"engines": {
"node": ">=8"
}
},
"node_modules/is-utf8": { "node_modules/is-utf8": {
"version": "0.2.1", "version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
@ -888,6 +942,11 @@
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
}, },
"node_modules/json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
},
"node_modules/jsonwebtoken": { "node_modules/jsonwebtoken": {
"version": "8.5.1", "version": "8.5.1",
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
@ -1138,14 +1197,14 @@
} }
}, },
"node_modules/mongodb": { "node_modules/mongodb": {
"version": "3.6.6", "version": "3.6.8",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.8.tgz",
"integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==", "integrity": "sha512-sDjJvI73WjON1vapcbyBD3Ao9/VN3TKYY8/QX9EPbs22KaCSrQ5rXo5ZZd44tWJ3wl3FlnrFZ+KyUtNH6+1ZPQ==",
"dependencies": { "dependencies": {
"bl": "^2.2.1", "bl": "^2.2.1",
"bson": "^1.1.4", "bson": "^1.1.4",
"denque": "^1.4.1", "denque": "^1.4.1",
"optional-require": "^1.0.2", "optional-require": "^1.0.3",
"safe-buffer": "^5.1.2" "safe-buffer": "^5.1.2"
}, },
"engines": { "engines": {
@ -1379,9 +1438,9 @@
} }
}, },
"node_modules/optional-require": { "node_modules/optional-require": {
"version": "1.0.2", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz", "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz",
"integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg==", "integrity": "sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA==",
"engines": { "engines": {
"node": ">=4" "node": ">=4"
} }
@ -1511,6 +1570,14 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"node_modules/punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
"engines": {
"node": ">=6"
}
},
"node_modules/qs": { "node_modules/qs": {
"version": "6.7.0", "version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
@ -1638,6 +1705,14 @@
"semver": "^5.1.0" "semver": "^5.1.0"
} }
}, },
"node_modules/require-from-string": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/resolve": { "node_modules/resolve": {
"version": "1.20.0", "version": "1.20.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
@ -2048,6 +2123,14 @@
"node": ">= 0.8" "node": ">= 0.8"
} }
}, },
"node_modules/uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
"dependencies": {
"punycode": "^2.1.0"
}
},
"node_modules/util-deprecate": { "node_modules/util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
@ -2134,14 +2217,17 @@
}, },
"dependencies": { "dependencies": {
"@fosscord/server-util": { "@fosscord/server-util": {
"version": "1.2.6", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.2.6.tgz", "resolved": "https://registry.npmjs.org/@fosscord/server-util/-/server-util-1.3.1.tgz",
"integrity": "sha512-HFa/DX+4Ze9e8j/tT/Je6at2UEygAH4xsHYay/SObFQKC1Oo+G5aIYvak0kwyzO12lg91i0FBRUEHuMviwNe8A==", "integrity": "sha512-NmrJ8HcZmOHyIUDMoQ+UnjoeMMi/HSbN2p/EMt1penTDSBvWcD8YS5m2NljuH0QxSmhuA2yLgSEpV1ydvJmOIw==",
"requires": { "requires": {
"@types/jsonwebtoken": "^8.5.0", "@types/jsonwebtoken": "^8.5.0",
"@types/mongoose-autopopulate": "^0.10.1", "@types/mongoose-autopopulate": "^0.10.1",
"@types/mongoose-lean-virtuals": "^0.5.1", "@types/mongoose-lean-virtuals": "^0.5.1",
"@types/node": "^14.14.25", "@types/node": "^14.14.25",
"ajv": "^8.5.0",
"dot-prop": "^6.0.1",
"env-paths": "^2.2.1",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"missing-native-js-functions": "^1.2.2", "missing-native-js-functions": "^1.2.2",
"mongodb": "^3.6.6", "mongodb": "^3.6.6",
@ -2241,6 +2327,17 @@
"negotiator": "0.6.2" "negotiator": "0.6.2"
} }
}, },
"ajv": {
"version": "8.5.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-8.5.0.tgz",
"integrity": "sha512-Y2l399Tt1AguU3BPRP9Fn4eN+Or+StUGWCUpbnFyXSo8NZ9S4uj+AG2pjs5apK+ZMOwYOz1+a+VKvKH7CudXgQ==",
"requires": {
"fast-deep-equal": "^3.1.1",
"json-schema-traverse": "^1.0.0",
"require-from-string": "^2.0.2",
"uri-js": "^4.2.2"
}
},
"anymatch": { "anymatch": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz",
@ -2500,6 +2597,14 @@
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
"dev": true "dev": true
}, },
"dot-prop": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz",
"integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==",
"requires": {
"is-obj": "^2.0.0"
}
},
"dotenv": { "dotenv": {
"version": "8.2.0", "version": "8.2.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz",
@ -2532,6 +2637,11 @@
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
}, },
"env-paths": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",
"integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A=="
},
"erlpack": { "erlpack": {
"version": "0.1.3", "version": "0.1.3",
"resolved": "https://registry.npmjs.org/erlpack/-/erlpack-0.1.3.tgz", "resolved": "https://registry.npmjs.org/erlpack/-/erlpack-0.1.3.tgz",
@ -2611,6 +2721,11 @@
"integrity": "sha512-h6aK1da4tpqWSbyCa3FxB/V6Ehd4EEB15zyQq9qe75OZBp0krinNKuH4rAY+S/U/2I36vdLAUFSjQJ+TFmODng==", "integrity": "sha512-h6aK1da4tpqWSbyCa3FxB/V6Ehd4EEB15zyQq9qe75OZBp0krinNKuH4rAY+S/U/2I36vdLAUFSjQJ+TFmODng==",
"requires": {} "requires": {}
}, },
"fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="
},
"file-uri-to-path": { "file-uri-to-path": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
@ -2834,6 +2949,11 @@
"integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
"dev": true "dev": true
}, },
"is-obj": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="
},
"is-utf8": { "is-utf8": {
"version": "0.2.1", "version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
@ -2845,6 +2965,11 @@
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
}, },
"json-schema-traverse": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz",
"integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="
},
"jsonwebtoken": { "jsonwebtoken": {
"version": "8.5.1", "version": "8.5.1",
"resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz",
@ -3052,14 +3177,14 @@
"dev": true "dev": true
}, },
"mongodb": { "mongodb": {
"version": "3.6.6", "version": "3.6.8",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.8.tgz",
"integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==", "integrity": "sha512-sDjJvI73WjON1vapcbyBD3Ao9/VN3TKYY8/QX9EPbs22KaCSrQ5rXo5ZZd44tWJ3wl3FlnrFZ+KyUtNH6+1ZPQ==",
"requires": { "requires": {
"bl": "^2.2.1", "bl": "^2.2.1",
"bson": "^1.1.4", "bson": "^1.1.4",
"denque": "^1.4.1", "denque": "^1.4.1",
"optional-require": "^1.0.2", "optional-require": "^1.0.3",
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"saslprep": "^1.0.0" "saslprep": "^1.0.0"
} }
@ -3215,9 +3340,9 @@
} }
}, },
"optional-require": { "optional-require": {
"version": "1.0.2", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz", "resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.3.tgz",
"integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg==" "integrity": "sha512-RV2Zp2MY2aeYK5G+B/Sps8lW5NHAzE5QClbFP15j+PWmP+T9PxlJXBOOLoSAdgwFvS4t0aMR4vpedMkbHfh0nA=="
}, },
"parse-json": { "parse-json": {
"version": "2.2.0", "version": "2.2.0",
@ -3311,6 +3436,11 @@
"ipaddr.js": "1.9.1" "ipaddr.js": "1.9.1"
} }
}, },
"punycode": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
"integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
},
"qs": { "qs": {
"version": "6.7.0", "version": "6.7.0",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz",
@ -3416,6 +3546,11 @@
"semver": "^5.1.0" "semver": "^5.1.0"
} }
}, },
"require-from-string": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz",
"integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="
},
"resolve": { "resolve": {
"version": "1.20.0", "version": "1.20.0",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz",
@ -3722,6 +3857,14 @@
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
}, },
"uri-js": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
"requires": {
"punycode": "^2.1.0"
}
},
"util-deprecate": { "util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",

View File

@ -13,7 +13,8 @@
"author": "Fosscord", "author": "Fosscord",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"@fosscord/server-util": "^1.2.6", "@fosscord/server-util": "^1.3.1",
"ajv": "^8.5.0",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"lambert-server": "^1.1.7", "lambert-server": "^1.1.7",

View File

@ -4,7 +4,6 @@ dotenv.config();
import { db } from "@fosscord/server-util"; import { db } from "@fosscord/server-util";
import { Server as WebSocketServer } from "ws"; import { Server as WebSocketServer } from "ws";
import { Connection } from "./events/Connection"; import { Connection } from "./events/Connection";
import Config from "./util/Config";
// TODO: only listen/start the server if everything got initalized // TODO: only listen/start the server if everything got initalized
// https://www.npmjs.com/package/ws use "External HTTP/S server" and listen manually at the end of listen() // https://www.npmjs.com/package/ws use "External HTTP/S server" and listen manually at the end of listen()
@ -38,7 +37,6 @@ export class Server {
await (db as Promise<Connection>); await (db as Promise<Connection>);
await this.setupSchema(); await this.setupSchema();
console.log("[DB] connected"); console.log("[DB] connected");
await Config.init();
console.log(`[Gateway] online on 0.0.0.0:${port}`); console.log(`[Gateway] online on 0.0.0.0:${port}`);
} }
} }

View File

@ -21,6 +21,7 @@ export async function Message(this: WebSocket, buffer: Data) {
if (this.encoding === "etf" && buffer instanceof Buffer) data = erlpack.unpack(buffer); if (this.encoding === "etf" && buffer instanceof Buffer) data = erlpack.unpack(buffer);
else if (this.encoding === "json" && typeof buffer === "string") data = JSON.parse(buffer); else if (this.encoding === "json" && typeof buffer === "string") data = JSON.parse(buffer);
else return;
check.call(this, PayloadSchema, data); check.call(this, PayloadSchema, data);

View File

@ -19,7 +19,7 @@ export interface DispatchOpts {
function getPipeline(this: WebSocket, guilds: string[], channels: string[] = []) { function getPipeline(this: WebSocket, guilds: string[], channels: string[] = []) {
if (this.shard_count) { if (this.shard_count) {
guilds = guilds.filter((x) => (BigInt(x) >> 22n) % this.shard_count === this.shard_id); guilds = guilds.filter((x) => (BigInt(x) >> 22n) % this.shard_count! === this.shard_id);
} }
return [ return [
@ -37,7 +37,7 @@ function getPipeline(this: WebSocket, guilds: string[], channels: string[] = [])
export async function setupListener(this: WebSocket) { export async function setupListener(this: WebSocket) {
const user = await UserModel.findOne({ id: this.user_id }).lean().exec(); const user = await UserModel.findOne({ id: this.user_id }).lean().exec();
var guilds = user.guilds; var guilds = user!.guilds;
const eventStream = new MongooseCache(db.collection("events"), getPipeline.call(this, guilds), { const eventStream = new MongooseCache(db.collection("events"), getPipeline.call(this, guilds), {
onlyEvents: true, onlyEvents: true,
@ -60,7 +60,7 @@ export async function dispatch(this: WebSocket, document: Event, { eventStream,
guilds.push(document.data.id); guilds.push(document.data.id);
eventStream.changeStream(getPipeline.call(this, guilds)); eventStream.changeStream(getPipeline.call(this, guilds));
} else if (document.event === "GUILD_DELETE") { } else if (document.event === "GUILD_DELETE") {
guilds.remove(document.guild_id); guilds.remove(document.guild_id!);
eventStream.changeStream(getPipeline.call(this, guilds)); eventStream.changeStream(getPipeline.call(this, guilds));
} else if (document.event === "CHANNEL_DELETE") channel_id = null; } else if (document.event === "CHANNEL_DELETE") channel_id = null;
if (document.guild_id && !this.intents.has("GUILDS")) return; if (document.guild_id && !this.intents.has("GUILDS")) return;

View File

@ -17,6 +17,7 @@ import { IdentifySchema } from "../schema/Identify";
import { Send } from "../util/Send"; import { Send } from "../util/Send";
import experiments from "./experiments.json"; import experiments from "./experiments.json";
import { check } from "./instanceOf"; import { check } from "./instanceOf";
import * as Config from "../util/Config";
// TODO: bot sharding // TODO: bot sharding
// TODO: check priviliged intents // TODO: check priviliged intents
@ -29,7 +30,8 @@ export async function onIdentify(this: WebSocket, data: Payload) {
const identify: IdentifySchema = data.d; const identify: IdentifySchema = data.d;
try { try {
var decoded = await checkToken(identify.token); // will throw an error if invalid const { jwtSecret } = Config.gatewayConfig.getAll().security;
var decoded = await checkToken(identify.token, jwtSecret); // will throw an error if invalid
} catch (error) { } catch (error) {
console.error("invalid token", error); console.error("invalid token", error);
return this.close(CLOSECODES.Authentication_failed); return this.close(CLOSECODES.Authentication_failed);

View File

@ -1,21 +1,36 @@
import { Config } from "@fosscord/server-util"; import { Config } from "@fosscord/server-util";
import { getConfigPathForFile } from "@fosscord/server-util/dist/util/Config";
export default { import Ajv, { JSONSchemaType } from "ajv";
init() {
return Config.init({ gateway: DefaultOptions });
},
get() {
return Config.getAll().gateway;
},
set(val: any) {
return Config.setAll({ gateway: val });
},
getAll: Config.getAll,
setAll: Config.setAll,
};
export interface DefaultOptions { export interface DefaultOptions {
endpoint?: string; endpoint?: string;
security: {
jwtSecret: string;
}
} }
export const DefaultOptions: DefaultOptions = {}; const schema: JSONSchemaType<DefaultOptions> = {
type: "object",
properties: {
endpoint: {
type: "string",
nullable: true
},
security: {
type: "object",
properties: {
jwtSecret: {
type: "string"
}
},
required: ["jwtSecret"]
},
},
required: ["security"]
}
const ajv = new Ajv();
const validator = ajv.compile(schema);
const configPath = getConfigPathForFile("fosscord", "gateway", ".json");
export const gatewayConfig = new Config<DefaultOptions>({path: configPath, schemaValidator: validator, schema: schema})

View File

@ -11,7 +11,7 @@ export async function Send(socket: WebSocket, data: Payload) {
if (socket.encoding === "etf") buffer = erlpack.pack(data); if (socket.encoding === "etf") buffer = erlpack.pack(data);
// TODO: encode circular object // TODO: encode circular object
else if (socket.encoding === "json") buffer = JSON.stringify(data); else if (socket.encoding === "json") buffer = JSON.stringify(data);
else return;
// TODO: compression // TODO: compression
if (socket.deflate) { if (socket.deflate) {
socket.deflate.write(buffer); socket.deflate.write(buffer);

View File

@ -29,7 +29,7 @@
/* Strict Type-Checking Options */ /* Strict Type-Checking Options */
"strict": false /* Enable all strict type-checking options. */, "strict": false /* Enable all strict type-checking options. */,
"noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */,
// "strictNullChecks": true, /* Enable strict null checks. */ "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */ // "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
"strictPropertyInitialization": false /* Enable strict checking of property initialization in classes. */, "strictPropertyInitialization": false /* Enable strict checking of property initialization in classes. */,