fix: http, improve env

This commit is contained in:
Isaac 2023-02-01 21:19:48 +00:00
parent ff37d63f2a
commit 5a2106caa4
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33
6 changed files with 118 additions and 97 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "discord-tickets", "name": "discord-tickets",
"version": "4.0.0-beta.0", "version": "4.0.0-beta.1",
"private": "true", "private": "true",
"description": "An open-source Discord bot for ticket management", "description": "An open-source Discord bot for ticket management",
"main": "src/", "main": "src/",
@ -34,7 +34,7 @@
"node": ">=18.0" "node": ">=18.0"
}, },
"dependencies": { "dependencies": {
"@discord-tickets/settings": "^1.1.6", "@discord-tickets/settings": "^1.1.7",
"@eartharoid/dbf": "^0.3.3", "@eartharoid/dbf": "^0.3.3",
"@eartharoid/dtf": "^2.0.1", "@eartharoid/dtf": "^2.0.1",
"@eartharoid/i18n": "^1.2.1", "@eartharoid/i18n": "^1.2.1",
@ -48,7 +48,7 @@
"discord.js": "^14.7.1", "discord.js": "^14.7.1",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"express": "^4.18.2", "express": "^4.18.2",
"fastify": "^4.11.0", "fastify": "^4.12.0",
"figlet": "^1.5.2", "figlet": "^1.5.2",
"fs-extra": "^10.1.0", "fs-extra": "^10.1.0",
"keyv": "^4.5.2", "keyv": "^4.5.2",
@ -67,7 +67,7 @@
}, },
"devDependencies": { "devDependencies": {
"all-contributors-cli": "^6.24.0", "all-contributors-cli": "^6.24.0",
"eslint": "^8.31.0", "eslint": "^8.33.0",
"eslint-plugin-unused-imports": "^2.0.0", "eslint-plugin-unused-imports": "^2.0.0",
"nodemon": "^2.0.20" "nodemon": "^2.0.20"
}, },

View File

