diff --git a/www/update-costs.sh b/www/update-costs.sh index b514fd6..d85a50e 100755 --- a/www/update-costs.sh +++ b/www/update-costs.sh @@ -23,7 +23,7 @@ python3 << 'PYEOF' import json, re, sys IMPACT_LOG = "/home/claude/claude-dir/.claude/impact/impact-log.jsonl" -PAGES = ["/home/claude/www/index.html", "/home/claude/claude-dir/www/index.html"] +LANDING_PAGE = "/home/claude/claude-dir/www/index.html" # Read all entries, keep latest per session sessions = {} @@ -73,17 +73,15 @@ new_para = ( f" " ) -# Read and replace in all landing page copies +# Read and replace +with open(LANDING_PAGE) as f: + html = f.read() + pattern = r"How this was made:.*?" -for page in PAGES: - try: - with open(page) as f: - html = f.read() - new_html = re.sub(pattern, new_para, html, flags=re.DOTALL) - with open(page, "w") as f: - f.write(new_html) - except FileNotFoundError: - pass +new_html = re.sub(pattern, new_para, html, flags=re.DOTALL) + +with open(LANDING_PAGE, "w") as f: + f.write(new_html) print(f"Updated: {n} {session_word}, {total_energy} Wh, {total_co2}g CO2, {cost_display}") PYEOF