diff --git a/videos.html b/videos.html index 49f4775..77b9362 100644 --- a/videos.html +++ b/videos.html @@ -76,9 +76,10 @@ function card(p) { // Through our own domain, so an open is a page load we can count. A link // straight to the file is invisible to us. 33 characters against 74. + // A placeholder only; share_link returns the real address, which lives on + // its own hostname rather than on this site. window.__shareUrl = window.__shareUrl || function (p) { - if (!(p.cut_url || p.video_url)) return ""; - return location.origin + "/v/" + String(p.id || "").slice(0, 8); + return (p.cut_url || p.video_url) ? "pending" : ""; }; return '
' @@ -113,24 +114,12 @@ async function load() { if (!p) return; var link = window.__shareUrl(p); if (!link) { showMsg("msg", "That one has no video yet."); return; } - // Publish the static page first: it is what carries the preview tags, - // and crawlers never run the JavaScript route. + // Nothing to publish: the page is rendered per request. This only marks + // the video shared and returns its address. b.disabled = true; b.textContent = "Preparing…"; - var s = await api("publish_share_page", { email: email, project_id: p.id }); - if (s.ok && s.pending) { - var waited = 0; - s = await new Promise(function (done) { - var t = setInterval(async function () { - waited += 4; - var g = await api("publish_share_page", { email: email, project_id: p.id }); - if (g.ok && !g.pending) { clearInterval(t); done(g); return; } - if (waited > 180) { clearInterval(t); done({ ok: false, error: "That is taking unusually long." }); } - }, 4000); - }); - } + var s = await api("share_link", { email: email, project_id: p.id }); b.disabled = false; b.textContent = "Share"; if (!s.ok) { showMsg("msg", s.error || "Could not prepare that link."); return; } - if (s.note) { showMsg("msg", s.note); return; } link = s.url || link; var title = p.title || ((p.pet_name || "Your pet") + " has something to say"); // The native sheet is the shortest path into a text message on a phone.