From f6f1335fff1f63a19b0df36bfd870ded0858099f Mon Sep 17 00:00:00 2001
From: gator
Date: Wed, 9 Sep 2026 02:21:45 +0000
Subject: [PATCH] Use the rendered share address here too
The link in the message under the picture now comes from share_link, which
returns the worker-rendered page rather than a guessed path on this site.
---
script.html | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
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 = '
Opened ' + (s.views || 0) + ' time'
- + ((s.views === 1) ? '' : 's') + '.';
+ if (el) {
+ el.innerHTML = '
' + esc(SHARE_LINK) + '
Opened ' + (s.views || 0)
+ + ' time' + ((s.views === 1) ? '' : 's') + '.';
}
+ var t = document.getElementById("sharemsg");
+ if (t && SHARE_LINK) t.value = t.value.replace(/https?:\/\/\S+/, SHARE_LINK);
});
var sl = document.getElementById("sharelink");
if (sl) sl.onclick = async function () {