Skip to content

Commit

Permalink
Bug fixes and improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
RedDragon0293 committed Apr 30, 2024
1 parent 491f5cc commit deabdc4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/main/java/cn/reddragon/eportal/Authenticator.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.NoRouteToHostException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -117,23 +117,25 @@ public static void checkOnline() {
error = false;
if (connection.getResponseCode() != HttpURLConnection.HTTP_MOVED_TEMP) {
if (HelloApplication.controller != null) {
Platform.runLater(() -> HelloApplication.controller.resultText.setText("Auth server error!"));
Platform.runLater(() -> HelloApplication.controller.resultText.setText("Error: Auth server error!"));
error = true;
}
}
} catch (SocketTimeoutException e) {
System.err.println(e.getMessage());
if (HelloApplication.controller != null) {
Platform.runLater(() -> {
HelloApplication.controller.resultText.setText("Auth server connection timeout!");
HelloApplication.controller.resultText.setText("Error: Auth server connection timeout!");
error = true;
//HelloApplication.controller.button.setDisable(true);
});
}
online = false;
} catch (NoRouteToHostException e) {
} catch (SocketException e) {
System.err.println(e.getMessage());
if (HelloApplication.controller != null) {
Platform.runLater(() -> {
HelloApplication.controller.resultText.setText("No Internet connection!");
HelloApplication.controller.resultText.setText("Error: No Internet connection!");
error = true;
//HelloApplication.controller.button.setDisable(true);
});
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cn/reddragon/eportal/HelloController.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void updateUI() {
remainLabel.setText("Time remaining:");
}
statusLabel.setText(sb.toString());
button.setDisable(Authenticator.error);
}

@FXML
Expand Down

0 comments on commit deabdc4

Please sign in to comment.