From 563ece989630c4cc024f9c5e65309f46c29ef2da Mon Sep 17 00:00:00 2001 From: martbost Date: Sat, 3 Oct 2026 19:23:04 -0500 Subject: [PATCH] Traffic exchanges: inside another site's frame, sign-in/join and off-site links open in a new tab (sign-in cookies are refused in frames) Co-Authored-By: Claude Opus 5.5 --- public/admin.html | 2 +- public/assets/common.js | 11 +++++++++++ public/assets/join.js | 6 +++++- public/contract.html | 2 +- public/disclaimer.html | 2 +- public/earning.html | 2 +- public/friday.html | 2 +- public/index.html | 2 +- public/join.html | 4 ++-- public/launch.html | 2 +- public/ledger.html | 2 +- public/my.html | 2 +- public/partners.html | 2 +- public/plays.html | 2 +- public/privacy.html | 2 +- public/terms.html | 2 +- public/tx.html | 2 +- public/wall.html | 2 +- public/wallets.html | 2 +- public/wednesday.html | 2 +- server.js | 2 +- 21 files changed, 36 insertions(+), 21 deletions(-) diff --git a/public/admin.html b/public/admin.html index 4aa43c0..5eb7ac3 100644 --- a/public/admin.html +++ b/public/admin.html @@ -511,7 +511,7 @@ - + diff --git a/public/assets/common.js b/public/assets/common.js index 346a1a5..2cbbc45 100644 --- a/public/assets/common.js +++ b/public/assets/common.js @@ -264,3 +264,14 @@ window.IAP = (function () { function confirmBox(text, o) { return dialog(Object.assign({ type: 'none', text, ok: 'Yes', cancel: 'No' }, o || {})); } return { getConfig, fmtPol, fmtUsd, status, renderNav, refreshNavWallet, describeEvent, feedRow, adSlot, reportAd, requestCode, launchChecks, launchToggle, ask, confirmBox, $ }; })(); +// shown inside someone else's frame (traffic exchanges, 2026-10-03): sign-in, join and off-site links open in a new tab, +// because browsers refuse our session cookie inside another site's frame +(function () { + var framed = false; try { framed = window.top !== window.self; } catch (e) { framed = true; } + if (!framed) return; + document.addEventListener('click', function (e) { + var a = e.target && e.target.closest && e.target.closest('a[href]'); if (!a) return; + var h = a.getAttribute('href') || ''; if (h.charAt(0) === '#' || /^javascript:/i.test(h)) return; + if (a.host !== location.host || /^\/(my|join|signin|login|from|admin)(\/|$)/.test(a.pathname)) { a.target = '_blank'; a.rel = 'noopener'; } + }, true); +})(); diff --git a/public/assets/join.js b/public/assets/join.js index 1ce09ea..1de7664 100644 --- a/public/assets/join.js +++ b/public/assets/join.js @@ -72,7 +72,11 @@ IAP.status(r.sent ? 'Code sent. Check your inbox (and spam, the first time).' : 'Dev mode: code filled in.', 'ok'); $('jnCode').focus(); }); - $('jnSend').addEventListener('click', send); + // framed: the code would arrive but the sign-in cookie would be refused, so the sign-up continues in a full window + // with the email filled in (the link carries the invite token, so the sponsor holds) + let framed = false; try { framed = window.top !== window.self; } catch (e) { framed = true; } + $('jnSend').addEventListener('click', framed ? () => { const t = new URL(location.href); const em = ($('jnEmail').value || '').trim(); if (em) t.searchParams.set('email', em); window.open(t.toString(), '_blank', 'noopener'); IAP.status('Opened InstantAdPay in a new tab. Finish joining there.', 'ok'); } : send); + try { const em = new URLSearchParams(location.search).get('email'); if (em && $('jnEmail') && !$('jnEmail').value) $('jnEmail').value = em.slice(0, 120); } catch (e) {} $('jnResend').addEventListener('click', busy($('jnResend'), async () => { const r = await IAP.requestCode($('jnEmail').value, codeOpts()); if (r.devCode) $('jnCode').value = r.devCode; diff --git a/public/contract.html b/public/contract.html index 3125b00..82ed301 100644 --- a/public/contract.html +++ b/public/contract.html @@ -141,7 +141,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.
- + diff --git a/public/disclaimer.html b/public/disclaimer.html index 7ba1e2e..32af4af 100644 --- a/public/disclaimer.html +++ b/public/disclaimer.html @@ -26,7 +26,7 @@

You decide whether, and how much, to spend. Never spend more than you can afford to lose.

- + diff --git a/public/earning.html b/public/earning.html index aae7c24..a3a8da9 100644 --- a/public/earning.html +++ b/public/earning.html @@ -83,6 +83,6 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees.
- + diff --git a/public/friday.html b/public/friday.html index 83b98f8..f8353e0 100644 --- a/public/friday.html +++ b/public/friday.html @@ -70,6 +70,6 @@ - + diff --git a/public/index.html b/public/index.html index ed88b23..d0d0b05 100644 --- a/public/index.html +++ b/public/index.html @@ -497,7 +497,7 @@ - + diff --git a/public/join.html b/public/join.html index 7cf867d..f138f37 100644 --- a/public/join.html +++ b/public/join.html @@ -157,7 +157,7 @@ InstantAdPay · Contract · Terms · Privacy · Disclaimer - - + + diff --git a/public/launch.html b/public/launch.html index 104f144..e1f2b65 100644 --- a/public/launch.html +++ b/public/launch.html @@ -104,7 +104,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees.
- + diff --git a/public/ledger.html b/public/ledger.html index 603da4c..69f1f4e 100644 --- a/public/ledger.html +++ b/public/ledger.html @@ -39,7 +39,7 @@
InstantAdPay · how it works · contract source ↗
- + diff --git a/public/my.html b/public/my.html index 1524873..0289d3b 100644 --- a/public/my.html +++ b/public/my.html @@ -1126,7 +1126,7 @@ - + diff --git a/public/partners.html b/public/partners.html index 17c07cc..358cc05 100644 --- a/public/partners.html +++ b/public/partners.html @@ -128,7 +128,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford to lose.
- + diff --git a/public/plays.html b/public/plays.html index a1bc841..1fc2f07 100644 --- a/public/plays.html +++ b/public/plays.html @@ -192,7 +192,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never spend what you cannot afford.
- + diff --git a/public/privacy.html b/public/privacy.html index 679d590..ce8a10a 100644 --- a/public/privacy.html +++ b/public/privacy.html @@ -29,7 +29,7 @@

We use reasonable safeguards, but no system is perfectly secure. Protect your email and your wallet.

- + diff --git a/public/terms.html b/public/terms.html index 33ae26a..244daa1 100644 --- a/public/terms.html +++ b/public/terms.html @@ -38,7 +38,7 @@

See also the Disclaimer and Privacy Policy.

- + diff --git a/public/tx.html b/public/tx.html index ac1f77a..c3a1417 100644 --- a/public/tx.html +++ b/public/tx.html @@ -34,7 +34,7 @@

← Back to the live ledger · Read the contract review

- + diff --git a/public/wall.html b/public/wall.html index d4ab3e6..5bd1ca9 100644 --- a/public/wall.html +++ b/public/wall.html @@ -47,7 +47,7 @@ - + diff --git a/public/wallets.html b/public/wallets.html index f123dfc..4df3d73 100644 --- a/public/wallets.html +++ b/public/wallets.html @@ -121,7 +121,7 @@
Advertising services with a performance referral program. Not an investment product; no income guarantees. Crypto transactions are irreversible. Never share your recovery phrase.
- + diff --git a/public/wednesday.html b/public/wednesday.html index 7898fab..419a006 100644 --- a/public/wednesday.html +++ b/public/wednesday.html @@ -63,6 +63,6 @@ - + diff --git a/server.js b/server.js index e5de1bd..1ce86ab 100644 --- a/server.js +++ b/server.js @@ -4217,7 +4217,7 @@ const server = http.createServer(async (req, res) => { + '' + '
' + esc(label) + ' badge for @' + esc(un) + '

@' + esc(un) + ' unlocked ' + label + '

' + esc(sub.charAt(0).toUpperCase() + sub.slice(1)) + '. On InstantAdPay every ad package that sells pays the sponsor in the same transaction, straight to their wallet, on-chain.

' + 'Join @' + esc(un) + '\u2019s line free

Advertising with a performance referral program. Not an investment; no income is guaranteed.

' - + ''; + + ''; res.writeHead(200, baseHeaders({ 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'public, max-age=300' })); return res.end(html); }