@ -1,7 +1,7 @@
lockfileVersion: 5.4 lockfileVersion: 5.4
specifiers: specifiers:
'@discord-tickets/settings': ^1.1.6 '@discord-tickets/settings': ^1.1.7
'@eartharoid/dbf': ^0.3.3 '@eartharoid/dbf': ^0.3.3
'@eartharoid/dtf': ^2.0.1 '@eartharoid/dtf': ^2.0.1
'@eartharoid/i18n': ^1.2.1 '@eartharoid/i18n': ^1.2.1
@ -17,10 +17,10 @@ specifiers:
discord.js: ^14.7.1 discord.js: ^14.7.1
dotenv: ^16.0.3 dotenv: ^16.0.3
erlpack: github:discord/erlpack erlpack: github:discord/erlpack
eslint: ^8.31.0 eslint: ^8.33.0
eslint-plugin-unused-imports: ^2.0.0 eslint-plugin-unused-imports: ^2.0.0
express: ^4.18.2 express: ^4.18.2
fastify: ^4.11.0 fastify: ^4.12.0
figlet: ^1.5.2 figlet: ^1.5.2
fs-extra: ^10.1.0 fs-extra: ^10.1.0
keyv: ^4.5.2 keyv: ^4.5.2
@ -41,7 +41,7 @@ specifiers:
zlib-sync: ^0.1.7 zlib-sync: ^0.1.7
dependencies: dependencies:
'@discord-tickets/settings': 1.1.6 '@discord-tickets/settings': 1.1.7
'@eartharoid/dbf': 0.3.3_3cxu5zja4e2r5wmvge7mdcljwq '@eartharoid/dbf': 0.3.3_3cxu5zja4e2r5wmvge7mdcljwq
'@eartharoid/dtf': 2.0.1 '@eartharoid/dtf': 2.0.1
'@eartharoid/i18n': 1.2.1 '@eartharoid/i18n': 1.2.1
@ -55,7 +55,7 @@ dependencies:
discord.js: 14.7.1_3cxu5zja4e2r5wmvge7mdcljwq discord.js: 14.7.1_3cxu5zja4e2r5wmvge7mdcljwq
dotenv: 16.0.3 dotenv: 16.0.3
express: 4.18.2 express: 4.18.2
fastify: 4.11.0 fastify: 4.12.0
figlet: 1.5.2 figlet: 1.5.2
fs-extra: 10.1.0 fs-extra: 10.1.0
keyv: 4.5.2 keyv: 4.5.2
@ -80,26 +80,26 @@ optionalDependencies:
devDependencies: devDependencies:
all-contributors-cli: 6.24.0 all-contributors-cli: 6.24.0
eslint: 8.31.0 eslint: 8.33.0
eslint-plugin-unused-imports: 2.0.0_eslint@8.31.0 eslint-plugin-unused-imports: 2.0.0_eslint@8.33.0
nodemon: 2.0.20 nodemon: 2.0.20
packages: packages:
/@babel/runtime/7.20.7: /@babel/runtime/7.20.13:
resolution: {integrity: sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==} resolution: {integrity: sha512-gt3PKXs0DBoL9xCvOIIZ2NEqAGZqHjAnmVbfQtB620V0uReIQutpel14KcneZuer7UioY8ALKZ7iocavvzTNFA==}
engines: {node: '>=6.9.0'} engines: {node: '>=6.9.0'}
dependencies: dependencies:
regenerator-runtime: 0.13.11 regenerator-runtime: 0.13.11
dev: true dev: true
/@discord-tickets/settings/1.1.6: /@discord-tickets/settings/1.1.7:
resolution: {integrity: sha512-NdU+M3j224yCB1fmPQTNWOIsgBQztQQY5uc+wugx5DqF8MJAS7LsQoLEymclx7h1wB/tdykLv2MNPNnjuFXwBg==} resolution: {integrity: sha512-Y10SHQafNUkIhfM3hf6MNgEWm7z/rAGkbfhAuuBkpcITAm9mt6Kf9jm3RH1FZibPeDH8Mvd5U1208xLejTxDHA==}
dependencies: dependencies:
'@fortawesome/fontawesome-free': 6.2.1 '@fortawesome/fontawesome-free': 6.2.1
cookie: 0.5.0 cookie: 0.5.0
emoji-name-map: 1.2.9 emoji-name-map: 1.2.9
marked: 4.2.5 marked: 4.2.12
ms: 2.1.3 ms: 2.1.3
postcss: 8.4.21 postcss: 8.4.21
sortablejs: 1.15.0 sortablejs: 1.15.0
@ -112,10 +112,10 @@ packages:
dependencies: dependencies:
'@discordjs/util': 0.1.0 '@discordjs/util': 0.1.0
'@sapphire/shapeshift': 3.8.1 '@sapphire/shapeshift': 3.8.1
discord-api-types: 0.37.28 discord-api-types: 0.37.31
fast-deep-equal: 3.1.3 fast-deep-equal: 3.1.3
ts-mixer: 6.0.2 ts-mixer: 6.0.2
tslib: 2.4.1 tslib: 2.5.0
dev: false dev: false
/@discordjs/collection/1.3.0: /@discordjs/collection/1.3.0:
@ -131,10 +131,10 @@ packages:
'@discordjs/util': 0.1.0 '@discordjs/util': 0.1.0
'@sapphire/async-queue': 1.5.0 '@sapphire/async-queue': 1.5.0
'@sapphire/snowflake': 3.4.0 '@sapphire/snowflake': 3.4.0
discord-api-types: 0.37.28 discord-api-types: 0.37.31
file-type: 18.1.0 file-type: 18.2.0
tslib: 2.4.1 tslib: 2.5.0
undici: 5.15.0 undici: 5.16.0
dev: false dev: false
/@discordjs/util/0.1.0: /@discordjs/util/0.1.0:
@ -171,7 +171,7 @@ packages:
ajv: 6.12.6 ajv: 6.12.6
debug: 4.3.4 debug: 4.3.4
espree: 9.4.1 espree: 9.4.1
globals: 13.19.0 globals: 13.20.0
ignore: 5.2.4 ignore: 5.2.4
import-fresh: 3.3.0 import-fresh: 3.3.0
js-yaml: 4.1.0 js-yaml: 4.1.0
@ -220,7 +220,7 @@ packages:
/@fastify/http-proxy/8.4.0_3cxu5zja4e2r5wmvge7mdcljwq: /@fastify/http-proxy/8.4.0_3cxu5zja4e2r5wmvge7mdcljwq:
resolution: {integrity: sha512-H8nwsmawFtKKRE6uhh1BtF1gQi/l147SmLsDGxB0HdYTHzjXz6uSQO3lEVmY7unKMzbArRjdoJQkEGpScszdSw==} resolution: {integrity: sha512-H8nwsmawFtKKRE6uhh1BtF1gQi/l147SmLsDGxB0HdYTHzjXz6uSQO3lEVmY7unKMzbArRjdoJQkEGpScszdSw==}
dependencies: dependencies:
'@fastify/reply-from': 8.3.1 '@fastify/reply-from': 8.4.0
ws: 8.12.0_3cxu5zja4e2r5wmvge7mdcljwq ws: 8.12.0_3cxu5zja4e2r5wmvge7mdcljwq
transitivePeerDependencies: transitivePeerDependencies:
- bufferutil - bufferutil
@ -247,8 +247,8 @@ packages:
- supports-color - supports-color
dev: false dev: false
/@fastify/reply-from/8.3.1: /@fastify/reply-from/8.4.0:
resolution: {integrity: sha512-fRByAvTMXuBuYIimcinukOB3YdmqtYPeoybXIBNY0aPVgetHkmCVffBo/M4pEOib9Pes8wuoYL4VawI65aHl4w==} resolution: {integrity: sha512-ju8h7k1aP3qHWwYOVZK+1jJJA6HnxXOHassU4mSRJ02ekDrCYD1t2gjCZWVHBRwJsAnMKnqfqWIzlSc+nRqyzA==}
dependencies: dependencies:
'@fastify/error': 3.2.0 '@fastify/error': 3.2.0
end-of-stream: 1.4.4 end-of-stream: 1.4.4
@ -256,7 +256,7 @@ packages:
fastify-plugin: 4.5.0 fastify-plugin: 4.5.0
pump: 3.0.0 pump: 3.0.0
tiny-lru: 10.0.1 tiny-lru: 10.0.1
undici: 5.15.0 undici: 5.16.0
dev: false dev: false
/@fortawesome/fontawesome-free/6.2.1: /@fortawesome/fontawesome-free/6.2.1:
@ -448,16 +448,16 @@ packages:
negotiator: 0.6.3 negotiator: 0.6.3
dev: false dev: false
/acorn-jsx/5.3.2_acorn@8.8.1: /acorn-jsx/5.3.2_acorn@8.8.2:
resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==}
peerDependencies: peerDependencies:
acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 acorn: ^6.0.0 || ^7.0.0 || ^8.0.0
dependencies: dependencies:
acorn: 8.8.1 acorn: 8.8.2
dev: true dev: true
/acorn/8.8.1: /acorn/8.8.2:
resolution: {integrity: sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==} resolution: {integrity: sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==}
engines: {node: '>=0.4.0'} engines: {node: '>=0.4.0'}
hasBin: true hasBin: true
dev: true dev: true
@ -494,14 +494,14 @@ packages:
engines: {node: '>=4'} engines: {node: '>=4'}
hasBin: true hasBin: true
dependencies: dependencies:
'@babel/runtime': 7.20.7 '@babel/runtime': 7.20.13
async: 3.2.4 async: 3.2.4
chalk: 4.1.2 chalk: 4.1.2
didyoumean: 1.2.2 didyoumean: 1.2.2
inquirer: 7.3.3 inquirer: 7.3.3
json-fixer: 1.6.15 json-fixer: 1.6.15
lodash: 4.17.21 lodash: 4.17.21
node-fetch: 2.6.8 node-fetch: 2.6.9
pify: 5.0.0 pify: 5.0.0
yargs: 15.4.1 yargs: 15.4.1
transitivePeerDependencies: transitivePeerDependencies:
@ -602,7 +602,7 @@ packages:
engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16}
dependencies: dependencies:
bytes: 3.1.2 bytes: 3.1.2
content-type: 1.0.4 content-type: 1.0.5
debug: 2.6.9 debug: 2.6.9
depd: 2.0.0 depd: 2.0.0
destroy: 1.2.0 destroy: 1.2.0
@ -661,7 +661,7 @@ packages:
resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==} resolution: {integrity: sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==}
dependencies: dependencies:
function-bind: 1.1.1 function-bind: 1.1.1
get-intrinsic: 1.1.3 get-intrinsic: 1.2.0
dev: false dev: false
/callsites/3.1.0: /callsites/3.1.0:
@ -747,8 +747,8 @@ packages:
safe-buffer: 5.2.1 safe-buffer: 5.2.1
dev: false dev: false
/content-type/1.0.4: /content-type/1.0.5:
resolution: {integrity: sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==} resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==}
engines: {node: '>= 0.6'} engines: {node: '>= 0.6'}
dev: false dev: false
@ -847,8 +847,8 @@ packages:
resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==} resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==}
dev: true dev: true
/discord-api-types/0.37.28: /discord-api-types/0.37.31:
resolution: {integrity: sha512-K0fw7m7km9th3dCQ2AR90q/FwX3uAj+OLc+Zuo39VY9vCn0Ux/iObM4y1zJYIH3vTc+QlrksVErUvyeONjOKMQ==} resolution: {integrity: sha512-k9DQQ7Wv+ehiF7901qk/FnP47k6O2MHm3meQFee4gUzi5dfGAVLf7SfLNtb4w7G2dmukJyWQtVJEDF9oMb9yuQ==}
dev: false dev: false
/discord.js/14.7.1_3cxu5zja4e2r5wmvge7mdcljwq: /discord.js/14.7.1_3cxu5zja4e2r5wmvge7mdcljwq:
@ -861,11 +861,11 @@ packages:
'@discordjs/util': 0.1.0 '@discordjs/util': 0.1.0
'@sapphire/snowflake': 3.4.0 '@sapphire/snowflake': 3.4.0
'@types/ws': 8.5.4 '@types/ws': 8.5.4
discord-api-types: 0.37.28 discord-api-types: 0.37.31
fast-deep-equal: 3.1.3 fast-deep-equal: 3.1.3
lodash.snakecase: 4.1.1 lodash.snakecase: 4.1.1
tslib: 2.4.1 tslib: 2.5.0
undici: 5.15.0 undici: 5.16.0
ws: 8.12.0_3cxu5zja4e2r5wmvge7mdcljwq ws: 8.12.0_3cxu5zja4e2r5wmvge7mdcljwq
transitivePeerDependencies: transitivePeerDependencies:
- bufferutil - bufferutil
@ -935,7 +935,7 @@ packages:
engines: {node: '>=10'} engines: {node: '>=10'}
dev: true dev: true
/eslint-plugin-unused-imports/2.0.0_eslint@8.31.0: /eslint-plugin-unused-imports/2.0.0_eslint@8.33.0:
resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==} resolution: {integrity: sha512-3APeS/tQlTrFa167ThtP0Zm0vctjr4M44HMpeg1P4bK6wItarumq0Ma82xorMKdFsWpphQBlRPzw/pxiVELX1A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -945,7 +945,7 @@ packages:
'@typescript-eslint/eslint-plugin': '@typescript-eslint/eslint-plugin':
optional: true optional: true
dependencies: dependencies:
eslint: 8.31.0 eslint: 8.33.0
eslint-rule-composer: 0.3.0 eslint-rule-composer: 0.3.0
dev: true dev: true
@ -962,13 +962,13 @@ packages:
estraverse: 5.3.0 estraverse: 5.3.0
dev: true dev: true
/eslint-utils/3.0.0_eslint@8.31.0: /eslint-utils/3.0.0_eslint@8.33.0:
resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==} resolution: {integrity: sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==}
engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0} engines: {node: ^10.0.0 || ^12.0.0 || >= 14.0.0}
peerDependencies: peerDependencies:
eslint: '>=5' eslint: '>=5'
dependencies: dependencies:
eslint: 8.31.0 eslint: 8.33.0
eslint-visitor-keys: 2.1.0 eslint-visitor-keys: 2.1.0
dev: true dev: true
@ -982,8 +982,8 @@ packages:
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dev: true dev: true
/eslint/8.31.0: /eslint/8.33.0:
resolution: {integrity: sha512-0tQQEVdmPZ1UtUKXjX7EMm9BlgJ08G90IhWh0PKDCb3ZLsgAOHI8fYSIzYVZej92zsgq+ft0FGsxhJ3xo2tbuA==} resolution: {integrity: sha512-WjOpFQgKK8VrCnAtl8We0SUOy/oVZ5NHykyMiagV1M9r8IFpIJX7DduK6n1mpfhlG7T1NLWm2SuD8QB7KFySaA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
hasBin: true hasBin: true
dependencies: dependencies:
@ -998,7 +998,7 @@ packages:
doctrine: 3.0.0 doctrine: 3.0.0
escape-string-regexp: 4.0.0 escape-string-regexp: 4.0.0
eslint-scope: 7.1.1 eslint-scope: 7.1.1
eslint-utils: 3.0.0_eslint@8.31.0 eslint-utils: 3.0.0_eslint@8.33.0
eslint-visitor-keys: 3.3.0 eslint-visitor-keys: 3.3.0
espree: 9.4.1 espree: 9.4.1
esquery: 1.4.0 esquery: 1.4.0
@ -1007,14 +1007,14 @@ packages:
file-entry-cache: 6.0.1 file-entry-cache: 6.0.1
find-up: 5.0.0 find-up: 5.0.0
glob-parent: 6.0.2 glob-parent: 6.0.2
globals: 13.19.0 globals: 13.20.0
grapheme-splitter: 1.0.4 grapheme-splitter: 1.0.4
ignore: 5.2.4 ignore: 5.2.4
import-fresh: 3.3.0 import-fresh: 3.3.0
imurmurhash: 0.1.4 imurmurhash: 0.1.4
is-glob: 4.0.3 is-glob: 4.0.3
is-path-inside: 3.0.3 is-path-inside: 3.0.3
js-sdsl: 4.2.0 js-sdsl: 4.3.0
js-yaml: 4.1.0 js-yaml: 4.1.0
json-stable-stringify-without-jsonify: 1.0.1 json-stable-stringify-without-jsonify: 1.0.1
levn: 0.4.1 levn: 0.4.1
@ -1034,8 +1034,8 @@ packages:
resolution: {integrity: sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==} resolution: {integrity: sha512-XwctdmTO6SIvCzd9810yyNzIrOrqNYV9Koizx4C/mRhf9uq0o4yHoCEU/670pOxOL/MSraektvSAji79kX90Vg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
dependencies: dependencies:
acorn: 8.8.1 acorn: 8.8.2
acorn-jsx: 5.3.2_acorn@8.8.1 acorn-jsx: 5.3.2_acorn@8.8.2
eslint-visitor-keys: 3.3.0 eslint-visitor-keys: 3.3.0
dev: true dev: true
@ -1086,7 +1086,7 @@ packages:
array-flatten: 1.1.1 array-flatten: 1.1.1
body-parser: 1.20.1 body-parser: 1.20.1
content-disposition: 0.5.4 content-disposition: 0.5.4
content-type: 1.0.4 content-type: 1.0.5
cookie: 0.5.0 cookie: 0.5.0
cookie-signature: 1.0.6 cookie-signature: 1.0.6
debug: 2.6.9 debug: 2.6.9
@ -1126,6 +1126,10 @@ packages:
tmp: 0.0.33 tmp: 0.0.33
dev: true dev: true
/fast-content-type-parse/1.0.0:
resolution: {integrity: sha512-Xbc4XcysUXcsP5aHUU7Nq3OwvHq97C+WnbkeIefpeYLX+ryzFJlU6OStFJhs6Ol0LkUGpcK+wL0JwfM+FCU5IA==}
dev: false
/fast-decode-uri-component/1.0.1: /fast-decode-uri-component/1.0.1:
resolution: {integrity: sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==} resolution: {integrity: sha512-WKgKWg5eUxvRZGwW8FvfbaH7AXSh2cL+3j5fMGzUMCxWBJ3dV3a7Wz8y2f/uQ0e3B6WmodD3oS54jTQ9HVTIIg==}
dev: false dev: false
@ -1191,15 +1195,15 @@ packages:
resolution: {integrity: sha512-79ak0JxddO0utAXAQ5ccKhvs6vX2MGyHHMMsmZkBANrq3hXc1CHzvNPHOcvTsVMEPl5I+NT+RO4YKMGehOfSIg==} resolution: {integrity: sha512-79ak0JxddO0utAXAQ5ccKhvs6vX2MGyHHMMsmZkBANrq3hXc1CHzvNPHOcvTsVMEPl5I+NT+RO4YKMGehOfSIg==}
dev: false dev: false
/fastify/4.11.0: /fastify/4.12.0:
resolution: {integrity: sha512-JteZ8pjEqd+6n+azQnQfSJV8MUMxAmxbvC2Dx/Mybj039Lf/u3kda9Kq84uy/huCpqCzZoyHIZS5JFGF3wLztw==} resolution: {integrity: sha512-Hh2GCsOCqnOuewWSvqXlpq5V/9VA+/JkVoooQWUhrU6gryO9+/UGOoF/dprGcKSDxkM/9TkMXSffYp8eA/YhYQ==}
dependencies: dependencies:
'@fastify/ajv-compiler': 3.5.0 '@fastify/ajv-compiler': 3.5.0
'@fastify/error': 3.2.0 '@fastify/error': 3.2.0
'@fastify/fast-json-stringify-compiler': 4.2.0 '@fastify/fast-json-stringify-compiler': 4.2.0
abstract-logging: 2.0.1 abstract-logging: 2.0.1
avvio: 8.2.0 avvio: 8.2.0
content-type: 1.0.4 fast-content-type-parse: 1.0.0
find-my-way: 7.4.0 find-my-way: 7.4.0
light-my-request: 5.8.0 light-my-request: 5.8.0
pino: 8.8.0 pino: 8.8.0
@ -1251,8 +1255,8 @@ packages:
flat-cache: 3.0.4 flat-cache: 3.0.4
dev: true dev: true
/file-type/18.1.0: /file-type/18.2.0:
resolution: {integrity: sha512-FqjmVvHjX5C/EnibCENAsCMIg7HgUYO0vDypt5V8RmtKDk7eUa+/6mEWSrY4PStFhUt0K3CoE8stjLJCcMsJFQ==} resolution: {integrity: sha512-M3RQMWY3F2ykyWZ+IHwNCjpnUmukYhtdkGGC1ZVEUb0ve5REGF7NNJ4Q9ehCUabtQKtSVFOMbFTXgJlFb0DQIg==}
engines: {node: '>=14.16'} engines: {node: '>=14.16'}
dependencies: dependencies:
readable-web-to-node-stream: 3.0.2 readable-web-to-node-stream: 3.0.2
@ -1364,8 +1368,8 @@ packages:
engines: {node: 6.* || 8.* || >= 10.*} engines: {node: 6.* || 8.* || >= 10.*}
dev: true dev: true
/get-intrinsic/1.1.3: /get-intrinsic/1.2.0:
resolution: {integrity: sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==} resolution: {integrity: sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==}
dependencies: dependencies:
function-bind: 1.1.1 function-bind: 1.1.1
has: 1.0.3 has: 1.0.3
@ -1397,8 +1401,8 @@ packages:
path-is-absolute: 1.0.1 path-is-absolute: 1.0.1
dev: true dev: true
/globals/13.19.0: /globals/13.20.0:
resolution: {integrity: sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==} resolution: {integrity: sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==}
engines: {node: '>=8'} engines: {node: '>=8'}
dependencies: dependencies:
type-fest: 0.20.2 type-fest: 0.20.2
@ -1552,8 +1556,8 @@ packages:
resolution: {integrity: sha512-4dG1D1x/7g8PwHS9aK6QV5V94+ZvyP4+d19qDv43EzImmrndysIl4prmJ1hWWIGCqrZHyaHBm6BSEWHOLnpoNw==} resolution: {integrity: sha512-4dG1D1x/7g8PwHS9aK6QV5V94+ZvyP4+d19qDv43EzImmrndysIl4prmJ1hWWIGCqrZHyaHBm6BSEWHOLnpoNw==}
dev: false dev: false
/js-sdsl/4.2.0: /js-sdsl/4.3.0:
resolution: {integrity: sha512-dyBIzQBDkCqCu+0upx25Y2jGdbTGxE9fshMsCdK0ViOongpV+n5tXRcZY9v7CaVQ79AGS9KA1KHtojxiM7aXSQ==} resolution: {integrity: sha512-mifzlm2+5nZ+lEcLJMoBK0/IH/bDg8XnJfd/Wq6IP+xoCjLZsTOnV2QpxlVbX9bMnkl5PdEjNtBJ9Cj1NjifhQ==}
dev: true dev: true
/js-yaml/4.1.0: /js-yaml/4.1.0:
@ -1571,7 +1575,7 @@ packages:
resolution: {integrity: sha512-TuDuZ5KrgyjoCIppdPXBMqiGfota55+odM+j2cQ5rt/XKyKmqGB3Whz1F8SN8+60yYGy/Nu5lbRZ+rx8kBIvBw==} resolution: {integrity: sha512-TuDuZ5KrgyjoCIppdPXBMqiGfota55+odM+j2cQ5rt/XKyKmqGB3Whz1F8SN8+60yYGy/Nu5lbRZ+rx8kBIvBw==}
engines: {node: '>=10'} engines: {node: '>=10'}
dependencies: dependencies:
'@babel/runtime': 7.20.7 '@babel/runtime': 7.20.13
chalk: 4.1.2 chalk: 4.1.2
pegjs: 0.10.0 pegjs: 0.10.0
dev: true dev: true
@ -1669,8 +1673,8 @@ packages:
iterate-object: 1.3.4 iterate-object: 1.3.4
dev: false dev: false
/marked/4.2.5: /marked/4.2.12:
resolution: {integrity: sha512-jPueVhumq7idETHkb203WDD4fMA3yV9emQ5vLwop58lu8bTclMghBWcYAavlDqIEMaisADinV1TooIFCfqOsYQ==} resolution: {integrity: sha512-yr8hSKa3Fv4D3jdZmtMMPghgVt6TWbk86WQaWhDloQjRSQhMMYCAro7jP7VDJrjjdV8pxVxMssXS8B8Y5DZ5aw==}
engines: {node: '>= 12'} engines: {node: '>= 12'}
hasBin: true hasBin: true
dev: false dev: false
@ -1779,8 +1783,8 @@ packages:
lodash: 4.17.21 lodash: 4.17.21
dev: false dev: false
/node-fetch/2.6.8: /node-fetch/2.6.9:
resolution: {integrity: sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==} resolution: {integrity: sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==}
engines: {node: 4.x || >=6.0.0} engines: {node: 4.x || >=6.0.0}
peerDependencies: peerDependencies:
encoding: ^0.1.0 encoding: ^0.1.0
@ -2053,8 +2057,8 @@ packages:
once: 1.4.0 once: 1.4.0
dev: false dev: false
/punycode/2.2.0: /punycode/2.3.0:
resolution: {integrity: sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==} resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
engines: {node: '>=6'} engines: {node: '>=6'}
/qs/6.11.0: /qs/6.11.0:
@ -2300,7 +2304,7 @@ packages:
resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==}
dependencies: dependencies:
call-bind: 1.0.2 call-bind: 1.0.2
get-intrinsic: 1.1.3 get-intrinsic: 1.2.0
object-inspect: 1.12.3 object-inspect: 1.12.3
dev: false dev: false
@ -2501,8 +2505,8 @@ packages:
resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==}
dev: true dev: true
/tslib/2.4.1: /tslib/2.5.0:
resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==} resolution: {integrity: sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==}
dev: false dev: false
/type-check/0.4.0: /type-check/0.4.0:
@ -2533,8 +2537,8 @@ packages:
resolution: {integrity: sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==} resolution: {integrity: sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==}
dev: true dev: true
/undici/5.15.0: /undici/5.16.0:
resolution: {integrity: sha512-wCAZJDyjw9Myv+Ay62LAoB+hZLPW9SmKbQkbHIhMw/acKSlpn7WohdMUc/Vd4j1iSMBO0hWwU8mjB7a5p5bl8g==} resolution: {integrity: sha512-KWBOXNv6VX+oJQhchXieUznEmnJMqgXMbs0xxH2t8q/FUAWSJvOSr/rMaZKnX5RIVq7JDn0JbP4BOnKG2SGXLQ==}
engines: {node: '>=12.18'} engines: {node: '>=12.18'}
dependencies: dependencies:
busboy: 1.6.0 busboy: 1.6.0
@ -2553,7 +2557,7 @@ packages:
/uri-js/4.4.1: /uri-js/4.4.1:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
dependencies: dependencies:
punycode: 2.2.0 punycode: 2.3.0
/utf-8-validate/5.0.10: /utf-8-validate/5.0.10:
resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==} resolution: {integrity: sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==}

View File

@ -1,10 +1,16 @@
/* eslint-disable no-console */
require('dotenv').config(); require('dotenv').config();
const fs = require('fs-extra'); const fs = require('fs-extra');
const util = require('util'); const util = require('util');
const exec = util.promisify(require('child_process').exec); const exec = util.promisify(require('child_process').exec);
const { short } = require('leeks.js');
function log(...strings) {
console.log(short('&9[postinstall]&r'), ...strings);
}
async function npx(cmd) { async function npx(cmd) {
console.log(`[postinstall] > ${cmd}`); log(`> ${cmd}`);
const { const {
stderr, stderr,
stdout, stdout,
@ -17,14 +23,14 @@ const providers = ['mysql', 'postgresql', 'sqlite'];
const provider = process.env.DB_PROVIDER; const provider = process.env.DB_PROVIDER;
if (!provider) { if (!provider) {
console.log('[postinstall] environment not set, exiting.'); log('environment not set, exiting.');
process.exit(0); process.exit(0);
} }
if (!providers.includes(provider)) throw new Error(`DB_PROVIDER must be one of: ${providers}`); if (!providers.includes(provider)) throw new Error(`DB_PROVIDER must be one of: ${providers}`);
console.log(`[postinstall] provider=${provider}`); log(`provider=${provider}`);
console.log(`[postinstall] copying ${provider} schema & migrations`); log(`copying ${provider} schema & migrations`);
if (!fs.existsSync('./prisma')) fs.mkdirSync('./prisma'); if (!fs.existsSync('./prisma')) fs.mkdirSync('./prisma');
fs.copySync(`./db/${provider}`, './prisma'); // copy schema & migrations fs.copySync(`./db/${provider}`, './prisma'); // copy schema & migrations

View File

@ -1,5 +1,11 @@
/* eslint-disable no-console */
const { randomBytes } = require('crypto'); const { randomBytes } = require('crypto');
const fs = require('fs'); const fs = require('fs');
const { short } = require('leeks.js');
function log (...strings) {
console.log(short('&9[preinstall]&r'), ...strings);
}
const env = { const env = {
DB_CONNECTION_URL: '', DB_CONNECTION_URL: '',
@ -7,18 +13,22 @@ const env = {
DISCORD_SECRET: '', DISCORD_SECRET: '',
DISCORD_TOKEN: '', DISCORD_TOKEN: '',
ENCRYPTION_KEY: randomBytes(24).toString('hex'), ENCRYPTION_KEY: randomBytes(24).toString('hex'),
HTTP_BIND: 8080, HTTP_EXTERNAL: 'http://127.0.0.1:8080',
HTTP_EXTERNAL: 'http://localhost:8080', HTTP_HOST: '127.0.0.1',
HTTP_PORT: 8080,
HTTP_TRUST_PROXY: false,
OVERRIDE_ARCHIVE: '',
PUBLIC_BOT: false, PUBLIC_BOT: false,
SETTINGS_BIND: 8888, SETTINGS_HOST: '127.0.0.1',
SETTINGS_PORT: 8169,
SUPER: '319467558166069248', SUPER: '319467558166069248',
}; };
// check DISCORD_TOKEN because we don't want to force use of the .env file // check ENCRYPTION_KEY because we don't want to force use of the .env file
if (!process.env.DISCORD_TOKEN && !fs.existsSync('./.env')) { if (!process.env.ENCRYPTION_KEY && !fs.existsSync('./.env')) {
console.log('[preinstall] Generating ENCRYPTION_KEY'); log('generating ENCRYPTION_KEY');
fs.writeFileSync('./.env', Object.entries(env).map(([k, v]) => `${k}=${v}`).join('\n')); fs.writeFileSync('./.env', Object.entries(env).map(([k, v]) => `${k}=${v}`).join('\n'));
console.log('[preinstall] Created .env file'); log('created .env file');
} else { } else {
console.log('[preinstall] Nothing to do'); log('nothing to do');
} }

View File

@ -1,4 +1,4 @@
const fastify = require('fastify')({ trustProxy: true }); const fastify = require('fastify')({ trustProxy: process.env.HTTP_TRUST_PROXY === 'true' });
const oauth = require('@fastify/oauth2'); const oauth = require('@fastify/oauth2');
const { domain } = require('./lib/http'); const { domain } = require('./lib/http');
const { short } = require('leeks.js'); const { short } = require('leeks.js');
@ -43,7 +43,7 @@ module.exports = async client => {
secret: process.env.ENCRYPTION_KEY, secret: process.env.ENCRYPTION_KEY,
}); });
// proxy /settings to express // proxy `/settings` to express
fastify.register(require('@fastify/http-proxy'), { fastify.register(require('@fastify/http-proxy'), {
http2: false, http2: false,
prefix: '/settings', prefix: '/settings',
@ -54,7 +54,7 @@ module.exports = async client => {
}), }),
}, },
rewritePrefix: '/settings', rewritePrefix: '/settings',
upstream: `http://127.0.0.1:${process.env.SETTINGS_BIND}`, upstream: `http://${process.env.SETTINGS_HOST}:${process.env.SETTINGS_PORT}`,
}); });
// auth // auth
@ -172,14 +172,14 @@ module.exports = async client => {
client.log.verbose.http(short(`Express ${req.ip} ${req.method} ${req.route?.path ?? req.path}`)); client.log.verbose.http(short(`Express ${req.ip} ${req.method} ${req.route?.path ?? req.path}`));
}); });
express.use(handler); // let SvelteKit handle everything express.use(handler); // let SvelteKit handle everything
express.listen(process.env.SETTINGS_BIND, () => { // start the express server express.listen(process.env.SETTINGS_PORT, process.env.SETTINGS_HOST, () => { // start the express server
client.log.verbose.http(`Express listening on port ${process.env.SETTINGS_BIND}`); client.log.verbose.http(`Express listening on port ${process.env.SETTINGS_PORT}`);
}); });
// start the fastify server // start the fastify server
fastify.listen({ fastify.listen({
host: '0.0.0.0', host: process.env.HTTP_HOST,
port: process.env.HTTP_BIND, port: process.env.HTTP_PORT,
}, (err, addr) => { }, (err, addr) => {
if (err) client.log.error.http(err); if (err) client.log.error.http(err);
else client.log.success.http(`Listening at ${addr}`); else client.log.success.http(`Listening at ${addr}`);

View File

@ -19,6 +19,7 @@ module.exports.get = () => ({
.setCookie('token', token, { .setCookie('token', token, {
domain: domain, domain: domain,
httpOnly: true, httpOnly: true,
maxAge: 604800, // seconds, not milliseconds
path: '/', path: '/',
sameSite: true, sameSite: true,
secure: false, secure: false,