Spaces:
Running
Running
redirect to deepsite
Browse files- app/layout.tsx +15 -1
app/layout.tsx
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 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";
|
|
@@ -77,6 +78,19 @@ export default async function RootLayout({
|
|
| 77 |
}: Readonly<{
|
| 78 |
children: React.ReactNode;
|
| 79 |
}>) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
// const data = await getMe();
|
| 81 |
|
| 82 |
// Generate structured data
|
|
|
|
| 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, headers } from "next/headers";
|
| 5 |
+
import { redirect } from "next/navigation";
|
| 6 |
import Script from "next/script";
|
| 7 |
|
| 8 |
import "@/assets/globals.css";
|
|
|
|
| 78 |
}: Readonly<{
|
| 79 |
children: React.ReactNode;
|
| 80 |
}>) {
|
| 81 |
+
// Check host and redirect if not on the correct domains
|
| 82 |
+
const headersList = await headers();
|
| 83 |
+
const host = headersList.get("host") || "";
|
| 84 |
+
|
| 85 |
+
// Check if we're not on hf.co/deepsite or huggingface.co/deepsite
|
| 86 |
+
const isHfCo = host === "hf.co" || host.startsWith("hf.co:");
|
| 87 |
+
const isHuggingFaceCo =
|
| 88 |
+
host === "huggingface.co" || host.startsWith("huggingface.co:");
|
| 89 |
+
|
| 90 |
+
if (!isHfCo && !isHuggingFaceCo) {
|
| 91 |
+
redirect("https://huggingface.co/deepsite");
|
| 92 |
+
}
|
| 93 |
+
|
| 94 |
// const data = await getMe();
|
| 95 |
|
| 96 |
// Generate structured data
|