Simplify www setup: symlink instead of two copies
/home/claude/www is now a symlink to the repo's www/ directory. update-costs.sh writes to a single path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
728f7784d1
commit
1c35751095
1 changed files with 9 additions and 11 deletions
|
|
@ -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" </div>"
|
||||
)
|
||||
|
||||
# Read and replace in all landing page copies
|
||||
pattern = r"How this was made:</strong>.*?</div>"
|
||||
for page in PAGES:
|
||||
try:
|
||||
with open(page) as f:
|
||||
# Read and replace
|
||||
with open(LANDING_PAGE) as f:
|
||||
html = f.read()
|
||||
|
||||
pattern = r"How this was made:</strong>.*?</div>"
|
||||
new_html = re.sub(pattern, new_para, html, flags=re.DOTALL)
|
||||
with open(page, "w") as f:
|
||||
|
||||
with open(LANDING_PAGE, "w") as f:
|
||||
f.write(new_html)
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
print(f"Updated: {n} {session_word}, {total_energy} Wh, {total_co2}g CO2, {cost_display}")
|
||||
PYEOF
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue