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.

remove cloudinary package

Steven Teyc3b506ba5317
diff --git a/apps/web/app/api/domains/[domain]/route.ts b/apps/web/app/api/domains/[domain]/route.ts
index 2c66857bcb..1a25697935 100644
--- a/apps/web/app/api/domains/[domain]/route.ts
+++ b/apps/web/app/api/domains/[domain]/route.ts
@@ -134,5 +134,6 @@ export const DELETE = withAuth(async ({ domain, project }) => {
}
const response = await deleteDomainAndLinks(domain);
+
return NextResponse.json(response);
});
diff --git a/apps/web/app/api/domains/route.ts b/apps/web/app/api/domains/route.ts
index 622d3a28f3..1a63c83886 100644
--- a/apps/web/app/api/domains/route.ts
+++ b/apps/web/app/api/domains/route.ts
@@ -44,10 +44,12 @@ export const POST = withAuth(async ({ req, project }) => {
}
const validDomain = await validateDomain(domain);
+
if (validDomain !== true) {
return new Response(validDomain, { status: 422 });
}
const vercelResponse = await addDomainToVercel(domain);
+
if (vercelResponse.error) {
return new Response(vercelResponse.error.message, { status: 422 });
}
diff --git a/apps/web/lib/api/domains.ts b/apps/web/lib/api/domains.ts
index 0148a0745c..8ce35d8c1f 100644
--- a/apps/web/lib/api/domains.ts
+++ b/apps/web/lib/api/domains.ts
@@ -6,7 +6,7 @@ import {
isIframeable,
validDomainRegex,
} from "@dub/utils";
-import cloudinary from "cloudinary";
+import { storage } from "../storage";
import { recordLink } from "../tinybird";
export const validateDomain = async (domain: string) => {
@@ -253,14 +253,13 @@ export async function deleteDomainAndLinks(
},
deleted: true,
}),
- ...allLinks.map((link) =>
+ ...allLinks.flatMap((link) => [
recordLink({
link,
deleted: true,
}),
- ),
- // remove all images from cloudinary
- cloudinary.v2.api.delete_resources_by_prefix(domain),
+ storage.delete(`images/${link.id}`),
+ ]),
// remove the domain from Vercel
removeDomainFromVercel(domain),
!skipPrismaDelete &&
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index 60688e0c7c..4edc84714f 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -55,9 +55,6 @@ module.exports = {
{
hostname: "api.dicebear.com",
},
- {
- hostname: "res.cloudinary.com", // Keep for now until we move to dubassets
- },
{
hostname: "pbs.twimg.com",
},
diff --git a/apps/web/package.json b/apps/web/package.json
index 54d6834178..fccf5e82cd 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -45,7 +45,6 @@
"@visx/tooltip": "^2.16.0",
"aws4fetch": "^1.0.18",
"bottleneck": "^2.19.5",
- "cloudinary": "^1.40.0",
"cmdk": "^0.2.0",
"cobe": "^0.6.3",
"concurrently": "^8.0.1",
diff --git a/apps/web/ui/modals/add-edit-link-modal/og-section.tsx b/apps/web/ui/modals/add-edit-link-modal/og-section.tsx
index ff126226d0..7a6f45d96e 100644
--- a/apps/web/ui/modals/add-edit-link-modal/og-section.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/og-section.tsx
@@ -167,7 +167,7 @@ export default function OGSection({
</div>
<label
htmlFor="image"
- className="group relative mt-1 flex aspect-[1200/630] h-[14rem] cursor-pointer flex-col items-center justify-center rounded-md border border-gray-300 bg-white shadow-sm transition-all hover:bg-gray-50"
+ className="group relative mt-1 flex aspect-[1200/630] w-full cursor-pointer flex-col items-center justify-center rounded-md border border-gray-300 bg-white shadow-sm transition-all hover:bg-gray-50"
>
{generatingMetatags && (
<div className="absolute z-[5] flex h-full w-full items-center justify-center rounded-md bg-white">
diff --git a/apps/web/ui/modals/add-edit-link-modal/preview.tsx b/apps/web/ui/modals/add-edit-link-modal/preview.tsx
index 647910a068..ffb82731f2 100644
--- a/apps/web/ui/modals/add-edit-link-modal/preview.tsx
+++ b/apps/web/ui/modals/add-edit-link-modal/preview.tsx
@@ -1,3 +1,4 @@
+import { isStored } from "@/lib/storage";
import { LinkProps } from "@/lib/types";
import {
BlurImage,
@@ -34,7 +35,7 @@ export default function Preview({
);
}
if (image) {
- if (image.startsWith("https://res.cloudinary.com")) {
+ if (isStored(image)) {
return (
<BlurImage
src={image}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 7f7018a8ee..9ec7c095bc 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -136,9 +136,6 @@ importers:
bottleneck:
specifier: ^2.19.5
version: 2.19.5
- cloudinary:
- specifier: ^1.40.0
- version: 1.40.0
cmdk:
specifier: ^0.2.0
@@ -8380,24 +8377,6 @@ packages:
engines: {node: '>=0.8'}
dev: false
- resolution: {integrity: sha512-Nt0Q5I2FtenmJghtC4YZ3MZZbGg1wLm84SsxcuVwZ83OyJqG9CNIGp86CiI6iDv3QobaqBUpOT7vg+HqY5HxEA==}
- peerDependencies:
- lodash: '>=4.0'
- dependencies:
- lodash: 4.17.21
- dev: false
-
- resolution: {integrity: sha512-Fifkl8NRw/M+Enw4cKCXc6e0Or28c5y6RVGYS3OCLzT1W8EfBt416FURhLuuL/S4BCVv8bSilmnM746kCtth3g==}
- engines: {node: '>=0.6'}
- dependencies:
- cloudinary-core: 2.13.0([email protected])
- core-js: 3.33.0
- lodash: 4.17.21
- q: 1.5.1
- dev: false
-
resolution: {integrity: sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==}
engines: {node: '>=6'}
@@ -8594,11 +8573,6 @@ packages:
browserslist: 4.22.1
dev: false
- resolution: {integrity: sha512-HoZr92+ZjFEKar5HS6MC776gYslNOKHt75mEBKWKnPeFDpZ6nH5OeF3S6HFT1mUAUZKrzkez05VboaX8myjSuw==}
- requiresBuild: true
- dev: false
-
resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==}
@@ -13280,11 +13254,6 @@ packages:
resolution: {integrity: sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==}
engines: {node: '>=6'}
- resolution: {integrity: sha512-kV/CThkXo6xyFEZUugw/+pIOywXcDbFYgSct5cT3gqlbkBE1SJdwy6UQoZvodiWF/ckQLZyDE/Bu1M6gVu5lVw==}
- engines: {node: '>=0.6.0', teleport: '>=0.2.0'}
- dev: false
-
resolution: {integrity: sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==}
engines: {node: '>=0.6'}