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

View File

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

View File

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

View File

@ -1,5 +1,11 @@
/* eslint-disable no-console */
const { randomBytes } = require('crypto');
const fs = require('fs');
const { short } = require('leeks.js');
function log (...strings) {
console.log(short('&9[preinstall]&r'), ...strings);
}
const env = {
DB_CONNECTION_URL: '',
@ -7,18 +13,22 @@ const env = {
DISCORD_SECRET: '',
DISCORD_TOKEN: '',
ENCRYPTION_KEY: randomBytes(24).toString('hex'),
HTTP_BIND: 8080,
HTTP_EXTERNAL: 'http://localhost:8080',
HTTP_EXTERNAL: 'http://127.0.0.1:8080',
HTTP_HOST: '127.0.0.1',
HTTP_PORT: 8080,
HTTP_TRUST_PROXY: false,
OVERRIDE_ARCHIVE: '',
PUBLIC_BOT: false,
SETTINGS_BIND: 8888,
SETTINGS_HOST: '127.0.0.1',
SETTINGS_PORT: 8169,
SUPER: '319467558166069248',
};
// check DISCORD_TOKEN because we don't want to force use of the .env file
if (!process.env.DISCORD_TOKEN && !fs.existsSync('./.env')) {
console.log('[preinstall] Generating ENCRYPTION_KEY');
// check ENCRYPTION_KEY because we don't want to force use of the .env file
if (!process.env.ENCRYPTION_KEY && !fs.existsSync('./.env')) {
log('generating ENCRYPTION_KEY');
fs.writeFileSync('./.env', Object.entries(env).map(([k, v]) => `${k}=${v}`).join('\n'));
console.log('[preinstall] Created .env file');
log('created .env file');
} 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 { domain } = require('./lib/http');
const { short } = require('leeks.js');
@ -43,7 +43,7 @@ module.exports = async client => {
secret: process.env.ENCRYPTION_KEY,
});
// proxy /settings to express
// proxy `/settings` to express
fastify.register(require('@fastify/http-proxy'), {
http2: false,
prefix: '/settings',
@ -54,7 +54,7 @@ module.exports = async client => {
}),
},
rewritePrefix: '/settings',
upstream: `http://127.0.0.1:${process.env.SETTINGS_BIND}`,
upstream: `http://${process.env.SETTINGS_HOST}:${process.env.SETTINGS_PORT}`,
});
// auth
@ -172,14 +172,14 @@ module.exports = async client => {
client.log.verbose.http(short(`Express ${req.ip} ${req.method} ${req.route?.path ?? req.path}`));
});
express.use(handler); // let SvelteKit handle everything
express.listen(process.env.SETTINGS_BIND, () => { // start the express server
client.log.verbose.http(`Express listening on port ${process.env.SETTINGS_BIND}`);
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_PORT}`);
});
// start the fastify server
fastify.listen({
host: '0.0.0.0',
port: process.env.HTTP_BIND,
host: process.env.HTTP_HOST,
port: process.env.HTTP_PORT,
}, (err, addr) => {
if (err) client.log.error.http(err);
else client.log.success.http(`Listening at ${addr}`);

View File

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