# Fix 1: save-config.php — META_TOKEN → META_SYSTEM_TOKEN
with open("public_html/supercerebro/api/save-config.php", "r") as f:
    content = f.read()

old = "        if(!empty($input['token']))   $existing['META_TOKEN']      = $input['token'];"
new = "        if(!empty($input['token']))   $existing['META_SYSTEM_TOKEN'] = $input['token'];"

if old in content:
    content = content.replace(old, new, 1)
    with open("public_html/supercerebro/api/save-config.php", "w") as f:
        f.write(content)
    print("OK fix 1: META_TOKEN → META_SYSTEM_TOKEN in save-config.php")
else:
    print("ERROR fix 1: anchor not found")
    print(repr(content[content.find("META_TOKEN")-5:content.find("META_TOKEN")+60]))
