0
Fork 0
mirror of https://github.com/stonith404/pingvin-share.git synced 2025-02-19 01:55:48 -05:00

chore: upgrade dependencies

This commit is contained in:
Elias Schneider 2024-07-01 11:08:23 +02:00
parent 31366d961f
commit 9193a79b9a
No known key found for this signature in database
GPG key ID: 07E623B294202B6C
11 changed files with 1253 additions and 813 deletions

1893
backend/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -14,20 +14,20 @@
},
"dependencies": {
"@nestjs/cache-manager": "^2.2.2",
"@nestjs/common": "^10.3.8",
"@nestjs/common": "^10.3.9",
"@nestjs/config": "^3.2.2",
"@nestjs/core": "^10.3.8",
"@nestjs/core": "^10.3.9",
"@nestjs/jwt": "^10.2.0",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.3.8",
"@nestjs/schedule": "^3.0.4",
"@nestjs/platform-express": "^10.3.9",
"@nestjs/schedule": "^4.0.2",
"@nestjs/swagger": "^7.3.1",
"@nestjs/throttler": "^4.2.1",
"@prisma/client": "^5.14.0",
"archiver": "^5.3.2",
"argon2": "^0.40.1",
"@nestjs/throttler": "^5.2.0",
"@prisma/client": "^5.16.1",
"archiver": "^7.0.1",
"argon2": "^0.40.3",
"body-parser": "^1.20.2",
"cache-manager": "^5.5.2",
"cache-manager": "^5.6.1",
"clamscan": "^2.2.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.1",
@ -36,50 +36,48 @@
"mime-types": "^2.1.35",
"moment": "^2.30.1",
"nanoid": "^3.3.7",
"node-fetch": "^2.7.0",
"nodemailer": "^6.9.13",
"nodemailer": "^6.9.14",
"otplib": "^12.0.1",
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"passport-local": "^1.0.0",
"qrcode-svg": "^1.1.0",
"reflect-metadata": "^0.1.12",
"reflect-metadata": "^0.2.2",
"rimraf": "^5.0.7",
"rxjs": "^7.8.1",
"sharp": "^0.32.4",
"sharp": "^0.33.4",
"ts-node": "^10.9.2"
},
"devDependencies": {
"@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.8",
"@types/archiver": "^5.3.4",
"@nestjs/testing": "^10.3.9",
"@types/archiver": "^6.0.2",
"@types/clamscan": "^2.0.8",
"@types/cookie-parser": "^1.4.7",
"@types/cron": "^2.0.1",
"@types/express": "^4.17.21",
"@types/mime-types": "^2.1.4",
"@types/multer": "^1.4.11",
"@types/node": "^20.12.12",
"@types/node-fetch": "^2.6.11",
"@types/node": "^20.14.9",
"@types/nodemailer": "^6.4.15",
"@types/passport-jwt": "^3.0.13",
"@types/passport-jwt": "^4.0.1",
"@types/qrcode-svg": "^1.1.4",
"@types/sharp": "^0.31.1",
"@types/supertest": "^2.0.16",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.14.1",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-config-prettier": "^8.10.0",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.1.3",
"newman": "^6.1.2",
"prettier": "^3.2.5",
"prisma": "^5.14.0",
"newman": "^6.1.3",
"prettier": "^3.3.2",
"prisma": "^5.16.1",
"source-map-support": "^0.5.21",
"ts-loader": "^9.5.1",
"tsconfig-paths": "4.2.0",
"typescript": "^5.4.5",
"typescript": "^5.5.2",
"wait-on": "^7.2.0"
}
}

View file

