mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-02-19 01:55:48 -05:00
refactor: run formatter
This commit is contained in:
parent
84d29dff68
commit
38986c971a
3 changed files with 4 additions and 3 deletions
|
@ -9,6 +9,8 @@ export class JwtGuard extends AuthGuard("jwt") {
|
||||||
canActivate(
|
canActivate(
|
||||||
context: ExecutionContext
|
context: ExecutionContext
|
||||||
): boolean | Promise<boolean> | Observable<boolean> {
|
): boolean | Promise<boolean> | Observable<boolean> {
|
||||||
return process.env.ALLOW_UNAUTHENTICATED_SHARES == "true" ? true : super.canActivate(context);
|
return process.env.ALLOW_UNAUTHENTICATED_SHARES == "true"
|
||||||
|
? true
|
||||||
|
: super.canActivate(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||||
super({
|
super({
|
||||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||||
secretOrKey: config.get("JWT_SECRET"),
|
secretOrKey: config.get("JWT_SECRET"),
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ export class ShareOwnerGuard implements CanActivate {
|
||||||
|
|
||||||
if (!share) throw new NotFoundException("Share not found");
|
if (!share) throw new NotFoundException("Share not found");
|
||||||
|
|
||||||
if(!share.creatorId) return true;
|
if (!share.creatorId) return true;
|
||||||
|
|
||||||
return share.creatorId == (request.user as User).id;
|
return share.creatorId == (request.user as User).id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue