@@ -4,6 +4,7 @@ import { AuthError } from "next-auth"
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { env } from "@/env/server"
|
||||
import { internalServerError } from "@/server/errors/next"
|
||||
import { getPublicURL } from "@/server/utils"
|
||||
|
||||
import { signOut } from "@/auth"
|
||||
|
||||
@@ -11,6 +12,8 @@ export async function GET(
|
||||
request: NextRequest,
|
||||
context: { params: { lang: Lang } }
|
||||
) {
|
||||
const publicURL = getPublicURL(request)
|
||||
|
||||
let redirectTo: string = ""
|
||||
|
||||
const returnUrl = request.headers.get("x-returnurl")
|
||||
@@ -39,7 +42,7 @@ export async function GET(
|
||||
// Make relative URL to absolute URL
|
||||
if (redirectTo.startsWith("/")) {
|
||||
console.log(`[logout] make redirectTo absolute, from ${redirectTo}`)
|
||||
redirectTo = new URL(redirectTo, env.PUBLIC_URL).href
|
||||
redirectTo = new URL(redirectTo, publicURL).href
|
||||
console.log(`[logout] make redirectTo absolute, to ${redirectTo}`)
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import { AuthError } from "next-auth"
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { env } from "@/env/server"
|
||||
import { internalServerError } from "@/server/errors/next"
|
||||
import { getPublicURL } from "@/server/utils"
|
||||
|
||||
import { signIn } from "@/auth"
|
||||
|
||||
@@ -11,9 +12,7 @@ export async function GET(
|
||||
request: NextRequest,
|
||||
context: { params: { lang: Lang } }
|
||||
) {
|
||||
if (!env.PUBLIC_URL) {
|
||||
throw internalServerError("No value for env.PUBLIC_URL")
|
||||
}
|
||||
const publicURL = getPublicURL(request)
|
||||
|
||||
let redirectHeaders: Headers | undefined = undefined
|
||||
let redirectTo: string
|
||||
@@ -54,7 +53,7 @@ export async function GET(
|
||||
// Make relative URL to absolute URL
|
||||
if (redirectTo.startsWith("/")) {
|
||||
console.log(`[login] make redirectTo absolute, from ${redirectTo}`)
|
||||
redirectTo = new URL(redirectTo, env.PUBLIC_URL).href
|
||||
redirectTo = new URL(redirectTo, publicURL).href
|
||||
console.log(`[login] make redirectTo absolute, to ${redirectTo}`)
|
||||
}
|
||||
|
||||
@@ -131,7 +130,7 @@ export async function GET(
|
||||
* because user might choose to do Email link login.
|
||||
* */
|
||||
// The `for_origin` param is used to make Curity email login functionality working.
|
||||
for_origin: env.PUBLIC_URL,
|
||||
for_origin: publicURL,
|
||||
// This is new param set for differentiate between the Magic link login of New web and current web
|
||||
version: "2",
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Lang } from "@/constants/languages"
|
||||
import { login } from "@/constants/routes/handleAuth"
|
||||
import { env } from "@/env/server"
|
||||
import { badRequest, internalServerError } from "@/server/errors/next"
|
||||
import { getPublicURL } from "@/server/utils"
|
||||
|
||||
import { signIn } from "@/auth"
|
||||
|
||||
@@ -12,9 +13,7 @@ export async function GET(
|
||||
request: NextRequest,
|
||||
context: { params: { lang: Lang } }
|
||||
) {
|
||||
if (!env.PUBLIC_URL) {
|
||||
throw internalServerError("No value for env.PUBLIC_URL")
|
||||
}
|
||||
const publicURL = getPublicURL(request)
|
||||
|
||||
const loginKey = request.nextUrl.searchParams.get("loginKey")
|
||||
if (!loginKey) {
|
||||
@@ -44,7 +43,7 @@ export async function GET(
|
||||
console.log(
|
||||
`[verifymagiclink] make redirectTo absolute, from ${redirectTo}`
|
||||
)
|
||||
redirectTo = new URL(redirectTo, env.PUBLIC_URL).href
|
||||
redirectTo = new URL(redirectTo, publicURL).href
|
||||
console.log(`[verifymagiclink] make redirectTo absolute, to ${redirectTo}`)
|
||||
}
|
||||
|
||||
@@ -69,7 +68,7 @@ export async function GET(
|
||||
ui_locales: context.params.lang,
|
||||
scope: ["openid", "profile"].join(" "),
|
||||
loginKey: loginKey,
|
||||
for_origin: env.PUBLIC_URL,
|
||||
for_origin: publicURL,
|
||||
acr_values: "abc",
|
||||
version: "2",
|
||||
}
|
||||
|
||||
@@ -4,14 +4,17 @@ import { env } from "process"
|
||||
import { Lang } from "@/constants/languages"
|
||||
import { profile } from "@/constants/routes/myPages"
|
||||
import { serverClient } from "@/lib/trpc/server"
|
||||
import { getPublicURL } from "@/server/utils"
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { lang: string } }
|
||||
) {
|
||||
const publicURL = getPublicURL(request)
|
||||
|
||||
console.log(`[add-card] callback started`)
|
||||
const lang = params.lang as Lang
|
||||
const returnUrl = new URL(`${env.PUBLIC_URL}/${profile[lang ?? Lang.en]}`)
|
||||
const returnUrl = new URL(`${publicURL}/${profile[lang ?? Lang.en]}`)
|
||||
|
||||
try {
|
||||
const searchParams = request.nextUrl.searchParams
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import type { NextRequest } from "next/server"
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const e = process.env
|
||||
console.log({ process_env: process.env })
|
||||
|
||||
const urlVar = "PUBLIC_URL"
|
||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
||||
const nextAuthUrlVar2 = "AUTH_URL"
|
||||
const envTestVar = "ENVTEST"
|
||||
|
||||
const values = {
|
||||
env_url: env.PUBLIC_URL,
|
||||
static_url: process.env.PUBLIC_URL,
|
||||
dynamic_url: e[urlVar],
|
||||
env_envtest: env.ENVTEST,
|
||||
static_envtest: process.env.ENVTEST,
|
||||
dynamic_envtest: e[envTestVar],
|
||||
env_nextauth: env.NEXTAUTH_URL,
|
||||
static_nextauth: process.env.NEXTAUTH_URL,
|
||||
dynamic_nextauth: e[nextAuthUrlVar],
|
||||
env_nextauth2: env.AUTH_URL,
|
||||
static_nextauth2: process.env.AUTH_URL,
|
||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
||||
}
|
||||
|
||||
console.log(values)
|
||||
|
||||
return NextResponse.json(values)
|
||||
}
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export const runtime = "edge"
|
||||
@@ -1,39 +0,0 @@
|
||||
import { config } from "dotenv"
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import type { NextRequest } from "next/server"
|
||||
|
||||
config({ path: "./.env" })
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const e = process.env
|
||||
console.log({ process_env: process.env })
|
||||
|
||||
const urlVar = "PUBLIC_URL"
|
||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
||||
const nextAuthUrlVar2 = "AUTH_URL"
|
||||
const envTestVar = "ENVTEST"
|
||||
|
||||
const values = {
|
||||
env_url: env.PUBLIC_URL,
|
||||
static_url: process.env.PUBLIC_URL,
|
||||
dynamic_url: e[urlVar],
|
||||
env_envtest: env.ENVTEST,
|
||||
static_envtest: process.env.ENVTEST,
|
||||
dynamic_envtest: e[envTestVar],
|
||||
env_nextauth: env.NEXTAUTH_URL,
|
||||
static_nextauth: process.env.NEXTAUTH_URL,
|
||||
dynamic_nextauth: e[nextAuthUrlVar],
|
||||
env_nextauth2: env.AUTH_URL,
|
||||
static_nextauth2: process.env.AUTH_URL,
|
||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
||||
}
|
||||
|
||||
console.log(values)
|
||||
|
||||
return NextResponse.json(values)
|
||||
}
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
@@ -1,38 +0,0 @@
|
||||
import "dotenv/config"
|
||||
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import type { NextRequest } from "next/server"
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const e = process.env
|
||||
console.log({ process_env: process.env })
|
||||
|
||||
const urlVar = "PUBLC_URL"
|
||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
||||
const nextAuthUrlVar2 = "AUTH_URL"
|
||||
const envTestVar = "ENVTEST"
|
||||
|
||||
const values = {
|
||||
env_url: env.PUBLIC_URL,
|
||||
static_url: process.env.PUBLIC_URL,
|
||||
dynamic_url: e[urlVar],
|
||||
env_envtest: env.ENVTEST,
|
||||
static_envtest: process.env.ENVTEST,
|
||||
dynamic_envtest: e[envTestVar],
|
||||
env_nextauth: env.NEXTAUTH_URL,
|
||||
static_nextauth: process.env.NEXTAUTH_URL,
|
||||
dynamic_nextauth: e[nextAuthUrlVar],
|
||||
env_nextauth2: env.AUTH_URL,
|
||||
static_nextauth2: process.env.AUTH_URL,
|
||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
||||
}
|
||||
|
||||
console.log(values)
|
||||
|
||||
return NextResponse.json(values)
|
||||
}
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
@@ -1,39 +0,0 @@
|
||||
import { config } from "dotenv"
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import type { NextRequest } from "next/server"
|
||||
|
||||
config({ debug: true, override: true })
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const e = process.env
|
||||
console.log({ process_env: process.env })
|
||||
|
||||
const urlVar = "PUBLC_URL"
|
||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
||||
const nextAuthUrlVar2 = "AUTH_URL"
|
||||
const envTestVar = "ENVTEST"
|
||||
|
||||
const values = {
|
||||
env_url: env.PUBLIC_URL,
|
||||
static_url: process.env.PUBLIC_URL,
|
||||
dynamic_url: e[urlVar],
|
||||
env_envtest: env.ENVTEST,
|
||||
static_envtest: process.env.ENVTEST,
|
||||
dynamic_envtest: e[envTestVar],
|
||||
env_nextauth: env.NEXTAUTH_URL,
|
||||
static_nextauth: process.env.NEXTAUTH_URL,
|
||||
dynamic_nextauth: e[nextAuthUrlVar],
|
||||
env_nextauth2: env.AUTH_URL,
|
||||
static_nextauth2: process.env.AUTH_URL,
|
||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
||||
}
|
||||
|
||||
console.log(values)
|
||||
|
||||
return NextResponse.json(values)
|
||||
}
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
@@ -1,36 +0,0 @@
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import type { NextRequest } from "next/server"
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const e = process.env
|
||||
console.log({ process_env: process.env })
|
||||
|
||||
const urlVar = "PUBLIC_URL"
|
||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
||||
const nextAuthUrlVar2 = "AUTH_URL"
|
||||
const envTestVar = "ENVTEST"
|
||||
|
||||
const values = {
|
||||
env_url: env.PUBLIC_URL,
|
||||
static_url: process.env.PUBLIC_URL,
|
||||
dynamic_url: e[urlVar],
|
||||
env_envtest: env.ENVTEST,
|
||||
static_envtest: process.env.ENVTEST,
|
||||
dynamic_envtest: e[envTestVar],
|
||||
env_nextauth: env.NEXTAUTH_URL,
|
||||
static_nextauth: process.env.NEXTAUTH_URL,
|
||||
dynamic_nextauth: e[nextAuthUrlVar],
|
||||
env_nextauth2: env.AUTH_URL,
|
||||
static_nextauth2: process.env.AUTH_URL,
|
||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
||||
}
|
||||
|
||||
console.log(values)
|
||||
|
||||
return NextResponse.json(values)
|
||||
}
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
@@ -1,37 +0,0 @@
|
||||
import { config } from "dotenv"
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import type { NextRequest } from "next/server"
|
||||
|
||||
config({ path: "./.env" })
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const e = process.env
|
||||
console.log({ process_env: process.env })
|
||||
|
||||
const urlVar = "PUBLIC_URL"
|
||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
||||
const nextAuthUrlVar2 = "AUTH_URL"
|
||||
const envTestVar = "ENVTEST"
|
||||
|
||||
const values = {
|
||||
env_url: env.PUBLIC_URL,
|
||||
static_url: process.env.PUBLIC_URL,
|
||||
dynamic_url: e[urlVar],
|
||||
env_envtest: env.ENVTEST,
|
||||
static_envtest: process.env.ENVTEST,
|
||||
dynamic_envtest: e[envTestVar],
|
||||
env_nextauth: env.NEXTAUTH_URL,
|
||||
static_nextauth: process.env.NEXTAUTH_URL,
|
||||
dynamic_nextauth: e[nextAuthUrlVar],
|
||||
env_nextauth2: env.AUTH_URL,
|
||||
static_nextauth2: process.env.AUTH_URL,
|
||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
||||
}
|
||||
|
||||
console.log(values)
|
||||
|
||||
return NextResponse.json(values)
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
import "dotenv/config"
|
||||
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import type { NextRequest } from "next/server"
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const e = process.env
|
||||
console.log({ process_env: process.env })
|
||||
|
||||
const urlVar = "PUBLIC_URL"
|
||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
||||
const nextAuthUrlVar2 = "AUTH_URL"
|
||||
const envTestVar = "ENVTEST"
|
||||
|
||||
const values = {
|
||||
env_url: env.PUBLIC_URL,
|
||||
static_url: process.env.PUBLIC_URL,
|
||||
dynamic_url: e[urlVar],
|
||||
env_envtest: env.ENVTEST,
|
||||
static_envtest: process.env.ENVTEST,
|
||||
dynamic_envtest: e[envTestVar],
|
||||
env_nextauth: env.NEXTAUTH_URL,
|
||||
static_nextauth: process.env.NEXTAUTH_URL,
|
||||
dynamic_nextauth: e[nextAuthUrlVar],
|
||||
env_nextauth2: env.AUTH_URL,
|
||||
static_nextauth2: process.env.AUTH_URL,
|
||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
||||
}
|
||||
|
||||
console.log(values)
|
||||
|
||||
return NextResponse.json(values)
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
import { config } from "dotenv"
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import type { NextRequest } from "next/server"
|
||||
|
||||
config({ debug: true, override: true })
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const e = process.env
|
||||
console.log({ process_env: process.env })
|
||||
|
||||
const urlVar = "PUBLIC_URL"
|
||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
||||
const nextAuthUrlVar2 = "AUTH_URL"
|
||||
const envTestVar = "ENVTEST"
|
||||
|
||||
const values = {
|
||||
env_url: env.PUBLIC_URL,
|
||||
static_url: process.env.PUBLIC_URL,
|
||||
dynamic_url: e[urlVar],
|
||||
env_envtest: env.ENVTEST,
|
||||
static_envtest: process.env.ENVTEST,
|
||||
dynamic_envtest: e[envTestVar],
|
||||
env_nextauth: env.NEXTAUTH_URL,
|
||||
static_nextauth: process.env.NEXTAUTH_URL,
|
||||
dynamic_nextauth: e[nextAuthUrlVar],
|
||||
env_nextauth2: env.AUTH_URL,
|
||||
static_nextauth2: process.env.AUTH_URL,
|
||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
||||
}
|
||||
|
||||
console.log(values)
|
||||
|
||||
return NextResponse.json(values)
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
import { NextResponse } from "next/server"
|
||||
|
||||
import { env } from "@/env/server"
|
||||
|
||||
import type { NextRequest } from "next/server"
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
const e = process.env
|
||||
console.log({ process_env: process.env })
|
||||
|
||||
const urlVar = "PUBLIC_URL"
|
||||
const nextAuthUrlVar = "NEXTAUTH_URL"
|
||||
const nextAuthUrlVar2 = "AUTH_URL"
|
||||
const envTestVar = "ENVTEST"
|
||||
|
||||
const values = {
|
||||
env_url: env.PUBLIC_URL,
|
||||
static_url: process.env.PUBLIC_URL,
|
||||
dynamic_url: e[urlVar],
|
||||
env_envtest: env.ENVTEST,
|
||||
static_envtest: process.env.ENVTEST,
|
||||
dynamic_envtest: e[envTestVar],
|
||||
env_nextauth: env.NEXTAUTH_URL,
|
||||
static_nextauth: process.env.NEXTAUTH_URL,
|
||||
dynamic_nextauth: e[nextAuthUrlVar],
|
||||
env_nextauth2: env.AUTH_URL,
|
||||
static_nextauth2: process.env.AUTH_URL,
|
||||
dynamic_nextauth2: e[nextAuthUrlVar2],
|
||||
}
|
||||
|
||||
console.log(values)
|
||||
|
||||
return NextResponse.json(values)
|
||||
}
|
||||
@@ -6,20 +6,21 @@ import {
|
||||
bookingConfirmation,
|
||||
payment,
|
||||
} from "@/constants/routes/hotelReservation"
|
||||
import { getPublicURL } from "@/server/utils"
|
||||
|
||||
export async function GET(
|
||||
request: NextRequest,
|
||||
{ params }: { params: { lang: string; status: string } }
|
||||
): Promise<NextResponse> {
|
||||
const publicURL = getPublicURL(request)
|
||||
|
||||
console.log(`[payment-callback] callback started`)
|
||||
const lang = params.lang as Lang
|
||||
const status = params.status
|
||||
const returnUrl = new URL(`${env.PUBLIC_URL}/${payment[lang]}`)
|
||||
const returnUrl = new URL(`${publicURL}/${payment[lang]}`)
|
||||
|
||||
if (status === "success") {
|
||||
const confirmationUrl = new URL(
|
||||
`${env.PUBLIC_URL}/${bookingConfirmation[lang]}`
|
||||
)
|
||||
const confirmationUrl = new URL(`${publicURL}/${bookingConfirmation[lang]}`)
|
||||
console.log(`[payment-callback] redirecting to: ${confirmationUrl}`)
|
||||
return NextResponse.redirect(confirmationUrl)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user