removed history bloat

This commit is contained in:
2025-10-10 10:21:07 +02:00
parent cd2545934e
commit 000bd789b1
2 changed files with 397 additions and 5 deletions

View File

@@ -328,11 +328,18 @@ class MyApp(Adw.Application):
if settings["save_conn"]:
password = conn_info["passwd"]
useratip = conn_info["user"] + "@" + conn_info["ip"]
with open(HOMEDIR+"/.config/rdpconnect/history.json", "w") as hist_file:
hist_id = str(int(max(hist_info, default=0)) + 1)
hist_info[hist_id] = useratip
js = json.dumps(hist_info, sort_keys=True, indent=4, separators=(',', ': '))
hist_file.write(js)
new_conn = 1
for i in hist_info:
if hist_info[i] == useratip:
new_conn = 0
if new_conn == 1:
with open(HOMEDIR+"/.config/rdpconnect/history.json", "w") as hist_file:
hist_id = str(int(max(hist_info, default=0)) + 1)
hist_info[hist_id] = useratip
js = json.dumps(hist_info, sort_keys=True, indent=4, separators=(',', ': '))
hist_file.write(js)
try:
keyring.set_password("com.angoosh.RDPConnect", useratip, password)
except: