mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-08-18 11:18:36 -04:00
cleanup, deactivate updateservice
This commit is contained in:
parent
81bf4b65d4
commit
d33ebbed27
13 changed files with 45 additions and 66 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<ECPoint> UPDATE_SIGNING_KEYS = Crypto.decode("029EF2D0D33A2546CB15FB10D969B7D65CAFB811CB3AC902E8D9A46BE847B1DA21");
|
||||
private static final String UPDATES_BASE_URL = "https://bitsquare.io/updateFX/v03";
|
||||
// private static final List<ECPoint> 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> state = new SimpleObjectProperty<>(State.CHECK_FOR_UPDATES);
|
||||
public final ObjectProperty<State> 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() {
|
||||
|
|
|
@ -146,6 +146,7 @@
|
|||
}
|
||||
|
||||
/* software update*/
|
||||
|
||||
#image-update-in-progress {
|
||||
-fx-image: url("../../../images/update/update_in_progress.png");
|
||||
}
|
||||
|
|
|
@ -340,7 +340,9 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
|||
});
|
||||
|
||||
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<StackPane, MainViewModel> {
|
|||
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<StackPane, MainViewModel> {
|
|||
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<StackPane, MainViewModel> {
|
|||
this.setGraphicTextGap(newValue ? -1 : 0);
|
||||
if (newValue) {
|
||||
this.getGraphic().setId("image-nav-" + viewId(viewClass) + "-active");
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.getGraphic().setId("image-nav-" + viewId(viewClass));
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -85,8 +85,8 @@
|
|||
<TextField fx:id="nodeAddress" GridPane.rowIndex="6" GridPane.columnIndex="1"
|
||||
mouseTransparent="true" focusTraversable="false"/>
|
||||
|
||||
<Label text="P2P bootstrap node addresses:" GridPane.rowIndex="7" GridPane.valignment="TOP"/>
|
||||
<TextArea fx:id="bootstrapNodeAddress" GridPane.rowIndex="7" GridPane.columnIndex="1"
|
||||
<Label text="P2P seed node addresses:" GridPane.rowIndex="7" GridPane.valignment="TOP"/>
|
||||
<TextArea fx:id="seedNodeNodeAddress" GridPane.rowIndex="7" GridPane.columnIndex="1"
|
||||
mouseTransparent="true" focusTraversable="false"/>
|
||||
|
||||
<columnConstraints>
|
||||
|
|
|
@ -55,7 +55,7 @@ public class NetworkSettingsView extends InitializableView {
|
|||
@FXML
|
||||
ComboBox<BitcoinNetwork> netWorkComboBox;
|
||||
@FXML
|
||||
TextArea bootstrapNodeAddress;
|
||||
TextArea seedNodeNodeAddress;
|
||||
|
||||
@Inject
|
||||
public NetworkSettingsView(WalletService walletService, P2PService p2PService, SeedNodesRepository bootstrapNodes, Preferences preferences, BSFormatter
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue