mirror of
https://github.com/openclaw/clawhub.git
synced 2026-08-14 00:47:57 +00:00
* Revert "fix: serve docs subdomain root (#2630)" This reverts commit9ef33726b8. * Revert "feat: move docs to canonical subdomain" This reverts commit6afb91b772. * Revert "docs: serve ClawHub docs with shared OpenClaw renderer (#2609)" This reverts commit71156751ff. * fix: restore ClawHub email docs host * test: preserve non-docs validation fixes * test: remove stale docs proxy test * docs: keep ClawHub contributor references current * fix: keep docs auth callback outside docs routes
26 lines
710 B
TypeScript
26 lines
710 B
TypeScript
const allowedDocsOrigins = new Set([
|
|
"https://documentation.openclaw.ai",
|
|
"https://docs.openclaw.ai",
|
|
"http://localhost:4173",
|
|
"http://127.0.0.1:4173",
|
|
]);
|
|
|
|
export function normalizeDocsReturnTo(value?: string | null) {
|
|
if (!value) return null;
|
|
try {
|
|
const url = new URL(value);
|
|
if (!allowedDocsOrigins.has(url.origin)) return null;
|
|
if (!["http:", "https:"].includes(url.protocol)) return null;
|
|
return url.href;
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export function buildDocsAuthCallbackUrl(returnTo: string) {
|
|
const normalized = normalizeDocsReturnTo(returnTo);
|
|
if (!normalized) return null;
|
|
const url = new URL(normalized);
|
|
return `${url.origin}/ask-molty/auth/callback`;
|
|
}
|