diff --git a/api/package-lock.json b/api/package-lock.json
index de889188..4e65e886 100644
--- a/api/package-lock.json
+++ b/api/package-lock.json
@@ -8,7 +8,7 @@
"name": "@fosscord/api",
"version": "1.0.0",
"hasInstallScript": true,
- "license": "GPLV3",
+ "license": "AGPL-3.0-only",
"dependencies": {
"@babel/preset-env": "^7.15.8",
"@babel/preset-typescript": "^7.15.0",
@@ -34,12 +34,13 @@
"missing-native-js-functions": "^1.2.18",
"morgan": "^1.10.0",
"multer": "^1.4.2",
+ "node-2fa": "^2.0.3",
"node-fetch": "^2.6.2",
"patch-package": "^6.4.7",
"picocolors": "^1.0.0",
"proxy-agent": "^5.0.0",
"supertest": "^6.1.6",
- "typeorm": "^0.2.37"
+ "typeorm": "^0.3.7"
},
"devDependencies": {
"@babel/core": "^7.15.5",
@@ -54,7 +55,7 @@
"@types/jsonwebtoken": "^8.5.0",
"@types/morgan": "^1.9.3",
"@types/multer": "^1.4.5",
- "@types/node": "^14.17.9",
+ "@types/node": "^14.18.22",
"@types/node-fetch": "^2.5.5",
"@types/supertest": "^2.0.11",
"@zerollup/ts-transform-paths": "^1.7.18",
@@ -72,7 +73,7 @@
"name": "@fosscord/util",
"version": "1.0.0",
"hasInstallScript": true,
- "license": "GPLV3",
+ "license": "AGPL-3.0-only",
"dependencies": {
"amqplib": "^0.8.0",
"form-data": "^4.0.0",
@@ -86,7 +87,7 @@
"picocolors": "^1.0.0",
"proxy-agent": "^5.0.0",
"reflect-metadata": "^0.1.13",
- "typeorm": "^0.2.38",
+ "typeorm": "^0.3.7",
"typescript": "^4.4.2",
"typescript-json-schema": "^0.50.1"
},
@@ -94,7 +95,7 @@
"@types/amqplib": "^0.8.1",
"@types/jsonwebtoken": "^8.5.0",
"@types/multer": "^1.4.7",
- "@types/node": "^14.17.9",
+ "@types/node": "^14.18.22",
"@types/node-fetch": "^2.5.12",
"jest": "^27.0.6",
"ts-node": "^10.2.1"
@@ -9718,9 +9719,9 @@
}
},
"node_modules/@types/node": {
- "version": "14.17.16",
- "dev": true,
- "license": "MIT"
+ "version": "14.18.22",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.22.tgz",
+ "integrity": "sha512-qzaYbXVzin6EPjghf/hTdIbnVW1ErMx8rPzwRNJhlbyJhu2SyqlvjGOY/tbUt6VFyzg56lROcOeSQRInpt63Yw=="
},
"node_modules/@types/node-fetch": {
"version": "2.5.12",
@@ -9731,6 +9732,14 @@
"form-data": "^3.0.0"
}
},
+ "node_modules/@types/notp": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@types/notp/-/notp-2.0.2.tgz",
+ "integrity": "sha512-JUcVYN9Tmw0AjoAfvjslS4hbv39fPBbZdftBK3b50g5z/DmhLsu6cd0UOEBiQuMwy2FirshF2Gk9gAvfWjshMw==",
+ "dependencies": {
+ "@types/node": "*"
+ }
+ },
"node_modules/@types/prettier": {
"version": "2.4.1",
"dev": true,
@@ -9800,10 +9809,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@types/zen-observable": {
- "version": "0.8.3",
- "license": "MIT"
- },
"node_modules/@yarnpkg/lockfile": {
"version": "1.1.0",
"license": "BSD-2-Clause"
@@ -10045,7 +10050,7 @@
},
"node_modules/arg": {
"version": "4.1.3",
- "dev": true,
+ "devOptional": true,
"license": "MIT"
},
"node_modules/argparse": {
@@ -10821,7 +10826,7 @@
},
"node_modules/create-require": {
"version": "1.1.1",
- "dev": true,
+ "devOptional": true,
"license": "MIT"
},
"node_modules/cross-spawn": {
@@ -10916,9 +10921,22 @@
"node": ">=10"
}
},
+ "node_modules/date-fns": {
+ "version": "2.28.0",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz",
+ "integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==",
+ "engines": {
+ "node": ">=0.11"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/date-fns"
+ }
+ },
"node_modules/debug": {
- "version": "4.3.2",
- "license": "MIT",
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"dependencies": {
"ms": "2.1.2"
},
@@ -11064,7 +11082,7 @@
},
"node_modules/diff": {
"version": "4.0.2",
- "dev": true,
+ "devOptional": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.3.1"
@@ -11427,13 +11445,6 @@
"bser": "2.1.1"
}
},
- "node_modules/figlet": {
- "version": "1.5.2",
- "license": "MIT",
- "engines": {
- "node": ">= 0.4.0"
- }
- },
"node_modules/file-uri-to-path": {
"version": "2.0.0",
"license": "MIT",
@@ -11663,13 +11674,14 @@
}
},
"node_modules/glob": {
- "version": "7.1.7",
- "license": "ISC",
+ "version": "7.2.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
- "minimatch": "^3.0.4",
+ "minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
@@ -11733,23 +11745,6 @@
"node": ">= 0.4.0"
}
},
- "node_modules/has-ansi": {
- "version": "2.0.0",
- "license": "MIT",
- "dependencies": {
- "ansi-regex": "^2.0.0"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/has-ansi/node_modules/ansi-regex": {
- "version": "2.1.1",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/has-flag": {
"version": "4.0.0",
"license": "MIT",
@@ -13106,7 +13101,7 @@
},
"node_modules/make-error": {
"version": "1.3.6",
- "dev": true,
+ "devOptional": true,
"license": "ISC"
},
"node_modules/makeerror": {
@@ -13187,8 +13182,9 @@
}
},
"node_modules/minimatch": {
- "version": "3.0.4",
- "license": "ISC",
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dependencies": {
"brace-expansion": "^1.1.7"
},
@@ -13321,6 +13317,17 @@
"version": "1.0.5",
"license": "MIT"
},
+ "node_modules/node-2fa": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/node-2fa/-/node-2fa-2.0.3.tgz",
+ "integrity": "sha512-PQldrOhjuoZyoydMvMSctllPN1ZPZ1/NwkEcgYwY9faVqE/OymxR+3awPpbWZxm6acLKqvmNqQmdqTsqYyflFw==",
+ "dependencies": {
+ "@types/notp": "^2.0.0",
+ "notp": "^2.0.3",
+ "thirty-two": "1.0.2",
+ "tslib": "^2.1.0"
+ }
+ },
"node_modules/node-addon-api": {
"version": "3.2.1",
"license": "MIT"
@@ -13449,6 +13456,14 @@
"node": ">=0.10.0"
}
},
+ "node_modules/notp": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/notp/-/notp-2.0.3.tgz",
+ "integrity": "sha512-oBig/2uqkjQ5AkBuw4QJYwkEWa/q+zHxI5/I5z6IeP2NT0alpJFsP/trrfCC+9xOAgQSZXssNi962kp5KBmypQ==",
+ "engines": {
+ "node": "> v0.6.0"
+ }
+ },
"node_modules/npm-run-path": {
"version": "4.0.1",
"dev": true,
@@ -13668,12 +13683,6 @@
"node": ">= 8"
}
},
- "node_modules/parent-require": {
- "version": "1.0.0",
- "engines": {
- "node": ">= 0.4.0"
- }
- },
"node_modules/parse5": {
"version": "6.0.1",
"license": "MIT"
@@ -14441,7 +14450,7 @@
},
"node_modules/source-map-support": {
"version": "0.5.20",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"buffer-from": "^1.0.0",
@@ -14450,7 +14459,7 @@
},
"node_modules/source-map-support/node_modules/source-map": {
"version": "0.6.1",
- "dev": true,
+ "devOptional": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@@ -14751,6 +14760,14 @@
"node": ">=0.8"
}
},
+ "node_modules/thirty-two": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/thirty-two/-/thirty-two-1.0.2.tgz",
+ "integrity": "sha512-OEI0IWCe+Dw46019YLl6V10Us5bi574EvlJEOcAkB29IzQ/mYD1A6RyNHLjZPiHCmuodxvgF6U+vZO1L15lxVA==",
+ "engines": {
+ "node": ">=0.2.6"
+ }
+ },
"node_modules/throat": {
"version": "6.0.1",
"dev": true,
@@ -14830,7 +14847,7 @@
},
"node_modules/ts-node": {
"version": "9.1.1",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"dependencies": {
"arg": "^4.1.0",
@@ -15004,51 +15021,62 @@
}
},
"node_modules/typeorm": {
- "version": "0.2.37",
- "license": "MIT",
+ "version": "0.3.7",
+ "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.7.tgz",
+ "integrity": "sha512-MsPJeP6Zuwfe64c++l80+VRqpGEGxf0CkztIEnehQ+CMmQPSHjOnFbFxwBuZ2jiLqZTjLk2ZqQdVF0RmvxNF3Q==",
"dependencies": {
"@sqltools/formatter": "^1.2.2",
"app-root-path": "^3.0.0",
"buffer": "^6.0.3",
"chalk": "^4.1.0",
"cli-highlight": "^2.1.11",
- "debug": "^4.3.1",
- "dotenv": "^8.2.0",
- "glob": "^7.1.6",
- "js-yaml": "^4.0.0",
+ "date-fns": "^2.28.0",
+ "debug": "^4.3.3",
+ "dotenv": "^16.0.0",
+ "glob": "^7.2.0",
+ "js-yaml": "^4.1.0",
"mkdirp": "^1.0.4",
"reflect-metadata": "^0.1.13",
"sha.js": "^2.4.11",
- "tslib": "^2.1.0",
+ "tslib": "^2.3.1",
+ "uuid": "^8.3.2",
"xml2js": "^0.4.23",
- "yargonaut": "^1.1.4",
- "yargs": "^17.0.1",
- "zen-observable-ts": "^1.0.0"
+ "yargs": "^17.3.1"
},
"bin": {
- "typeorm": "cli.js"
+ "typeorm": "cli.js",
+ "typeorm-ts-node-commonjs": "cli-ts-node-commonjs.js",
+ "typeorm-ts-node-esm": "cli-ts-node-esm.js"
+ },
+ "engines": {
+ "node": ">= 12.9.0"
},
"funding": {
"url": "https://opencollective.com/typeorm"
},
"peerDependencies": {
- "@sap/hana-client": "*",
- "better-sqlite3": "*",
- "hdb-pool": "*",
- "ioredis": "*",
+ "@google-cloud/spanner": "^5.18.0",
+ "@sap/hana-client": "^2.12.25",
+ "better-sqlite3": "^7.1.2",
+ "hdb-pool": "^0.1.6",
+ "ioredis": "^5.0.4",
"mongodb": "^3.6.0",
- "mssql": "*",
- "mysql2": "*",
- "oracledb": "*",
- "pg": "*",
- "pg-native": "*",
- "pg-query-stream": "*",
- "redis": "*",
- "sql.js": "*",
- "sqlite3": "*",
- "typeorm-aurora-data-api-driver": "*"
+ "mssql": "^7.3.0",
+ "mysql2": "^2.2.5",
+ "oracledb": "^5.1.0",
+ "pg": "^8.5.1",
+ "pg-native": "^3.0.0",
+ "pg-query-stream": "^4.0.0",
+ "redis": "^3.1.1 || ^4.0.0",
+ "sql.js": "^1.4.0",
+ "sqlite3": "^5.0.3",
+ "ts-node": "^10.7.0",
+ "typeorm-aurora-data-api-driver": "^2.0.0"
},
"peerDependenciesMeta": {
+ "@google-cloud/spanner": {
+ "optional": true
+ },
"@sap/hana-client": {
"optional": true
},
@@ -15091,6 +15119,9 @@
"sqlite3": {
"optional": true
},
+ "ts-node": {
+ "optional": true
+ },
"typeorm-aurora-data-api-driver": {
"optional": true
}
@@ -15122,9 +15153,18 @@
"ieee754": "^1.2.1"
}
},
+ "node_modules/typeorm/node_modules/dotenv": {
+ "version": "16.0.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz",
+ "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==",
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/typeorm/node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"engines": {
"node": ">=8"
}
@@ -15150,36 +15190,46 @@
}
},
"node_modules/typeorm/node_modules/string-width": {
- "version": "4.2.2",
- "license": "MIT",
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.0"
+ "strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/typeorm/node_modules/yargs": {
- "version": "17.1.1",
- "license": "MIT",
+ "version": "17.5.1",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz",
+ "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==",
"dependencies": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
- "string-width": "^4.2.0",
+ "string-width": "^4.2.3",
"y18n": "^5.0.5",
- "yargs-parser": "^20.2.2"
+ "yargs-parser": "^21.0.0"
},
"engines": {
"node": ">=12"
}
},
+ "node_modules/typeorm/node_modules/yargs-parser": {
+ "version": "21.0.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz",
+ "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg==",
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/typescript": {
"version": "4.4.3",
- "dev": true,
+ "devOptional": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
@@ -15314,10 +15364,7 @@
},
"node_modules/uuid": {
"version": "8.3.2",
- "dev": true,
"license": "MIT",
- "optional": true,
- "peer": true,
"bin": {
"uuid": "dist/bin/uuid"
}
@@ -15575,60 +15622,6 @@
"version": "4.0.0",
"license": "ISC"
},
- "node_modules/yargonaut": {
- "version": "1.1.4",
- "license": "Apache-2.0",
- "dependencies": {
- "chalk": "^1.1.1",
- "figlet": "^1.1.1",
- "parent-require": "^1.0.0"
- }
- },
- "node_modules/yargonaut/node_modules/ansi-regex": {
- "version": "2.1.1",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/yargonaut/node_modules/ansi-styles": {
- "version": "2.2.1",
- "license": "MIT",
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/yargonaut/node_modules/chalk": {
- "version": "1.1.3",
- "license": "MIT",
- "dependencies": {
- "ansi-styles": "^2.2.1",
- "escape-string-regexp": "^1.0.2",
- "has-ansi": "^2.0.0",
- "strip-ansi": "^3.0.0",
- "supports-color": "^2.0.0"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/yargonaut/node_modules/strip-ansi": {
- "version": "3.0.1",
- "license": "MIT",
- "dependencies": {
- "ansi-regex": "^2.0.0"
- },
- "engines": {
- "node": ">=0.10.0"
- }
- },
- "node_modules/yargonaut/node_modules/supports-color": {
- "version": "2.0.0",
- "license": "MIT",
- "engines": {
- "node": ">=0.8.0"
- }
- },
"node_modules/yargs": {
"version": "16.2.0",
"license": "MIT",
@@ -15673,23 +15666,11 @@
},
"node_modules/yn": {
"version": "3.1.1",
- "dev": true,
+ "devOptional": true,
"license": "MIT",
"engines": {
"node": ">=6"
}
- },
- "node_modules/zen-observable": {
- "version": "0.8.15",
- "license": "MIT"
- },
- "node_modules/zen-observable-ts": {
- "version": "1.1.0",
- "license": "MIT",
- "dependencies": {
- "@types/zen-observable": "0.8.3",
- "zen-observable": "0.8.15"
- }
}
},
"dependencies": {
@@ -16673,7 +16654,7 @@
"@types/amqplib": "^0.8.1",
"@types/jsonwebtoken": "^8.5.0",
"@types/multer": "^1.4.7",
- "@types/node": "^14.17.9",
+ "@types/node": "^14.18.22",
"@types/node-fetch": "^2.5.12",
"amqplib": "^0.8.0",
"form-data": "^4.0.0",
@@ -16689,7 +16670,7 @@
"proxy-agent": "^5.0.0",
"reflect-metadata": "^0.1.13",
"ts-node": "^10.2.1",
- "typeorm": "^0.2.38",
+ "typeorm": "^0.3.7",
"typescript": "^4.4.2",
"typescript-json-schema": "^0.50.1"
},
@@ -22091,8 +22072,9 @@
}
},
"@types/node": {
- "version": "14.17.16",
- "dev": true
+ "version": "14.18.22",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.22.tgz",
+ "integrity": "sha512-qzaYbXVzin6EPjghf/hTdIbnVW1ErMx8rPzwRNJhlbyJhu2SyqlvjGOY/tbUt6VFyzg56lROcOeSQRInpt63Yw=="
},
"@types/node-fetch": {
"version": "2.5.12",
@@ -22102,6 +22084,14 @@
"form-data": "^3.0.0"
}
},
+ "@types/notp": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@types/notp/-/notp-2.0.2.tgz",
+ "integrity": "sha512-JUcVYN9Tmw0AjoAfvjslS4hbv39fPBbZdftBK3b50g5z/DmhLsu6cd0UOEBiQuMwy2FirshF2Gk9gAvfWjshMw==",
+ "requires": {
+ "@types/node": "*"
+ }
+ },
"@types/prettier": {
"version": "2.4.1",
"dev": true
@@ -22160,9 +22150,6 @@
"version": "20.2.1",
"dev": true
},
- "@types/zen-observable": {
- "version": "0.8.3"
- },
"@yarnpkg/lockfile": {
"version": "1.1.0"
},
@@ -22318,7 +22305,7 @@
},
"arg": {
"version": "4.1.3",
- "dev": true
+ "devOptional": true
},
"argparse": {
"version": "1.0.10",
@@ -22844,7 +22831,7 @@
},
"create-require": {
"version": "1.1.1",
- "dev": true
+ "devOptional": true
},
"cross-spawn": {
"version": "7.0.3",
@@ -22906,8 +22893,15 @@
"whatwg-url": "^8.0.0"
}
},
+ "date-fns": {
+ "version": "2.28.0",
+ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.28.0.tgz",
+ "integrity": "sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw=="
+ },
"debug": {
- "version": "4.3.2",
+ "version": "4.3.4",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
+ "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
"ms": "2.1.2"
}
@@ -22990,7 +22984,7 @@
},
"diff": {
"version": "4.0.2",
- "dev": true
+ "devOptional": true
},
"diff-sequences": {
"version": "27.0.6",
@@ -23220,9 +23214,6 @@
"bser": "2.1.1"
}
},
- "figlet": {
- "version": "1.5.2"
- },
"file-uri-to-path": {
"version": "2.0.0"
},
@@ -23372,12 +23363,14 @@
}
},
"glob": {
- "version": "7.1.7",
+ "version": "7.2.3",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
+ "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
- "minimatch": "^3.0.4",
+ "minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
@@ -23417,17 +23410,6 @@
"function-bind": "^1.1.1"
}
},
- "has-ansi": {
- "version": "2.0.0",
- "requires": {
- "ansi-regex": "^2.0.0"
- },
- "dependencies": {
- "ansi-regex": {
- "version": "2.1.1"
- }
- }
- },
"has-flag": {
"version": "4.0.0"
},
@@ -24340,7 +24322,7 @@
},
"make-error": {
"version": "1.3.6",
- "dev": true
+ "devOptional": true
},
"makeerror": {
"version": "1.0.11",
@@ -24386,7 +24368,9 @@
"dev": true
},
"minimatch": {
- "version": "3.0.4",
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"requires": {
"brace-expansion": "^1.1.7"
}
@@ -24479,6 +24463,17 @@
"nice-try": {
"version": "1.0.5"
},
+ "node-2fa": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/node-2fa/-/node-2fa-2.0.3.tgz",
+ "integrity": "sha512-PQldrOhjuoZyoydMvMSctllPN1ZPZ1/NwkEcgYwY9faVqE/OymxR+3awPpbWZxm6acLKqvmNqQmdqTsqYyflFw==",
+ "requires": {
+ "@types/notp": "^2.0.0",
+ "notp": "^2.0.3",
+ "thirty-two": "1.0.2",
+ "tslib": "^2.1.0"
+ }
+ },
"node-addon-api": {
"version": "3.2.1"
},
@@ -24567,6 +24562,11 @@
"version": "3.0.0",
"dev": true
},
+ "notp": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/notp/-/notp-2.0.3.tgz",
+ "integrity": "sha512-oBig/2uqkjQ5AkBuw4QJYwkEWa/q+zHxI5/I5z6IeP2NT0alpJFsP/trrfCC+9xOAgQSZXssNi962kp5KBmypQ=="
+ },
"npm-run-path": {
"version": "4.0.1",
"dev": true,
@@ -24699,9 +24699,6 @@
"netmask": "^2.0.1"
}
},
- "parent-require": {
- "version": "1.0.0"
- },
"parse5": {
"version": "6.0.1"
},
@@ -25201,7 +25198,7 @@
},
"source-map-support": {
"version": "0.5.20",
- "dev": true,
+ "devOptional": true,
"requires": {
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
@@ -25209,7 +25206,7 @@
"dependencies": {
"source-map": {
"version": "0.6.1",
- "dev": true
+ "devOptional": true
}
}
},
@@ -25398,6 +25395,11 @@
"thenify": ">= 3.1.0 < 4"
}
},
+ "thirty-two": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/thirty-two/-/thirty-two-1.0.2.tgz",
+ "integrity": "sha512-OEI0IWCe+Dw46019YLl6V10Us5bi574EvlJEOcAkB29IzQ/mYD1A6RyNHLjZPiHCmuodxvgF6U+vZO1L15lxVA=="
+ },
"throat": {
"version": "6.0.1",
"dev": true
@@ -25447,7 +25449,7 @@
},
"ts-node": {
"version": "9.1.1",
- "dev": true,
+ "devOptional": true,
"requires": {
"arg": "^4.1.0",
"create-require": "^1.1.0",
@@ -25550,25 +25552,27 @@
}
},
"typeorm": {
- "version": "0.2.37",
+ "version": "0.3.7",
+ "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.7.tgz",
+ "integrity": "sha512-MsPJeP6Zuwfe64c++l80+VRqpGEGxf0CkztIEnehQ+CMmQPSHjOnFbFxwBuZ2jiLqZTjLk2ZqQdVF0RmvxNF3Q==",
"requires": {
"@sqltools/formatter": "^1.2.2",
"app-root-path": "^3.0.0",
"buffer": "^6.0.3",
"chalk": "^4.1.0",
"cli-highlight": "^2.1.11",
- "debug": "^4.3.1",
- "dotenv": "^8.2.0",
- "glob": "^7.1.6",
- "js-yaml": "^4.0.0",
+ "date-fns": "^2.28.0",
+ "debug": "^4.3.3",
+ "dotenv": "^16.0.0",
+ "glob": "^7.2.0",
+ "js-yaml": "^4.1.0",
"mkdirp": "^1.0.4",
"reflect-metadata": "^0.1.13",
"sha.js": "^2.4.11",
- "tslib": "^2.1.0",
+ "tslib": "^2.3.1",
+ "uuid": "^8.3.2",
"xml2js": "^0.4.23",
- "yargonaut": "^1.1.4",
- "yargs": "^17.0.1",
- "zen-observable-ts": "^1.0.0"
+ "yargs": "^17.3.1"
},
"dependencies": {
"argparse": {
@@ -25581,8 +25585,15 @@
"ieee754": "^1.2.1"
}
},
+ "dotenv": {
+ "version": "16.0.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz",
+ "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ=="
+ },
"is-fullwidth-code-point": {
- "version": "3.0.0"
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
},
"js-yaml": {
"version": "4.1.0",
@@ -25594,30 +25605,39 @@
"version": "1.0.4"
},
"string-width": {
- "version": "4.2.2",
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
- "strip-ansi": "^6.0.0"
+ "strip-ansi": "^6.0.1"
}
},
"yargs": {
- "version": "17.1.1",
+ "version": "17.5.1",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.5.1.tgz",
+ "integrity": "sha512-t6YAJcxDkNX7NFYiVtKvWUz8l+PaKTLiL63mJYWR2GnHq2gjEWISzsLp9wg3aY36dY1j+gfIEL3pIF+XlJJfbA==",
"requires": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
- "string-width": "^4.2.0",
+ "string-width": "^4.2.3",
"y18n": "^5.0.5",
- "yargs-parser": "^20.2.2"
+ "yargs-parser": "^21.0.0"
}
+ },
+ "yargs-parser": {
+ "version": "21.0.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.1.tgz",
+ "integrity": "sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg=="
}
}
},
"typescript": {
"version": "4.4.3",
- "dev": true
+ "devOptional": true
},
"typescript-json-schema": {
"version": "0.50.1",
@@ -25702,10 +25722,7 @@
"version": "1.0.1"
},
"uuid": {
- "version": "8.3.2",
- "dev": true,
- "optional": true,
- "peer": true
+ "version": "8.3.2"
},
"v8-to-istanbul": {
"version": "8.1.0",
@@ -25866,41 +25883,6 @@
"yallist": {
"version": "4.0.0"
},
- "yargonaut": {
- "version": "1.1.4",
- "requires": {
- "chalk": "^1.1.1",
- "figlet": "^1.1.1",
- "parent-require": "^1.0.0"
- },
- "dependencies": {
- "ansi-regex": {
- "version": "2.1.1"
- },
- "ansi-styles": {
- "version": "2.2.1"
- },
- "chalk": {
- "version": "1.1.3",
- "requires": {
- "ansi-styles": "^2.2.1",
- "escape-string-regexp": "^1.0.2",
- "has-ansi": "^2.0.0",
- "strip-ansi": "^3.0.0",
- "supports-color": "^2.0.0"
- }
- },
- "strip-ansi": {
- "version": "3.0.1",
- "requires": {
- "ansi-regex": "^2.0.0"
- }
- },
- "supports-color": {
- "version": "2.0.0"
- }
- }
- },
"yargs": {
"version": "16.2.0",
"requires": {
@@ -25931,17 +25913,7 @@
},
"yn": {
"version": "3.1.1",
- "dev": true
- },
- "zen-observable": {
- "version": "0.8.15"
- },
- "zen-observable-ts": {
- "version": "1.1.0",
- "requires": {
- "@types/zen-observable": "0.8.3",
- "zen-observable": "0.8.15"
- }
+ "devOptional": true
}
}
}
diff --git a/api/package.json b/api/package.json
index b34f1b30..48a857b1 100644
--- a/api/package.json
+++ b/api/package.json
@@ -93,7 +93,7 @@
"picocolors": "^1.0.0",
"proxy-agent": "^5.0.0",
"supertest": "^6.1.6",
- "typeorm": "^0.2.45"
+ "typeorm": "^0.3.7"
},
"jest": {
"setupFiles": [
diff --git a/api/src/routes/channels/#channel_id/messages/bulk-delete.ts b/api/src/routes/channels/#channel_id/messages/bulk-delete.ts
index 6eacf249..9e8cad23 100644
--- a/api/src/routes/channels/#channel_id/messages/bulk-delete.ts
+++ b/api/src/routes/channels/#channel_id/messages/bulk-delete.ts
@@ -17,15 +17,15 @@ export interface BulkDeleteSchema {
// https://discord.com/developers/docs/resources/channel#bulk-delete-messages
router.post("/", route({ body: "BulkDeleteSchema" }), async (req: Request, res: Response) => {
const { channel_id } = req.params;
- const channel = await Channel.findOneOrFail({ id: channel_id });
+ const channel = await Channel.findOneByOrFail({ id: channel_id });
if (!channel.guild_id) throw new HTTPError("Can't bulk delete dm channel messages", 400);
const rights = await getRights(req.user_id);
rights.hasThrow("SELF_DELETE_MESSAGES");
-
+
let superuser = rights.has("MANAGE_MESSAGES");
const permission = await getPermission(req.user_id, channel?.guild_id, channel_id);
-
+
const { maxBulkDelete } = Config.get().limits.message;
const { messages } = req.body as { messages: string[] };
@@ -35,7 +35,7 @@ router.post("/", route({ body: "BulkDeleteSchema" }), async (req: Request, res:
if (messages.length > maxBulkDelete) throw new HTTPError(`You cannot delete more than ${maxBulkDelete} messages`);
}
- await Message.delete(messages.map((x) => ({ id: x })));
+ await Message.delete({ id: In(messages) });
await emitEvent({
event: "MESSAGE_DELETE_BULK",
diff --git a/api/src/routes/channels/#channel_id/purge.ts b/api/src/routes/channels/#channel_id/purge.ts
index 622e06e5..3a6997b2 100644
--- a/api/src/routes/channels/#channel_id/purge.ts
+++ b/api/src/routes/channels/#channel_id/purge.ts
@@ -2,24 +2,9 @@ import { HTTPError } from "lambert-server";
import { route } from "@fosscord/api";
import { isTextChannel } from "./messages";
import { FindManyOptions, Between, Not } from "typeorm";
-import {
- Attachment,
- Channel,
- Config,
- Embed,
- DiscordApiErrors,
- emitEvent,
- FosscordApiErrors,
- getPermission,
- getRights,
- Message,
- MessageDeleteBulkEvent,
- Snowflake,
- uploadFile
-} from "@fosscord/util";
+import { Channel, Config, emitEvent, getPermission, getRights, Message, MessageDeleteBulkEvent } from "@fosscord/util";
import { Router, Response, Request } from "express";
-import multer from "multer";
-import { handleMessage, postHandleMessage } from "@fosscord/api";
+import { In } from "typeorm";
const router: Router = Router();
@@ -27,58 +12,58 @@ export default router;
export interface PurgeSchema {
before: string;
- after: string
+ after: string;
}
/**
TODO: apply the delete bit by bit to prevent client and database stress
**/
-router.post("/", route({ /*body: "PurgeSchema",*/ }), async (req: Request, res: Response) => {
- const { channel_id } = req.params;
- const channel = await Channel.findOneOrFail({ id: channel_id });
-
- if (!channel.guild_id) throw new HTTPError("Can't purge dm channels", 400);
- isTextChannel(channel.type);
+router.post("/",route({ /*body: "PurgeSchema",*/ }), async (req: Request, res: Response) => {
+ const { channel_id } = req.params;
+ const channel = await Channel.findOneOrFail({ where: { id: channel_id } });
- const rights = await getRights(req.user_id);
- if (!rights.has("MANAGE_MESSAGES")) {
- const permissions = await getPermission(req.user_id, channel.guild_id, channel_id);
- permissions.hasThrow("MANAGE_MESSAGES");
- permissions.hasThrow("MANAGE_CHANNELS");
- }
-
- const { before, after } = req.body as PurgeSchema;
+ if (!channel.guild_id) throw new HTTPError("Can't purge dm channels", 400);
+ isTextChannel(channel.type);
- // TODO: send the deletion event bite-by-bite to prevent client stress
+ const rights = await getRights(req.user_id);
+ if (!rights.has("MANAGE_MESSAGES")) {
+ const permissions = await getPermission(req.user_id, channel.guild_id, channel_id);
+ permissions.hasThrow("MANAGE_MESSAGES");
+ permissions.hasThrow("MANAGE_CHANNELS");
+ }
- let query: FindManyOptions<Message> & { where: { id?: any; }; } = {
- order: { id: "ASC" },
- // take: limit,
- where: {
- channel_id,
- id: Between(after, before), // the right way around
- author_id: rights.has("SELF_DELETE_MESSAGES") ? undefined : Not(req.user_id)
- // if you lack the right of self-deletion, you can't delete your own messages, even in purges
- },
- relations: ["author", "webhook", "application", "mentions", "mention_roles", "mention_channels", "sticker_items", "attachments"]
- };
-
+ const { before, after } = req.body as PurgeSchema;
- const messages = await Message.find(query);
- const endpoint = Config.get().cdn.endpointPublic;
-
- if (messages.length == 0) {
- res.sendStatus(304);
- return;
- }
+ // TODO: send the deletion event bite-by-bite to prevent client stress
+
+ let query: FindManyOptions<Message> & { where: { id?: any } } = {
+ order: { id: "ASC" },
+ // take: limit,
+ where: {
+ channel_id,
+ id: Between(after, before), // the right way around
+ author_id: rights.has("SELF_DELETE_MESSAGES") ? undefined : Not(req.user_id)
+ // if you lack the right of self-deletion, you can't delete your own messages, even in purges
+ },
+ relations: ["author", "webhook", "application", "mentions", "mention_roles", "mention_channels", "sticker_items", "attachments"]
+ };
+
+ const messages = await Message.find(query);
+ const endpoint = Config.get().cdn.endpointPublic;
- await Message.delete(messages.map((x) => ({ id: x })));
-
- await emitEvent({
- event: "MESSAGE_DELETE_BULK",
- channel_id,
- data: { ids: messages.map(x => x.id), channel_id, guild_id: channel.guild_id }
- } as MessageDeleteBulkEvent);
+ if (messages.length == 0) {
+ res.sendStatus(304);
+ return;
+ }
- res.sendStatus(204);
-});
+ await Message.delete({ id: In(messages) });
+
+ await emitEvent({
+ event: "MESSAGE_DELETE_BULK",
+ channel_id,
+ data: { ids: messages.map((x) => x.id), channel_id, guild_id: channel.guild_id }
+ } as MessageDeleteBulkEvent);
+
+ res.sendStatus(204);
+ }
+);
diff --git a/api/src/routes/discoverable-guilds.ts b/api/src/routes/discoverable-guilds.ts
index 984916f4..fb7b844f 100644
--- a/api/src/routes/discoverable-guilds.ts
+++ b/api/src/routes/discoverable-guilds.ts
@@ -16,19 +16,24 @@ router.get("/", route({}), async (req: Request, res: Response) => {
if (categories == undefined) {
guilds = showAllGuilds
? await Guild.find({ take: Math.abs(Number(limit || configLimit)) })
- : await Guild.find({ where: `"features" LIKE '%DISCOVERABLE%'`, take: Math.abs(Number(limit || configLimit)) });
+ : await Guild.find({ where: { features: Like("%DISCOVERABLE%") }, take: Math.abs(Number(limit || configLimit)) });
} else {
guilds = showAllGuilds
- ? await Guild.find({ where: `"primary_category_id" = ${categories}`, take: Math.abs(Number(limit || configLimit)) })
- : await Guild.find({
- where: `"primary_category_id" = ${categories} AND "features" LIKE '%DISCOVERABLE%'`,
- take: Math.abs(Number(limit || configLimit))
- });
+ ? await Guild.find({ where: { primary_category_id: Number(categories) }, take: Math.abs(Number(limit || configLimit)) })
+ : await Guild.find({
+ where: { primary_category_id: Number(categories), features: Like("%DISCOVERABLE%") },
+ take: Math.abs(Number(limit || configLimit))
+ });
}
const total = guilds ? guilds.length : undefined;
- res.send({ total: total, guilds: guilds, offset: Number(offset || Config.get().guild.discovery.offset), limit: Number(limit || configLimit) });
+ res.send({
+ total: total,
+ guilds: guilds,
+ offset: Number(offset || Config.get().guild.discovery.offset),
+ limit: Number(limit || configLimit)
+ });
});
export default router;
|