Files
wiki/tasks/enduro-trails/scripts/patch_rebuild.py
2026-05-13 19:10:01 +03:00

30 lines
732 B
Python

import sys
path = "/home/slin/enduro-trails/prototype/static/app.js"
with open(path, 'r') as f:
content = f.read()
# Add restoreTerrainState and restoreTrailsState to rebuildMapOverlays
old = """function rebuildMapOverlays() {
// Re-apply recon circle if active
if (reconMode && reconCenter) {"""
new = """function rebuildMapOverlays() {
// Re-apply terrain and trails after style change
restoreTerrainState();
restoreTrailsState();
// Re-apply recon circle if active
if (reconMode && reconCenter) {"""
if old not in content:
print("ERROR: marker not found")
sys.exit(1)
content = content.replace(old, new)
with open(path, 'w') as f:
f.write(content)
print("OK - rebuildMapOverlays patched")