Fix config.py: remove dead code after main(), fix work_place key, remove idmasa.txt write

This commit is contained in:
2026-04-23 16:31:39 +03:00
parent 35fb6b93ad
commit a94fc40a9e

View File

@@ -43,7 +43,7 @@ def _read_config():
p = configparser.ConfigParser()
p.read(CONFIG_PATH)
return {
"device_name": p.get("device", "name", fallback="notconfig"),
"device_name": p.get("device", "work_place", fallback="notconfig"),
"hostname": p.get("device", "hostname", fallback=socket.gethostname()),
"device_ip": p.get("device", "ip", fallback=_get_local_ip()),
"location": p.get("device", "location", fallback=""),
@@ -80,7 +80,7 @@ def _write_config(cfg):
p.set("server", "internet_check_host", cfg.get("internet_check_host", ""))
p.add_section("device")
p.set("device", "name", cfg["device_name"])
p.set("device", "work_place", cfg["device_name"])
p.set("device", "hostname", cfg["hostname"])
p.set("device", "ip", cfg["device_ip"])
p.set("device", "location", cfg.get("location", ""))
@@ -97,10 +97,6 @@ def _write_config(cfg):
f.write(f"# Last updated by config.py: {now_ts}\n\n")
p.write(f)
# Keep legacy idmasa.txt in sync for older code paths
with open("./data/idmasa.txt", "w") as f:
f.write(cfg["device_name"])
print(f"✓ config.txt saved (last_synced={now_ts})")
@@ -268,16 +264,6 @@ def main():
if __name__ == "__main__":
main()
window.close()
# daca variabila nook este 1
time.sleep(2)
if n_config == 0:
os.system("sudo reboot now")