Remove update check
This commit is contained in:
parent
e7ea814715
commit
2d47cd6236
|
@ -1,7 +1,6 @@
|
||||||
package ctbrec.ui;
|
package ctbrec.ui;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
import ctbrec.Config;
|
import ctbrec.Config;
|
||||||
import ctbrec.Model;
|
import ctbrec.Model;
|
||||||
|
@ -15,7 +14,6 @@ import ctbrec.image.LocalPortraitStore;
|
||||||
import ctbrec.image.PortraitStore;
|
import ctbrec.image.PortraitStore;
|
||||||
import ctbrec.image.RemotePortraitStore;
|
import ctbrec.image.RemotePortraitStore;
|
||||||
import ctbrec.io.*;
|
import ctbrec.io.*;
|
||||||
import ctbrec.io.json.ObjectMapperFactory;
|
|
||||||
import ctbrec.notes.LocalModelNotesService;
|
import ctbrec.notes.LocalModelNotesService;
|
||||||
import ctbrec.notes.ModelNotesService;
|
import ctbrec.notes.ModelNotesService;
|
||||||
import ctbrec.notes.RemoteModelNotesService;
|
import ctbrec.notes.RemoteModelNotesService;
|
||||||
|
@ -57,7 +55,6 @@ import javafx.scene.paint.Color;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.WindowEvent;
|
import javafx.stage.WindowEvent;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import okhttp3.Request;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -126,9 +123,6 @@ public class CamrecApplication extends Application {
|
||||||
createPortraitStore();
|
createPortraitStore();
|
||||||
createModelNotesService();
|
createModelNotesService();
|
||||||
createGui(primaryStage);
|
createGui(primaryStage);
|
||||||
if (config.getSettings().checkForUpdates) {
|
|
||||||
checkForUpdates();
|
|
||||||
}
|
|
||||||
registerClipboardListener();
|
registerClipboardListener();
|
||||||
registerTrayIconListener();
|
registerTrayIconListener();
|
||||||
}
|
}
|
||||||
|
@ -591,37 +585,6 @@ public class CamrecApplication extends Application {
|
||||||
launch(args);
|
launch(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkForUpdates() {
|
|
||||||
var updateCheck = new Thread(() -> {
|
|
||||||
var url = "https://pastebin.com/raw/mUxtKzyB";
|
|
||||||
var request = new Request.Builder().url(url).build();
|
|
||||||
try (var response = httpClient.execute(request)) {
|
|
||||||
var body = response.body().string();
|
|
||||||
LOG.trace("Version check respone: {}", body);
|
|
||||||
if (response.isSuccessful()) {
|
|
||||||
List<Release> releases = ObjectMapperFactory.getMapper().readValue(body, new TypeReference<>() {
|
|
||||||
});
|
|
||||||
var latest = releases.get(0);
|
|
||||||
var latestVersion = latest.getVersion();
|
|
||||||
var ctbrecVersion = Version.getVersion();
|
|
||||||
if (latestVersion.compareTo(ctbrecVersion) > 0) {
|
|
||||||
LOG.debug("Update available {} < {}", ctbrecVersion, latestVersion);
|
|
||||||
Platform.runLater(() -> tabPane.getTabs().add(new UpdateTab(latest)));
|
|
||||||
} else {
|
|
||||||
LOG.debug("ctbrec is up-to-date {}", ctbrecVersion);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
throw new HttpException(response.code(), response.message());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.warn("Update check failed: {}", e.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
updateCheck.setName("Update Check");
|
|
||||||
updateCheck.setDaemon(true);
|
|
||||||
updateCheck.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Release {
|
public static class Release {
|
||||||
private String name;
|
private String name;
|
||||||
|
|
|
@ -132,7 +132,6 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
private SimpleLongProperty recordUntilDefaultDurationInMinutes;
|
private SimpleLongProperty recordUntilDefaultDurationInMinutes;
|
||||||
private SimpleStringProperty dateTimeFormat;
|
private SimpleStringProperty dateTimeFormat;
|
||||||
private final VariablePlayGroundDialogFactory variablePlayGroundDialogFactory = new VariablePlayGroundDialogFactory();
|
private final VariablePlayGroundDialogFactory variablePlayGroundDialogFactory = new VariablePlayGroundDialogFactory();
|
||||||
private SimpleBooleanProperty checkForUpdates;
|
|
||||||
private SimpleStringProperty filterBlacklist;
|
private SimpleStringProperty filterBlacklist;
|
||||||
private SimpleStringProperty filterWhitelist;
|
private SimpleStringProperty filterWhitelist;
|
||||||
private SimpleBooleanProperty deleteOrphanedRecordingMetadata;
|
private SimpleBooleanProperty deleteOrphanedRecordingMetadata;
|
||||||
|
@ -220,7 +219,6 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
recordUntilDefaultDurationInMinutes = new SimpleLongProperty(null, "recordUntilDefaultDurationInMinutes", settings.recordUntilDefaultDurationInMinutes);
|
recordUntilDefaultDurationInMinutes = new SimpleLongProperty(null, "recordUntilDefaultDurationInMinutes", settings.recordUntilDefaultDurationInMinutes);
|
||||||
dateTimeFormat = new SimpleStringProperty(null, "dateTimeFormat", settings.dateTimeFormat);
|
dateTimeFormat = new SimpleStringProperty(null, "dateTimeFormat", settings.dateTimeFormat);
|
||||||
tabsSortable = new SimpleBooleanProperty(null, "tabsSortable", settings.tabsSortable);
|
tabsSortable = new SimpleBooleanProperty(null, "tabsSortable", settings.tabsSortable);
|
||||||
checkForUpdates = new SimpleBooleanProperty(null, "checkForUpdates", settings.checkForUpdates);
|
|
||||||
filterBlacklist = new SimpleStringProperty(null, "filterBlacklist", settings.filterBlacklist);
|
filterBlacklist = new SimpleStringProperty(null, "filterBlacklist", settings.filterBlacklist);
|
||||||
filterWhitelist = new SimpleStringProperty(null, "filterWhitelist", settings.filterWhitelist);
|
filterWhitelist = new SimpleStringProperty(null, "filterWhitelist", settings.filterWhitelist);
|
||||||
deleteOrphanedRecordingMetadata = new SimpleBooleanProperty(null, "deleteOrphanedRecordingMetadata", settings.deleteOrphanedRecordingMetadata);
|
deleteOrphanedRecordingMetadata = new SimpleBooleanProperty(null, "deleteOrphanedRecordingMetadata", settings.deleteOrphanedRecordingMetadata);
|
||||||
|
@ -257,7 +255,6 @@ public class SettingsTab extends Tab implements TabSelectionListener {
|
||||||
Setting.of("Add models from clipboard", monitorClipboard, "Monitor clipboard for model URLs and automatically add them to the recorder").needsRestart(),
|
Setting.of("Add models from clipboard", monitorClipboard, "Monitor clipboard for model URLs and automatically add them to the recorder").needsRestart(),
|
||||||
Setting.of("Show confirmation dialogs", confirmationDialogs, "Show confirmation dialogs for irreversible actions"),
|
Setting.of("Show confirmation dialogs", confirmationDialogs, "Show confirmation dialogs for irreversible actions"),
|
||||||
Setting.of("Recording tab per site", recordedModelsPerSite, "Add a Recording tab for each site").needsRestart(),
|
Setting.of("Recording tab per site", recordedModelsPerSite, "Add a Recording tab for each site").needsRestart(),
|
||||||
Setting.of("Check for new versions at startup", checkForUpdates, "Search for updates every startup"),
|
|
||||||
Setting.of("Start Tab", startTab)),
|
Setting.of("Start Tab", startTab)),
|
||||||
|
|
||||||
Group.of("Player",
|
Group.of("Player",
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
package ctbrec.ui.tabs;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import ctbrec.GlobalThreadPool;
|
|
||||||
import ctbrec.io.HttpException;
|
|
||||||
import ctbrec.ui.CamrecApplication;
|
|
||||||
import ctbrec.ui.CamrecApplication.Release;
|
|
||||||
import ctbrec.ui.DesktopIntegration;
|
|
||||||
import ctbrec.ui.controls.Dialogs;
|
|
||||||
import javafx.geometry.Insets;
|
|
||||||
import javafx.geometry.Pos;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.control.Tab;
|
|
||||||
import javafx.scene.control.TextArea;
|
|
||||||
import javafx.scene.layout.Priority;
|
|
||||||
import javafx.scene.layout.VBox;
|
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
|
|
||||||
public class UpdateTab extends Tab implements TabSelectionListener {
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(UpdateTab.class);
|
|
||||||
|
|
||||||
private final TextArea changelog;
|
|
||||||
|
|
||||||
public UpdateTab(Release latest) {
|
|
||||||
setText("Update Available");
|
|
||||||
var vbox = new VBox(10);
|
|
||||||
var l = new Label("New Version available " + latest.getVersion());
|
|
||||||
vbox.getChildren().add(l);
|
|
||||||
VBox.setMargin(l, new Insets(20, 0, 0, 0));
|
|
||||||
var button = new Button("Download");
|
|
||||||
button.setOnAction(e -> DesktopIntegration.open(latest.getHtmlUrl()));
|
|
||||||
vbox.getChildren().add(button);
|
|
||||||
VBox.setMargin(button, new Insets(0, 0, 10, 0));
|
|
||||||
vbox.setAlignment(Pos.CENTER);
|
|
||||||
changelog = new TextArea();
|
|
||||||
changelog.setEditable(false);
|
|
||||||
changelog.setText("Loading changelog...");
|
|
||||||
vbox.getChildren().add(changelog);
|
|
||||||
VBox.setVgrow(changelog, Priority.ALWAYS);
|
|
||||||
setContent(vbox);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadChangeLog() {
|
|
||||||
GlobalThreadPool.submit(() -> {
|
|
||||||
Request req = new Request.Builder().url("https://pastebin.com/raw/fiAPtM0s").build();
|
|
||||||
try (Response resp = CamrecApplication.httpClient.execute(req)) {
|
|
||||||
if (resp.isSuccessful()) {
|
|
||||||
changelog.setText(resp.body().string());
|
|
||||||
} else {
|
|
||||||
throw new HttpException(resp.code(), resp.message());
|
|
||||||
}
|
|
||||||
} catch (Exception e1) {
|
|
||||||
LOG.error("Couldn't download the changelog", e1);
|
|
||||||
Dialogs.showError(getTabPane().getScene(), "Communication error", "Couldn't download the changelog", e1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selected() {
|
|
||||||
loadChangeLog();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void deselected() {
|
|
||||||
// nothing to do
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -218,7 +218,6 @@ public class Settings {
|
||||||
public String xlovecamPassword = "";
|
public String xlovecamPassword = "";
|
||||||
public boolean stripchatVR = true;
|
public boolean stripchatVR = true;
|
||||||
public boolean streamrayRecordGoalShows = false;
|
public boolean streamrayRecordGoalShows = false;
|
||||||
public boolean checkForUpdates = true;
|
|
||||||
public int thumbCacheSize = 16;
|
public int thumbCacheSize = 16;
|
||||||
public boolean dreamcamVR = true;
|
public boolean dreamcamVR = true;
|
||||||
public String filterBlacklist = "";
|
public String filterBlacklist = "";
|
||||||
|
|
Loading…
Reference in New Issue