set to previous proxy when launch

This commit is contained in:
Zichao Lin 2024-07-07 10:18:26 +08:00
parent ec561c6cf3
commit 8559ec6dc7
Signed by: earthjasonlin
GPG Key ID: 406D9913DE2E42FB

@ -56,7 +56,7 @@ def disable_proxy():
try: try:
winreg.SetValueEx(INTERNET_SETTINGS, "ProxyEnable", 0, winreg.REG_DWORD, 0) winreg.SetValueEx(INTERNET_SETTINGS, "ProxyEnable", 0, winreg.REG_DWORD, 0)
refresh_internet_settings() refresh_internet_settings()
config["current_proxy"] = "无代理" config["current_proxy"] = "none"
save_config(config) save_config(config)
messagebox.showinfo("代理设置", "代理已禁用") messagebox.showinfo("代理设置", "代理已禁用")
except Exception as e: except Exception as e:
@ -169,4 +169,10 @@ app.resizable(False, False)
# 更新列表框 # 更新列表框
update_proxy_listbox() update_proxy_listbox()
if config["current_proxy"]:
if config["current_proxy"] == "无代理":
disable_proxy()
else:
set_system_proxy(config["current_proxy"])
app.mainloop() app.mainloop()