From d33ebbed27a4d2d0e8665b9571e338c34936b939 Mon Sep 17 00:00:00 2001 From: Manfred Karrer Date: Thu, 5 Nov 2015 23:59:49 +0100 Subject: [PATCH] cleanup, deactivate updateservice --- gui/pom.xml | 13 ----- .../java/io/bitsquare/app/BitsquareApp.java | 4 +- .../io/bitsquare/app/BitsquareAppMain.java | 12 +---- .../java/io/bitsquare/app/UpdateProcess.java | 50 +++++++++---------- gui/src/main/java/io/bitsquare/gui/images.css | 1 + .../java/io/bitsquare/gui/main/MainView.java | 13 +++-- .../io/bitsquare/gui/main/MainViewModel.java | 4 ++ .../settings/network/NetworkSettingsView.fxml | 4 +- .../settings/network/NetworkSettingsView.java | 2 +- pom.xml | 2 +- {bootstrap => seednode}/pom.xml | 6 +-- .../io/bitsquare/p2p/seed/SeedNodeMain.java | 0 .../src/main/resources/logback.xml | 0 13 files changed, 45 insertions(+), 66 deletions(-) rename {bootstrap => seednode}/pom.xml (93%) rename {bootstrap => seednode}/src/main/java/io/bitsquare/p2p/seed/SeedNodeMain.java (100%) rename {bootstrap => seednode}/src/main/resources/logback.xml (100%) diff --git a/gui/pom.xml b/gui/pom.xml index 1337f84255..0532bcc194 100644 --- a/gui/pom.xml +++ b/gui/pom.xml @@ -118,19 +118,6 @@ ${project.parent.version} - - com.vinumeris - updatefx - 1.3-SNAPSHOT - - - - org.slf4j - slf4j-jdk14 - - - - org.controlsfx controlsfx diff --git a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java index 78bd192fe1..03e90c8d4a 100644 --- a/gui/src/main/java/io/bitsquare/app/BitsquareApp.java +++ b/gui/src/main/java/io/bitsquare/app/BitsquareApp.java @@ -20,7 +20,6 @@ package io.bitsquare.app; import ch.qos.logback.classic.Logger; import com.google.inject.Guice; import com.google.inject.Injector; -import com.vinumeris.updatefx.UpdateFX; import io.bitsquare.alert.AlertManager; import io.bitsquare.btc.WalletService; import io.bitsquare.common.UserThread; @@ -322,6 +321,7 @@ public class BitsquareApp extends Application { } private void restart() { - gracefulShutDown(UpdateFX::restartApp); + //TODO + //gracefulShutDown(UpdateFX::restartApp); } } diff --git a/gui/src/main/java/io/bitsquare/app/BitsquareAppMain.java b/gui/src/main/java/io/bitsquare/app/BitsquareAppMain.java index d07bdebc5e..f70dd0eeec 100644 --- a/gui/src/main/java/io/bitsquare/app/BitsquareAppMain.java +++ b/gui/src/main/java/io/bitsquare/app/BitsquareAppMain.java @@ -17,7 +17,6 @@ package io.bitsquare.app; -import com.vinumeris.updatefx.UpdateFX; import io.bitsquare.BitsquareException; import io.bitsquare.btc.BitcoinNetwork; import io.bitsquare.btc.RegTestHost; @@ -29,7 +28,6 @@ import joptsimple.OptionSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -38,6 +36,7 @@ import java.nio.file.Paths; import static io.bitsquare.app.BitsquareEnvironment.*; import static java.util.Arrays.asList; +//TODO clean up public class BitsquareAppMain extends BitsquareExecutable { private static final Logger log = LoggerFactory.getLogger(BitsquareAppMain.class); @@ -63,15 +62,9 @@ public class BitsquareAppMain extends BitsquareExecutable { } BitsquareEnvironment bitsquareEnvironment = new BitsquareEnvironment(options); - // update dir need to be setup before UpdateFX bootstrap + // need to call that before BitsquareAppMain().execute(args) initAppDir(bitsquareEnvironment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY)); - UpdateFX.bootstrap(BitsquareAppMain.class, new File(bitsquareEnvironment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY)).toPath(), args); - } - - // That will be called from UpdateFX after updates are checked - public static void realMain(String[] args) throws Exception { - //log.trace("realMain"); // For some reason the JavaFX launch process results in us losing the thread context class loader: reset it. // In order to work around a bug in JavaFX 8u25 and below, you must include the following code as the first line of your realMain method: Thread.currentThread().setContextClassLoader(BitsquareAppMain.class.getClassLoader()); @@ -122,7 +115,6 @@ public class BitsquareAppMain extends BitsquareExecutable { .ofType(BitcoinNetwork.class) .withValuesConvertedBy(new EnumValueConverter(BitcoinNetwork.class)); - parser.accepts(RegTestHost.KEY, description("", RegTestHost.DEFAULT)) .withRequiredArg() .ofType(RegTestHost.class) diff --git a/gui/src/main/java/io/bitsquare/app/UpdateProcess.java b/gui/src/main/java/io/bitsquare/app/UpdateProcess.java index 3161aa4963..287a69417e 100644 --- a/gui/src/main/java/io/bitsquare/app/UpdateProcess.java +++ b/gui/src/main/java/io/bitsquare/app/UpdateProcess.java @@ -18,38 +18,30 @@ package io.bitsquare.app; import com.google.inject.Inject; -import com.vinumeris.updatefx.Crypto; -import com.vinumeris.updatefx.UpdateFX; -import com.vinumeris.updatefx.UpdateSummary; -import com.vinumeris.updatefx.Updater; import io.bitsquare.common.handlers.ResultHandler; -import io.bitsquare.common.util.Utilities; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; -import org.bouncycastle.math.ec.ECPoint; -import org.reactfx.util.FxTimer; import org.reactfx.util.Timer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.time.Duration; -import java.util.List; - +// TODO +// Deactivated for the moment. +// UpdateFX use https for getting the version nr./jars, which we want to avoid with the Tor P2p network +// We need to wait until tor is setup and then request from a hidden service the version and jars public class UpdateProcess { private static final Logger log = LoggerFactory.getLogger(UpdateProcess.class); - private static final List UPDATE_SIGNING_KEYS = Crypto.decode("029EF2D0D33A2546CB15FB10D969B7D65CAFB811CB3AC902E8D9A46BE847B1DA21"); - private static final String UPDATES_BASE_URL = "https://bitsquare.io/updateFX/v03"; + // private static final List UPDATE_SIGNING_KEYS = Crypto.decode("029EF2D0D33A2546CB15FB10D969B7D65CAFB811CB3AC902E8D9A46BE847B1DA21"); + // private static final String UPDATES_BASE_URL = "https://bitsquare.io/updateFX/v03"; private static final int UPDATE_SIGNING_THRESHOLD = 1; - private static final Path ROOT_CLASS_PATH = UpdateFX.findCodePath(BitsquareAppMain.class); + // private static final Path ROOT_CLASS_PATH = UpdateFX.findCodePath(BitsquareAppMain.class); private final BitsquareEnvironment environment; private ResultHandler resultHandler; public enum State { + INIT, CHECK_FOR_UPDATES, UPDATE_AVAILABLE, UP_TO_DATE, @@ -57,7 +49,7 @@ public class UpdateProcess { FAILURE } - public final ObjectProperty state = new SimpleObjectProperty<>(State.CHECK_FOR_UPDATES); + public final ObjectProperty state = new SimpleObjectProperty<>(State.INIT); private String releaseUrl; private Timer timeoutTimer; @@ -68,25 +60,29 @@ public class UpdateProcess { } public void restart() { - UpdateFX.restartApp(); + // UpdateFX.restartApp(); } public void setResultHandler(ResultHandler resultHandler) { this.resultHandler = resultHandler; + + resultHandler.handleResult(); } public void init() { - log.info("UpdateFX checking for patch version " + Version.PATCH_VERSION); + + + //log.info("UpdateFX checking for patch version " + Version.PATCH_VERSION); // process.timeout() will cause an error state back but we don't want to break startup in case of an timeout - timeoutTimer = FxTimer.runLater(Duration.ofMillis(10000), () -> { + /* timeoutTimer = FxTimer.runLater(Duration.ofMillis(10000), () -> { log.error("Timeout reached for UpdateFX"); resultHandler.handleResult(); }); String userAgent = environment.getProperty(BitsquareEnvironment.APP_NAME_KEY) + Version.VERSION; - +*/ // Check if there is a new minor version release out. The release_url should be empty if no release is available, otherwise the download url. - try { + /* try { releaseUrl = Utilities.readTextFileFromServer(UPDATES_BASE_URL + "/release_url", userAgent); if (releaseUrl != null && releaseUrl.length() > 0) { log.info("New release available at: " + releaseUrl); @@ -99,9 +95,9 @@ public class UpdateProcess { } } catch (IOException e) { // ignore. File might be missing - } + }*/ - Updater updater = new Updater(UPDATES_BASE_URL, userAgent, Version.PATCH_VERSION, + /* Updater updater = new Updater(UPDATES_BASE_URL, userAgent, Version.PATCH_VERSION, Paths.get(environment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY)), ROOT_CLASS_PATH, UPDATE_SIGNING_KEYS, UPDATE_SIGNING_THRESHOLD) { @Override @@ -109,13 +105,13 @@ public class UpdateProcess { //log.trace("updateProgress " + workDone + "/" + max); super.updateProgress(workDone, max); } - }; + };*/ /* updater.progressProperty().addListener((observableValue, oldValue, newValue) -> { log.trace("progressProperty newValue = " + newValue); });*/ - updater.setOnSucceeded(event -> { + /* updater.setOnSucceeded(event -> { try { UpdateSummary summary = updater.get(); //log.info("summary " + summary.toString()); @@ -159,7 +155,7 @@ public class UpdateProcess { Thread thread = new Thread(updater, "Online update check"); thread.setDaemon(true); - thread.start(); + thread.start();*/ } public String getReleaseUrl() { diff --git a/gui/src/main/java/io/bitsquare/gui/images.css b/gui/src/main/java/io/bitsquare/gui/images.css index 557e00ad85..e9f332285d 100644 --- a/gui/src/main/java/io/bitsquare/gui/images.css +++ b/gui/src/main/java/io/bitsquare/gui/images.css @@ -146,6 +146,7 @@ } /* software update*/ + #image-update-in-progress { -fx-image: url("../../../images/update/update_in_progress.png"); } diff --git a/gui/src/main/java/io/bitsquare/gui/main/MainView.java b/gui/src/main/java/io/bitsquare/gui/main/MainView.java index 69f04bc6f8..631f8da771 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/MainView.java +++ b/gui/src/main/java/io/bitsquare/gui/main/MainView.java @@ -340,7 +340,9 @@ public class MainView extends InitializableView { }); ImageView updateIcon = new ImageView(); - updateIcon.setId(model.updateIconId.get()); + String id = model.updateIconId.get(); + if (id != null && !id.equals("")) + updateIcon.setId(id); updateIconIdListener = (ov, oldValue, newValue) -> { updateIcon.setId(newValue); @@ -410,8 +412,7 @@ public class MainView extends InitializableView { bitcoinNetworkLabel.setId("splash-error-state-msg"); bitcoinNetworkLabel.setText("Not connected"); openBTCConnectionErrorPopup(newValue); - } - else { + } else { bitcoinNetworkLabel.setId("footer-bitcoin-network-label"); bitcoinNetworkLabel.setText(model.bitcoinNetworkAsString); } @@ -469,8 +470,7 @@ public class MainView extends InitializableView { bootstrapLabel.setText("Not connected"); new Popup().error("Connecting to the P2P network failed. \n" + newValue + "\nPlease check your internet connection.").show(); - } - else { + } else { bootstrapLabel.setId("footer-pane"); bootstrapLabel.textProperty().bind(model.p2pNetworkInfoFooter); } @@ -559,8 +559,7 @@ public class MainView extends InitializableView { this.setGraphicTextGap(newValue ? -1 : 0); if (newValue) { this.getGraphic().setId("image-nav-" + viewId(viewClass) + "-active"); - } - else { + } else { this.getGraphic().setId("image-nav-" + viewId(viewClass)); } }); diff --git a/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java b/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java index 1d32568328..9e7e7f4508 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java +++ b/gui/src/main/java/io/bitsquare/gui/main/MainViewModel.java @@ -462,6 +462,10 @@ class MainViewModel implements ViewModel { private void applyUpdateState(UpdateProcess.State state) { switch (state) { + case INIT: + updateInfo.set(""); + updateIconId.set(null); + break; case CHECK_FOR_UPDATES: updateInfo.set("Check for updates..."); updateIconId.set("image-update-in-progress"); diff --git a/gui/src/main/java/io/bitsquare/gui/main/settings/network/NetworkSettingsView.fxml b/gui/src/main/java/io/bitsquare/gui/main/settings/network/NetworkSettingsView.fxml index 45d6129147..2a80429516 100644 --- a/gui/src/main/java/io/bitsquare/gui/main/settings/network/NetworkSettingsView.fxml +++ b/gui/src/main/java/io/bitsquare/gui/main/settings/network/NetworkSettingsView.fxml @@ -85,8 +85,8 @@ -