diff --git a/script.html b/script.html index 4672046..6d033dc 100644 --- a/script.html +++ b/script.html @@ -1140,11 +1140,10 @@ function bindShare() { // correct (video/mp4, filename=final.mp4) so anything that reads them is // fine, but clients that sniff the extension from the URL string are not. // A filename query is accepted and ignored by the file service. - function named(url) { - // Through our own domain so an open can be counted; a link straight to the - // file is invisible to us. 33 characters against 74. - return location.origin + "/v/" + String(pid || "").slice(0, 8); - } + // Filled in by share_link, which owns the address. A link straight to the + // file would be invisible to us; this one is counted server side. + var SHARE_LINK = ""; + function named(url) { return SHARE_LINK || ""; } function paint(r) { var kb = Math.round((r.bytes || 0) / 1024); @@ -1170,11 +1169,15 @@ function bindShare() { + '
' + ''; api("share_link", { email: email, project_id: pid }).then(function (s) { + if (!(s && s.ok)) return; + SHARE_LINK = s.url || ""; var el = document.getElementById("viewcount"); - if (el && s && s.ok) { - el.innerHTML = '