d611c4b251
Replaces the dark ink-green/amber newsroom look Marty rejected as too dark. Look only: routes, ids, copy facts and the trust pack are unchanged. - vab.css rewritten around CSS variables: #EAF0FF ground, white clipped cards, royal #0A1F6B bands/ticker, #0A2FA8 hero panels with network lines, red pill CTA, gold Boost/boosted, Barlow Condensed / Chakra Petch / Inter / JetBrains Mono. [hidden] now always wins over display rules. - Front page: slanted hero, ribbon, green-check list, rising bars, three YOUR AD screens, gold chips; board tabs (verified clicks / on the wire / boosted, from data the page already has); Boost band; ledger chips. - Member page: own ad as a hero panel, level rows with LEVEL chips, royal join bar. Rows are now labelled LEVEL 1 to LEVEL 5 in display order (Marty's decision); the real place is kept in the API as depth. - My page becomes the dashboard: side menu, stat cards, my-ad card with LIVE/BOOSTED badges and a folded editor, line bars, Boost ring, recent activity, payouts. All figures from /api/my, nothing estimated. - Boost, ledger, contract, promote, legal and admin pages restyled; 404 too. - Default JOIN_URL is now https://instantadpay.com/join/{ref} (no ref falls back to the InstantAdPay home page). - New mark, icon, OG image, 21 kit creatives and 3 proof cards (royal/daylight/navy) rendered by tools/art.mjs; asset tags bumped to v=4. - smoke.mjs: new headline, level/depth and join URL checks, UI_FONTS=1. Tests: qa/smoke.mjs 162/162, qa/chain.mjs 20/20 (local anvil). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
64 lines
4.6 KiB
JavaScript
64 lines
4.6 KiB
JavaScript
// All runtime config comes from env (Coolify sets these). Read once.
|
|
// ViralAdBlitz (viraladblitz.com rebuild, Marty approved 2026-11-14): the network's text-ad home. Members post one free text ad;
|
|
// each member's page shows their ad plus the ads of the 5 people above them in their network (hub) sponsor line. A Boost ($5,
|
|
// one-time, 500 guaranteed network views) is paid in POL through VABShop and split on-chain 10% to each of 5 sponsor levels
|
|
// (pass-up to the next person who has boosted) + 50% company. Purchases are inert until CONTRACT_ADDRESS / CHAIN_RPC / KEEPER_KEY are set.
|
|
const path = require('path');
|
|
|
|
let cfg = null;
|
|
function get() {
|
|
if (cfg) return cfg;
|
|
const e = process.env;
|
|
const num = (v, d, min, max) => { const n = Number(v); return Number.isFinite(n) && v !== '' && v != null ? Math.min(max, Math.max(min, Math.round(n))) : d; };
|
|
const addr = v => /^0x[0-9a-fA-F]{40}$/.test(String(v || '').trim()) ? require('ethers').getAddress(String(v).trim().toLowerCase()) : '';
|
|
cfg = {
|
|
port: Number(e.PORT || 3000),
|
|
isProd: e.NODE_ENV === 'production',
|
|
site: e.SITE_HOST || 'viraladblitz.com',
|
|
siteName: 'ViralAdBlitz',
|
|
siteId: 'viraladblitz', // hub site id, network sign-in audience, netsites id
|
|
dataDir: e.DATA_DIR || path.join(__dirname, 'data'),
|
|
chainId: Number(e.CHAIN_ID || 137),
|
|
chainName: e.CHAIN_NAME || 'Polygon',
|
|
publicRpc: e.PUBLIC_RPC || 'https://polygon-bor-rpc.publicnode.com',
|
|
walletConnectProjectId: (e.WALLETCONNECT_PROJECT_ID || '').trim(),
|
|
// ---- Boost (Marty 2026-11-14: "$5 for 500 guaranteed network views"). The contract's SKU holds the real price; this is the
|
|
// display copy and must match it (smoke + chain tests check). One-time, never a subscription.
|
|
boost: { sku: num(e.BOOST_SKU, 1, 1, 1000), usd: Number(e.BOOST_USD || 5), views: num(e.BOOST_VIEWS, 500, 1, 1e6), maxQty: 10 },
|
|
split: { levels: 5, levelPct: 10, companyPct: 50, maxDepth: 20 }, // VABShop constants (display copy)
|
|
deliverDays: num(e.BOOST_DELIVER_DAYS, 30, 1, 365), // on-site delivery window; then Network Ad Space finishes the rest
|
|
// the pages
|
|
levels: 5, // upline ads on a member's page
|
|
lineSearch: num(e.LINE_SEARCH, 20, 5, 50), // hub places walked to find 5 uplines with a live ad
|
|
boostSlots: num(e.BOOST_SLOTS, 2, 0, 10), // Boosted places on a member page (the "extra place on the five-level pages")
|
|
tickerBoosts: num(e.TICKER_BOOSTS, 12, 0, 50), // starred Boosted ads in the ticker
|
|
tickerNewest: num(e.TICKER_NEWEST, 16, 0, 100), // newest ads in the ticker
|
|
boardSize: num(e.BOARD_SIZE, 9, 3, 50), // "Top ads this week"
|
|
// verified visitors (the VBB rules)
|
|
visitSeconds: num(e.VISIT_SECONDS, 6, 2, 60), // page visible this long before views count
|
|
visitWindowHours: 24, // one verified view per visitor per ad (and one visit per page) per 24 h
|
|
perIpDay: num(e.VISITS_PER_IP_DAY, 3, 1, 100), // distinct browsers counted per connection per 24 h
|
|
// text ads
|
|
ad: { headline: 60, line: 90 }, // characters
|
|
linkProbe: e.LINK_PROBE !== '0', // check the link answers (off in the local smoke test)
|
|
explorer: String(e.EXPLORER || (Number(e.CHAIN_ID || 137) === 137 ? 'https://polygonscan.com' : '')).replace(/\/+$/, ''),
|
|
// VABShop (../contracts). KEEPER_KEY is read by shop.js only, never kept here.
|
|
contractAddress: addr(e.CONTRACT_ADDRESS),
|
|
companyWallet: addr(e.COMPANY_WALLET) || '0x7627Fc78876948AC9d95C1C9eB061E7D6d647b70', // Tangem (immutable in VABShop)
|
|
chainRpc: String(e.CHAIN_RPC || '').trim(),
|
|
shopStartBlock: num(e.SHOP_START_BLOCK, 0, 0, 1e12),
|
|
shopConfirmations: num(e.SHOP_CONFIRMATIONS, 10, 0, 1000),
|
|
shopPollMs: num(e.SHOP_POLL_MS, 30000, 200, 3600000),
|
|
voucherSeconds: num(e.VOUCHER_SECONDS, 1800, 60, 86400),
|
|
iapBase: String(e.IAP_URL || 'https://instantadpay.com').replace(/\/+$/, ''),
|
|
lsBase: String(e.LS_URL || 'https://linkspin.app').replace(/\/+$/, ''),
|
|
// where someone who is not in the network yet joins free under the page owner ({ref} = the owner's network username)
|
|
joinUrl: String(e.JOIN_URL || 'https://instantadpay.com/join/{ref}'),
|
|
networkLookupUrl: e.NETWORK_LOOKUP_URL !== undefined ? String(e.NETWORK_LOOKUP_URL).trim()
|
|
: String(e.IAP_URL || 'https://instantadpay.com').replace(/\/+$/, '') + '/api/network/member'
|
|
};
|
|
return cfg;
|
|
}
|
|
|
|
module.exports = { get, reset: () => { cfg = null; } };
|