feat: warn users approaching upload limits and block at 5 GB#91
Closed
dobby-coder[bot] wants to merge 1 commit into
Closed
feat: warn users approaching upload limits and block at 5 GB#91dobby-coder[bot] wants to merge 1 commit into
dobby-coder[bot] wants to merge 1 commit into
Conversation
Closes #87. - Shows a warning banner when a user has used ≥10 GB of the 15 GB rolling 2-week limit, and a hard-block banner at 15 GB. - Shows an inline 'upload limit exceeded' error in the file picker when selected files total more than the per-upload (5 GB) limit, instead of surfacing it only at send time. - Gracefully handles cryptify's 413 response (cryptify#100) with a clear server-blocked banner instead of the generic error page. - Adds a VITE_ROLLING_LIMIT env constant with a 15 GB default, ready for postguard-website#85 to set it. Per-upload size text now derives from MAX_UPLOAD_SIZE instead of hard-coding '2 GB'. - Adds usage utilities ($lib/usage.ts) and a UsageWarning component that can be reused by the Thunderbird/Outlook add-ons. Proactive warning is currently wired to the first recipient email because the fileshare UI has no sender email input — the usage quota is per sender. See the PR body for the open design question.
Contributor
|
I was mistaken with the proactive check. Check it as soon as you know the senders email. |
This was referenced Apr 23, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #87.
Adds UI feedback for upload-limit states described in the issue:
MAX_UPLOAD_SIZE. Previously the validation dialog only showed it on clicking Send.Files
src/lib/usage.ts— new utility.fetchUsage(email)consumesGET /usage?email=...from cryptify (shape agreed in the coordination note for the upload-limits initiative). Quiet-fails tonullif the backend isn't deployed yet.parseLimitExceededBody(body)decodes cryptify's 413 body into aUsageStatus.src/lib/components/filesharing/UsageWarning.svelte— debounced banner (500 ms). Renders nothing when usage is below the warn threshold.src/lib/components/filesharing/SendButton.svelte— wires inUsageWarning, handles 413 gracefully.src/lib/components/filesharing/inputs/FileInput.svelte— adds the inline per-upload error, and the "max 5 GB" text now derives fromMAX_UPLOAD_SIZEinstead of being hard-coded.src/lib/env.ts— addsROLLING_LIMIT(VITE_ROLLING_LIMIT, defaults to 5 GB), ready for Upgrade max upload size to 5 GB with 5 GB per 2-week rolling limit #85.src/lib/locales/{en,nl}.json— newusage.*andfileBox.overLimit*keys;maxSizeTextnow takes a{max}argument.Open design question for @rubenhensen
The issue says "proactive check on email input: when the user types their email address, query the backend". The 5 GB limit is tracked per sender email (per cryptify#100). The fileshare UI today has no sender email input — the sender's identity only becomes known after Yivi signing.
This PR wires the proactive check to the first recipient's email as a best-effort hook. It's semantically imperfect (recipient ≠ sender), but it lets the component and the endpoint integration land now. The two proper fixes for follow-up:
UsageWarningto it.localStorage.Happy to implement either in a follow-up once you pick.
Out of scope
UsageWarningcomponent andusage.tsutility are deliberately framework-light so an equivalent can be dropped into each addon in follow-up PRs.VITE_MAX_UPLOAD_SIZEto 5 GB and settingVITE_ROLLING_LIMITto 5 GB — that's Upgrade max upload size to 5 GB with 5 GB per 2-week rolling limit #85.How to verify
/usage?email=...→ warning banner renders after typing a recipient email.Test plan
UsageWarningbinding if needed.postguard-outlook-addonandpostguard-tb-addonto reuse this component / utility.Related issues
/usageendpoint)VITE_MAX_UPLOAD_SIZE=5 GB,VITE_ROLLING_LIMIT=5 GB)