这些界面改动和专家服务草稿停在工作区,没有随上一笔主分支提交进入仓库。 Co-authored-by: Cursor <cursoragent@cursor.com>
19 lines
443 B
TypeScript
19 lines
443 B
TypeScript
const OFFICIAL_HOST = /(^|\.)dify\.(ai|com)$/i
|
|
|
|
export function isOfficialDifyUrl(value?: string | null): boolean {
|
|
const trimmed = value?.trim() ?? ''
|
|
if (!trimmed) return false
|
|
|
|
const mailto = trimmed.match(/^mailto:([^?]+)/i)
|
|
if (mailto) {
|
|
const host = mailto[1]?.split('@').pop() ?? ''
|
|
return OFFICIAL_HOST.test(host)
|
|
}
|
|
|
|
try {
|
|
return OFFICIAL_HOST.test(new URL(trimmed).hostname)
|
|
} catch {
|
|
return false
|
|
}
|
|
}
|