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.

switched from avatar.tobi.sh to avatar.vercel.sh, accounted for a few more edge cases

Steven Tey168ec91c2bb3
diff --git a/components/app/links/link-filters/user-filter.tsx b/components/app/links/link-filters/user-filter.tsx
index c325a7e4b3..fa6de58a1d 100644
--- a/components/app/links/link-filters/user-filter.tsx
+++ b/components/app/links/link-filters/user-filter.tsx
@@ -48,7 +48,7 @@ export default function UserFilter() {
className="flex w-full items-center space-x-2 rounded-md p-2 hover:bg-gray-100 active:bg-gray-200"
>
<BlurImage
- src={`https://avatar.tobi.sh/${email}`}
+ src={`https://avatar.vercel.sh/${email}`}
alt={email}
width={28}
height={28}
diff --git a/components/app/modals/add-edit-link-modal/utm-section.tsx b/components/app/modals/add-edit-link-modal/utm-section.tsx
index 1983a21f1a..d59258b26c 100644
--- a/components/app/modals/add-edit-link-modal/utm-section.tsx
+++ b/components/app/modals/add-edit-link-modal/utm-section.tsx
@@ -39,10 +39,14 @@ export default function UTMSection({
useEffect(() => {
if (enabled) {
- // if enabling, add all params from props if exists
+ // if enabling, add all params from props if exists && it's still the same URL
setData({
...data,
- url: props?.url || url,
+ url:
+ props?.url &&
+ getUrlWithoutUTMParams(props?.url) === getUrlWithoutUTMParams(url)
+ ? props?.url
+ : url,
});
} else {
// if disabling, remove all UTM params
diff --git a/components/shared/blur-image.tsx b/components/shared/blur-image.tsx
index 4b5a0910c4..597328b541 100644
--- a/components/shared/blur-image.tsx
+++ b/components/shared/blur-image.tsx
@@ -18,7 +18,7 @@ export default function BlurImage(props: ImageProps) {
setLoading(false);
}}
onError={() => {
- setSrc(`https://avatar.tobi.sh/${props.alt}`); // if the image fails to load, use the default avatar
+ setSrc(`https://avatar.vercel.sh/${props.alt}`); // if the image fails to load, use the default avatar
}}
/>
);
diff --git a/next.config.js b/next.config.js
index d9384e77a9..ffcf064581 100644
--- a/next.config.js
+++ b/next.config.js
@@ -4,7 +4,7 @@ module.exports = {
images: {
domains: [
"www.google.com",
- "avatar.tobi.sh",
+ "avatar.vercel.sh",
"faisalman.github.io",
"avatars.dicebear.com",
"res.cloudinary.com",
diff --git a/pages/api/edge/metatags.ts b/pages/api/edge/metatags.ts
index 8b0e3f71d7..23bfd47adb 100644
--- a/pages/api/edge/metatags.ts
+++ b/pages/api/edge/metatags.ts
@@ -68,17 +68,26 @@ const getMetadataFromUrl = async (url: string) => {
},
);
console.log(obj);
+
+ let image =
+ obj["og:image"] ||
+ obj["twitter:image"] ||
+ obj["icon"] ||
+ obj["image_src"];
+
+ if (image && image.startsWith("//")) {
+ image = "https:" + image;
+ } else if (image && image.startsWith("/")) {
+ image = new URL(url).origin + image;
+ }
+
return {
title: obj["title"] || obj["og:title"] || obj["twitter:title"],
description:
obj["description"] ||
obj["og:description"] ||
obj["twitter:description"],
- image:
- obj["og:image"] ||
- obj["twitter:image"] ||
- obj["icon"] ||
- obj["image_src"],
+ image,
};
})
.catch((err) => {