Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

update comments

Steven Tey865bd6ee13a8
diff --git a/apps/web/app/(ee)/api/stripe/webhook/checkout-session-completed.ts b/apps/web/app/(ee)/api/stripe/webhook/checkout-session-completed.ts
index 7b500023d5..ed67c76460 100644
--- a/apps/web/app/(ee)/api/stripe/webhook/checkout-session-completed.ts
+++ b/apps/web/app/(ee)/api/stripe/webhook/checkout-session-completed.ts
@@ -136,8 +136,7 @@ export async function checkoutSessionCompleted(event: Stripe.Event) {
dublink: true,
},
}),
-
- // expire restricted tokens cache
+ // expire tokens cache
tokenCache.expireMany({
hashedKeys: workspace.restrictedTokens.map(({ hashedKey }) => hashedKey),
}),
diff --git a/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-deleted.ts b/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-deleted.ts
index f6df038fac..cf9c0ae71c 100644
--- a/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-deleted.ts
+++ b/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-deleted.ts
@@ -184,7 +184,7 @@ export async function customerSubscriptionDeleted(event: Stripe.Event) {
},
}),
- // expire restricted tokens cache
+ // expire tokens cache
tokenCache.expireMany({
hashedKeys: workspace.restrictedTokens.map(({ hashedKey }) => hashedKey),
}),
diff --git a/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-updated.ts b/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-updated.ts
index 17750517ed..692591a292 100644
--- a/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-updated.ts
+++ b/apps/web/app/(ee)/api/stripe/webhook/customer-subscription-updated.ts
@@ -104,7 +104,7 @@ export async function customerSubscriptionUpdated(event: Stripe.Event) {
},
}),
- // expire restricted tokens cache
+ // expire tokens cache
tokenCache.expireMany({
hashedKeys: workspace.restrictedTokens.map(
({ hashedKey }) => hashedKey,
diff --git a/apps/web/app/api/tokens/[id]/route.ts b/apps/web/app/api/tokens/[id]/route.ts
index 4943c4ba65..52658c78ba 100644
--- a/apps/web/app/api/tokens/[id]/route.ts
+++ b/apps/web/app/api/tokens/[id]/route.ts
@@ -89,6 +89,7 @@ export const PATCH = withWorkspace(
},
});
+ // update tokens cache
waitUntil(
tokenCache.set({
hashedKey: token.hashedKey,
@@ -131,6 +132,7 @@ export const DELETE = withWorkspace(
});
}
+ // delete tokens cache
waitUntil(
tokenCache.delete({
hashedKey: token.hashedKey,
diff --git a/apps/web/lib/auth/token-cache.ts b/apps/web/lib/auth/token-cache.ts
index e654a3f249..a0fbc128b7 100644
--- a/apps/web/lib/auth/token-cache.ts
+++ b/apps/web/lib/auth/token-cache.ts
@@ -20,7 +20,7 @@ const tokenCacheItemSchema = z.object({
type TokenCacheItem = z.infer<typeof tokenCacheItemSchema>;
-// Cache for the restricted tokens
+// Cache for restricted tokens (and legacy personal tokens)
class TokenCache {
async set({
hashedKey,