Files
webworthit/tools/build-index.py
T
martbost 6616680fc6 WebWorthIt staging: read-only contract + website check (Marty 2026-11-16)
Free check (DeepSeek v4.1 Flash scorecard) and deep report (Opus 5.5) over a generalised
evidence pack from the read-only chain tools; fact gate blocks any address, tx or number not
in the evidence; MySQL store; hub sign-in, sponsor line recorder, vouchers, ad slots in iframes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 10:54:08 -06:00

101 lines
11 KiB
Python

"""Builds public/index.html from the approved mockup (tools/mockup-Main.dc.html, Marty 2026-11-16): same copy, colours, fonts and
sections; the header and footer come from assets/common.js; the form, pricing buttons, live result and network table are wired.
Run: python tools/build-index.py"""
import re, os
H = os.path.dirname(os.path.abspath(__file__))
src = open(os.path.join(H, 'mockup-Main.dc.html'), encoding='utf8').read()
a = src.index('<!-- hero / check -->'); b = src.index('<!-- footer -->')
body = src[a:b]
def rep(old, new, count=1):
global body
assert old in body, old[:80]
body = body.replace(old, new, count)
# form
rep('<form style="', '<form id="checkForm" novalidate style="')
rep('<input id="site" type="url"', '<input id="site" name="website" type="url" autocomplete="url" inputmode="url"')
rep('<input id="target" type="text"', '<input id="target" name="address" type="text" autocomplete="off" spellcheck="false"')
rep('<select aria-label="Chain"', '<select id="chain" name="chain" aria-label="Chain"')
rep('<option>BNB Chain</option><option>Polygon</option><option>Ethereum</option><option>Base</option>',
'<option value="bsc">BNB Chain</option><option value="polygon">Polygon</option><option value="eth">Ethereum</option><option value="base">Base</option>')
rep('<button type="button" style="font-family: Archivo', '<button id="runBtn" type="submit" style="font-family: Archivo')
rep('3 free checks a day. Read-only: a check never asks you to connect a wallet.</span>',
'3 free checks a day. Read-only: a check never asks you to connect a wallet.</span>\n<span id="formErr" role="alert" style="color: #FFB599; font-size: 14px"></span><span id="freeLeft" style="font-size: 13px; color: #A9BEB1"></span>')
# live result goes right after the hero
rep('<!-- problem / agitate / solve -->', '<div id="heroSlot"></div>\n<!-- live result -->\n<div id="live" class="wrap hide" style="padding-top: 48px; padding-bottom: 8px; display: flex; flex-direction: column; gap: 24px"></div>\n<div id="liveSlot"></div>\n<!-- problem / agitate / solve -->')
# sample label
rep('Sample free check, a real contract</span>', 'Sample free check, a real contract (example)</span>')
rep('<a href="#reports" style="text-decoration: none; background: #E2541B; color: #FFFFFF; text-align: center; padding: 13px; border-radius: 6px; font-weight: 600">Get the deep report</a>',
'<a href="#reports" style="text-decoration: none; background: #E2541B; color: #FFFFFF; text-align: center; padding: 13px; border-radius: 6px; font-weight: 600">See deep report prices</a>')
rep('[Project website screenshot, taken by our own headless browser]', '<img src="/art/sample-3xsusu.jpg" alt="Screenshot of the 3xSusu website taken by our own headless browser" style="width: 100%; height: 100%; object-fit: cover; object-position: top" data-sample>[Project website screenshot, taken by our own headless browser]')
# how-it-works band: ad slot at its end
rep('A project can reply to its check on Earners Corner.</p>', 'A project can reply to its check on Earners Corner.</p>\n<div id="howSlot"></div>')
# pricing: staging buttons, sponsor line, voucher + test-code boxes
rep('<p style="margin: 0; color: #3E5149; font-size: 14px">One-time payments on Polygon. No subscriptions. Pay with SafePal or any other crypto wallet.</p>',
'<p style="margin: 0; color: #3E5149; font-size: 14px">One-time payments on Polygon. No subscriptions. Pay with SafePal or any other crypto wallet.</p>\n'
'<p style="margin: 0; color: #3E5149; font-size: 14px">Sponsors earn 20% when someone they referred buys, plus 5% on levels 2 to 5. Only members who have bought here themselves receive a share; anyone who has not is passed over. You earn only when people choose to buy.</p>')
rep('cursor: pointer">Buy one report</button>', 'cursor: pointer" data-buy="deep1" disabled>Payments arrive at launch</button>')
rep('cursor: pointer">Buy 10 reports</button>', 'cursor: pointer" data-buy="deep10" disabled>Payments arrive at launch</button>')
rep('<input type="checkbox" checked style=', '<input id="watch" type="checkbox" checked style=')
rep('<span style="font-size: 13px; color: #A9BEB1">One payment. It stops by itself after 3 months.</span>',
'<span style="font-size: 13px; color: #A9BEB1">One payment. It stops by itself after 3 months. Alerts start at launch.</span>')
rep('<!-- payment contract scanned -->', '''<div style="display: flex; flex-wrap: wrap; gap: 20px">
<div style="flex: 1 1 300px; min-width: 0; background: #FFFFFF; border: 1px solid #C9D3CC; border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 10px">
<span style="font-family: Archivo, sans-serif; font-weight: 700; font-size: 18px">Have a voucher?</span>
<span style="color: #3E5149; font-size: 14px">Vouchers add deep reports or extra free checks to this browser, or to your account when you are signed in.</span>
<div style="display: flex; gap: 10px; flex-wrap: wrap"><input id="voucher" class="code" placeholder="VOUCHER CODE" style="flex: 1 1 180px"><button id="redeemBtn" class="btn dark" type="button">Redeem</button></div>
<span id="voucherMsg" style="font-size: 14px; color: #3E5149"></span><span id="creditLine" style="font-size: 14px; color: #1F6B4F"></span>
</div>
<div id="testBox" class="hide" style="flex: 1 1 300px; min-width: 0; background: #FCE6DC; border: 1px dashed #B23E10; border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 10px">
<span style="font-family: Archivo, sans-serif; font-weight: 700; font-size: 18px">Staging test code</span>
<span style="color: #3E5149; font-size: 14px">For testing only. It unlocks deep reports and test purchases that record who would be paid. No money moves.</span>
<div id="testIn" style="display: flex; gap: 10px; flex-wrap: wrap"><input id="testCode" class="code" placeholder="test code" autocomplete="off" style="flex: 1 1 180px"><button id="testBtn" class="btn dark" type="button">Unlock</button></div>
<div id="testOn" class="hide" style="display: flex; gap: 10px; flex-wrap: wrap"><button class="btn line" type="button" data-test="deep1">Test purchase: 1 report</button><button class="btn line" type="button" data-test="deep10">Test purchase: 10 reports</button><button id="lockBtn" class="btn" type="button" style="background: transparent; text-decoration: underline">Lock</button></div>
<span id="testMsg" style="font-size: 14px; color: #3E5149"></span>
</div>
</div>
<div id="shareBox" class="hide" style="background: #FFFFFF; border: 2px solid #1F6B4F; border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 10px">
<span style="font-family: Archivo, sans-serif; font-weight: 700; font-size: 18px">Share WebWorthIt</span>
<span style="color: #3E5149; font-size: 14px">Your referral link. When someone you referred buys a report, you earn 20% as their direct sponsor, plus 5% on levels 2 to 5 of your team. You earn only when people choose to buy.</span>
<div style="display: flex; gap: 10px; flex-wrap: wrap"><input id="refLink" class="code" readonly style="flex: 1 1 320px"><button id="copyRef" class="btn dark" type="button">Copy link</button></div>
</div>
<!-- payment contract scanned -->''')
rep('[address published at launch] · source verified on Polygonscan', '[address published at launch] · source verified on Polygonscan · placeholder until launch')
rep('<a href="#c" style="font-weight: 600">View its scorecard</a>', '<span style="color: #5B7067">[scorecard at launch]</span>')
# network table: full addresses, filled from /api/network-checks
NET = [('Viral Banner Blitz', 'polygon', '0x36F6ccc8752DcE1c84e06b65f07dF30e8a4707D7', '0x36F6…D7D7'), ('ViralAdBlitz', 'polygon', '0xb58447b0CE9a38Ad0e7d41a074FEbee696452905', '0xb584…2905'),
('DownlineHydra', 'polygon', '0xEd07Ad7150ecBa62689Cf2480729753F2Fa44e90', '0xEd07…4e90'), ('5xYourTeam', 'polygon', '0x83Bb982d8B485De1a24E7D313765dDA48D5aBc74', '0x83Bb…bc74')]
for name, ch, full, sh in NET:
old = re.search(r'<tr style="border-top: 1px solid #2D5446"><td style="padding: 13px 16px">%s</td>.*?</tr>' % re.escape(name), body).group(0)
body = body.replace(old, '<tr style="border-top: 1px solid #2D5446" data-net="%s"><td style="padding: 13px 16px">%s</td><td style="padding: 13px 16px; font-family: \'IBM Plex Mono\', monospace"><a style="color: #EEF3EF" href="https://polygonscan.com/address/%s" target="_blank" rel="noopener nofollow">%s</a></td><td style="padding: 13px 16px; color: #8FD3B1" data-src>Verified</td><td style="padding: 13px 16px; color: #A9BEB1" data-score>[scorecard at launch]</td></tr>' % (full.lower(), name, full, sh))
rep('<p style="margin: 0; color: #C5D3CA; max-width: 720px">We run the same check on every contract in our own network and publish the result, good or bad. Rescanned every week.</p>',
'<p style="margin: 0; color: #C5D3CA; max-width: 720px">We run the same check on every contract in our own network and publish the result, good or bad. Rescanned every week.</p>\n<p style="margin: 0; color: #A9BEB1; font-size: 13px">Each grade is our opinion, from the published rubric applied to the public facts in the linked report.</p>')
rep('<a href="#ec-topic" style="font-weight: 600">Open the Contract Checks topic</a>', '<span style="font-weight: 600; color: #5B7067">Open the Contract Checks topic [placeholder: opens at launch]</span>')
rep('High risk · updated Nov 16</span>', 'High risk · updated Nov 16 [placeholder]</span>')
assert '—' not in body
head = '''<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>WebWorthIt: check before you join</title>
<meta name="description" content="Paste a smart contract address or a project website and see who controls the money, where it went and whether the promises match the code. Public information only, read-only.">
<meta name="theme-color" content="#0E2A22">
<link rel="icon" type="image/svg+xml" href="/art/mark.svg">
<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=Archivo:wght@500;700;800&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap">
<link rel="stylesheet" href="/assets/wwi.css?v=1">
</head>
<body>
<div style="background: #F3F5F1; color: #0E2A22; font-family: 'IBM Plex Sans', system-ui, sans-serif; font-size: 16px; line-height: 1.55">
'''
tail = '''</div>
<script src="/assets/common.js?v=1"></script>
<script src="/assets/render.js?v=1"></script>
<script src="/assets/index.js?v=1"></script>
</body>
</html>
'''
open(os.path.join(H, '..', 'public', 'index.html'), 'w', encoding='utf8', newline='\n').write(head + body + tail)
print('ok', len(head + body + tail))