Staging test mode (Marty's rule: test apps never touch real people): TANK_MODE=iap with DRAFT_LIVE not 1 reads the pool + statuses from InstantAdPay but every pick (5 instant picks on a purchase, the Monday draft) and release is a preview kept here: no tank.adopt(), no sponsor change, no email. Yellow 'TEST MODE, nobody is adopted' strip on every page (/api/config testMode). Admin view: testMode, previewPicks, adoptionMailsSkipped. iap-tank 35/35 (new section 6 against the real draftpartner.js), unit 62/62, smoke 156/156. common.js/fx.css ?v=3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ KEEPER_KEY= # the voucher key; its a
|
||||
WALLETCONNECT_PROJECT_ID=
|
||||
# the holding tank: stub (phase 1 fixture) | hub (phase 2, not wired)
|
||||
TANK_MODE=stub
|
||||
DRAFT_LIVE=0 # 1 only at go-live: picks become real IAP adoptions + sponsor emails
|
||||
# the draft (Central time); every value here is an open question for Marty
|
||||
DRAFT_DOW=1
|
||||
DRAFT_HOUR_CT=19
|
||||
|
||||
@@ -21,6 +21,7 @@ services:
|
||||
HUB_URL: ${HUB_URL:-}
|
||||
HUB_SECRET: ${HUB_SECRET:-}
|
||||
TANK_MODE: ${TANK_MODE:-}
|
||||
DRAFT_LIVE: ${DRAFT_LIVE:-0} # 1 = picks are real InstantAdPay adoptions (go-live only); anything else = test mode, nobody adopted
|
||||
IAP_URL: ${IAP_URL:-}
|
||||
LS_URL: ${LS_URL:-}
|
||||
DRAFT_PARTNER_SECRET: ${DRAFT_PARTNER_SECRET:-}
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body data-page="admin">
|
||||
<main class="wrap">
|
||||
@@ -28,7 +28,7 @@
|
||||
<section class="panel"><h3>Best Coach pot (last week)</h3><pre id="potOut" class="kit-pre"></pre></section>
|
||||
<section class="panel"><h3>Old-link map (JSON {"oldrefs": {"old": "network username"}})</h3><input type="file" id="oldFile" accept="application/json"><pre id="oldOut" class="kit-pre"></pre></section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/misc.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/misc.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -29,6 +29,9 @@ window.FX = (function () {
|
||||
+ links.map(l => '<a href="' + l[0] + '"' + (l[0] === active ? ' class="on" aria-current="page"' : '') + '>' + l[1] + '</a>').join('') + '</div></div>';
|
||||
document.body.prepend(nav);
|
||||
if (week) setWeek(week);
|
||||
// staging test mode (DRAFT_LIVE not 1): say so on every page, plainly
|
||||
getConfig().then(c => { if (!c || !c.testMode || $('testMode')) return; const b = document.createElement('div'); b.id = 'testMode'; b.className = 'testmode'; b.setAttribute('role', 'status');
|
||||
b.innerHTML = '<div class="wrap"><b>TEST MODE, nobody is adopted.</b> Picks on this site are previews: no one gets a new sponsor and no email is sent.</div>'; nav.after(b); }).catch(() => {});
|
||||
}
|
||||
// ISO-ish week number of a Monday date (the mockup's "DRAFT WEEK 46")
|
||||
function weekNo(monday) { const d = new Date(monday + 'T12:00:00Z'); const t = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate() + 3)); const y = new Date(Date.UTC(t.getUTCFullYear(), 0, 4)); return 1 + Math.round(((t - y) / 86400000 - 3 + ((y.getUTCDay() + 6) % 7)) / 7); }
|
||||
|
||||
@@ -217,3 +217,7 @@ footer.foot p{margin:4px 0}footer.foot a{color:var(--gold)}footer.foot .here{col
|
||||
.kit-pre{white-space:pre-wrap;font:inherit;font-size:14px;color:var(--muted);margin:0;background:var(--bar);padding:12px}
|
||||
.ccard .l .kvr{color:var(--muted)}.ccard .l .kvr span{color:var(--muted)}.ccard .l .kvr b{font-family:var(--text);font-size:15px;color:#fff;word-break:normal}
|
||||
.splitbar div{font-size:11px;padding:0 4px}
|
||||
|
||||
/* staging test mode strip (DRAFT_LIVE not 1) */
|
||||
.testmode{background:#ffc93c;color:#0b1530;font-size:14px;padding:8px 0;border-bottom:2px solid #0b1530}
|
||||
.testmode b{letter-spacing:.04em}
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body data-page="builder">
|
||||
<main class="wrap">
|
||||
@@ -28,8 +28,8 @@
|
||||
<p id="status" class="note" hidden></p>
|
||||
<section class="panel" id="bList"></section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/wallet.js?v=2"></script>
|
||||
<script src="/assets/misc.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/wallet.js?v=3"></script>
|
||||
<script src="/assets/misc.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body>
|
||||
<main class="wrap">
|
||||
@@ -28,7 +28,7 @@
|
||||
<section style="display:flex;flex-direction:column;gap:12px"><h2>The five tiers</h2><div class="cards" id="tiers"></div>
|
||||
<p class="small">Rookie when drafted, Starter when they link a wallet, Pro when they switch on payouts, All-Star at their first purchase, Hall of Fame when they hold a position of their own and coach a team. Tap a card to flip it for the stats on the back.</p></section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/cards.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/cards.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body>
|
||||
<main class="wrap">
|
||||
@@ -27,7 +27,7 @@
|
||||
<div class="r"><h3>The team</h3><p class="small" style="color:#4a587e">Milestones only. Every Monday this coach drafts people who joined the network without a sponsor and helps them get started.</p><div class="row"><a class="btn-gold" id="cJoin" href="https://instantadpay.com/">Join the network free</a><a class="btn" href="/join">Coach a team of your own</a></div></div></section>
|
||||
<section class="cards" id="cTeam"></section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/coach.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/coach.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body>
|
||||
<main class="wrap">
|
||||
<section><p class="kicker">CONTRACT</p><h1 style="font-size:44px">Check the contract yourself</h1><p class="muted">Read live from Polygon. No owner withdraw, no proxy, the split fixed in the code.</p></section>
|
||||
<section class="panel"><div class="tbl"><table id="facts"></table></div></section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/contract.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body data-page="legal">
|
||||
<main class="wrap legal">
|
||||
@@ -30,7 +30,7 @@
|
||||
<section class="card"><h2>Prices and taxes</h2><p>Positions are priced in US dollars and paid in POL, whose price moves. You are responsible for any taxes on what you receive where you live.</p></section>
|
||||
<section class="card"><h2>Who to ask</h2><p>TrustClickz, 615 Green Valley Drive, Moody, AL 35004. <a href="https://instantadpay.com/support" target="_blank" rel="noopener">Network support</a>.</p></section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/misc.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/misc.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -15,4 +15,4 @@ h1{margin:0;font-family:Oswald,Impact,sans-serif;font-weight:700;font-size:108px
|
||||
</style></head><body data-page="draftday"><div class="dd"><img class="spot" src="/art/dd/spotlight.jpg" alt=""><img class="conf" src="/art/dd/confetti.png" alt=""><div class="top"><span class="wm">5X<b>YOUR</b>TEAM</span><span class="wk" id="ddWeek"></span></div>
|
||||
<h1>DRAFT DAY<br><span>RESULTS</span></h1><div class="rows" id="ddRows"></div>
|
||||
<div class="ft"><div><span id="ddStats"></span><span class="p" id="ddPot"></span></div><span class="url">5xyourteam.com</span></div></div>
|
||||
<script src="/assets/common.js?v=2"></script><script src="/assets/misc.js?v=2"></script></body></html>
|
||||
<script src="/assets/common.js?v=3"></script><script src="/assets/misc.js?v=3"></script></body></html>
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body>
|
||||
<main class="wrap">
|
||||
@@ -53,7 +53,7 @@
|
||||
<p class="small">A position buys a draft spot and coaching tools, not income. Nothing is promised.</p></div>
|
||||
</section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/board.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/board.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body>
|
||||
<main class="wrap">
|
||||
@@ -34,8 +34,8 @@
|
||||
<p class="small">Your sponsor gets 25% and levels 2 to 5 of your network sponsor line get 5% each. Only people who hold a position can receive a share: anyone in your line who does not is passed over and the share goes up to the next person who does. 10% goes to the weekly Best Coach pot and 45% to 5xYourTeam. The contract keeps nothing. Check it on the <a href="/contract">contract page</a> and every payment on the <a href="/ledger">ledger</a>.</p>
|
||||
<p class="small">A position buys a draft spot and coaching tools, not income. Nothing is promised.</p></section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/wallet.js?v=2"></script>
|
||||
<script src="/assets/join.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/wallet.js?v=3"></script>
|
||||
<script src="/assets/join.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body>
|
||||
<main class="wrap">
|
||||
@@ -28,7 +28,7 @@
|
||||
<section class="panel"><div class="tbl"><table id="rows"><thead><tr><th>WHEN</th><th>POSITION</th><th>PAID IN THE SAME TRANSACTION</th><th></th></tr></thead><tbody></tbody></table></div></section>
|
||||
<section class="panel"><h3 style="font-size:24px">Best Coach payouts</h3><div class="tbl"><table id="payouts"><thead><tr><th>WEEK</th><th>COACH</th><th>POL</th><th></th></tr></thead><tbody></tbody></table></div></section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/ledger.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/ledger.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body data-page="legal">
|
||||
<main class="wrap legal">
|
||||
@@ -32,7 +32,7 @@
|
||||
<section class="card"><h2>Your choices</h2><p>You can ask us to remove your account and messages here. Records on the blockchain cannot be removed by anyone.</p></section>
|
||||
<section class="card"><h2>Contact</h2><p>TrustClickz, 615 Green Valley Drive, Moody, AL 35004. <a href="https://instantadpay.com/support" target="_blank" rel="noopener">Network support</a>. Last updated November 15, 2026.</p></section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/misc.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/misc.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body data-page="promote">
|
||||
<main class="wrap">
|
||||
@@ -28,8 +28,8 @@
|
||||
<p id="status" class="note" hidden></p>
|
||||
<div id="kit" style="display:flex;flex-direction:column;gap:16px"></div>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/kitpage.js?v=2"></script>
|
||||
<script src="/assets/misc.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/kitpage.js?v=3"></script>
|
||||
<script src="/assets/misc.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body>
|
||||
<main class="wrap">
|
||||
@@ -52,8 +52,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/wallet.js?v=2"></script>
|
||||
<script src="/assets/team.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/wallet.js?v=3"></script>
|
||||
<script src="/assets/team.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
<link rel="icon" type="image/png" href="/art/icon-192.png"><link rel="apple-touch-icon" href="/art/icon-192.png">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=2">
|
||||
<link rel="stylesheet" href="/assets/fx.css?v=3">
|
||||
</head>
|
||||
<body data-page="legal">
|
||||
<main class="wrap legal">
|
||||
@@ -37,7 +37,7 @@
|
||||
<section class="card"><h2>The service</h2><p>The site is provided as it is. We work to keep it running but cannot promise it will always be available or free of errors. The smart contract runs on Polygon on its own; its rules are public on the <a href="/contract">contract page</a>. We may change features, draft settings, the price of future positions or these terms; changes apply from the date they are posted here. As far as the law allows, our total responsibility to you is limited to what you paid for the purchase in question. These terms are governed by the laws of the State of Alabama, USA.</p></section>
|
||||
<section class="card"><h2>Contact</h2><p>TrustClickz, 615 Green Valley Drive, Moody, AL 35004. <a href="https://instantadpay.com/support" target="_blank" rel="noopener">Network support</a>. Last updated November 15, 2026.</p></section>
|
||||
</main>
|
||||
<script src="/assets/common.js?v=2"></script>
|
||||
<script src="/assets/misc.js?v=2"></script>
|
||||
<script src="/assets/common.js?v=3"></script>
|
||||
<script src="/assets/misc.js?v=3"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+24
-1
@@ -40,7 +40,7 @@ function fakeAccounts() {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'fx-iaptank-'));
|
||||
const iapDir = path.join(dir, 'iap'); fs.mkdirSync(iapDir);
|
||||
delete process.env.DATABASE_URL;
|
||||
Object.assign(process.env, { DATA_DIR: path.join(dir, 'fx'), DOCSTORE_URL: '', TANK_MODE: 'iap', IAP_URL: 'http://127.0.0.1:' + PORT, DRAFT_PARTNER_SECRET: SECRET, DRAFT_ROUNDS: '2', PICK_RETURN_DAYS: '3' });
|
||||
Object.assign(process.env, { DATA_DIR: path.join(dir, 'fx'), DOCSTORE_URL: '', TANK_MODE: 'iap', IAP_URL: 'http://127.0.0.1:' + PORT, DRAFT_PARTNER_SECRET: SECRET, DRAFT_ROUNDS: '2', PICK_RETURN_DAYS: '3', DRAFT_LIVE: '1' }); // sections 1-5 live; section 6 = staging test mode
|
||||
fs.mkdirSync(process.env.DATA_DIR);
|
||||
require(path.join(APP, 'config.js')).reset(); const C = require(path.join(APP, 'config.js')).get();
|
||||
const store = require(path.join(APP, 'store.js')); const league = require(path.join(APP, 'league.js')); const tank = require(path.join(APP, 'tankpool.js'));
|
||||
@@ -137,6 +137,29 @@ function fakeAccounts() {
|
||||
ok(r.error && store.picks().length === n0, 'no answer: a pick is refused and nothing is recorded', r);
|
||||
const st = await tank.status([back[0].id], now()); ok(st[back[0].id] === null, 'no answer: status is null (nothing changes on the sweep)');
|
||||
ok(tank.view().remote.failed >= 3 && tank.view().remote.secret === true, 'the admin view counts the failures', tank.view().remote);
|
||||
|
||||
console.log('6. staging test mode (DRAFT_LIVE not 1): the pool is read, picks are previews, nobody is adopted, no mail');
|
||||
C.iapBase = 'http://127.0.0.1:' + PORT; delete process.env.DRAFT_LIVE;
|
||||
const m0 = mails.length, c0 = chats.length;
|
||||
ok(tank.preview() === true && tank.live() === false && tank.view().testMode === true, 'test mode is on without DRAFT_LIVE=1', tank.view());
|
||||
const tp = await league.pool(now()); ok(tp.length > 0, 'the pool is still read from InstantAdPay', tp.length);
|
||||
const who = tp[0]; const whoEmail = emailOfId(who.id); const sp0 = await sponsorOf(whoEmail);
|
||||
r = await league.instantPick(A, who.id);
|
||||
ok(r.ok && /^preview:/.test(store.pick(r.pickId).ref), 'instant pick in test mode: recorded here as a preview (ref preview:...)', r);
|
||||
ok(await sponsorOf(whoEmail) === sp0 && (await itank.openOf(whoEmail)).length === 0, 'InstantAdPay: no sponsor change, no open adoption');
|
||||
ok(mails.length === m0 && chats.length === c0, 'no adoption email, no chat', mails.slice(m0));
|
||||
ok(!(await league.pool(now())).some(x => x.id === who.id), 'a previewed person leaves the pool on this site only');
|
||||
const nextMon = store.ctToMs('2026-11-23', 19); league.clock.set(nextMon + 1000); await league.tick();
|
||||
const d2 = store.draft('2026-11-23'); const made2 = d2 ? d2.made.filter(x => x.person) : [];
|
||||
ok(d2 && d2.status === 'done' && made2.length > 0, 'the Monday draft runs in test mode', d2 && d2.made.map(x => x.person ? 'pick' : x.skipped || 'x'));
|
||||
const prev = store.picks().filter(p => p.status === 'open');
|
||||
ok(prev.length > 0 && prev.every(p => /^preview:/.test(p.ref || '')), 'every open pick is a preview', prev.map(p => p.ref));
|
||||
let clean = true; for (const p of prev) { const e = emailOfId(p.person); if ((await itank.openOf(e)).length || (await sponsorOf(e)) !== '') clean = false; }
|
||||
ok(clean, 'InstantAdPay: no drafted person got a sponsor or an open adoption');
|
||||
ok(mails.length === m0 && chats.length === c0, 'still no email or chat after the draft', mails.length - m0);
|
||||
league.clock.set(nextMon + 3 * D); const rp = prev.find(p => p.coach === A) || prev[0]; r = await league.release(rp.coach, rp.id);
|
||||
ok(r.ok && store.pick(rp.id).status === 'returned' && mails.length === m0, 'releasing a preview pick touches nothing on InstantAdPay', r);
|
||||
ok(tank.view().adoptionMailsSkipped >= 1 + made2.length, 'the admin view counts the adoptions (and emails) that test mode skipped', tank.view());
|
||||
} finally { srv.close(); fs.rmSync(dir, { recursive: true, force: true }); }
|
||||
console.log('\n' + pass + ' passed, ' + fail + ' failed');
|
||||
process.exit(fail ? 1 : 0);
|
||||
|
||||
@@ -248,7 +248,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (p === '/api/config' && req.method === 'GET') {
|
||||
return json(res, 200, { site: C.site, siteName: C.siteName, chainId: C.chainId, chainName: C.chainName, rpc: C.publicRpc, walletConnectProjectId: C.walletConnectProjectId,
|
||||
position: C.position, split: C.split, draft: { dow: C.draft.dow, hour: C.draft.hour, rounds: C.draft.rounds, pickSeconds: C.draft.pickSeconds }, picks: { returnDays: C.picks.returnDays, maxOpen: C.picks.maxOpen, holdHours: C.picks.holdHours },
|
||||
pot: C.pot, sso: networksso.enabled(), shop: { live: shop.watching(), contract: shop.watching() ? C.contractAddress : null }, explorer: C.explorer, tank: C.tankMode, joinUrl: joinUrl('') });
|
||||
pot: C.pot, sso: networksso.enabled(), shop: { live: shop.watching(), contract: shop.watching() ? C.contractAddress : null }, explorer: C.explorer, tank: C.tankMode, testMode: tank.preview(), joinUrl: joinUrl('') });
|
||||
}
|
||||
if (p === '/api/board' && req.method === 'GET') { const s = session(req); return json(res, 200, await board(s ? s.address : null)); }
|
||||
if (p === '/api/draftday' && req.method === 'GET') {
|
||||
|
||||
+23
-4
@@ -42,9 +42,17 @@ function init(cfg, opts) {
|
||||
try { fixture = JSON.parse(fs.readFileSync(f, 'utf8')); } catch (e) { fixture = { people: [] }; console.error('tankpool: no stub pool at', f); }
|
||||
fixture.base = nowFn(); // relative times are measured from boot
|
||||
console.log('tankpool: STUB mode (' + fixture.people.length + ' fixture people, nobody is adopted for real, no mail)');
|
||||
} else console.log('tankpool: InstantAdPay mode (' + C.iapBase + '/api/partner/draft/*' + (secret() ? '' : ', DRAFT_PARTNER_SECRET MISSING: every call refuses') + ')');
|
||||
} else console.log('tankpool: InstantAdPay mode (' + C.iapBase + '/api/partner/draft/*' + (secret() ? '' : ', DRAFT_PARTNER_SECRET MISSING: every call refuses') + ')' + (live() ? ' LIVE: picks are real adoptions' : ' TEST MODE (DRAFT_LIVE not 1): pool read-only, picks are previews, nobody is adopted, no mail'));
|
||||
}
|
||||
const isStub = () => mode === 'stub';
|
||||
// ---- staging test mode (Marty 2026-11-15, "test apps never touch real people"): with TANK_MODE=iap and DRAFT_LIVE not '1', the pool
|
||||
// and pick status are READ from InstantAdPay, but every pick (instant picks on a purchase and the weekly draft) and every release is a
|
||||
// PREVIEW kept here only: no tank.adopt() on InstantAdPay, no sponsor change, no "X is now your sponsor" email. DRAFT_LIVE=1 at go-live.
|
||||
const live = () => !isStub() && String(process.env.DRAFT_LIVE || '').trim() === '1';
|
||||
const preview = () => !isStub() && !live();
|
||||
const PFILE = () => path.join(C.dataDir, 'preview-picks.json');
|
||||
function pst() { let s = {}; try { s = JSON.parse(fs.readFileSync(PFILE(), 'utf8')); } catch (e) {} s.picked = s.picked || {}; s.log = s.log || []; s.wouldMail = s.wouldMail || 0; return s; }
|
||||
function pput(s) { s.log = s.log.slice(-300); fs.writeFileSync(PFILE() + '.tmp', JSON.stringify(s)); fs.renameSync(PFILE() + '.tmp', PFILE()); }
|
||||
// ---- the InstantAdPay client ----
|
||||
const secret = () => { const s = String(process.env.DRAFT_PARTNER_SECRET || '').trim(); return s.length >= 32 ? s : ''; };
|
||||
const remote = { calls: 0, failed: 0, lastError: null, lastPool: 0 };
|
||||
@@ -82,7 +90,7 @@ function person(p, s, now) {
|
||||
}
|
||||
|
||||
async function candidates(now) {
|
||||
if (!isStub()) { const r = await call('pool', {}); if (!r.ok || !Array.isArray(r.pool)) return []; remote.lastPool = r.pool.length; return r.pool.filter(c => c && c.id).map(candOf); }
|
||||
if (!isStub()) { const r = await call('pool', {}); if (!r.ok || !Array.isArray(r.pool)) return []; remote.lastPool = r.pool.length; const taken = preview() ? pst().picked : {}; return r.pool.filter(c => c && c.id && !taken[String(c.id)]).map(candOf); }
|
||||
const s = st(); now = now || nowFn();
|
||||
return fixture.people.filter(p => !s.adopted[p.id]).map(p => { const x = person(p, s, now); return Object.assign(x, { wallet: !!x.wallet }); })
|
||||
.filter(x => !x.payouts && !x.purchase); // payouts on = out of the tank (the IAP rule)
|
||||
@@ -104,6 +112,13 @@ async function status(ids, now) {
|
||||
return out;
|
||||
}
|
||||
async function adopt(o) {
|
||||
if (preview()) {
|
||||
const s = pst(); const id = String(o.person || ''); if (!id) return { error: 'Not in the holding tank.' };
|
||||
if (s.picked[id]) return { error: 'Already picked (test mode).' };
|
||||
const c = o.coach || {}; s.picked[id] = { coach: c.address || null, at: nowFn(), kind: o.kind || 'draft', week: o.week || null };
|
||||
s.wouldMail++; s.log.push({ at: nowFn(), preview: 'adopt', person: id, coach: c.address || null, kind: o.kind || 'draft' }); pput(s);
|
||||
return { ok: true, ref: 'preview:' + id, preview: true };
|
||||
}
|
||||
if (!isStub()) {
|
||||
const c = o.coach || {}; const body = { rid: rid(), coach: { wallet: c.address, hubId: c.hubId || null, username: c.username || null, positions: Number(c.positions) || 0 },
|
||||
person: o.person, kind: o.kind || 'draft', week: o.week || null, slot: o.slot || null, note: o.note || '' };
|
||||
@@ -121,6 +136,10 @@ async function adopt(o) {
|
||||
return { ok: true, ref: 'stub:' + p.id };
|
||||
}
|
||||
async function release(o) {
|
||||
if (preview() || String(o.ref || '').startsWith('preview:')) { // a preview pick never touches InstantAdPay, even after DRAFT_LIVE flips to 1
|
||||
const s = pst(); const id = String(o.person || ''); delete s.picked[id];
|
||||
s.log.push({ at: nowFn(), preview: 'release', person: id, why: o.why || '' }); pput(s); return { ok: true, outcome: 'returned', preview: true };
|
||||
}
|
||||
if (!isStub()) {
|
||||
const body = { rid: rid(), coach: { wallet: o.coach }, ref: o.ref || null, person: o.person, why: o.kind === 'return' || /window/.test(o.why || '') ? 'return' : 'coach' };
|
||||
let r = await call('release', body); if (r.transient) r = await call('release', body);
|
||||
@@ -136,5 +155,5 @@ function setStatus(id, patch) {
|
||||
for (const k of ['wallet', 'payouts', 'purchase', 'seen']) if (patch[k] !== undefined) o[k] = patch[k] ? (typeof patch[k] === 'number' ? patch[k] : t) : 0;
|
||||
put(s); return { ok: true, over: o };
|
||||
}
|
||||
function view() { if (!C) return {}; const s = isStub() ? st() : null; return { mode, remote: isStub() ? null : Object.assign({ url: C.iapBase, secret: !!secret() }, remote), fixture: fixture ? fixture.people.length : 0, adopted: s ? Object.keys(s.adopted).length : 0, adoptionMailsThatWouldSend: s ? s.mails : 0, log: s ? s.log.slice(-20) : [] }; }
|
||||
module.exports = { init, candidates, status, adopt, release, setStatus, view, isStub, H, D };
|
||||
function view() { if (!C) return {}; const s = isStub() ? st() : null; const ps = preview() ? pst() : null; return { mode, live: live(), testMode: preview(), previewPicks: ps ? Object.keys(ps.picked).length : 0, adoptionMailsSkipped: ps ? ps.wouldMail : 0, remote: isStub() ? null : Object.assign({ url: C.iapBase, secret: !!secret() }, remote), fixture: fixture ? fixture.people.length : 0, adopted: s ? Object.keys(s.adopted).length : 0, adoptionMailsThatWouldSend: s ? s.mails : 0, log: s ? s.log.slice(-20) : [] }; }
|
||||
module.exports = { init, candidates, status, adopt, release, setStatus, view, isStub, live, preview, H, D };
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
const PUB = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'public');
|
||||
const SITE = 'https://5xyourteam.com';
|
||||
const V = { css: 2, js: 2 };
|
||||
const V = { css: 3, js: 3 };
|
||||
const F = { co: 'TrustClickz', addr: '615 Green Valley Drive, Moody, AL 35004', updated: 'November 15, 2026', usd: 10, picks: 5, rounds: 5, returnDays: 3, maxOpen: 10 };
|
||||
const FONTS = 'https://fonts.googleapis.com/css2?family=Oswald:wght@500;700&family=Inter:wght@400;600;700&display=swap';
|
||||
const NOTE = 'A position buys a draft spot and coaching tools, not income. Nothing is promised.';
|
||||
|
||||
Reference in New Issue
Block a user