mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-19 07:15:54 -04:00
Add support for new release download, Fix bug with empty log file
This commit is contained in:
parent
5cc6c5c552
commit
9594ab96cf
@ -126,10 +126,14 @@ public class BootstrapNode {
|
||||
while (true) {
|
||||
if (peer.peerBean().peerMap().all().size() > 0) {
|
||||
noPeersInfoPrinted = false;
|
||||
log.info("Number of peers online = " + peer.peerBean().peerMap().all().size());
|
||||
int relayed = 0;
|
||||
for (PeerAddress peerAddress : peer.peerBean().peerMap().all()) {
|
||||
log.info("Peer: " + peerAddress.toString());
|
||||
if (peerAddress.isRelayed())
|
||||
relayed++;
|
||||
}
|
||||
log.info("Number of peers online = " + peer.peerBean().peerMap().all().size());
|
||||
log.info("Relayed peers = " + relayed);
|
||||
}
|
||||
else if (noPeersInfoPrinted) {
|
||||
log.info("No peers online");
|
||||
|
@ -64,7 +64,7 @@ public class BitsquareEnvironment extends StandardEnvironment {
|
||||
public static final String DEFAULT_APP_NAME = "Bitsquare";
|
||||
|
||||
public static final String APP_DATA_DIR_KEY = "app.data.dir";
|
||||
public static final String DEFAULT_APP_DATA_DIR = appDataDir(DEFAULT_USER_DATA_DIR, DEFAULT_APP_NAME, BitcoinNetwork.DEFAULT, Version.VERSION);
|
||||
public static final String DEFAULT_APP_DATA_DIR = appDataDir(DEFAULT_USER_DATA_DIR, DEFAULT_APP_NAME);
|
||||
|
||||
public static final String APP_DATA_DIR_CLEAN_KEY = "app.data.dir.clean";
|
||||
public static final String DEFAULT_APP_DATA_DIR_CLEAN = "false";
|
||||
@ -80,6 +80,7 @@ public class BitsquareEnvironment extends StandardEnvironment {
|
||||
protected final String appName;
|
||||
protected final String userDataDir;
|
||||
protected final String appDataDir;
|
||||
protected final String btcNetworkDir;
|
||||
protected final String bootstrapNodePort;
|
||||
|
||||
public BitsquareEnvironment(OptionSet options) {
|
||||
@ -87,7 +88,7 @@ public class BitsquareEnvironment extends StandardEnvironment {
|
||||
}
|
||||
|
||||
public BitcoinNetwork getBtcNetworkProperty() {
|
||||
String dirString = Paths.get(userDataDir, appName, Version.VERSION).toString();
|
||||
String dirString = Paths.get(userDataDir, appName).toString();
|
||||
String fileString = Paths.get(dirString, BITCOIN_NETWORK_PROP).toString();
|
||||
File dir = new File(dirString);
|
||||
File file = new File(fileString);
|
||||
@ -114,7 +115,7 @@ public class BitsquareEnvironment extends StandardEnvironment {
|
||||
}
|
||||
|
||||
public void setBitcoinNetwork(BitcoinNetwork bitcoinNetwork) {
|
||||
String path = Paths.get(userDataDir, appName, Version.VERSION, BITCOIN_NETWORK_PROP).toString();
|
||||
String path = Paths.get(userDataDir, appName, BITCOIN_NETWORK_PROP).toString();
|
||||
File file = new File(path);
|
||||
try (FileOutputStream fos = new FileOutputStream(file)) {
|
||||
Properties properties = new Properties();
|
||||
@ -137,7 +138,12 @@ public class BitsquareEnvironment extends StandardEnvironment {
|
||||
|
||||
appDataDir = commandLineProperties.containsProperty(APP_DATA_DIR_KEY) ?
|
||||
(String) commandLineProperties.getProperty(APP_DATA_DIR_KEY) :
|
||||
appDataDir(userDataDir, appName, getBtcNetworkProperty(), Version.VERSION);
|
||||
appDataDir(userDataDir, appName);
|
||||
|
||||
btcNetworkDir = Paths.get(appDataDir, getBtcNetworkProperty().name().toLowerCase()).toString();
|
||||
File btcNetworkDirFile = new File(btcNetworkDir);
|
||||
if (!btcNetworkDirFile.exists())
|
||||
btcNetworkDirFile.mkdir();
|
||||
|
||||
bootstrapNodePort = commandLineProperties.containsProperty(TomP2PModule.BOOTSTRAP_NODE_PORT_KEY) ?
|
||||
(String) commandLineProperties.getProperty(TomP2PModule.BOOTSTRAP_NODE_PORT_KEY) : "-1";
|
||||
@ -155,7 +161,7 @@ public class BitsquareEnvironment extends StandardEnvironment {
|
||||
}
|
||||
|
||||
PropertySource<?> appDirProperties() throws Exception {
|
||||
String location = String.format("file:%s/bitsquare.properties", appDataDir);
|
||||
String location = String.format("file:%s/bitsquare.properties", btcNetworkDir);
|
||||
Resource resource = resourceLoader.getResource(location);
|
||||
|
||||
if (!resource.exists())
|
||||
@ -182,19 +188,22 @@ public class BitsquareEnvironment extends StandardEnvironment {
|
||||
protected PropertySource<?> defaultProperties() {
|
||||
return new PropertiesPropertySource(BITSQUARE_DEFAULT_PROPERTY_SOURCE_NAME, new Properties() {
|
||||
private static final long serialVersionUID = -8478089705207326165L;
|
||||
|
||||
{
|
||||
setProperty(APP_DATA_DIR_KEY, appDataDir);
|
||||
setProperty(APP_DATA_DIR_CLEAN_KEY, DEFAULT_APP_DATA_DIR_CLEAN);
|
||||
|
||||
setProperty(APP_NAME_KEY, appName);
|
||||
setProperty(USER_DATA_DIR_KEY, userDataDir);
|
||||
|
||||
setProperty(UserAgent.NAME_KEY, appName);
|
||||
setProperty(UserAgent.VERSION_KEY, Version.VERSION);
|
||||
|
||||
setProperty(WalletService.DIR_KEY, appDataDir);
|
||||
setProperty(WalletService.DIR_KEY, btcNetworkDir);
|
||||
setProperty(WalletService.PREFIX_KEY, appName);
|
||||
|
||||
setProperty(Storage.DIR_KEY, Paths.get(appDataDir, "db").toString());
|
||||
setProperty(KeyStorage.DIR_KEY, Paths.get(appDataDir, "keys").toString());
|
||||
setProperty(Storage.DIR_KEY, Paths.get(btcNetworkDir, "db").toString());
|
||||
setProperty(KeyStorage.DIR_KEY, Paths.get(btcNetworkDir, "keys").toString());
|
||||
|
||||
setProperty(TomP2PModule.BOOTSTRAP_NODE_PORT_KEY, bootstrapNodePort);
|
||||
}
|
||||
@ -210,7 +219,7 @@ public class BitsquareEnvironment extends StandardEnvironment {
|
||||
return Paths.get(System.getProperty("user.home"), ".local", "share").toString();
|
||||
}
|
||||
|
||||
private static String appDataDir(String userDataDir, String appName, BitcoinNetwork bitcoinNetwork, String version) {
|
||||
return Paths.get(userDataDir, appName, version, bitcoinNetwork.name().toLowerCase()).toString();
|
||||
private static String appDataDir(String userDataDir, String appName) {
|
||||
return Paths.get(userDataDir, appName).toString();
|
||||
}
|
||||
}
|
||||
|
@ -278,8 +278,10 @@ public class WalletService {
|
||||
public void shutDown() {
|
||||
if (wallet != null)
|
||||
wallet.removeEventListener(walletEventListener);
|
||||
if (walletAppKit != null)
|
||||
if (walletAppKit != null) {
|
||||
walletAppKit.stopAsync();
|
||||
walletAppKit.awaitTerminated();
|
||||
}
|
||||
}
|
||||
|
||||
public ReadOnlyDoubleProperty downloadPercentageProperty() {
|
||||
|
@ -53,7 +53,7 @@ public class Preferences implements Serializable {
|
||||
}
|
||||
|
||||
transient private final Storage<Preferences> storage;
|
||||
transient private BitsquareEnvironment bitsquareEnvironment;
|
||||
transient private final BitsquareEnvironment bitsquareEnvironment;
|
||||
|
||||
// Persisted fields
|
||||
private String btcDenomination = MonetaryFormat.CODE_BTC;
|
||||
|
@ -21,6 +21,9 @@ import io.bitsquare.common.handlers.ResultHandler;
|
||||
|
||||
import org.bitcoinj.utils.Threading;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.CharStreams;
|
||||
|
||||
import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
@ -32,6 +35,8 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.ObjectInput;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutput;
|
||||
@ -39,6 +44,7 @@ import java.io.ObjectOutputStream;
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URLConnection;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
@ -54,7 +60,6 @@ public class Utilities {
|
||||
private static final Logger log = LoggerFactory.getLogger(Utilities.class);
|
||||
private static long lastTimeStamp = System.currentTimeMillis();
|
||||
|
||||
|
||||
public static Timer setTimeout(long delay, ResultHandler handler) {
|
||||
Timer timer = new Timer();
|
||||
TimerTask task = new TimerTask() {
|
||||
@ -299,4 +304,18 @@ public class Utilities {
|
||||
}
|
||||
}
|
||||
|
||||
public static String readTextFileFromServer(String url, String userAgent) throws IOException {
|
||||
URLConnection connection = URI.create(url).toURL().openConnection();
|
||||
connection.setDoOutput(true);
|
||||
connection.setUseCaches(false);
|
||||
connection.setConnectTimeout(10 * 1000);
|
||||
connection.addRequestProperty("User-Agent", userAgent);
|
||||
connection.connect();
|
||||
try (InputStream inputStream = connection.getInputStream();) {
|
||||
return CharStreams.toString(new InputStreamReader(inputStream, Charsets.UTF_8));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@
|
||||
<dependency>
|
||||
<groupId>com.vinumeris</groupId>
|
||||
<artifactId>updatefx</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.3-SNAPSHOT</version>
|
||||
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
@ -128,7 +128,6 @@
|
||||
<artifactId>slf4j-jdk14</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
|
@ -35,6 +35,8 @@ import com.google.inject.Injector;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -53,6 +55,7 @@ import org.controlsfx.dialog.Dialogs;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ch.qos.logback.classic.Logger;
|
||||
import com.vinumeris.updatefx.UpdateFX;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import static io.bitsquare.app.BitsquareEnvironment.APP_NAME_KEY;
|
||||
@ -72,6 +75,7 @@ public class BitsquareApp extends Application {
|
||||
private MainView mainView;
|
||||
|
||||
public static Runnable shutDownHandler;
|
||||
public static Runnable restartDownHandler;
|
||||
|
||||
public static void setEnvironment(Environment env) {
|
||||
BitsquareApp.env = env;
|
||||
@ -81,7 +85,10 @@ public class BitsquareApp extends Application {
|
||||
public void start(Stage primaryStage) throws IOException {
|
||||
this.primaryStage = primaryStage;
|
||||
|
||||
Logging.setup(Paths.get(env.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY), "bitsquare").toString());
|
||||
|
||||
shutDownHandler = this::stop;
|
||||
restartDownHandler = this::restart;
|
||||
|
||||
// setup UncaughtExceptionHandler
|
||||
Thread.UncaughtExceptionHandler handler = (thread, throwable) -> {
|
||||
@ -103,12 +110,6 @@ public class BitsquareApp extends Application {
|
||||
URI.create("http://188.226.179.109/crashfx/upload"));*/
|
||||
// Server not setup yet, so we use client side only support
|
||||
|
||||
Storage.setDatabaseCorruptionHandler((String fileName) -> {
|
||||
corruptedDatabaseFiles.add(fileName);
|
||||
if (mainView != null)
|
||||
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
|
||||
});
|
||||
|
||||
// Guice
|
||||
bitsquareAppModule = new BitsquareAppModule(env, primaryStage);
|
||||
injector = Guice.createInjector(bitsquareAppModule);
|
||||
@ -119,6 +120,12 @@ public class BitsquareApp extends Application {
|
||||
mainView = (MainView) viewLoader.load(MainView.class);
|
||||
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
|
||||
|
||||
Storage.setDatabaseCorruptionHandler((String fileName) -> {
|
||||
corruptedDatabaseFiles.add(fileName);
|
||||
if (mainView != null)
|
||||
mainView.setPersistedFilesCorrupted(corruptedDatabaseFiles);
|
||||
});
|
||||
|
||||
scene = new Scene(mainView.getRoot(), 1000, 650);
|
||||
scene.getStylesheets().setAll(
|
||||
"/io/bitsquare/gui/bitsquare.css",
|
||||
@ -218,4 +225,14 @@ public class BitsquareApp extends Application {
|
||||
bitsquareAppModule.close(injector);
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
public void restart() {
|
||||
try {
|
||||
bitsquareAppModule.close(injector);
|
||||
UpdateFX.restartApp();
|
||||
} catch (Throwable t) {
|
||||
// in dev mode restart does not work
|
||||
stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
/*
|
||||
* This file is part of Bitsquare.
|
||||
*
|
||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.app;
|
||||
|
||||
import io.bitsquare.btc.UserAgent;
|
||||
import io.bitsquare.btc.WalletService;
|
||||
import io.bitsquare.crypto.KeyStorage;
|
||||
import io.bitsquare.gui.main.MainView;
|
||||
import io.bitsquare.p2p.tomp2p.TomP2PModule;
|
||||
import io.bitsquare.storage.Storage;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import joptsimple.OptionSet;
|
||||
import org.springframework.core.env.PropertiesPropertySource;
|
||||
import org.springframework.core.env.PropertySource;
|
||||
|
||||
public class BitsquareAppEnvironment extends BitsquareEnvironment {
|
||||
|
||||
public BitsquareAppEnvironment(OptionSet options) {
|
||||
super(options);
|
||||
}
|
||||
|
||||
BitsquareAppEnvironment(PropertySource commandLineProperties) {
|
||||
super(commandLineProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PropertySource<?> defaultProperties() {
|
||||
return new PropertiesPropertySource(BITSQUARE_DEFAULT_PROPERTY_SOURCE_NAME, new Properties() {
|
||||
private static final long serialVersionUID = -8478089705207326165L;
|
||||
|
||||
{
|
||||
setProperty(APP_DATA_DIR_KEY, appDataDir);
|
||||
setProperty(APP_DATA_DIR_CLEAN_KEY, DEFAULT_APP_DATA_DIR_CLEAN);
|
||||
|
||||
setProperty(APP_NAME_KEY, appName);
|
||||
|
||||
setProperty(UserAgent.NAME_KEY, appName);
|
||||
setProperty(UserAgent.VERSION_KEY, Version.VERSION);
|
||||
|
||||
setProperty(WalletService.DIR_KEY, appDataDir);
|
||||
setProperty(WalletService.PREFIX_KEY, appName);
|
||||
|
||||
setProperty(Storage.DIR_KEY, Paths.get(appDataDir, "db").toString());
|
||||
setProperty(KeyStorage.DIR_KEY, Paths.get(appDataDir, "keys").toString());
|
||||
|
||||
setProperty(MainView.TITLE_KEY, appName);
|
||||
|
||||
setProperty(TomP2PModule.BOOTSTRAP_NODE_PORT_KEY, bootstrapNodePort);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -67,15 +67,12 @@ public class BitsquareAppMain extends BitsquareExecutable {
|
||||
System.exit(EXIT_FAILURE);
|
||||
return;
|
||||
}
|
||||
BitsquareAppEnvironment bitsquareEnvironment = new BitsquareAppEnvironment(options);
|
||||
String updatesDirectory = bitsquareEnvironment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY);
|
||||
BitsquareEnvironment bitsquareEnvironment = new BitsquareEnvironment(options);
|
||||
|
||||
Logging.setup(Paths.get(bitsquareEnvironment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY), "bitsquare").toString());
|
||||
// update dir need to be setup before UpdateFX bootstrap
|
||||
initAppDir(bitsquareEnvironment.getProperty(BitsquareEnvironment.APP_DATA_DIR_KEY));
|
||||
|
||||
// app dir need to be setup before UpdateFX bootstrap
|
||||
initAppDir(updatesDirectory);
|
||||
|
||||
UpdateFX.bootstrap(BitsquareAppMain.class, new File(updatesDirectory).toPath(), args);
|
||||
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
|
||||
@ -151,7 +148,7 @@ public class BitsquareAppMain extends BitsquareExecutable {
|
||||
|
||||
@Override
|
||||
protected void doExecute(OptionSet options) {
|
||||
BitsquareApp.setEnvironment(new BitsquareAppEnvironment(options));
|
||||
BitsquareApp.setEnvironment(new BitsquareEnvironment(options));
|
||||
javafx.application.Application.launch(BitsquareApp.class);
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,8 @@ import io.bitsquare.util.Utilities;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
@ -38,7 +40,6 @@ import com.vinumeris.updatefx.UpdateFX;
|
||||
import com.vinumeris.updatefx.UpdateSummary;
|
||||
import com.vinumeris.updatefx.Updater;
|
||||
import org.bouncycastle.math.ec.ECPoint;
|
||||
import org.springframework.core.env.Environment;
|
||||
import rx.Observable;
|
||||
import rx.subjects.BehaviorSubject;
|
||||
import rx.subjects.Subject;
|
||||
@ -46,25 +47,26 @@ import rx.subjects.Subject;
|
||||
public class UpdateProcess {
|
||||
private static final Logger log = LoggerFactory.getLogger(UpdateProcess.class);
|
||||
|
||||
private static final List<ECPoint> UPDATE_SIGNING_KEYS = Crypto.decode("038396415C265C59042AB05A5436356E8D0FA19F13E3DE4915AFF763CB4785345E");
|
||||
private static final String UPDATES_BASE_URL = "http://bitsquare.io/updateFX/";
|
||||
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 final Environment environment;
|
||||
private final BitsquareEnvironment environment;
|
||||
|
||||
public enum State {
|
||||
CHECK_FOR_UPDATES,
|
||||
UPDATE_AVAILABLE,
|
||||
UP_TO_DATE,
|
||||
NEW_RELEASE, // if a new minor release is out we inform the user to download the new binary
|
||||
FAILURE
|
||||
}
|
||||
|
||||
public final ObjectProperty<State> state = new SimpleObjectProperty<>(State.CHECK_FOR_UPDATES);
|
||||
|
||||
protected String errorMessage;
|
||||
protected final Subject<State, State> process = BehaviorSubject.create();
|
||||
protected Timer timeoutTimer;
|
||||
private String releaseUrl;
|
||||
private final Subject<State, State> process = BehaviorSubject.create();
|
||||
private Timer timeoutTimer;
|
||||
|
||||
@Inject
|
||||
public UpdateProcess(BitsquareEnvironment environment) {
|
||||
@ -79,24 +81,35 @@ public class UpdateProcess {
|
||||
return process.asObservable();
|
||||
}
|
||||
|
||||
public String getErrorMessage() {
|
||||
return errorMessage;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
log.info("UpdateFX current 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 = Utilities.setTimeout(10000, () -> process.onCompleted());
|
||||
timeoutTimer = Utilities.setTimeout(10000, () -> {
|
||||
log.error("Timeout reached for UpdateFX");
|
||||
process.onCompleted();
|
||||
});
|
||||
String userAgent = environment.getProperty(BitsquareEnvironment.APP_NAME_KEY) + Version.VERSION;
|
||||
|
||||
String agent = 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 {
|
||||
releaseUrl = Utilities.readTextFileFromServer(UPDATES_BASE_URL + "/release_url", userAgent);
|
||||
if (releaseUrl != null && releaseUrl.length() > 0) {
|
||||
log.info("New release available at: " + releaseUrl);
|
||||
state.set(State.NEW_RELEASE);
|
||||
timeoutTimer.cancel();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// All ok. Empty file if we have no new release.
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// ignore. File might be missing
|
||||
}
|
||||
|
||||
// We use the outer dir not the app data dir including version and btc network
|
||||
Path dataDirPath = Paths.get(environment.getProperty(BitsquareEnvironment.USER_DATA_DIR_KEY),
|
||||
environment.getProperty(BitsquareEnvironment.APP_NAME_KEY));
|
||||
|
||||
Updater updater = new Updater(UPDATES_BASE_URL, agent, Version.PATCH_VERSION, dataDirPath, ROOT_CLASS_PATH,
|
||||
UPDATE_SIGNING_KEYS, UPDATE_SIGNING_THRESHOLD) {
|
||||
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
|
||||
protected void updateProgress(long workDone, long max) {
|
||||
//log.trace("updateProgress " + workDone + "/" + max);
|
||||
@ -135,7 +148,6 @@ public class UpdateProcess {
|
||||
|
||||
// we treat errors as update not as critical errors to prevent startup,
|
||||
// so we use state.onCompleted() instead of state.onError()
|
||||
errorMessage = "Exception at processing UpdateSummary: " + e.getMessage();
|
||||
state.set(State.FAILURE);
|
||||
timeoutTimer.cancel();
|
||||
process.onCompleted();
|
||||
@ -147,7 +159,6 @@ public class UpdateProcess {
|
||||
|
||||
// we treat errors as update not as critical errors to prevent startup,
|
||||
// so we use state.onCompleted() instead of state.onError()
|
||||
errorMessage = "Update failed: " + updater.getException();
|
||||
state.set(State.FAILURE);
|
||||
timeoutTimer.cancel();
|
||||
process.onCompleted();
|
||||
@ -157,4 +168,8 @@ public class UpdateProcess {
|
||||
thread.setDaemon(true);
|
||||
thread.start();
|
||||
}
|
||||
|
||||
public String getReleaseUrl() {
|
||||
return releaseUrl;
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@
|
||||
package io.bitsquare.gui;
|
||||
|
||||
import io.bitsquare.BitsquareModule;
|
||||
import io.bitsquare.app.BitsquareEnvironment;
|
||||
import io.bitsquare.gui.common.fxml.FxmlViewLoader;
|
||||
import io.bitsquare.gui.common.view.CachingViewLoader;
|
||||
import io.bitsquare.gui.common.view.ViewFactory;
|
||||
@ -78,6 +79,6 @@ public class GuiModule extends BitsquareModule {
|
||||
bind(Stage.class).toInstance(primaryStage);
|
||||
Popups.primaryStage = primaryStage;
|
||||
|
||||
bindConstant().annotatedWith(Names.named(MainView.TITLE_KEY)).to(env.getRequiredProperty(MainView.TITLE_KEY));
|
||||
bindConstant().annotatedWith(Names.named(MainView.TITLE_KEY)).to(env.getRequiredProperty(BitsquareEnvironment.APP_NAME_KEY));
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ public class TxIdTextField extends AnchorPane {
|
||||
try {
|
||||
// TODO get the url form the app preferences
|
||||
Utilities.openWebPage("https://www.biteasy.com/testnet/transactions/" + txID);
|
||||
// https://insight.bitpay.com/ only mainnet?
|
||||
//Utilities.openURL("https://blockchain.info/tx/" + txID);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
|
@ -37,6 +37,7 @@ import io.bitsquare.gui.main.offer.SellOfferView;
|
||||
import io.bitsquare.gui.main.portfolio.PortfolioView;
|
||||
import io.bitsquare.gui.main.settings.SettingsView;
|
||||
import io.bitsquare.gui.util.Transitions;
|
||||
import io.bitsquare.util.Utilities;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -75,12 +76,14 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
private ChangeListener<Number> bootstrapProgressListener;
|
||||
private ChangeListener<String> updateIconIdListener;
|
||||
private Button restartButton;
|
||||
private Button downloadButton;
|
||||
private ProgressIndicator bootstrapIndicator;
|
||||
private Label bootstrapStateLabel;
|
||||
private ProgressBar blockchainSyncIndicator;
|
||||
private Label blockchainSyncLabel;
|
||||
private Label updateInfoLabel;
|
||||
private List<String> persistedFilesCorrupted;
|
||||
private Tooltip downloadButtonTooltip;
|
||||
|
||||
@Inject
|
||||
public MainView(MainViewModel model, CachingViewLoader viewLoader, Navigation navigation, Transitions transitions,
|
||||
@ -296,6 +299,22 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
restartButton.managedProperty().bind(model.showRestartButton);
|
||||
restartButton.setOnAction(e -> model.restart());
|
||||
|
||||
downloadButton = new Button("Download");
|
||||
downloadButton.setDefaultButton(true);
|
||||
downloadButton.visibleProperty().bind(model.showDownloadButton);
|
||||
downloadButton.managedProperty().bind(model.showDownloadButton);
|
||||
downloadButtonTooltip = new Tooltip();
|
||||
downloadButtonTooltip.textProperty().bind(model.newReleaseUrl);
|
||||
downloadButton.setTooltip(downloadButtonTooltip);
|
||||
downloadButton.setOnAction(e -> {
|
||||
try {
|
||||
Utilities.openWebPage(model.newReleaseUrl.get());
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
log.error(e1.getMessage());
|
||||
}
|
||||
});
|
||||
|
||||
ImageView updateIcon = new ImageView();
|
||||
updateIcon.setId(model.updateIconId.get());
|
||||
|
||||
@ -310,7 +329,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
updateBox.setSpacing(10);
|
||||
updateBox.setAlignment(Pos.CENTER);
|
||||
updateBox.setPrefHeight(20);
|
||||
updateBox.getChildren().addAll(updateInfoLabel, restartButton, updateIcon);
|
||||
updateBox.getChildren().addAll(updateInfoLabel, restartButton, downloadButton, updateIcon);
|
||||
|
||||
vBox.getChildren().addAll(logo, blockchainSyncBox, bootstrapBox, updateBox);
|
||||
return vBox;
|
||||
@ -331,6 +350,9 @@ public class MainView extends InitializableView<StackPane, MainViewModel> {
|
||||
updateInfoLabel.textProperty().unbind();
|
||||
restartButton.visibleProperty().unbind();
|
||||
restartButton.managedProperty().unbind();
|
||||
downloadButton.visibleProperty().unbind();
|
||||
downloadButton.managedProperty().unbind();
|
||||
downloadButtonTooltip.textProperty().unbind();
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,6 +100,8 @@ class MainViewModel implements ViewModel {
|
||||
String version = "v." + Version.VERSION;
|
||||
|
||||
final BooleanProperty showRestartButton = new SimpleBooleanProperty(false);
|
||||
final BooleanProperty showDownloadButton = new SimpleBooleanProperty(false);
|
||||
final StringProperty newReleaseUrl = new SimpleStringProperty();
|
||||
final StringProperty updateIconId = new SimpleStringProperty();
|
||||
|
||||
final StringProperty bankAccountsComboBoxPrompt = new SimpleStringProperty();
|
||||
@ -295,8 +297,14 @@ class MainViewModel implements ViewModel {
|
||||
updateInfo.set("Software is up to date. Version: " + Version.VERSION);
|
||||
updateIconId.set("image-update-up-to-date");
|
||||
break;
|
||||
case NEW_RELEASE:
|
||||
updateInfo.set("A new release is available.");
|
||||
updateIconId.set("image-update-available");
|
||||
newReleaseUrl.set(updateProcess.getReleaseUrl());
|
||||
showDownloadButton.setValue(true);
|
||||
break;
|
||||
case FAILURE:
|
||||
updateInfo.set("Check for updates failed. ");
|
||||
updateInfo.set("Check for updates failed.");
|
||||
updateIconId.set("image-update-failed");
|
||||
break;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class NetworkSettingsView extends InitializableView {
|
||||
"Do you want to shutdown now?", actions);
|
||||
|
||||
if (Popups.isYes(response))
|
||||
BitsquareApp.shutDownHandler.run();
|
||||
BitsquareApp.restartDownHandler.run();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,18 +6,18 @@
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="WARN">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE_APPENDER"/>
|
||||
</root>
|
||||
|
||||
<logger name="io.bitsquare" level="TRACE"/>
|
||||
<logger name="io.bitsquare" level="DEBUG"/>
|
||||
<logger name="io.bitsquare.btc.AddressBasedCoinSelector" level="OFF"/>
|
||||
|
||||
<logger name="io.bitsquare.gui.util.Profiler" level="ERROR"/>
|
||||
<logger name="io.bitsquare.locale.BSResources" level="ERROR"/>
|
||||
|
||||
<logger name="org.bitcoinj" level="WARN"/>
|
||||
<logger name="net.tomp2p" level="WARN"/>
|
||||
<logger name="org.bitcoinj" level="INFO"/>
|
||||
<logger name="net.tomp2p" level="INFO"/>
|
||||
|
||||
<logger name="org.bitcoinj.core.BitcoinSerializer" level="WARN"/>
|
||||
<logger name="org.bitcoinj.core.Peer" level="WARN"/>
|
||||
|
7
gui/src/main/resources/update-description.txt
Normal file
7
gui/src/main/resources/update-description.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Release notes:
|
||||
- Bootstrap to all bootstrap nodes
|
||||
- Separeate btc network by directories in data dir
|
||||
- Add support for new release download
|
||||
- Only use mailbox for certain P2P messages
|
||||
- Bootstrap node update
|
||||
- Fix bug with empty log file
|
@ -23,8 +23,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1</string>
|
||||
|
||||
<!-- CFBundleSignature exists only for compatibility with Classic Mac OS apps and documents. Modern Mac OS X apps don't need to worry about assigning a Bundle
|
||||
Signature.-->
|
||||
<!-- CFBundleSignature exists only for compatibility with Classic Mac OS apps and documents. Modern Mac OS X apps don't need to worry about assigning a Bundle Signature.-->
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
|
||||
|
@ -23,8 +23,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1</string>
|
||||
|
||||
<!-- CFBundleSignature exists only for compatibility with Classic Mac OS apps and documents. Modern Mac OS X apps don't need to worry about assigning a Bundle
|
||||
Signature.-->
|
||||
<!-- CFBundleSignature exists only for compatibility with Classic Mac OS apps and documents. Modern Mac OS X apps don't need to worry about assigning a Bundle Signature.-->
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
|
||||
|
@ -31,9 +31,7 @@ sed "s|JAR_NAME_STRING_GOES_HERE|$patchVersion.jar|" package/mac/Info.template.p
|
||||
mvn clean package -DskipTests -Dmaven.javadoc.skip=true
|
||||
cp gui/target/shaded.jar gui/updatefx/builds/$patchVersion.jar
|
||||
|
||||
java -jar ./updatefx/updatefx-app-1.6.jar --url=http://bitsquare.io/updateFX/ gui/updatefx
|
||||
# using trezor
|
||||
#java -jar ./updatefx/updatefx-app-1.6.jar --url=http://bitsquare.io/updateFX/ gui/updatefx --trezor
|
||||
java -jar ./updatefx/updatefx-app-1.3-SNAPSHOT.jar --url=http://bitsquare.io/updateFX/v03 gui/updatefx
|
||||
|
||||
$JAVA_HOME/bin/javapackager \
|
||||
-deploy \
|
||||
|
@ -9,7 +9,7 @@ mkdir gui/updatefx/site
|
||||
mkdir gui/deploy
|
||||
|
||||
# create key/wallet. Copy wallet key to UpdateProcess and use wallet for other OS builds
|
||||
java -jar ./updatefx/updatefx-app-1.6.jar --url=http://bitsquare.io/updateFX/ gui/updatefx
|
||||
java -jar ./updatefx/updatefx-app-1.3-SNAPSHOT.jar --url=http://bitsquare.io/updateFX/v03 gui/updatefx
|
||||
|
||||
cd package/mac
|
||||
|
||||
|
@ -26,6 +26,6 @@ echo fullVersion = $fullVersion
|
||||
|
||||
mvn clean package -DskipTests -Dmaven.javadoc.skip=true
|
||||
cp gui/target/shaded.jar gui/updatefx/builds/$patchVersion.jar
|
||||
java -jar ./updatefx/updatefx-app-1.6.jar --url=http://bitsquare.io/updateFX/ gui/updatefx
|
||||
java -jar ./updatefx/updatefx-app-1.3-SNAPSHOT.jar --url=http://bitsquare.io/updateFX/v03 gui/updatefx
|
||||
|
||||
cd package/mac
|
BIN
updatefx/updatefx-app-1.3-SNAPSHOT.jar
Normal file
BIN
updatefx/updatefx-app-1.3-SNAPSHOT.jar
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user