Referral layer: guest play from share links (/r/<username>), guest clears paid on sign-in, sharer's link via their IAP join page, 10% referrer slice of each referral refuel's pool income (IAP sponsor), share buttons + stats in the lobby and on chapter clears, wallet-less progress follows the member once a wallet is linked; 11 new checks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
<div><label>Daily cap on drips (POL)</label><input name="dailyCapPol" type="number" step="0.01" min="0"></div>
|
||||
<div><label>Payout threshold (POL)</label><input name="thresholdPol" type="number" step="0.01" min="0"></div>
|
||||
<div><label>Seed float (POL, on purpose)</label><input name="seedPol" type="number" step="0.01" min="0"></div>
|
||||
<div><label>Referrer slice of refuel income (%)</label><input name="refSharePct" type="number" step="1" min="0" max="50"></div>
|
||||
<div><label>Pool share of ad spend (%)</label><input name="poolSharePct" type="number" step="1" min="0" max="100"></div>
|
||||
<div><label>Credits per visit</label><input name="creditsPerVisit" type="number" step="1" min="0"></div>
|
||||
<div><label>USD per credit</label><input name="usdPerCredit" type="number" step="0.001" min="0"></div>
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ function load() {
|
||||
$('pool').innerHTML = stat('Available now', f4(p.available) + ' POL') + stat('In from refuels', f4(p.in)) + stat('Back from spends', f4(p.spends)) + stat('Out as drips', f4(p.out)) + stat('Seed float', f4(p.seed)) + stat('Granted today', f4(p.grantedToday) + ' / ' + f4(p.dailyCapPol));
|
||||
var f = d.faucet; $('faucet').innerHTML = stat('Mode', f.enabled ? (f.dryRun ? 'DRY RUN' : 'LIVE') : 'off') + stat('Wallet', f.address ? f.address.slice(0, 8) + '…' + f.address.slice(-6) : '–') + stat('Balance', f.balance != null ? f4(f.balance) + ' POL' : '–') + stat('Last check', ct(f.checkedAt) || '–') + stat('Last tick', f.lastTick ? esc(JSON.stringify(f.lastTick)) : '–');
|
||||
var s = d.settings, form = $('settings');
|
||||
['dripPol', 'dailyCapPol', 'thresholdPol', 'seedPol', 'poolSharePct', 'creditsPerVisit', 'usdPerCredit', 'usdPerPolFallback', 'lowBalancePol', 'signups'].forEach(function (k) { form.elements[k].value = s[k]; });
|
||||
['refSharePct', 'dripPol', 'dailyCapPol', 'thresholdPol', 'seedPol', 'poolSharePct', 'creditsPerVisit', 'usdPerCredit', 'usdPerPolFallback', 'lowBalancePol', 'signups'].forEach(function (k) { form.elements[k].value = s[k]; });
|
||||
form.elements.item_shield.value = s.itemPol.shield; form.elements.item_slow.value = s.itemPol.slow; form.elements.item_magnet.value = s.itemDrips.magnet; form.elements.item_ship.value = s.itemDrips.ship;
|
||||
form.elements.testers.value = (s.testers || []).join('\n'); form.elements.trial.value = s.trial === false ? 'off' : 'on';
|
||||
table('players', [['Member', function (r) { return '#' + r.memberId + (r.username ? ' @' + esc(r.username) : '') + '<br><span class="muted">' + esc(r.email || '') + '</span>'; }], ['Wallet', function (r) { return r.wallet ? r.wallet.slice(0, 6) + '…' + r.wallet.slice(-4) : '<span style="color:var(--sig)">none</span>'; }], ['Chapter', 'chapter', 1], ['Drips', 'bank', 1], ['Best', 'best', 1], ['Runs', 'runs', 1], ['Armed', function (r) { return Object.keys(r.items || {}).join(', '); }], ['Last seen', function (r) { return ct(r.lastSeen); }]], d.players);
|
||||
@@ -33,7 +33,7 @@ function load() {
|
||||
}
|
||||
$('settings').addEventListener('submit', function (e) {
|
||||
e.preventDefault(); var f = e.target.elements; var body = {};
|
||||
['dripPol', 'dailyCapPol', 'thresholdPol', 'seedPol', 'poolSharePct', 'creditsPerVisit', 'usdPerCredit', 'usdPerPolFallback', 'lowBalancePol', 'signups'].forEach(function (k) { body[k] = f[k].value; });
|
||||
['refSharePct', 'dripPol', 'dailyCapPol', 'thresholdPol', 'seedPol', 'poolSharePct', 'creditsPerVisit', 'usdPerCredit', 'usdPerPolFallback', 'lowBalancePol', 'signups'].forEach(function (k) { body[k] = f[k].value; });
|
||||
body.itemPol = { shield: Number(f.item_shield.value), slow: Number(f.item_slow.value) }; body.itemDrips = { magnet: Number(f.item_magnet.value), ship: Number(f.item_ship.value) };
|
||||
body.trial = f.trial.value; body.testers = f.testers.value.split(/\r?\n/).map(function (x) { return x.trim(); }).filter(Boolean);
|
||||
api('/api/admin/settings', body).then(function (r) { $('saveOut').textContent = r.ok ? 'Saved.' : (r.error || 'Failed'); load(); });
|
||||
|
||||
+10
-2
@@ -5,6 +5,10 @@
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover,user-scalable=no">
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<title>Drip Runner</title>
|
||||
<meta property="og:title" content="Drip Runner: hop the network, get paid in POL">
|
||||
<meta property="og:description" content="A fast little runner game for InstantAdPay members. Clear chapters, refuel on sponsor pages, collect POL.">
|
||||
<meta property="og:image" content="https://driprunner.saasy.top/badges/ch1.jpg">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800;900&family=Manrope:wght@400;600;800&family=JetBrains+Mono:wght@500;700&display=swap">
|
||||
<style>
|
||||
:root{color-scheme:dark;--page:#050912;--ink:#EEF3FA;--ink2:#AFC0D8;--muted:#6E82A3;--cyan:#22D3EE;--cyan2:#8FF0FF;--gold:#FFC24B;--gold2:#FFE9A8;--bot:#FF3B7A;--sig:#FF6A1A;--ok:#34D399;--violet:#8B5CF6;--panel:#0E172D;--panel2:#141F3A;--line:#24365F;
|
||||
@@ -77,6 +81,7 @@ canvas#game{position:absolute;inset:0;width:100%;height:100%;display:block;touch
|
||||
.led{display:flex;justify-content:space-between;gap:8px;font-size:12px;color:var(--ink2);padding:7px 2px;border-top:1px solid var(--line)}.led:first-child{border-top:0}.led .m{font:700 12px var(--mono);color:var(--gold);white-space:nowrap}.led .m.ok{color:var(--ok)}.led .m.neg{color:var(--sig)}.led a{color:var(--cyan2)}
|
||||
.prog{height:8px;background:rgba(255,255,255,.08);border-radius:4px;overflow:hidden;margin-top:8px}.prog i{display:block;height:100%;background:linear-gradient(90deg,var(--cyan),var(--gold));box-shadow:0 0 10px rgba(255,194,75,.5)}
|
||||
.tip{margin:12px 0 0;padding:10px 12px;border-radius:10px;background:rgba(34,211,238,.07);border:1px solid rgba(34,211,238,.25);font-size:12px;line-height:1.45;color:var(--ink2);text-align:left}.tip b{display:block;font:700 9px var(--body);letter-spacing:.16em;text-transform:uppercase;color:var(--cyan);margin-bottom:3px}
|
||||
.shr{margin-top:10px;padding:10px 12px;border-radius:10px;border:1px solid var(--line);background:rgba(14,23,45,.6);font-size:11px;color:var(--muted);text-align:center}.shr b{color:var(--gold)}.shr .btn{margin-top:8px}
|
||||
.toast{position:absolute;left:50%;bottom:calc(70px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:20;background:var(--panel2);border:1px solid var(--line);color:var(--ink);font-size:12px;padding:8px 12px;border-radius:10px;opacity:0;transition:opacity .2s;pointer-events:none;max-width:92%;text-align:center}
|
||||
.toast.on{opacity:1}
|
||||
.tapdesk{position:absolute;bottom:calc(14px + env(safe-area-inset-bottom,0px));left:14px;z-index:5;font:600 10px var(--body);letter-spacing:.14em;text-transform:uppercase;color:var(--muted);pointer-events:none}
|
||||
@@ -110,18 +115,21 @@ canvas#game{position:absolute;inset:0;width:100%;height:100%;display:block;touch
|
||||
<button class="btn" id="bPlay" type="button">Play</button>
|
||||
<div class="row2"><button class="btn ghost" id="bHangar" type="button">Hangar</button><button class="btn ghost" id="bBalance" type="button">Balance</button></div>
|
||||
<a class="btn gold" id="bLevel" href="https://instantadpay.com/my#buy" style="text-decoration:none;text-align:center;font-size:13px;padding:11px">Level up on InstantAdPay</a>
|
||||
<a class="btn" id="bSignin" href="#" hidden style="text-decoration:none;text-align:center">Sign in to keep progress</a>
|
||||
<div class="shr" id="lShare" hidden><div id="lShareStat"></div><button class="btn ghost" id="bShare" type="button">Share your link</button></div>
|
||||
<div class="member" id="lMember"><i></i>connecting…</div>
|
||||
<div class="member" style="margin-top:6px"><a id="lIap" href="https://instantadpay.com/my" style="color:var(--muted)">InstantAdPay dashboard</a> · <a href="/" style="color:var(--muted)">tester briefing</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ov" id="ovLoad"><div class="card"><div class="eyebrow">Drip Runner</div><h2 id="loadTitle">Connecting…</h2><p id="loadText">Checking your InstantAdPay sign-in.</p><a class="btn" id="loadBtn" href="/" hidden>Tester page</a></div></div>
|
||||
<div class="ov" id="ovLoad"><div class="card"><div class="eyebrow">Drip Runner</div><h2 id="loadTitle">Connecting…</h2><p id="loadText">Checking your InstantAdPay sign-in.</p><button class="btn" id="loadGuest" type="button" hidden>Play now</button><a class="btn" id="loadBtn" href="/" hidden>Tester page</a></div></div>
|
||||
|
||||
<div class="ov" id="ovClear" hidden><div class="card">
|
||||
<div class="eyebrow" id="cEyebrow">Chapter cleared</div><h2 id="cTitle">Banked 20 drips</h2>
|
||||
<div class="big" id="cBig">+0.010<small>POL</small></div><p id="cText"></p><span class="chip ok" id="cChip"></span>
|
||||
<div class="tip" id="cTip" hidden></div>
|
||||
<button class="btn gold" id="bNext" type="button">Next chapter</button><button class="btn ghost" id="bLobby1" type="button">Back to lobby</button>
|
||||
<button class="btn gold" id="bNext" type="button">Next chapter</button>
|
||||
<div class="row2"><button class="btn ghost" id="bShareClear" type="button" hidden>Share this</button><a class="btn ghost" id="bClearSignin" href="#" hidden style="text-decoration:none;text-align:center">Sign in to collect</a></div><button class="btn ghost" id="bLobby1" type="button">Back to lobby</button>
|
||||
</div></div>
|
||||
|
||||
<div class="ov" id="ovOver" hidden><div class="card">
|
||||
|
||||
+37
-5
@@ -44,13 +44,31 @@ var hudCache = {}; function setHud() { if (!R) return; var v = { d: R.drips, c:
|
||||
function f3(n) { return Number(n || 0).toFixed(3); }
|
||||
|
||||
/* ---------- lobby / me ---------- */
|
||||
function loadMe() { return api('/api/me').then(function (r) { if (r._status !== 200) throw r; ME = r.me; P = r.player; BAL = r.balance; POOL = r.pool; IAP = r.iap || IAP; TIPS = r.tips || []; return r; }); }
|
||||
var ME_EXTRA = {};
|
||||
function loadMe() { return api('/api/me').then(function (r) { if (r._status !== 200) throw r; ME = r.me; P = r.player; BAL = r.balance; POOL = r.pool; IAP = r.iap || IAP; TIPS = r.tips || []; ME_EXTRA = { signin: r.signin, share: r.share, referrals: r.referrals }; return r; }); }
|
||||
// share: the phone's share sheet where there is one, else copy the link
|
||||
function share(text) {
|
||||
var url = ME_EXTRA.share; if (!url) return toast('Set a username on InstantAdPay to get a share link.');
|
||||
if (navigator.share) { navigator.share({ title: 'Drip Runner', text: text, url: url }).catch(function () {}); return; }
|
||||
var full = text + ' ' + url;
|
||||
if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(full).then(function () { toast('Link copied. Paste it anywhere.'); }, function () { window.prompt('Copy your link', url); });
|
||||
else window.prompt('Copy your link', url);
|
||||
}
|
||||
function lobby() {
|
||||
R = null; $('hud').classList.remove('on'); $('tapdesk').hidden = true;
|
||||
$('lChap').textContent = P.chapter; $('lDrips').textContent = P.bank.toLocaleString(); $('lPol').textContent = f3(BAL.unpaid);
|
||||
$('lPool').innerHTML = 'POL pool <b>' + f3(POOL.available) + '</b> · today’s cap left <b>' + f3(POOL.capLeft) + '</b> · a chapter drip is <b>' + f3(POOL.dripPol) + '</b>';
|
||||
$('lIap').href = IAP + '/my'; $('bLevel').href = IAP + '/my#buy'; tip('lTip');
|
||||
$('lMember').innerHTML = '<i class="' + (ME.wallet ? '' : 'no') + '"></i>InstantAdPay · ' + (ME.username ? '@' + ME.username : '#' + ME.memberId) + ' · ' + (ME.wallet ? ME.wallet.slice(0, 6) + '…' + ME.wallet.slice(-4) : 'no wallet on file');
|
||||
if (ME.guest) {
|
||||
$('lMember').innerHTML = '<i class="no"></i>Playing as a guest · sign in to keep your progress and collect POL';
|
||||
$('bSignin').hidden = false; $('bSignin').href = ME_EXTRA.signin || (IAP + '/api/my/driprunner'); $('lShare').hidden = true;
|
||||
} else {
|
||||
$('lMember').innerHTML = '<i class="' + (ME.wallet ? '' : 'no') + '"></i>InstantAdPay · ' + (ME.username ? '@' + ME.username : '#' + ME.memberId) + ' · ' + (ME.wallet ? ME.wallet.slice(0, 6) + '…' + ME.wallet.slice(-4) : 'no wallet on file');
|
||||
$('bSignin').hidden = true;
|
||||
var rf = ME_EXTRA.referrals || {};
|
||||
$('lShare').hidden = !ME_EXTRA.share;
|
||||
$('lShareStat').innerHTML = 'Your link: <b>' + (rf.clicks || 0) + '</b> visits · <b>' + (rf.count || 0) + '</b> players on your team · <b>' + f3(rf.earned) + '</b> POL earned from their refuels (' + (rf.pct || 0) + '% of each)';
|
||||
}
|
||||
show('ovLobby');
|
||||
}
|
||||
|
||||
@@ -122,13 +140,17 @@ function cleared() {
|
||||
$('cEyebrow').textContent = 'Chapter ' + c.chapter + ' cleared'; $('cTitle').textContent = 'Banked ' + (R.goal) + ' drips';
|
||||
var m = Math.floor(c.playTime / 60), s = c.playTime % 60; var tm = m + ':' + (s < 10 ? '0' : '') + s;
|
||||
$('cBig').innerHTML = '+' + f3(c.pol) + '<small>POL</small>'; $('cBig').classList.toggle('dim', !c.pol);
|
||||
var why = { paid: 'First clear, verified. Added to your game balance.', replay: c.first ? 'Verified.' : 'You cleared this one before. Only the first clear pays.', pool: 'The POL pool is empty right now. Refuel visits fill it, so this clear counts but pays nothing.', cap: 'Today’s pool cap is spent. Chapter counts, no POL today.', flagged: 'This run was flagged by the server check, so it pays nothing.' };
|
||||
var why = { paid: 'First clear, verified. Added to your game balance.', replay: c.first ? 'Verified.' : 'You cleared this one before. Only the first clear pays.', pool: 'The POL pool is empty right now. Refuel visits fill it, so this clear counts but pays nothing.', cap: 'Today’s pool cap is spent. Chapter counts, no POL today.', flagged: 'This run was flagged by the server check, so it pays nothing.', guest: 'You are playing as a guest. Sign in with InstantAdPay and this clear pays ' + f3(POOL.dripPol) + ' POL into your balance. Your progress comes with you.' };
|
||||
$('bShareClear').hidden = !!ME.guest || !ME_EXTRA.share; $('bShareClear').dataset.text = 'I just cleared Chapter ' + c.chapter + ' in Drip Runner' + (c.pol ? ' and it paid ' + f3(c.pol) + ' POL' : '') + '. Hop the network, dodge the bots:';
|
||||
$('bClearSignin').hidden = !ME.guest; if (ME.guest) $('bClearSignin').href = ME_EXTRA.signin || (IAP + '/api/my/driprunner');
|
||||
$('cText').textContent = why[c.reason] || ''; $('cChip').className = 'chip ' + (c.pol ? 'ok' : 'sig'); $('cChip').textContent = (c.pol ? 'verified' : c.reason) + ' · ' + tm + ' play time';
|
||||
R.chapter = c.next; R.goal = c.nextGoal; R.chapDrips = 0; if (r.pool != null) POOL.available = r.pool;
|
||||
tip('cTip'); setTimeout(function () { show('ovClear'); }, 500);
|
||||
});
|
||||
}
|
||||
$('bNext').addEventListener('click', function () { if (!R) return; R.paused = false; R.inv = 1.5; hideAll(); });
|
||||
$('bShareClear').addEventListener('click', function () { share(this.dataset.text || 'Play Drip Runner with me:'); });
|
||||
$('bShare').addEventListener('click', function () { share('I am playing Drip Runner, a game that pays in POL. Hop the network, dodge the bots:'); });
|
||||
$('bRestart').addEventListener('click', function () { endRun().then(newRun); });
|
||||
function endRun() { var id = R && R.id; R = null; hideAll(); return id ? api('/api/run/end', { runId: id }).catch(function () {}) : Promise.resolve(); }
|
||||
['bLobby1', 'bLobby2'].forEach(function (id) { $(id).addEventListener('click', function () { endRun().then(loadMe).then(lobby); }); });
|
||||
@@ -141,7 +163,9 @@ function snapshot(nonce) {
|
||||
try { sessionStorage.setItem('dr.snap', JSON.stringify(s)); } catch (e) {}
|
||||
}
|
||||
$('bRefuel').addEventListener('click', function () {
|
||||
if (!R) return; $('bRefuel').disabled = true;
|
||||
if (!R) return;
|
||||
if (ME.guest) { location.href = ME_EXTRA.signin || (IAP + '/api/my/driprunner'); return; } // guests sign in first; their progress follows them
|
||||
$('bRefuel').disabled = true;
|
||||
api('/api/refuel/start', { runId: R.id }).then(function (r) {
|
||||
$('bRefuel').disabled = false;
|
||||
if (r._status !== 200) return toast(r.error || 'Refuel is not available right now.');
|
||||
@@ -224,8 +248,16 @@ resize(); requestAnimationFrame(loop);
|
||||
loadMe().then(function () {
|
||||
var q = new URLSearchParams(location.search);
|
||||
if (q.get('resume')) { history.replaceState(null, '', '/play'); return tryResume(q); }
|
||||
if (q.get('collected')) { history.replaceState(null, '', '/play'); setTimeout(function () { toast('Signed in. Your guest clears paid ' + q.get('collected') + ' drip' + (q.get('collected') === '1' ? '' : 's') + ' into your balance.'); }, 600); }
|
||||
lobby();
|
||||
}).catch(function (r) {
|
||||
$('loadTitle').textContent = 'Sign in first'; $('loadText').textContent = (r && r.error) || 'Open Drip Runner from your InstantAdPay dashboard.'; var b = $('loadBtn'); b.hidden = false; b.textContent = 'Open through InstantAdPay'; b.href = (r && r.iap) || IAP + '/api/my/driprunner';
|
||||
var b = $('loadBtn'); b.hidden = false; b.href = (r && (r.signin || r.iap)) || IAP + '/api/my/driprunner';
|
||||
if (r && r.guestOk) { // came through a share or tester link: play first, sign in later
|
||||
$('loadTitle').textContent = 'Ready to run'; $('loadText').textContent = 'Play a run right now, no sign-in. Sign in with InstantAdPay when you want to keep your progress, refuel, and collect POL.';
|
||||
b.textContent = 'Sign in with InstantAdPay'; b.className = 'btn ghost'; var g = $('loadGuest'); g.hidden = false;
|
||||
g.onclick = function () { g.disabled = true; api('/api/guest', {}).then(function (x) { if (x._status !== 200) { g.disabled = false; return toast(x.error || 'Could not start a guest run.'); } return loadMe().then(function () { lobby(); newRun(); }); }); };
|
||||
return;
|
||||
}
|
||||
$('loadTitle').textContent = 'Sign in first'; $('loadText').textContent = (r && r.error) || 'Open Drip Runner from your InstantAdPay dashboard.'; b.textContent = 'Open through InstantAdPay';
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user