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.

some small fixes

Steven Teyadf4fc457a30
diff --git a/components/app/link-card.tsx b/components/app/link-card.tsx
index 9be07f890f..1d1866c659 100644
--- a/components/app/link-card.tsx
+++ b/components/app/link-card.tsx
@@ -108,7 +108,7 @@ export default function LinkCard({ props }: { props: LinkProps }) {
</div>
</div>
<div className="flex items-center space-x-3 w-full sm:w-auto">
- <p className="text-sm hidden sm:block text-gray-500">
+ <p className="text-sm hidden sm:block text-gray-500 whitespace-nowrap">
Added {timeAgo(createdAt)}
</p>
{slug && exceededUsage ? (
diff --git a/components/app/modals/add-edit-link-modal/expiration-section.tsx b/components/app/modals/add-edit-link-modal/expiration-section.tsx
index 64d3f57fd3..542d5665da 100644
--- a/components/app/modals/add-edit-link-modal/expiration-section.tsx
+++ b/components/app/modals/add-edit-link-modal/expiration-section.tsx
@@ -5,7 +5,7 @@ import { LinkProps } from "@/lib/types";
import { getDateTimeLocal } from "@/lib/utils";
import { AnimationSettings } from "./advanced-settings";
-export default function ExpireSection({
+export default function ExpirationSection({
data,
setData,
}: {
diff --git a/lib/api/links.ts b/lib/api/links.ts
index 52b12515c6..3d8bbee688 100644
--- a/lib/api/links.ts
+++ b/lib/api/links.ts
@@ -132,7 +132,7 @@ export async function editLink(
} = link;
const hasPassword = password && password.length > 0;
const proxy = title && description && image ? true : false;
- const exat = expiresAt ? expiresAt.getTime() : null;
+ const exat = expiresAt ? new Date(expiresAt).getTime() : null;
const changedKey = key !== oldKey;
const uploadedImage = image && image.startsWith("data:image");
@@ -213,8 +213,6 @@ export async function editLink(
});
}
- console.log(effects);
-
return response;
}
diff --git a/lib/middleware/link.ts b/lib/middleware/link.ts
index 121b4143a9..69914f584b 100644
--- a/lib/middleware/link.ts
+++ b/lib/middleware/link.ts
@@ -1,7 +1,6 @@
import { NextFetchEvent, NextRequest, NextResponse } from "next/server";
import { detectBot, parse } from "@/lib/middleware/utils";
import { recordClick, redis } from "@/lib/upstash";
-import { LinkProps } from "../types";
export default async function LinkMiddleware(
req: NextRequest,
@@ -21,9 +20,12 @@ export default async function LinkMiddleware(
}>(`${domain}:${key}`);
const { url: target, password, proxy } = response || {};
- console.log(req.cookies.get("dub_authenticated"));
-
if (target) {
+ // special case for link health monitoring with planetfall.io :)
+ if (!req.headers.get("dub-no-track")) {
+ ev.waitUntil(recordClick(domain, req, key)); // track the click only if there is no `dub-no-track` header
+ }
+
if (password && !req.cookies.get("dub_authenticated")) {
return NextResponse.rewrite(
process.env.NODE_ENV === "development"
@@ -32,11 +34,6 @@ export default async function LinkMiddleware(
);
}
- // special case for link health monitoring with planetfall.io :)
- if (!req.headers.get("dub-no-track")) {
- ev.waitUntil(recordClick(domain, req, key)); // track the click only if there is no `dub-no-track` header
- }
-
const isBot = detectBot(req);
if (isBot && proxy) {
// rewrite to proxy page (dub.sh/proxy/[domain]/[key]) if it's a bot