Skip to content

Commit

Permalink
Delete Version check logic (#91)
Browse files Browse the repository at this point in the history
* add sasl module

* add okhttp dependency for plugging original connector

* downgrade okhttp deps for not using alpha version

* Add method to create Unsafe client for fixing #89

* Change sentence for more explanation

* Delete Version check functionality due that no workaround was found

* Delete `VersionHelper` and related tests for vulnerable
  • Loading branch information
hizumiaoba authored Aug 6, 2024
1 parent 8325db0 commit feef310
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 382 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies {
// https://mvnrepository.com/artifact/com.melloware/jintellitype
implementation(libs.jintelitype)
implementation(libs.gh.api)
implementation(libs.okhttp)


// test dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import io.github.hizumiaoba.mctimemachine.MainController.GlobalShortcutKeyListener.Shortcut;
import io.github.hizumiaoba.mctimemachine.api.Config;
import io.github.hizumiaoba.mctimemachine.api.ExceptionPopup;
import io.github.hizumiaoba.mctimemachine.api.Version;
import io.github.hizumiaoba.mctimemachine.internal.ApplicationConfig;
import io.github.hizumiaoba.mctimemachine.internal.concurrent.ConcurrentThreadFactory;
import io.github.hizumiaoba.mctimemachine.internal.fs.BackupUtils;
import io.github.hizumiaoba.mctimemachine.internal.version.VersionObj;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
Expand All @@ -26,7 +28,10 @@
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonType;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Spinner;
import javafx.scene.control.SpinnerValueFactory.IntegerSpinnerValueFactory;
Expand Down Expand Up @@ -403,18 +408,31 @@ void onSpecialBackupNowBtnClick() {
}

@FXML
private Button checkVersionUpdateBtn;

@FXML
void onCheckVersionUpdateBtnClick() throws IOException {
log.trace("Checking the latest version...");
// open new dialog with `update.fxml`
FXMLLoader loader = new FXMLLoader(
MineCraftTimeMachineApplication.class.getResource("update.fxml"));
Stage updateDialogStage = new Stage();
updateDialogStage.setScene(new Scene(loader.load()));
updateDialogStage.initModality(Modality.APPLICATION_MODAL);
updateDialogStage.showAndWait();
void onOpenReleasePageOnWebBtnClick() {
runConcurrentTask(es, () -> {
final String url = "https://github.com/hizumiaoba/MineCraftTimeMachine/releases";
Platform.runLater(() -> {
Alert alert = new Alert(AlertType.CONFIRMATION);
alert.initModality(Modality.APPLICATION_MODAL);
alert.setTitle("リリースページを開きますか?");
alert.setHeaderText("既定のブラウザでリリースページを開きます。よろしいですか?");
alert.setContentText(String.format("現在のバージョン: v%s", VersionObj.parse(MineCraftTimeMachineApplication.class.getAnnotation(Version.class)).asStringNotation()));
alert.getButtonTypes().setAll(ButtonType.OK, ButtonType.CANCEL);
alert.showAndWait().ifPresent(response -> {
if(response == ButtonType.OK) {
try {
Desktop.getDesktop().browse(URI.create(url));
} catch (IOException e) {
ExceptionPopup popup = new ExceptionPopup(e, "リリースページを開けませんでした。",
"MainController#onOpenReleasePageOnWebBtnClick()$lambda");
popup.pop();
}
} else {
log.trace("User canceled to open the release page.");
}
});
});
});
}

private void runConcurrentTask(ExecutorService service, Runnable task) {
Expand Down

This file was deleted.

This file was deleted.

3 changes: 3 additions & 0 deletions app/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
requires javafx.fxml;
requires kotlin.stdlib;
requires java.desktop;
requires java.security.sasl;
requires org.xerial.sqlitejdbc;
requires org.slf4j;
requires ch.qos.logback.classic;
Expand All @@ -11,6 +12,8 @@
requires annotations;
requires jintellitype;
requires org.kohsuke.github.api;
requires org.apache.commons.lang3;
requires okhttp3;
requires com.fasterxml.jackson.core;
requires com.fasterxml.jackson.databind;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
prefHeight="40.0" prefWidth="170.0"
text="各種フォルダを開く" fx:id="openRelatedFolderBtn"/>
<Button layoutX="215.0" layoutY="17.0" mnemonicParsing="false"
onAction="#onCheckVersionUpdateBtnClick" prefHeight="40.0"
prefWidth="170.0" text="アップデートを確認" fx:id="checkVersionUpdateBtn"/>
onAction="#onOpenReleasePageOnWebBtnClick" prefHeight="40.0"
prefWidth="170.0" text="最新リリースをwebで確認" fx:id="checkVersionUpdateBtn"/>
</children>
<padding>
<Insets left="20.0" />
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit feef310

Please sign in to comment.