// SPDX-FileCopyrightText: 2026 Progmasoft // SPDX-License-Identifier: AGPL-3.0-or-later WITH AdditionRef-Progmasoft-Patent-Grant-1.1 import type { MetadataRoute } from "next"; import { headers } from "next/headers"; export default async function robots(): Promise { const requestHeaders = await headers(); const host = requestHeaders.get("x-forwarded-host") ?? requestHeaders.get("host") ?? ""; const canonicalHost = host.split(":", 1)[0]?.toLowerCase(); // Progmasoft OAuth and the Progmasoft Console have sign-in, consent and // developer pages only; none of them is a search document. if ( canonicalHost === "credentials.progmasoft.com" || canonicalHost === "authorize.progmasoft.com" || canonicalHost === "console.progmasoft.com" ) { return { rules: [{ userAgent: "*", disallow: "/" }] }; } const sitemap = canonicalHost === "viget.progmasoft.com" ? "https://viget.progmasoft.com/sitemap.xml" : "https://progmasoft.com/sitemap.xml"; return { rules: [ { userAgent: "Googlebot", allow: "/" }, { userAgent: "Google-Extended", allow: "/" }, { userAgent: "OAI-SearchBot", allow: "/" }, { userAgent: "ChatGPT-User", allow: "/" }, { userAgent: "GPTBot", disallow: "/" }, { userAgent: "Claude-SearchBot", allow: "/" }, { userAgent: "Claude-User", allow: "/" }, { userAgent: "ClaudeBot", allow: "/" }, { userAgent: "CCBot", disallow: "/" }, { userAgent: "Bytespider", disallow: "/" }, { userAgent: "*", allow: "/" }, ], sitemap, }; }