35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
import sys
|
|
try:
|
|
path = "/var/www/html/weval-technology-platform.html"
|
|
with open(path, "r", encoding="utf-8") as f:
|
|
c = f.read()
|
|
|
|
if "V131-WTP-WEDROID" in c:
|
|
print("ALREADY")
|
|
sys.exit(0)
|
|
|
|
lines = c.split('\n')
|
|
target_idx = None
|
|
for i, line in enumerate(lines):
|
|
if 'office-hub.html' in line and 'v80-quick' in line:
|
|
target_idx = i
|
|
break
|
|
|
|
if target_idx is None:
|
|
print("office line not found")
|
|
sys.exit(1)
|
|
|
|
# Build new line manually (no .replace to avoid issues)
|
|
new_line = ' <a class="v80-quick" href="/wevcode.html" target="_blank"><span class="v80-quick-icon"></span>WEDROID</a> V131-WTP-WEDROID-marker'
|
|
|
|
lines.insert(target_idx + 1, new_line)
|
|
new_content = '\n'.join(lines)
|
|
|
|
with open(path, "w", encoding="utf-8") as f:
|
|
f.write(new_content)
|
|
print(f"OK size={len(new_content)} inserted_at_line={target_idx+2}")
|
|
except Exception as e:
|
|
print(f"ERROR: {type(e).__name__}: {e}")
|
|
sys.exit(2)
|