mirror of
https://github.com/stonith404/pingvin-share.git
synced 2025-01-29 01:28:59 -05:00
refactor: manual merge conflict changes that broke that application
This commit is contained in:
parent
9d17377bbc
commit
83cde4778a
1 changed files with 6 additions and 8 deletions
|
@ -5,19 +5,13 @@ import {
|
|||
Injectable,
|
||||
NotFoundException,
|
||||
} from "@nestjs/common";
|
||||
import { Reflector } from "@nestjs/core";
|
||||
import { Request } from "express";
|
||||
import * as moment from "moment";
|
||||
import { PrismaService } from "src/prisma/prisma.service";
|
||||
import { ShareService } from "src/share/share.service";
|
||||
|
||||
@Injectable()
|
||||
export class ShareTokenSecurity implements CanActivate {
|
||||
constructor(
|
||||
private reflector: Reflector,
|
||||
private shareService: ShareService,
|
||||
private prisma: PrismaService
|
||||
) {}
|
||||
constructor(private prisma: PrismaService) {}
|
||||
|
||||
async canActivate(context: ExecutionContext) {
|
||||
const request: Request = context.switchToHttp().getRequest();
|
||||
|
@ -33,7 +27,11 @@ export class ShareTokenSecurity implements CanActivate {
|
|||
include: { security: true },
|
||||
});
|
||||
|
||||
if (!share || moment().isAfter(share.expiration))
|
||||
if (
|
||||
!share ||
|
||||
(moment().isAfter(share.expiration) &&
|
||||
!moment(share.expiration).isSame(0))
|
||||
)
|
||||
throw new NotFoundException("Share not found");
|
||||
|
||||
if (share.security?.maxViews && share.security.maxViews <= share.views)
|
||||
|
|
Loading…
Add table
Reference in a new issue