diff --git a/gotify_tray/gui/widgets/ServerInfoDialog.py b/gotify_tray/gui/widgets/ServerInfoDialog.py index 89e147f..9ae170a 100644 --- a/gotify_tray/gui/widgets/ServerInfoDialog.py +++ b/gotify_tray/gui/widgets/ServerInfoDialog.py @@ -44,18 +44,16 @@ class ServerInfoDialog(QtWidgets.QDialog, Ui_Dialog): self.task.incorrect_url.connect(self.incorrect_url_callback) self.task.start() - def server_info_success(self, version: GotifyVersionModel): + def server_info_success(self): self.pb_test.setEnabled(True) - self.label_server_info.setText(f"Version: {version.version}") update_widget_property(self.pb_test, "state", "success") update_widget_property(self.line_token, "state", "success") update_widget_property(self.line_url, "state", "success") self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setEnabled(True) self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setFocus() - def incorrect_token_callback(self, version: GotifyVersionModel): + def incorrect_token_callback(self): self.pb_test.setEnabled(True) - self.label_server_info.setText(f"Version: {version.version}") update_widget_property(self.pb_test, "state", "failed") update_widget_property(self.line_token, "state", "failed") update_widget_property(self.line_url, "state", "success") diff --git a/gotify_tray/tasks.py b/gotify_tray/tasks.py index 4ccc4e2..848da57 100644 --- a/gotify_tray/tasks.py +++ b/gotify_tray/tasks.py @@ -171,8 +171,8 @@ class ProcessMessageTask(BaseTask): class VerifyServerInfoTask(BaseTask): - success = pyqtSignal(GotifyVersionModel) - incorrect_token = pyqtSignal(GotifyVersionModel) + success = pyqtSignal() + incorrect_token = pyqtSignal() incorrect_url = pyqtSignal() def __init__(self, url: str, client_token: str): @@ -184,21 +184,16 @@ class VerifyServerInfoTask(BaseTask): try: gotify_client = gotify.GotifyClient(self.url, self.client_token) - version = gotify_client.version() - if isinstance(version, gotify.GotifyErrorModel): - self.incorrect_url.emit() - return - result = gotify_client.get_messages(limit=1) if isinstance(result, gotify.GotifyPagedMessagesModel): - self.success.emit(version) + self.success.emit() return elif ( isinstance(result, gotify.GotifyErrorModel) and result["error"] == "Unauthorized" ): - self.incorrect_token.emit(version) + self.incorrect_token.emit() return self.incorrect_url.emit() except Exception as e: