From 36ca8084e19dd5b090c3ec0f0e2da357bbd02fac Mon Sep 17 00:00:00 2001 From: xecdev Date: Wed, 19 Feb 2025 09:25:08 +0430 Subject: [PATCH 1/2] Fix session synchronization --- paybutton.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paybutton.php b/paybutton.php index 31c9107..96175e0 100644 --- a/paybutton.php +++ b/paybutton.php @@ -63,4 +63,4 @@ // Initialize AJAX handlers. new PayButton_AJAX(); -} ); +}, 1); // Use a priority to ensure this runs before other actions that might depend on session data. \ No newline at end of file From a369fc9df0c1e1b3e3a87c946d85f2c3f29da4b4 Mon Sep 17 00:00:00 2001 From: xecdev Date: Wed, 19 Feb 2025 19:37:29 +0430 Subject: [PATCH 2/2] Implement cache-busting mechanism --- assets/js/paybutton-paywall-cashtab-login.js | 4 ++++ assets/js/paywalled-content.js | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/assets/js/paybutton-paywall-cashtab-login.js b/assets/js/paybutton-paywall-cashtab-login.js index 1dbd905..eaba041 100644 --- a/assets/js/paybutton-paywall-cashtab-login.js +++ b/assets/js/paybutton-paywall-cashtab-login.js @@ -15,6 +15,10 @@ function handleLogin(address) { address: address }, function() { + var baseUrl = location.href.split('?')[0]; + // Build a new URL that includes a timestamp parameter to bust caches + var newUrl = baseUrl + '?t=' + Date.now(); + window.history.replaceState(null, '', newUrl); location.reload(); } ); diff --git a/assets/js/paywalled-content.js b/assets/js/paywalled-content.js index 1630d25..93adf1d 100644 --- a/assets/js/paywalled-content.js +++ b/assets/js/paywalled-content.js @@ -48,9 +48,11 @@ jQuery(document).ready(function($) { }, success: function() { setTimeout(function() { - // Build the new URL with the hash - var newUrl = location.href.split('#')[0] + '#unlocked'; - // Replace the current URL in the address bar without triggering a navigation + // Get the base URL (without any query parameters or hash) + var baseUrl = location.href.split('#')[0].split('?')[0]; + // Build a new URL that includes a timestamp parameter to bust caches + var newUrl = baseUrl + '?t=' + Date.now() + '#unlocked'; + // Update the URL in the address bar without triggering a navigation window.history.replaceState(null, '', newUrl); // Force a reload location.reload();