My Stack POL: network sign-in through the hub + signed-in member area at /my (Marty approved 2026-11-19)
- networksso.js (shared file, same copy as IAP/LinkSpin/YPB): hub-only sign-in (HUB_SSO=on), silent check on /my, sign-out - my.js: signed session cookie (keyed off HUB_SECRET), sign-outs in the my-signouts.json MySQL document; /my shows the page link + on/off, Pro, join links per program, share kit, own payout rows with Polygonscan links and totals from the ledger - iapswitch.js: the page switch stays in IAP's stack-optin.json; Stack POL calls IAP POST /api/partner/stackpol/switch (signed, STACKPOL_SWITCH_KEY; spec in the file). Until IAP has it, /my links to IAP Promo tools - tools/indexer.py: snapshot gains `my` (every paid member's rows, wallets, page flag, IAP switches, Pro list); public data unchanged - header Sign in / My Stack POL entry; robots keeps /my and /sso/ out - qa/my.test.mjs: 66 checks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+25
-1
@@ -447,8 +447,32 @@ def main():
|
||||
links = [{'code': x['code'], 'name': str(x.get('name') or '')[:60]} for x in rt
|
||||
if str(x.get('owner', '')).lower() in mine and not x.get('paused') and any(d.get('active', True) for d in x.get('destinations') or [])]
|
||||
stacks[un]['pro'] = {'spins': spins[:40], 'links': links[:20]}
|
||||
# My Stack POL (Marty 2026-11-19): the signed-in member area. Every paid member's own rows (newest first, up to 500), their totals
|
||||
# (the same sums as their public stack), the wallets mapped to them, whether their page is on, plus IAP's explicit switches and Pro
|
||||
# owners. Read only by /my for the member who is signed in; never rendered on a public page, so a switched-off member stays hidden.
|
||||
wl = {}
|
||||
for a, un in wu.items():
|
||||
if a and un:
|
||||
wl.setdefault(str(un).lower(), set()).add(str(a).lower())
|
||||
members = {}
|
||||
for r in rows:
|
||||
un = r['u']
|
||||
if not un:
|
||||
continue
|
||||
m = members.setdefault(un, {'total': 0.0, 'payments': 0, 'since': r['ts'], 'byProg': {}, 'rows': []})
|
||||
m['total'] += r['pol']; m['payments'] += 1; m['since'] = min(m['since'], r['ts'])
|
||||
b = m['byProg'].setdefault(r['k'], {'pol': 0.0, 'payments': 0}); b['pol'] += r['pol']; b['payments'] += 1
|
||||
if len(m['rows']) < 500:
|
||||
m['rows'].append({'k': r['k'], 'pol': round(r['pol'], 4), 'tx': r['tx'], 'ts': r['ts']})
|
||||
for un, m in members.items():
|
||||
m['total'] = round(m['total'], 4)
|
||||
m['byProg'] = {k: {'pol': round(v['pol'], 4), 'payments': v['payments']} for k, v in m['byProg'].items()}
|
||||
m['wallets'] = sorted(wl.get(un, set()))
|
||||
m['page'] = un in stacks
|
||||
switch = {str(un).lower(): bool(on) for un, on in (so.get('users', {}) if isinstance(so, dict) else {}).items()}
|
||||
my = {'members': members, 'switch': switch, 'pro': sorted(pro)}
|
||||
snap = {'v': 1, 'at': now, 'network': {'pol': round(sum(r['pol'] for r in rows), 4), 'payments': len(rows), 'wallets': len(wallets - {''})},
|
||||
'last7': {'pol': round(sum(r['pol'] for r in l7), 4), 'payments': len(l7)}, 'programs': programs, 'recent': recent, 'progRecent': prog_recent, 'stacks': stacks}
|
||||
'last7': {'pol': round(sum(r['pol'] for r in l7), 4), 'payments': len(l7)}, 'programs': programs, 'recent': recent, 'progRecent': prog_recent, 'stacks': stacks, 'my': my}
|
||||
print('network %.2f POL, %d payments, %d wallets | last7 %.2f | stacks %s' % (snap['network']['pol'], snap['network']['payments'], snap['network']['wallets'], snap['last7']['pol'], ','.join(stacks) or '-'))
|
||||
for k, v in sorted(programs.items(), key=lambda x: -x[1]['pol']):
|
||||
print(' %-4s %10.2f POL %6d payments %5d wallets' % (k, v['pol'], v['payments'], v['wallets']))
|
||||
|
||||
Reference in New Issue
Block a user