VBB v1 skeleton: off-chain loop engine, verified visitors, members, banners, leaderboards, admin; docstore + networksso from Downline Banners
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
// All runtime config comes from env (Coolify sets these). Read once.
|
||||
// VBB v1 is off-chain: no contract, no prices, no money. Rewards are recorded, not credited yet.
|
||||
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; };
|
||||
cfg = {
|
||||
port: Number(e.PORT || 3000),
|
||||
isProd: e.NODE_ENV === 'production',
|
||||
site: e.SITE_HOST || 'viralbannerblitz.com',
|
||||
siteName: 'Viral Banner Blitz',
|
||||
dataDir: e.DATA_DIR || path.join(__dirname, 'data'),
|
||||
chainId: Number(e.CHAIN_ID || 137), // only used in the wallet sign-in message + picker
|
||||
chainName: e.CHAIN_NAME || 'Polygon',
|
||||
publicRpc: e.PUBLIC_RPC || 'https://polygon-bor-rpc.publicnode.com',
|
||||
walletConnectProjectId: (e.WALLETCONNECT_PROJECT_ID || '').trim(),
|
||||
// the loop
|
||||
loopSize: num(e.LOOP_SIZE, 50, 5, 500), // banners on the splash at once
|
||||
perShift: num(e.VISITORS_PER_SHIFT, 10, 1, 1000), // verified unique visitors per one-place shift
|
||||
viewsPerCycle: num(e.VIEWS_PER_CYCLE, 150, 0, 100000), // network ad views recorded per completed cycle (not credited in v1)
|
||||
// verified visitors
|
||||
visitSeconds: num(e.VISIT_SECONDS, 6, 2, 60), // the page must be visible this long before the visit counts
|
||||
visitWindowHours: 24, // one count per visitor key per 24 h
|
||||
perIpDay: num(e.VISITS_PER_IP_DAY, 3, 1, 100), // distinct user agents counted per IP per 24 h (shared connections, UA rotation)
|
||||
// members
|
||||
freeCreditCap: num(e.FREE_CREDIT_CAP, 7, 1, 365), // daily free credits bank up to this many
|
||||
maxQueuedPerMember: num(e.MAX_QUEUED_PER_MEMBER, 3, 1, 100), // banners one member may have waiting at once
|
||||
linkProbe: e.LINK_PROBE !== '0', // check the target link answers and allows frames (off in the local smoke test)
|
||||
iapBase: String(e.IAP_URL || 'https://instantadpay.com').replace(/\/+$/, ''),
|
||||
lsBase: String(e.LS_URL || 'https://linkspin.app').replace(/\/+$/, ''),
|
||||
// network usernames: ?u=<username> / ?a=<wallet> -> {address, username}. '' turns the lookup off (local prototype).
|
||||
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; } };
|
||||
Reference in New Issue
Block a user