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.

change localhost port

Steven Tey654eaf3ed276
diff --git a/emails/login-link.tsx b/emails/login-link.tsx
index c08feb3337..de39a27125 100644
--- a/emails/login-link.tsx
+++ b/emails/login-link.tsx
@@ -17,7 +17,7 @@ import Footer from "./components/footer";
export default function LoginLink({
email = "[email protected]",
- url = "http://app.localhost:3000/api/auth/callback/email?callbackUrl=http%3A%2F%2Fapp.localhost%3A3000%2Flogin&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&[email protected]",
+ url = "http://localhost:8888/api/auth/callback/email?callbackUrl=http%3A%2F%2Fapp.localhost%3A3000%2Flogin&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&[email protected]",
}: {
email: string;
url: string;
diff --git a/emails/project-invite.tsx b/emails/project-invite.tsx
index afea550647..9c50330642 100644
--- a/emails/project-invite.tsx
+++ b/emails/project-invite.tsx
@@ -17,7 +17,7 @@ import Footer from "./components/footer";
export default function ProjectInvite({
email = "[email protected]",
- url = "http://app.localhost:3000/api/auth/callback/email?callbackUrl=http%3A%2F%2Fapp.localhost%3A3000%2Flogin&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&[email protected]",
+ url = "http://localhost:8888/api/auth/callback/email?callbackUrl=http%3A%2F%2Fapp.localhost%3A3000%2Flogin&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&[email protected]",
projectName = "Acme",
projectUser = "Brendon Urie",
projectUserEmail = "[email protected]",
diff --git a/lib/constants/index.ts b/lib/constants/index.ts
index 1b8693b9b4..63f5637dac 100644
--- a/lib/constants/index.ts
+++ b/lib/constants/index.ts
@@ -31,24 +31,24 @@ export const FADE_IN_ANIMATION_SETTINGS = {
transition: { duration: 0.2 },
};
-export const HOME_HOSTNAMES = new Set([
- // comment for better diffs
- "dub.sh",
- "localhost",
- "localhost:3000",
-]);
+/*
+ NOTE: We're using home.localhost:8888 for HOME_DOMAIN and localhost:8888 for APP_DOMAIN
+ in local development because Google OAuth doesn't allow subdomain localhost (e.g. app.localhost:8888)
+ as the callback URL.
+*/
+
+export const HOME_HOSTNAMES = new Set(["home.localhost:8888", "dub.sh"]);
export const HOME_DOMAIN =
process.env.NEXT_PUBLIC_VERCEL_ENV === "production"
? "https://dub.sh"
: process.env.NEXT_PUBLIC_VERCEL_ENV === "preview"
? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}`
- : "http://localhost:3000";
+ : "http://home.localhost:8888";
export const APP_HOSTNAMES = new Set([
+ "localhost:8888",
"app.dub.sh",
- "app.localhost:3000",
- "app.localhost",
"preview.dub.sh",
]);
@@ -57,7 +57,7 @@ export const APP_DOMAIN =
? "https://app.dub.sh"
: process.env.NEXT_PUBLIC_VERCEL_ENV === "preview"
? "https://preview.dub.sh"
- : "http://app.localhost:3000";
+ : "http://localhost:8888";
export const DEFAULT_REDIRECTS = {
home: "https://dub.sh",
diff --git a/lib/utils.ts b/lib/utils.ts
index 06b62d6758..f83398e963 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -134,9 +134,9 @@ export function linkConstructor({
pretty?: boolean;
noDomain?: boolean;
}) {
- const link = `${localhost ? "http://localhost:3000" : `https://${domain}`}${
- key !== "_root" ? `/${key}` : ""
- }`;
+ const link = `${
+ localhost ? "http://home.localhost:8888" : `https://${domain}`
+ }${key !== "_root" ? `/${key}` : ""}`;
if (noDomain) return `/${key}`;
return pretty ? link.replace(/^https?:\/\//, "") : link;
diff --git a/middleware.ts b/middleware.ts
index b5d248f240..061bc9bb80 100644
--- a/middleware.ts
+++ b/middleware.ts
@@ -33,13 +33,13 @@ export default async function middleware(req: NextRequest, ev: NextFetchEvent) {
return AppMiddleware(req);
}
- // for API (api.dub.sh and api.localhost:3000)
- if (domain === "api.dub.sh" || domain === "api.localhost:3000") {
+ // for API (api.dub.sh and api.localhost:8888)
+ if (domain === "api.dub.sh" || domain === "api.localhost:8888") {
return ApiMiddleware(req);
}
- // for Admin (admin.dub.sh and admin.localhost:3000)
- if (domain === "admin.dub.sh" || domain === "admin.localhost:3000") {
+ // for Admin (admin.dub.sh and admin.localhost:8888)
+ if (domain === "admin.dub.sh" || domain === "admin.localhost:8888") {
return AdminMiddleware(req);
}
diff --git a/package.json b/package.json
index 26468758dd..1bda8e6878 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
"private": true,
"license": "AGPL-3.0-or-later",
"scripts": {
- "dev": "concurrently --kill-others \"next dev\" \"prisma studio --browser none\" \"email dev --port 3333\"",
+ "dev": "concurrently --kill-others \"next dev --port 8888\" \"prisma studio --browser none\" \"email dev --port 3333\"",
"build": "prisma generate & next build",
"format:write": "prettier --write \"**/*.{css,js,json,jsx,ts,tsx}\"",
"format": "prettier \"**/*.{css,js,json,jsx,ts,tsx}\"",