diff --git a/ads.js b/ads.js
index 28b0259..895058f 100644
Binary files a/ads.js and b/ads.js differ
diff --git a/public/assets/refuel.js b/public/assets/refuel.js
new file mode 100644
index 0000000..b553ca8
--- /dev/null
+++ b/public/assets/refuel.js
@@ -0,0 +1,46 @@
+/* Drip Runner refuel: one verified visit, then back to the game with a signed receipt. */
+(function () {
+ 'use strict';
+ var $ = function (id) { return document.getElementById(id); };
+ var q = new URLSearchParams(location.search); var tok = q.get('t') || '';
+ var nonce = ''; try { nonce = JSON.parse(atob(tok.split('.')[0].replace(/-/g, '+').replace(/_/g, '/'))).nonce || ''; } catch (e) {}
+ var ret = null, dwell = 8, left = 8, timer = null, done = false;
+ function msg(title, text, backUrl) { $('rfFrame').innerHTML = '
' + title + '
' + text + '
'; $('rfDone').hidden = true; $('rfCheck').hidden = true; if (backUrl) { var b = $('rfBack'); b.hidden = false; b.onclick = function () { location.href = backUrl; }; } }
+ function esc(s) { return String(s == null ? '' : s).replace(/[&<>"']/g, function (c) { return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]; }); }
+ function api(p, body) { return fetch(p, body ? { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) } : {}).then(function (r) { return r.json(); }); }
+ function ring() { $('rfN').textContent = left; $('rfRing').style.setProperty('--p', ((dwell - left) / dwell * 100) + '%'); }
+ function tick() {
+ if (document.hidden) return; // the timer only runs while the page is in front
+ left--; if (left > 0) return ring();
+ clearInterval(timer); ring(); $('rfHint').textContent = 'One quick check to count the visit:';
+ challenge();
+ }
+ function challenge() {
+ api('/api/refuel/challenge?n=' + encodeURIComponent(nonce)).then(function (c) {
+ if (c.early) { setTimeout(challenge, (c.wait || 1) * 1000 + 300); return; }
+ if (c.error) { $('rfHint').textContent = c.error; return; }
+ $('rfPrompt').textContent = 'Tap the ' + c.prompt + ':'; var w = $('rfOpts'); w.innerHTML = '';
+ c.options.forEach(function (em, i) { var b = document.createElement('button'); b.type = 'button'; b.textContent = em; b.addEventListener('click', function () { answer(i); }); w.appendChild(b); });
+ $('rfCheck').hidden = false;
+ });
+ }
+ function answer(i) {
+ api('/api/refuel/done', { n: nonce, answer: i }).then(function (r) {
+ if (r.error) { if (r.retry) return challenge(); $('rfHint').textContent = r.error; $('rfCheck').hidden = true; return; }
+ done = true; $('rfCheck').hidden = true; $('rfHint').textContent = 'Visit counted. Your tank is full.';
+ var b = $('rfDone'); b.disabled = false; b.textContent = 'Back to the run'; b.onclick = function () { location.href = r.ret; };
+ setTimeout(function () { location.href = r.ret; }, 1200);
+ });
+ }
+ if (!tok) return msg('No refuel link', 'Open this page from the game’s Refuel button.');
+ api('/api/refuel/open?t=' + encodeURIComponent(tok)).then(function (r) {
+ if (r.error) return msg('Refuel link problem', esc(r.error));
+ if (r.done) { location.href = r.ret; return; }
+ if (r.none) return msg('No sponsor pages right now', r.why === 'cap' ? 'You have done today’s verified visits on InstantAdPay. Refuels reopen tomorrow.' : 'No verified-visit packs are running at the moment. Try again in a while.', r.ret + '&none=1');
+ ret = r.ret; dwell = r.dwell || 8; left = Math.max(1, dwell - (r.elapsed || 0));
+ $('rfTitle').textContent = r.title || 'Member site'; try { $('rfUrl').textContent = new URL(r.target).hostname; } catch (e) {}
+ var f = document.createElement('iframe'); f.src = r.target; f.setAttribute('referrerpolicy', 'no-referrer'); f.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-forms allow-popups'); $('rfFrame').innerHTML = ''; $('rfFrame').appendChild(f);
+ var o = $('rfOpen'); o.href = r.target; o.hidden = false;
+ ring(); timer = setInterval(tick, 1000);
+ }).catch(function () { msg('Could not load the visit', 'Check your connection and go back to the game.'); });
+})();
diff --git a/public/refuel.html b/public/refuel.html
new file mode 100644
index 0000000..a114c2d
--- /dev/null
+++ b/public/refuel.html
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+Refuel · InstantAdPay verified visit
+
+
+
+
+
InstantAdPay · verified visit · refuel for Drip Runner
+
+
+
…
Loading the sponsor page…
Stay on this page. The timer only runs while it is in front.