enzostvs HF Staff commited on
Commit
4c9a7ca
·
1 Parent(s): d3269d8
Files changed (1) hide show
  1. app/api/auth/login-url/route.ts +10 -3
app/api/auth/login-url/route.ts CHANGED
@@ -2,9 +2,16 @@ import { NextRequest, NextResponse } from "next/server";
2
 
3
  export async function GET(req: NextRequest) {
4
  const host = req.headers.get("host") ?? "localhost:3000";
5
- const url = host.includes("/spaces/enzostvs")
6
- ? "enzostvs-deepsite.hf.space"
7
- : host;
 
 
 
 
 
 
 
8
  const redirect_uri =
9
  `${host.includes("localhost") ? "http://" : "https://"}` +
10
  url +
 
2
 
3
  export async function GET(req: NextRequest) {
4
  const host = req.headers.get("host") ?? "localhost:3000";
5
+
6
+ let url: string;
7
+ if (process.env.NODE_ENV === "production") {
8
+ url = "deepsite.hf.co";
9
+ } else if (host.includes("/spaces/enzostvs")) {
10
+ url = "enzostvs-deepsite.hf.space";
11
+ } else {
12
+ url = host;
13
+ }
14
+
15
  const redirect_uri =
16
  `${host.includes("localhost") ? "http://" : "https://"}` +
17
  url +