Retire the PolHunter launch card: launch announcements show 7 days after launchAt, then stop

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-03 09:41:22 -05:00
parent 737ed28e1d
commit e484025d6d
3 changed files with 26 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
# Retire the PolHunter launch announcement (Marty, 2026-10-03: "retire the old cards"): a launch card
# shows for 7 days after launchAt, then never again.
ROOT = 'D:/Projects/HighRisk/onchain-ad-membership/site/'
def edit(path, pairs):
b = open(ROOT + path, 'rb').read(); crlf = b.count(b'\r\n') > b.count(b'\n') // 2
s = b.decode('utf-8').replace('\r\n', '\n')
for a, r in pairs:
if s.count(a) != 1: raise SystemExit('%s anchor %d: %s' % (path, s.count(a), a[:70]))
s = s.replace(a, r)
if crlf: s = s.replace('\n', '\r\n')
open(ROOT + path, 'wb').write(s.encode('utf-8')); print('patched', path)
edit('public/assets/my.js', [
(" if (!at || Date.now() < at) return;\n const card = $('phLaunch'); if (!card || phShown) return;\n",
" if (!at || Date.now() < at) return;\n"
" // launch cards retire 7 days after launch (Marty, 2026-10-03: old announcements kept stacking up)\n"
" if (Date.now() > at + LAUNCH_CARD_DAYS * 86400000) { const c = $('phLaunch'); if (c) c.hidden = true; return; }\n"
" const card = $('phLaunch'); if (!card || phShown) return;\n"),
(" let phShown = false;\n", " let phShown = false;\n const LAUNCH_CARD_DAYS = 7;\n"),
])
edit('public/my.html', [('/assets/my.js?v=20261003snz', '/assets/my.js?v=20261003rlc')])
print('ok')