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 tweaks

Steven Teyb990abfc0d4b
diff --git a/components/app/links/link-card.tsx b/components/app/links/link-card.tsx
index 106fe699cb..b95d616061 100644
--- a/components/app/links/link-card.tsx
+++ b/components/app/links/link-card.tsx
@@ -158,6 +158,7 @@ export default function LinkCard({ props }: { props: LinkProps }) {
src={`${GOOGLE_FAVICON_URL}${apexDomain}`}
alt={apexDomain}
className="h-8 w-8 rounded-full sm:h-10 sm:w-10"
+ unoptimized
width={20}
height={20}
/>
diff --git a/components/app/modals/add-edit-link-modal/index.tsx b/components/app/modals/add-edit-link-modal/index.tsx
index 3cd8276b96..d70fcfba39 100644
--- a/components/app/modals/add-edit-link-modal/index.tsx
+++ b/components/app/modals/add-edit-link-modal/index.tsx
@@ -156,7 +156,6 @@ function AddEditLinkModal({
const results = await res.json();
setData((prev) => ({
...prev,
- // TODO: can remove this eventually when I figure out Why am I storing the metatags data for links with proxy: false???
...{
title: truncate(results.title, 120),
description: truncate(results.description, 240),
diff --git a/lib/utils.ts b/lib/utils.ts
index 1a9c2b2568..e7a2d4eda1 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -286,7 +286,7 @@ export const setQueryString = (
export const truncate = (str: string | null, length: number) => {
if (!str || str.length <= length) return str;
- return `${str.slice(0, length)}...`;
+ return `${str.slice(0, length - 3)}...`;
};
export const getParamsFromURL = (url: string) => {
diff --git a/pages/_proxy/[domain]/[key].tsx b/pages/_proxy/[domain]/[key].tsx
index feb616af65..570b58fa0a 100644
--- a/pages/_proxy/[domain]/[key].tsx
+++ b/pages/_proxy/[domain]/[key].tsx
@@ -1,4 +1,3 @@
-import Image from "next/image";
import Head from "next/head";
import { unescape } from "html-escaper";
import prisma from "@/lib/prisma";
@@ -41,19 +40,11 @@ export default function LinkPage({
</Head>
<main className="flex h-screen w-screen items-center justify-center">
<div className="mx-5 w-full max-w-lg overflow-hidden rounded-lg border border-gray-200 sm:mx-0">
- <Image
- src={image}
- alt={title}
- width={1200}
- height={627}
- className="w-full object-cover"
- />
+ <img src={image} alt={title} className="w-full object-cover" />
<div className="flex space-x-3 bg-gray-100 p-5">
- <Image
+ <img
src={`${GOOGLE_FAVICON_URL}${unescape(apexDomain)}`}
alt={title}
- width={300}
- height={300}
className="mt-1 h-6 w-6"
/>
<div className="flex flex-col space-y-3">
@@ -78,13 +69,14 @@ export async function getServerSideProps(ctx) {
},
});
- const { url, title, description, image } = link || {};
+ const { url, proxy, title, description, image } = link || {};
if (!url) {
return {
notFound: true,
};
- } else if (!image) {
+ // if it's not a proxy page, redirect to the original URL
+ } else if (!proxy) {
return {
redirect: {
destination: url,