Spaces:
Running
Running
add log
Browse files- app/layout.tsx +0 -3
- middleware.ts +4 -5
app/layout.tsx
CHANGED
|
@@ -1,13 +1,10 @@
|
|
| 1 |
/* eslint-disable @typescript-eslint/no-explicit-any */
|
| 2 |
import type { Metadata, Viewport } from "next";
|
| 3 |
import { Inter, PT_Sans } from "next/font/google";
|
| 4 |
-
import { cookies } from "next/headers";
|
| 5 |
import Script from "next/script";
|
| 6 |
|
| 7 |
import "@/assets/globals.css";
|
| 8 |
import { Toaster } from "@/components/ui/sonner";
|
| 9 |
-
import MY_TOKEN_KEY from "@/lib/get-cookie-name";
|
| 10 |
-
import { apiServer } from "@/lib/api";
|
| 11 |
import IframeDetector from "@/components/iframe-detector";
|
| 12 |
import AppContext from "@/components/contexts/app-context";
|
| 13 |
import TanstackContext from "@/components/contexts/tanstack-query-context";
|
|
|
|
| 1 |
/* eslint-disable @typescript-eslint/no-explicit-any */
|
| 2 |
import type { Metadata, Viewport } from "next";
|
| 3 |
import { Inter, PT_Sans } from "next/font/google";
|
|
|
|
| 4 |
import Script from "next/script";
|
| 5 |
|
| 6 |
import "@/assets/globals.css";
|
| 7 |
import { Toaster } from "@/components/ui/sonner";
|
|
|
|
|
|
|
| 8 |
import IframeDetector from "@/components/iframe-detector";
|
| 9 |
import AppContext from "@/components/contexts/app-context";
|
| 10 |
import TanstackContext from "@/components/contexts/tanstack-query-context";
|
middleware.ts
CHANGED
|
@@ -4,12 +4,11 @@ import type { NextRequest } from "next/server";
|
|
| 4 |
export function middleware(request: NextRequest) {
|
| 5 |
const host = request.headers.get("host") || "";
|
| 6 |
|
| 7 |
-
|
| 8 |
-
const
|
| 9 |
-
const isHuggingFaceCo = host === "huggingface.co" || host.startsWith("huggingface.co:");
|
| 10 |
|
| 11 |
-
|
| 12 |
-
|
| 13 |
return NextResponse.redirect("https://huggingface.co/deepsite", 301);
|
| 14 |
}
|
| 15 |
|
|
|
|
| 4 |
export function middleware(request: NextRequest) {
|
| 5 |
const host = request.headers.get("host") || "";
|
| 6 |
|
| 7 |
+
const isLocalhost = host.startsWith("localhost") || host.startsWith("127.0.0.1");
|
| 8 |
+
const isCorrectDomain = host === "huggingface.co" || host.startsWith("huggingface.co:");
|
|
|
|
| 9 |
|
| 10 |
+
console.log("++ DOMAIN CHECK ++", host)
|
| 11 |
+
if (!isCorrectDomain && !isLocalhost) {
|
| 12 |
return NextResponse.redirect("https://huggingface.co/deepsite", 301);
|
| 13 |
}
|
| 14 |
|