sdk: improve goView iframe/video import heuristics

This commit is contained in:
clawdbot 2026-01-28 03:03:29 +08:00
parent 08543ad714
commit 499aafcaab
3 changed files with 16 additions and 1 deletions

View File

@ -143,8 +143,14 @@ function isVideo(c: GoViewComponentLike): boolean {
k.includes('player') || k.includes('player') ||
k.includes('stream') || k.includes('stream') ||
k.includes('rtsp') || k.includes('rtsp') ||
k.includes('rtmp') ||
k.includes('hls') || k.includes('hls') ||
k.includes('m3u8') ||
k.includes('flv') ||
k.includes('webrtc') ||
k.includes('dash') ||
// common low-code names for live streams // common low-code names for live streams
k.includes('live') ||
k.includes('camera') || k.includes('camera') ||
k.includes('cctv') || k.includes('cctv') ||
k.includes('monitor') k.includes('monitor')
@ -178,6 +184,7 @@ function looksLikeIframeOption(option: unknown): boolean {
if ('iframeUrl' in o || 'iframeSrc' in o || 'embedUrl' in o) return true; if ('iframeUrl' in o || 'iframeSrc' in o || 'embedUrl' in o) return true;
// Some exports store raw HTML instead of a URL. // Some exports store raw HTML instead of a URL.
if ('srcdoc' in o || 'srcDoc' in o) return true;
if ('html' in o || 'htmlContent' in o || 'content' in o || 'template' in o) return true; if ('html' in o || 'htmlContent' in o || 'content' in o || 'template' in o) return true;
} }

View File

@ -38,7 +38,7 @@ function pickSrc(option: GoViewIframeOption): string {
const html = pickFromNested( const html = pickFromNested(
option, option,
(obj) => { (obj) => {
const v = obj.html ?? obj.htmlContent ?? obj.content ?? obj.template; const v = obj.srcdoc ?? obj.srcDoc ?? obj.html ?? obj.htmlContent ?? obj.content ?? obj.template;
return typeof v === 'string' ? v : undefined; return typeof v === 'string' ? v : undefined;
}, },
2, 2,

View File

@ -41,6 +41,14 @@ function pickUrlLikeInner(input: unknown, depth: number): string {
'path', 'path',
'source', 'source',
'address', 'address',
// some editors use page-ish naming
'pageUrl',
'pageSrc',
'page',
'documentUrl',
// iframe-ish HTML-in-URL fields (handled by iframe widget converter)
'srcdoc',
'srcDoc',
// common aliases // common aliases
'srcUrl', 'srcUrl',
'sourceUrl', 'sourceUrl',