diff --git a/videos.html b/videos.html index 7e838c3..c37914d 100644 --- a/videos.html +++ b/videos.html @@ -71,7 +71,15 @@ function card(p) { cta += 'Edit'; cta += 'Download'; + + esc(dlUrl(p.video_url)) + '" download>Download'; + } + + // `download` on a cross-origin link is ignored by the browser, and the + // storage URL is signed with an inline disposition, so a click just opened + // the video. Asking the worker for ?dl=1 makes it serve an attachment. + function dlUrl(u) { + u = String(u || ""); + return /\/media\/[0-9a-fA-F-]{16,}$/.test(u) ? u + "?dl=1" : u; } // Through our own domain, so an open is a page load we can count. A link