Skip to content

Commit 472c37b

Browse files
committed
fixed check for updates
1 parent 53c696e commit 472c37b

1 file changed

Lines changed: 17 additions & 14 deletions

File tree

ui/windows/main_window.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
QWidget,
5656
)
5757

58+
from config.environments import Environment
5859
from ui.custom.job_tab import JobTab
5960
from ui.custom_widgets import (
6061
ButtonManagerWidget,
@@ -2027,20 +2028,22 @@ def refresh_nest_directories(self):
20272028
# * \/ CHECKERS \/
20282029
def check_for_updates(self, on_start_up: bool = False):
20292030
try:
2030-
try:
2031-
response = requests.get("http://10.0.0.10:5051/version", timeout=5)
2032-
except ConnectionError:
2033-
return
2034-
if response.status_code == 200:
2035-
version = response.text
2036-
if version != __version__:
2037-
subprocess.Popen("start update.exe", shell=True)
2038-
elif not on_start_up:
2039-
msg = QMessageBox(self)
2040-
msg.setIcon(QMessageBox.Icon.Information)
2041-
msg.setWindowTitle("No updates")
2042-
msg.setText("There are currently no updates available")
2043-
msg.exec()
2031+
resp = requests.get(
2032+
f"{Environment.SOFTWARE_API_BASE}/version",
2033+
timeout=10,
2034+
)
2035+
2036+
data = resp.json()
2037+
latest_version = data.get("version")
2038+
2039+
if latest_version != __version__:
2040+
subprocess.Popen("start update.exe", shell=True)
2041+
elif not on_start_up:
2042+
msg = QMessageBox(self)
2043+
msg.setIcon(QMessageBox.Icon.Information)
2044+
msg.setWindowTitle("No updates")
2045+
msg.setText("There are currently no updates available")
2046+
msg.exec()
20442047
except Exception as e:
20452048
if not on_start_up:
20462049
msg = QMessageBox(self)

0 commit comments

Comments
 (0)