Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

465 B
Raw Blame
import type { RefObject } from 'react'

/** 返回当前 Harness iframe 的精确来源;无有效 HTTP(S) 来源时拒绝通信。 */
export function getIframeOrigin(iframeRef: RefObject<HTMLIFrameElement | null>): string | null {
  const source = iframeRef.current?.src
  if (!source)
    return null
  try {
    const url = new URL(source)
    return url.protocol === 'http:' || url.protocol === 'https:' ? url.origin : null
  }
  catch {
    return null
  }
}