Initial aishare service

This commit is contained in:
Codex
2026-07-06 11:25:57 +00:00
commit e051b568ab
23 changed files with 5615 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
export function validateChatGptShareUrl(raw: string): string {
let url: URL;
try {
url = new URL(raw);
} catch {
throw new Error("Enter a valid public ChatGPT share URL.");
}
if (url.protocol !== "https:") {
throw new Error("Only HTTPS ChatGPT share URLs are accepted.");
}
const host = url.hostname.toLowerCase();
const allowedHost = host === "chatgpt.com" || host === "chat.openai.com";
if (!allowedHost || !url.pathname.startsWith("/share/")) {
throw new Error("Only public ChatGPT share URLs under /share/ are accepted.");
}
url.hash = "";
return url.toString();
}