mirror of
https://github.com/bisq-network/bisq.git
synced 2025-03-13 11:09:10 +01:00
Clear Tor directory when a new release is downloaded.
This commit is contained in:
parent
8850436023
commit
a5ba349574
4 changed files with 27 additions and 3 deletions
|
@ -2691,7 +2691,7 @@ displayUpdateDownloadWindow.verify.failed=Verification failed.\n\
|
|||
Please download and verify manually at [HYPERLINK:https://bisq.network/downloads]
|
||||
displayUpdateDownloadWindow.success=The new version has been successfully downloaded and the signature verified.\n\n\
|
||||
Please open the download directory, shut down the application and install the new version.
|
||||
displayUpdateDownloadWindow.download.openDir=Open download directory
|
||||
displayUpdateDownloadWindow.download.openDir=Open download directory and shut down
|
||||
|
||||
disputeSummaryWindow.title=Summary
|
||||
disputeSummaryWindow.openDate=Ticket opening date
|
||||
|
|
|
@ -23,6 +23,10 @@ import bisq.desktop.setup.DesktopPersistedDataHost;
|
|||
|
||||
import bisq.core.app.AvoidStandbyModeService;
|
||||
import bisq.core.app.BisqExecutable;
|
||||
import bisq.core.app.TorSetup;
|
||||
import bisq.core.user.Cookie;
|
||||
import bisq.core.user.CookieKey;
|
||||
import bisq.core.user.User;
|
||||
|
||||
import bisq.common.UserThread;
|
||||
import bisq.common.app.AppModule;
|
||||
|
@ -125,6 +129,16 @@ public class BisqAppMain extends BisqExecutable {
|
|||
|
||||
@Override
|
||||
protected void startApplication() {
|
||||
Cookie cookie = injector.getInstance(User.class).getCookie();
|
||||
cookie.getAsOptionalBoolean(CookieKey.CLEAN_TOR_DIR_AT_RESTART).ifPresent(wasCleanTorDirSet -> {
|
||||
if (wasCleanTorDirSet) {
|
||||
injector.getInstance(TorSetup.class).cleanupTorFiles(() -> {
|
||||
log.info("Tor directory reset");
|
||||
cookie.remove(CookieKey.CLEAN_TOR_DIR_AT_RESTART);
|
||||
}, log::error);
|
||||
}
|
||||
});
|
||||
|
||||
// We need to be in user thread! We mapped at launchApplication already. Once
|
||||
// the UI is ready we get onApplicationStarted called and start the setup there.
|
||||
application.startApplication(this::onApplicationStarted);
|
||||
|
|
|
@ -411,7 +411,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupListener {
|
|||
.onClose(() -> BisqApp.getShutDownHandler().run())
|
||||
.show());
|
||||
|
||||
bisqSetup.setDisplayUpdateHandler((alert, key) -> new DisplayUpdateDownloadWindow(alert, config)
|
||||
bisqSetup.setDisplayUpdateHandler((alert, key) -> new DisplayUpdateDownloadWindow(alert, config, user)
|
||||
.actionButtonText(Res.get("displayUpdateDownloadWindow.button.downloadLater"))
|
||||
.onAction(() -> {
|
||||
preferences.dontShowAgain(key, false); // update later
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package bisq.desktop.main.overlays.windows.downloadupdate;
|
||||
|
||||
import bisq.desktop.app.BisqApp;
|
||||
import bisq.desktop.components.AutoTooltipButton;
|
||||
import bisq.desktop.components.AutoTooltipLabel;
|
||||
import bisq.desktop.components.BusyAnimation;
|
||||
|
@ -25,7 +26,10 @@ import bisq.desktop.main.overlays.popups.Popup;
|
|||
|
||||
import bisq.core.alert.Alert;
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.user.CookieKey;
|
||||
import bisq.core.user.User;
|
||||
|
||||
import bisq.common.UserThread;
|
||||
import bisq.common.config.Config;
|
||||
import bisq.common.util.Utilities;
|
||||
|
||||
|
@ -72,6 +76,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWindow> {
|
||||
private final Alert alert;
|
||||
private final Config config;
|
||||
private final User user;
|
||||
private Optional<DownloadTask> downloadTaskOptional;
|
||||
private VerifyTask verifyTask;
|
||||
private ProgressBar progressBar;
|
||||
|
@ -82,9 +87,10 @@ public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWi
|
|||
// Public API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public DisplayUpdateDownloadWindow(Alert alert, Config config) {
|
||||
public DisplayUpdateDownloadWindow(Alert alert, Config config, User user) {
|
||||
this.alert = alert;
|
||||
this.config = config;
|
||||
this.user = user;
|
||||
this.type = Type.Attention;
|
||||
}
|
||||
|
||||
|
@ -254,12 +260,16 @@ public class DisplayUpdateDownloadWindow extends Overlay<DisplayUpdateDownloadWi
|
|||
if (verifyResults == null || verifyResults.isEmpty() || verifyFailed.isPresent()) {
|
||||
showErrorMessage(downloadButton, statusLabel, Res.get("displayUpdateDownloadWindow.verify.failed"));
|
||||
} else {
|
||||
// We set a flag to clear tor cache files at re-start. We cannot clear it now as Tor is used and
|
||||
// that can cause problems.
|
||||
user.getCookie().putAsBoolean(CookieKey.CLEAN_TOR_DIR_AT_RESTART, true);
|
||||
verifiedSigLabel.getStyleClass().add("success-text");
|
||||
new Popup().feedback(Res.get("displayUpdateDownloadWindow.success"))
|
||||
.actionButtonText(Res.get("displayUpdateDownloadWindow.download.openDir"))
|
||||
.onAction(() -> {
|
||||
try {
|
||||
Utilities.openFile(new File(Utilities.getDownloadOfHomeDir()));
|
||||
BisqApp.getShutDownHandler().run();
|
||||
doClose();
|
||||
} catch (IOException e2) {
|
||||
log.error(e2.getMessage());
|
||||
|
|
Loading…
Add table
Reference in a new issue