From ec81838229de03184e9ac619ac2876877f8940d7 Mon Sep 17 00:00:00 2001 From: Hackall <36754621+hackall360@users.noreply.github.com> Date: Sat, 13 Sep 2025 03:42:22 -0700 Subject: [PATCH 1/3] Use default PolliClient and dynamic referrer --- index.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 9cb4c87..2dad414 100644 --- a/index.html +++ b/index.html @@ -16,9 +16,11 @@ (function(){ try { if (window.polliLib) { - // Use a stable referrer for API tiering; avoid hardcoding endpoints elsewhere - window.polliLib.configure({ referrer: 'unityailab.com' }); - window.polliClient = new window.polliLib.PolliClientWeb({ referrer: 'unityailab.com' }); + // Derive referrer from attribute or window location + const cur = document.currentScript; + const referrer = (cur && cur.getAttribute('data-referrer')) || window.location.origin; + window.polliLib.configure({ referrer }); + window.polliClient = window.polliLib.getDefaultClient(); // Provide basic helpers used by image features if (!window.randomSeed) { From 6e0cf02cd286496b8ae46a49dcb3860ca8a89358 Mon Sep 17 00:00:00 2001 From: Hackall <36754621+hackall360@users.noreply.github.com> Date: Sat, 13 Sep 2025 03:47:37 -0700 Subject: [PATCH 2/3] Ensure PolliLib referrer uses base origin --- index.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 2dad414..6a5853b 100644 --- a/index.html +++ b/index.html @@ -16,9 +16,14 @@ (function(){ try { if (window.polliLib) { - // Derive referrer from attribute or window location + // Derive base referrer from attribute or window location (no path segments) const cur = document.currentScript; - const referrer = (cur && cur.getAttribute('data-referrer')) || window.location.origin; + const attrRef = cur && cur.getAttribute('data-referrer'); + let base = window.location.origin; + if (attrRef) { + try { base = new URL(attrRef).origin; } catch {} + } + const referrer = base.endsWith('/') ? base : base + '/'; window.polliLib.configure({ referrer }); window.polliClient = window.polliLib.getDefaultClient(); From 2491008b1161156941bc40a60694330efe880321 Mon Sep 17 00:00:00 2001 From: Hackall <36754621+hackall360@users.noreply.github.com> Date: Sat, 13 Sep 2025 03:53:40 -0700 Subject: [PATCH 3/3] Handle referrer without protocol --- index.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 6a5853b..5ee4018 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,8 @@ const attrRef = cur && cur.getAttribute('data-referrer'); let base = window.location.origin; if (attrRef) { - try { base = new URL(attrRef).origin; } catch {} + // Support values missing protocol by resolving against window.location.origin + try { base = new URL(attrRef, window.location.origin).origin; } catch {} } const referrer = base.endsWith('/') ? base : base + '/'; window.polliLib.configure({ referrer });