From a3d6ebe44d48e6a753281e7c969acb93c493ac95 Mon Sep 17 00:00:00 2001 From: Huang Xin Date: Fri, 4 Apr 2025 09:48:43 +0800 Subject: [PATCH] feat: add fixed storage quota for self-hosted instance, closes #805 (#806) --- apps/readest-app/.env.local.example | 2 ++ apps/readest-app/src/utils/access.ts | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/readest-app/.env.local.example b/apps/readest-app/.env.local.example index 42e39d4f..f3ccf16a 100644 --- a/apps/readest-app/.env.local.example +++ b/apps/readest-app/.env.local.example @@ -4,6 +4,8 @@ NEXT_PUBLIC_POSTHOG_HOST=YOUR_POSTHOG_HOST NEXT_PUBLIC_SUPABASE_URL=YOUR_SUPABASE_URL NEXT_PUBLIC_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY +NEXT_PUBLIC_STORAGE_FIXED_QUOTA=1073741824 + SUPABASE_ADMIN_KEY=YOUR_SUPABASE_ADMIN_KEY DEEPL_PRO_API_KEYS=YOUR_DEEPL_PRO_API_KEYS diff --git a/apps/readest-app/src/utils/access.ts b/apps/readest-app/src/utils/access.ts index f815b23a..8f7a465e 100644 --- a/apps/readest-app/src/utils/access.ts +++ b/apps/readest-app/src/utils/access.ts @@ -19,7 +19,8 @@ export const getStoragePlanData = (token: string) => { const data = jwtDecode(token) || {}; const plan = data['plan'] || 'free'; const usage = data['storage_usage_bytes'] || 0; - const quota = DEFAULT_STORAGE_QUOTA[plan] || DEFAULT_STORAGE_QUOTA['free']; + const fixedQuota = parseInt(process.env['NEXT_PUBLIC_STORAGE_FIXED_QUOTA'] || '0'); + const quota = fixedQuota || DEFAULT_STORAGE_QUOTA[plan] || DEFAULT_STORAGE_QUOTA['free']; return { plan,