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.

convert to edge runtime

Steven Tey15c1f8c2ff7f
diff --git a/app/(marketing)/changelog/[slug]/page.tsx b/app/(marketing)/changelog/[slug]/page.tsx
index 45b4a5d18e..1dba518625 100644
--- a/app/(marketing)/changelog/[slug]/page.tsx
+++ b/app/(marketing)/changelog/[slug]/page.tsx
@@ -9,6 +9,8 @@ import BlurImage from "#/ui/blur-image";
import Author from "#/ui/blog/author";
import { Facebook, LinkedIn, Twitter } from "@/components/shared/icons";
+export const runtime = "edge";
+
export async function generateStaticParams() {
return allChangelogPosts.map((post) => ({
slug: post.slug,
diff --git a/app/(marketing)/changelog/page.tsx b/app/(marketing)/changelog/page.tsx
index 71e5f4f4c6..197cf9a2f7 100644
--- a/app/(marketing)/changelog/page.tsx
+++ b/app/(marketing)/changelog/page.tsx
@@ -8,6 +8,8 @@ import { MDX } from "#/ui/blog/mdx";
import { Twitter } from "@/components/shared/icons";
import { Rss } from "lucide-react";
+export const runtime = "edge";
+
export const metadata: Metadata = {
title: "Changelog - Dub",
description:
diff --git a/app/(marketing)/metatags/page.tsx b/app/(marketing)/metatags/page.tsx
index cef92e9a57..0b7b9e2b05 100644
--- a/app/(marketing)/metatags/page.tsx
+++ b/app/(marketing)/metatags/page.tsx
@@ -4,6 +4,8 @@ import Background from "@/components/shared/background";
import LaunchTweet from "./launch";
import MetatagsContent from "./content";
+export const runtime = "edge";
+
export const metadata = {
title: "Metatags API - The Free API to Get Meta Tags from a URL",
description:
diff --git a/app/(marketing)/page.tsx b/app/(marketing)/page.tsx
index 201b272fca..c648db353b 100644
--- a/app/(marketing)/page.tsx
+++ b/app/(marketing)/page.tsx
@@ -9,6 +9,8 @@ import OSS from "#/ui/home/oss";
import Testimonials from "#/ui/home/testimonials";
import { Suspense } from "react";
+export const runtime = "edge";
+
export default function Home() {
return (
<>
diff --git a/app/lib/twitter/get-tweet.ts b/app/lib/twitter/get-tweet.ts
index 4499047779..9c798ed4e4 100644
--- a/app/lib/twitter/get-tweet.ts
+++ b/app/lib/twitter/get-tweet.ts
@@ -1,8 +1,6 @@
-import { stringify as queryStringify } from "querystring";
-
import { getTwitterMedia } from "./twitter-media";
-const queryParams = queryStringify({
+const queryParams = new URLSearchParams({
expansions:
"author_id,attachments.media_keys,referenced_tweets.id,referenced_tweets.id.author_id,attachments.poll_ids",
"tweet.fields":
@@ -11,7 +9,7 @@ const queryParams = queryStringify({
"media.fields":
"duration_ms,height,media_key,preview_image_url,type,url,width,public_metrics",
"poll.fields": "duration_minutes,end_datetime,id,options,voting_status",
-});
+}).toString();
export const getTweet = async (id: string) => {
try {
diff --git a/app/ui/home/testimonials.tsx b/app/ui/home/testimonials.tsx
index dac90a4eed..c102c5f8bb 100644
--- a/app/ui/home/testimonials.tsx
+++ b/app/ui/home/testimonials.tsx
@@ -1,11 +1,15 @@
-import prisma from "@/lib/prisma";
+import { conn } from "@/lib/planetscale";
import { nFormatter } from "@/lib/utils";
import getTweetsMetadata, { homepageTweets } from "#/lib/twitter";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
import Tweet from "#/ui/tweet";
export default async function Testimonials() {
- const userCount = process.env.DATABASE_URL ? await prisma.user.count() : 5000;
+ const userCount = conn
+ ? // await prisma.user.count()
+ (await conn.execute("SELECT COUNT(id) FROM User")).rows[0]["count(id)"]
+ : 5000;
+
const tweets = await getTweetsMetadata(homepageTweets);
return (