mirror of
https://github.com/yusufipk/OpenFrame.git
synced 2026-09-11 09:36:08 +00:00
feat(uploads): size one upload against the account's own quota
The per-file ceiling was a flat 5 GiB from the environment, which is both too small for a paying account with 200 GB of storage and unaware of what an upload actually costs. The provider derives its own renditions from the file (1080p, 720p and down) and bills them to the same account, so a file allowed to fill the quota exactly is over it by the time it finishes processing. The ceiling is now 80% of whatever limit the account is held to: 160 GB on the plan, 2.4 GB on a cardless trial, and it moves on its own when either number changes. OPENFRAME_MAX_VIDEO_UPLOAD_BYTES keeps working as an absolute cap for a host that wants one, where the lower of the two applies, and an instance running without billing has no quota to divide and falls back to the flat 5 GiB. The refusal now names the ceiling, which the old one left the client to guess. Finalize re-checks only the host cap. Re-deriving the account's ceiling there would delete a finished upload over a plan that lapsed while the bytes were in flight, and an upload larger than what was declared is already caught by the declared-size check beside it.
This commit is contained in:
+4
-4
@@ -26,10 +26,10 @@ export const TRIAL_PROJECT_LIMIT = 1;
|
||||
*/
|
||||
export const TRIAL_STORAGE_LIMIT_BYTES = BigInt(3) * BigInt(1024) * BigInt(1024) * BigInt(1024);
|
||||
|
||||
// There is deliberately no separate per-file ceiling for trials. The default
|
||||
// per-file limit is 5 GiB and the trial's total is 3 GiB, so the quota check
|
||||
// already refuses anything bigger, and a second limit would only add a second
|
||||
// way to be told no.
|
||||
// There is deliberately no separate per-file ceiling for trials. The per-file
|
||||
// ceiling is a share of whatever limit applies to the account (see
|
||||
// `getMaxVideoUploadBytesForUser`), so a trial is already held to 80% of these
|
||||
// 3 GiB without a second number to keep in step with this one.
|
||||
|
||||
export function getStorageLimitBytes(isPaid: boolean, planLimitBytes: bigint): bigint {
|
||||
if (isPaid) return planLimitBytes;
|
||||
|
||||
Reference in New Issue
Block a user