/api/me sponsor fallback also capped at the on-chain member count (the Credits screen activates from /api/me)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -1330,6 +1330,7 @@ const server = http.createServer(async (req, res) => {
|
||||
if (sponsorId && await payoutChainBlocked(sponsorId, 2)) sponsorId = 0;
|
||||
const _defSpon = Number(siteConfig().defaultSponsorId) || 1;
|
||||
if (!sponsorId && memberId !== _defSpon) sponsorId = _defSpon; // orphan fallback → #1 (never self-sponsor)
|
||||
if (sponsorId) { try { if (sponsorId > await chain.memberCount()) sponsorId = 0; } catch (e) {} } // fresh contract: no catch position exists yet, the first member becomes #1
|
||||
if (memberId && acct && acct.memberId !== memberId) accounts.setMemberId(acct.email, memberId).catch(() => {});
|
||||
const out = { signedIn: true, sponsorBlocked, sponsorName: spdMe.name || null, email: s.email || (acct && acct.email) || null,
|
||||
address: s.address || (acct && acct.address) || null, memberId,
|
||||
|
||||
Reference in New Issue
Block a user