@ -3,20 +3,20 @@ import { Module } from "@nestjs/common";
import { ScheduleModule } from "@nestjs/schedule";
import { AuthModule } from "./auth/auth.module";
import { CacheModule } from "@nestjs/cache-manager";
import { APP_GUARD } from "@nestjs/core";
import { ThrottlerGuard, ThrottlerModule } from "@nestjs/throttler";
import { AppController } from "./app.controller";
import { ClamScanModule } from "./clamscan/clamscan.module";
import { ConfigModule } from "./config/config.module";
import { EmailModule } from "./email/email.module";
import { FileModule } from "./file/file.module";
import { JobsModule } from "./jobs/jobs.module";
import { OAuthModule } from "./oauth/oauth.module";
import { PrismaModule } from "./prisma/prisma.module";
import { ReverseShareModule } from "./reverseShare/reverseShare.module";
import { ShareModule } from "./share/share.module";
import { UserModule } from "./user/user.module";
import { ClamScanModule } from "./clamscan/clamscan.module";
import { ReverseShareModule } from "./reverseShare/reverseShare.module";
import { AppController } from "./app.controller";
import { OAuthModule } from "./oauth/oauth.module";
import { CacheModule } from "@nestjs/cache-manager";
@Module({
imports: [
@ -28,10 +28,12 @@ import { CacheModule } from "@nestjs/cache-manager";
ConfigModule,
JobsModule,
UserModule,
ThrottlerModule.forRoot({
ttl: 60,
limit: 100,
}),
ThrottlerModule.forRoot([
{
ttl: 60,
limit: 100,
},
]),
ScheduleModule.forRoot(),
ClamScanModule,
ReverseShareModule,

View file

@ -37,7 +37,12 @@ export class AuthController {
) {}
@Post("signUp")
@Throttle(10, 5 * 60)
@Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
async signUp(
@Body() dto: AuthRegisterDTO,
@Res({ passthrough: true }) response: Response,
@ -57,7 +62,12 @@ export class AuthController {
}
@Post("signIn")
@Throttle(10, 5 * 60)
@Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
@HttpCode(200)
async signIn(
@Body() dto: AuthSignInDTO,
@ -77,7 +87,12 @@ export class AuthController {
}
@Post("signIn/totp")
@Throttle(10, 5 * 60)
@Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
@HttpCode(200)
async signInTotp(
@Body() dto: AuthSignInTotpDTO,
@ -95,14 +110,24 @@ export class AuthController {
}
@Post("resetPassword/:email")
@Throttle(5, 5 * 60)
@Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
@HttpCode(202)
async requestResetPassword(@Param("email") email: string) {
this.authService.requestResetPassword(email);
}
@Post("resetPassword")
@Throttle(5, 5 * 60)
@Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
@HttpCode(204)
async resetPassword(@Body() dto: ResetPasswordDTO) {
return await this.authService.resetPassword(dto.token, dto.password);

View file

@ -1,5 +1,4 @@
import { Injectable } from "@nestjs/common";
import fetch from "node-fetch";
import { ConfigService } from "../../config/config.service";
import { OAuthCallbackDto } from "../dto/oauthCallback.dto";
import { OAuthSignInDto } from "../dto/oauthSignIn.dto";
@ -52,7 +51,7 @@ export class DiscordProvider implements OAuthProvider<DiscordToken> {
this.config.get("general.appUrl") + "/api/oauth/callback/discord",
}),
});
const token: DiscordToken = await res.json();
const token = (await res.json()) as DiscordToken;
return {
accessToken: token.access_token,
refreshToken: token.refresh_token,

View file

@ -1,5 +1,4 @@
import { Logger } from "@nestjs/common";
import fetch from "node-fetch";
import { ConfigService } from "../../config/config.service";
import { JwtService } from "@nestjs/jwt";
import { Cache } from "cache-manager";
@ -25,7 +24,7 @@ export abstract class GenericOidcProvider implements OAuthProvider<OidcToken> {
protected cache: Cache,
) {
this.discoveryUri = this.getDiscoveryUri();
this.config.addListener("update", (key: string, _: unknown) => {
this.config.addListener("update", (key: string) => {
if (this.keyOfConfigUpdateEvents.includes(key)) {
this.deinit();
this.discoveryUri = this.getDiscoveryUri();
@ -94,7 +93,7 @@ export abstract class GenericOidcProvider implements OAuthProvider<OidcToken> {
redirect_uri: this.getRedirectUri(),
}).toString(),
});
const token: OidcToken = await res.json();
const token = (await res.json()) as OidcToken;
return {
accessToken: token.access_token,
expiresIn: token.expires_in,
@ -159,7 +158,7 @@ export abstract class GenericOidcProvider implements OAuthProvider<OidcToken> {
: Date.now() + 1000 * 60 * 60 * 24;
this.configuration = {
expires,
data: await res.json(),
data: (await res.json()) as OidcConfiguration,
};
}

View file

@ -1,5 +1,4 @@
import { Injectable } from "@nestjs/common";
import fetch from "node-fetch";
import { ConfigService } from "../../config/config.service";
import { OAuthCallbackDto } from "../dto/oauthCallback.dto";
import { OAuthSignInDto } from "../dto/oauthSignIn.dto";
@ -38,7 +37,7 @@ export class GitHubProvider implements OAuthProvider<GitHubToken> {
},
},
);
const token: GitHubToken = await res.json();
const token = (await res.json()) as GitHubToken;
return {
accessToken: token.access_token,
tokenType: token.token_type,

View file

@ -36,7 +36,12 @@ export class ReverseShareController {
return { token, link };
}
@Throttle(20, 60)
@Throttle({
default: {
limit: 20,
ttl: 60,
},
})
@Get(":reverseShareToken")
async getByToken(@Param("reverseShareToken") reverseShareToken: string) {
const isValid = await this.reverseShareService.isValid(reverseShareToken);

View file

@ -16,6 +16,7 @@ import { Request, Response } from "express";
import { GetUser } from "src/auth/decorator/getUser.decorator";
import { AdministratorGuard } from "src/auth/guard/isAdmin.guard";
import { JwtGuard } from "src/auth/guard/jwt.guard";
import { AdminShareDTO } from "./dto/adminShare.dto";
import { CreateShareDTO } from "./dto/createShare.dto";
import { MyShareDTO } from "./dto/myShare.dto";
import { ShareDTO } from "./dto/share.dto";
@ -26,7 +27,6 @@ import { ShareOwnerGuard } from "./guard/shareOwner.guard";
import { ShareSecurityGuard } from "./guard/shareSecurity.guard";
import { ShareTokenSecurity } from "./guard/shareTokenSecurity.guard";
import { ShareService } from "./share.service";
import { AdminShareDTO } from "./dto/adminShare.dto";
@Controller("shares")
export class ShareController {
constructor(private shareService: ShareService) {}
@ -99,14 +99,24 @@ export class ShareController {
await this.shareService.remove(id, isDeleterAdmin);
}
@Throttle(10, 60)
@Throttle({
default: {
limit: 10,
ttl: 60,
},
})
@Get("isShareIdAvailable/:id")
async isShareIdAvailable(@Param("id") id: string) {
return this.shareService.isShareIdAvailable(id);
}
@HttpCode(200)
@Throttle(20, 5 * 60)
@Throttle({
default: {
limit: 20,
ttl: 5 * 60,
},
})
@UseGuards(ShareTokenSecurity)
@Post(":id/token")
async getShareToken(

View file

@ -11,7 +11,7 @@ import { ShareService } from "./share.service";
imports: [
JwtModule.register({}),
EmailModule,
ClamScanModule,
forwardRef(() => ClamScanModule),
ReverseShareModule,
forwardRef(() => FileModule),
],

View file

@ -4022,11 +4022,11 @@
}
},
"node_modules/braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"dependencies": {
"fill-range": "^7.0.1"
"fill-range": "^7.1.1"
},
"engines": {
"node": ">=8"
@ -5673,9 +5673,9 @@
}
},
"node_modules/fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"dependencies": {
"to-regex-range": "^5.0.1"
},
@ -12547,11 +12547,11 @@
}
},
"braces": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz",
"integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==",
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
"integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
"requires": {
"fill-range": "^7.0.1"
"fill-range": "^7.1.1"
}
},
"browserslist": {
@ -13772,9 +13772,9 @@
}
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
"integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==",
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
"integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
"requires": {
"to-regex-range": "^5.0.1"
}