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.

small fixes to link history feature

Steven Tey48e7bdc9aed2
diff --git a/app/ui/home/pricing.tsx b/app/ui/home/pricing.tsx
index 6534ea8483..3882c849b4 100644
--- a/app/ui/home/pricing.tsx
+++ b/app/ui/home/pricing.tsx
@@ -34,6 +34,7 @@ const pricingItems = [
"Password protection, link expiration, device targeting, custom social media cards, etc.",
},
{ text: "Up to 3 users", neutral: true },
+ { text: "30-day link history", neutral: true },
{
text: "Root domain redirect",
footnote:
@@ -67,6 +68,7 @@ const pricingItems = [
"Password protection, link expiration, device targeting, custom social media cards, etc.",
},
{ text: "Unlimited users" },
+ { text: "Unlimited link history" },
{
text: "Root domain redirect",
footnote:
@@ -98,6 +100,7 @@ const pricingItems = [
"Password protection, link expiration, device targeting, custom social media cards, etc.",
},
{ text: "Unlimited users" },
+ { text: "Unlimited link history" },
{
text: "Root domain redirect",
footnote:
diff --git a/app/ui/stats/toggle.tsx b/app/ui/stats/toggle.tsx
index cc369c3c61..4c7203b4fb 100644
--- a/app/ui/stats/toggle.tsx
+++ b/app/ui/stats/toggle.tsx
@@ -64,7 +64,9 @@ export default function Toggle() {
content={
<div className="w-full p-2 md:w-48">
{INTERVALS.map(({ display, slug }) =>
- slug === "all" && (!plan || plan === "free") ? (
+ !(domain === "dub.sh" && key === "github") &&
+ (slug === "all" || slug === "90d") &&
+ (!plan || plan === "free") ? (
<Tooltip
key={slug}
content={
diff --git a/app/ui/tooltip.tsx b/app/ui/tooltip.tsx
index a725a4dae7..b7333f630d 100644
--- a/app/ui/tooltip.tsx
+++ b/app/ui/tooltip.tsx
@@ -112,7 +112,7 @@ export default function Tooltip({
<TooltipPrimitive.Content
sideOffset={4}
side="top"
- className="z-30 hidden animate-slide-up-fade items-center overflow-hidden rounded-md border border-gray-200 bg-white drop-shadow-lg sm:block"
+ className="z-40 hidden animate-slide-up-fade items-center overflow-hidden rounded-md border border-gray-200 bg-white drop-shadow-lg sm:block"
>
<TooltipPrimitive.Arrow className="fill-current text-white" />
{typeof content === "string" ? (
diff --git a/lib/constants/index.ts b/lib/constants/index.ts
index 07cc8fd92a..8dbaa12c54 100644
--- a/lib/constants/index.ts
+++ b/lib/constants/index.ts
@@ -34,6 +34,7 @@ export const FADE_IN_ANIMATION_SETTINGS = {
export const HOME_HOSTNAMES = new Set([
// comment for better diffs
"dub.sh",
+ "localhost",
"localhost:3000",
]);
diff --git a/pages/api/edge/links/[key]/stats/[endpoint].ts b/pages/api/edge/links/[key]/stats/[endpoint].ts
index c40868b473..e17b1c7f76 100644
--- a/pages/api/edge/links/[key]/stats/[endpoint].ts
+++ b/pages/api/edge/links/[key]/stats/[endpoint].ts
@@ -16,14 +16,19 @@ export default async function handler(req: NextRequest) {
if (isHomeHostname(domain)) domain = "dub.sh";
let data;
- // don't need to check if the link has public stats if the link is dub.sh/github (demo link)
- if (!(domain === "dub.sh" || key === "github")) {
+ // if the link is NOT dub.sh/github (demo link)
+ if (!(domain === "dub.sh" && key === "github")) {
data = await getLinkViaEdge(domain, key);
+ // check if the link is public
if (!data?.publicStats) {
return new Response(`Stats for this link are not public`, {
status: 403,
});
}
+ // return 403 if interval is 90d or all
+ if (interval === "all" || interval === "90d") {
+ return new Response(`Require higher plan`, { status: 403 });
+ }
}
const response = await getStats({