fix: dependencies security vulnerabilities

This commit is contained in:
Divlo
2022-11-08 11:16:24 +00:00
parent e1543becc5
commit 6926132a1b
35 changed files with 1311 additions and 1537 deletions

View File

@ -18,7 +18,7 @@ export const JWT_REFRESH_SECRET =
export const JWT_ACCESS_EXPIRES_IN =
process.env.JWT_ACCESS_EXPIRES_IN ?? '15 minutes'
export const SRC_URL = new URL('../../', import.meta.url)
export const SRC_URL = new URL('../', import.meta.url)
export const ROOT_URL = new URL('../', SRC_URL)
export const EMAIL_URL = new URL('./email/', ROOT_URL)
export const EMAIL_TEMPLATE_URL = new URL('./email-template.ejs', EMAIL_URL)

View File

@ -1,38 +0,0 @@
import dotenv from 'dotenv'
import { readPackage } from 'read-pkg'
import type { FastifyDynamicSwaggerOptions } from '@fastify/swagger'
dotenv.config()
const packageJSON = await readPackage()
export const swaggerOptions: FastifyDynamicSwaggerOptions = {
routePrefix: '/documentation',
openapi: {
info: {
title: packageJSON.name,
description: packageJSON.description,
version: packageJSON.version
},
tags: [
{ name: 'users' },
{ name: 'oauth2' },
{ name: 'guilds' },
{ name: 'channels' },
{ name: 'messages' },
{ name: 'members' }
],
components: {
securitySchemes: {
bearerAuth: {
type: 'http',
scheme: 'bearer',
bearerFormat: 'JWT'
}
}
}
},
exposeRoute: true,
staticCSP: true,
hideUntagged: true
}

View File

@ -4,10 +4,7 @@ import { URL, fileURLToPath } from 'node:url'
import ejs from 'ejs'
import type { Language, Theme } from '../../models/UserSettings.js'
import {
EMAIL_LOCALES_URL,
EMAIL_TEMPLATE_URL
} from '../configurations/index.js'
import { EMAIL_LOCALES_URL, EMAIL_TEMPLATE_URL } from '../configurations.js'
import { emailTransporter, EMAIL_INFO } from './emailTransporter.js'
interface EmailTranslation {

View File

@ -4,7 +4,7 @@ import jwt from 'jsonwebtoken'
import prisma from '../database/prisma.js'
import type { UserJWT, UserRequest } from '../../models/User.js'
import { JWT_ACCESS_SECRET } from '../configurations/index.js'
import { JWT_ACCESS_SECRET } from '../configurations.js'
const { Unauthorized, Forbidden, BadRequest } = httpErrors

View File

@ -4,7 +4,7 @@ import { Server as SocketIoServer } from 'socket.io'
import { authorize } from '@thream/socketio-jwt'
import prisma from '../database/prisma.js'
import { JWT_ACCESS_SECRET } from '../configurations/index.js'
import { JWT_ACCESS_SECRET } from '../configurations.js'
interface EmitEventOptions {
event: string

View File

@ -10,7 +10,7 @@ import {
JWT_ACCESS_EXPIRES_IN,
JWT_ACCESS_SECRET,
JWT_REFRESH_SECRET
} from '../configurations/index.js'
} from '../configurations.js'
export interface ResponseJWT {
accessToken: string

View File

@ -8,7 +8,7 @@ import type { SavedMultipartFile } from '@fastify/multipart'
import {
FILE_UPLOADS_API_KEY,
FILE_UPLOADS_API_URL
} from '../configurations/index.js'
} from '../configurations.js'
export const fileUploadAPI = axios.create({
baseURL: FILE_UPLOADS_API_URL,