* Rewrite a Dropbox share URL's host to `dl.dropboxusercontent.com` so the file * streams as media, returning null for a non-video path. The caller has already * verified the host is Dropbox.
(parsed: URL)
| 45 | * verified the host is Dropbox. |
| 46 | */ |
| 47 | function toDropboxDirectVideoUrl(parsed: URL): string | null { |
| 48 | if (!/\.(mp4|mov|webm)$/i.test(parsed.pathname)) return null |
| 49 | parsed.hostname = 'dl.dropboxusercontent.com' |
| 50 | parsed.searchParams.delete('dl') |
| 51 | return parsed.toString() |
| 52 | } |
| 53 | |
| 54 | /** |
| 55 | * Map a URL to its embeddable form across supported media platforms (YouTube, |
no test coverage detected