diff --git a/apps/contentindexer/web/src/components/modals/NewJobModal.jsx b/apps/contentindexer/web/src/components/modals/NewJobModal.jsx index f319b83..0c740a3 100644 --- a/apps/contentindexer/web/src/components/modals/NewJobModal.jsx +++ b/apps/contentindexer/web/src/components/modals/NewJobModal.jsx @@ -34,6 +34,9 @@ const FALLBACK_DETECTORS = [ { name: 'shot_detection', display_name: 'Shot Detection', price_per_second: 0.001 }, ] +// The pipeline only reads YouTube links and our own uploads; any other link fails after the charge. +const YOUTUBE_URL = /^https?:\/\/(www\.|m\.)?(youtube\.com|youtu\.be)\//i + function isAvailable(d) { return d.is_available === true || d.is_available === 1 || d.is_available === '1' } @@ -121,7 +124,8 @@ export default function NewJobModal({ onClose, onJobCreated, userContent = [], o const contentUrl = source === 'library' ? selectedContent?.canonical_url || selectedContent?.content_url || selectedContent?.url : url.trim() - const canSubmit = !submitting && !loadingCatalog && !slidesBlocked && selected.length > 0 && !!contentUrl + const urlUnsupported = source === 'url' && !!contentUrl && !YOUTUBE_URL.test(contentUrl) + const canSubmit = !submitting && !loadingCatalog && !slidesBlocked && selected.length > 0 && !!contentUrl && !urlUnsupported const toggle = (name) => setSelected((s) => (s.includes(name) ? s.filter((n) => n !== name) : [...s, name])) @@ -131,10 +135,9 @@ export default function NewJobModal({ onClose, onJobCreated, userContent = [], o setError(null) setSubmitting(true) try { - const isYouTube = /^https?:\/\/(www\.)?(youtube\.com|youtu\.be)\//i.test(contentUrl) const response = await apiCall('/v1/jobs', { method: 'POST', - body: JSON.stringify(isYouTube && source === 'url' + body: JSON.stringify(source === 'url' ? { youtube_url: contentUrl, content_url: contentUrl, detectors: selected } : { content_url: contentUrl, detectors: selected }), }) @@ -239,10 +242,19 @@ export default function NewJobModal({ onClose, onJobCreated, userContent = [], o inputMode="url" value={url} onChange={(e) => setUrl(e.target.value)} - placeholder="https://youtu.be/… or a direct link to an .mp4" + placeholder="https://youtu.be/…" + aria-invalid={urlUnsupported} + aria-describedby="video-url-hint" className="ci-focus w-full rounded-md bg-sheet px-4 py-3 text-ink ring-1 ring-rule placeholder:text-mute/70" /> -
YouTube links and direct video links work. For a file on your computer, use My uploads.
+ {urlUnsupported ? ( ++ Only YouTube links work here. For any other video, download it and add it in{' '} + . +
+ ) : ( +Only YouTube links work here. For any other video, use My uploads.
+ )} ) : (