feat: allow unauthenticated uploads

This commit is contained in:
Elias Schneider
2022-10-18 14:27:14 +02:00
parent 41c3bafbd7
commit 84d29dff68
17 changed files with 340 additions and 249 deletions

View File

@@ -1,7 +1,14 @@
import { ExecutionContext } from "@nestjs/common";
import { AuthGuard } from "@nestjs/passport";
import { Observable } from "rxjs";
export class JwtGuard extends AuthGuard("jwt") {
constructor() {
super();
}
canActivate(
context: ExecutionContext
): boolean | Promise<boolean> | Observable<boolean> {
return process.env.ALLOW_UNAUTHENTICATED_SHARES == "true" ? true : super.canActivate(context);
}
}