diff options
| author | Mohamed Bassem <me@mbassem.com> | 2025-07-19 11:01:18 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2025-07-19 11:02:03 +0000 |
| commit | 4e9544b0c753b7fa01c56710a0d151e3a9f977e0 (patch) | |
| tree | 623abb438668295a88f2d99515c94ab7c2a9eb5a /packages/trpc/routers/subscriptions.ts | |
| parent | 64a0d9185bf292ca0f4b407bfe302f6db7232493 (diff) | |
| download | karakeep-4e9544b0c753b7fa01c56710a0d151e3a9f977e0.tar.zst | |
feat: Allow setting browserless crawling per user
Diffstat (limited to '')
| -rw-r--r-- | packages/trpc/routers/subscriptions.ts | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/trpc/routers/subscriptions.ts b/packages/trpc/routers/subscriptions.ts index 4915a225..1cd34d30 100644 --- a/packages/trpc/routers/subscriptions.ts +++ b/packages/trpc/routers/subscriptions.ts @@ -90,12 +90,14 @@ async function syncStripeDataToDatabase(customerId: string, db: Context["db"]) { }) .where(eq(subscriptions.stripeCustomerId, customerId)); - // Update user quotas to free tier limits + // Update user quotas to free tier limits and disable browser crawling await trx .update(users) .set({ bookmarkQuota: serverConfig.quotas.free.bookmarkLimit, storageQuota: serverConfig.quotas.free.assetSizeBytes, + browserCrawlingEnabled: + serverConfig.quotas.free.browserCrawlingEnabled, }) .where(eq(users.id, existingSubscription.userId)); }); @@ -129,19 +131,25 @@ async function syncStripeDataToDatabase(customerId: string, db: Context["db"]) { .where(eq(subscriptions.stripeCustomerId, customerId)); if (subData.status === "active" || subData.status === "trialing") { + // Enable paid tier quotas and browser crawling await trx .update(users) .set({ bookmarkQuota: serverConfig.quotas.paid.bookmarkLimit, storageQuota: serverConfig.quotas.paid.assetSizeBytes, + browserCrawlingEnabled: + serverConfig.quotas.paid.browserCrawlingEnabled, }) .where(eq(users.id, existingSubscription.userId)); } else { + // Set free tier quotas and disable browser crawling await trx .update(users) .set({ bookmarkQuota: serverConfig.quotas.free.bookmarkLimit, storageQuota: serverConfig.quotas.free.assetSizeBytes, + browserCrawlingEnabled: + serverConfig.quotas.free.browserCrawlingEnabled, }) .where(eq(users.id, existingSubscription.userId)); } |
