feat: allow unauthenticated uploads
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
super({
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
secretOrKey: config.get("JWT_SECRET"),
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user