From d238e24f629c9330518bbf5a271f72aacbd5d608 Mon Sep 17 00:00:00 2001 From: IThundxr Date: Wed, 12 Apr 2023 19:59:30 -0400 Subject: [PATCH] feat: Add check to prevent favorited files from being deleted (#369) * additions * add proper lock system * migreation * Revert "migreation" This reverts commit 4058146c2867d8a0cf2edc56b89e4bec3b2a826b. * remove that * get rid of bad code --------- Co-authored-by: Jayvin Hernandez --- .env.local.example | 4 ++-- .github/ISSUE_TEMPLATE/config.yml | 2 +- CONTRIBUTING.md | 2 +- src/server/decorators/preFile.ts | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.env.local.example b/.env.local.example index 011dec7..c79c221 100644 --- a/.env.local.example +++ b/.env.local.example @@ -42,5 +42,5 @@ UPLOADER_DISABLED_EXTENSIONS=someext URLS_ROUTE=/go URLS_LENGTH=6 -RATELIMIT_USER = 5 -RATELIMIT_ADMIN = 3 +RATELIMIT_USER=5 +RATELIMIT_ADMIN=3 diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 46dade9..ce66bf7 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,7 +1,7 @@ blank_issues_enabled: false contact_links: - name: Feature Request - url: https://github.com/diced/zipline/discussions/new?category=ideas&title=Your%20breif%20description%20here&labels=feature + url: https://github.com/diced/zipline/discussions/new?category=ideas&title=Your%20brief%20description%20here&labels=feature about: Ask for a new feature - name: Zipline Discord url: https://discord.gg/EAhCRfGxCF diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9ee94d3..daad89f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ Create an issue on GitHub, please include the following (if one of them is not a Create an discussion on GitHub, please include the following: -- Breif explanation of the feature in the title (very breif please) +- Brief explanation of the feature in the title (very brief please) - How it would work (detailed, but optional) ## Pull Requests (contributions to the codebase) diff --git a/src/server/decorators/preFile.ts b/src/server/decorators/preFile.ts index ad14328..b6517a6 100644 --- a/src/server/decorators/preFile.ts +++ b/src/server/decorators/preFile.ts @@ -7,6 +7,7 @@ function preFileDecorator(fastify: FastifyInstance, _, done) { done(); async function preFile(this: FastifyReply, file: File) { + if (file.favorite) return false; if (file.expiresAt && file.expiresAt < new Date()) { await this.server.datasource.delete(file.name); await this.server.prisma.file.delete({ where: { id: file.id } });