Various small fixes

This commit is contained in:
crschnick 2023-02-07 21:54:59 +00:00
parent 37760e06fd
commit ad92311a7d
10 changed files with 65 additions and 27 deletions

View file

@ -34,7 +34,7 @@ It comes with the following main features:
- Automatically login into a shell in your favourite terminal with one click (no need to fill password prompts, etc.)
- Works for all kinds of shells. This includes command shells (e.g. bash, PowerShell, cmd, etc.) and database shells (e.g. PSQL Shell)
- Comes with integrations for all commonly used terminals in Windows and Linux
- Comes with integrations for all commonly used terminals for all operating systems
- Exclusively uses established CLI tools and therefore works out of the box on most systems and doesn't require any additional setup
- Allows you to customize the launched shell's init environment
@ -42,7 +42,8 @@ It comes with the following main features:
- Easily create and manage all kinds of remote connections at one location
- Securely stores all information exclusively on your computer and encrypts all secret information
- Allows you to share connection configurations to any other trusted party through shareable URLs
- Share connection configurations to any other trusted party through shareable URLs
- Create desktop shortcuts to open your connections
<img src="https://user-images.githubusercontent.com/72509152/213240153-3f742f03-1289-44c3-bf4d-626d9886ffcf.png" alt="drawing" height="450"/>

View file

@ -131,7 +131,7 @@ application {
run {
systemProperty 'io.xpipe.app.mode', 'gui'
systemProperty 'io.xpipe.app.dataDir', "$projectDir/local/"
systemProperty 'io.xpipe.app.dataDir', "$projectDir/local_stage/"
systemProperty 'io.xpipe.app.writeLogs', "true"
systemProperty 'io.xpipe.app.writeSysOut', "true"
systemProperty 'io.xpipe.app.developerMode', "true"

View file

@ -18,11 +18,13 @@ public class IntegratedTextAreaComp extends SimpleComp {
private final Property<String> value;
private final boolean lazy;
private final String identifier;
private final String fileType;
public IntegratedTextAreaComp(Property<String> value, boolean lazy, String identifier) {
public IntegratedTextAreaComp(Property<String> value, boolean lazy, String identifier, String fileType) {
this.value = value;
this.lazy = lazy;
this.identifier = identifier;
this.fileType = fileType;
}
@Override
@ -44,7 +46,7 @@ public class IntegratedTextAreaComp extends SimpleComp {
private Region createOpenButton(Region container) {
var button = new IconButtonComp("mdal-edit", () -> EditorState.get()
.startEditing(identifier, this, value.getValue(), (s) -> {
.startEditing(identifier, fileType, this, value.getValue(), (s) -> {
Platform.runLater(() -> value.setValue(s));
})).createRegion();
return button;

View file

@ -124,6 +124,7 @@ public class EditorState {
public void startEditing(
String keyName,
String fileType,
Object key,
String input,
Consumer<String> output) {
@ -132,7 +133,7 @@ public class EditorState {
}
String s = input;
startEditing(keyName, key, () -> new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)), () -> new ByteArrayOutputStream(s.length()) {
startEditing(keyName, fileType, key, () -> new ByteArrayInputStream(s.getBytes(StandardCharsets.UTF_8)), () -> new ByteArrayOutputStream(s.length()) {
@Override
public void close() throws IOException {
super.close();
@ -143,6 +144,7 @@ public class EditorState {
public void startEditing(
String keyName,
String fileType,
Object key,
Charsetter.FailableSupplier<InputStream, Exception> input,
Charsetter.FailableSupplier<OutputStream, Exception> output) {
@ -152,7 +154,7 @@ public class EditorState {
return;
}
var name = keyName + " - " + UUID.randomUUID().toString().substring(0, 6) + ".txt";
var name = keyName + " - " + UUID.randomUUID().toString().substring(0, 6) + "." + (fileType != null ? fileType : "txt");
Path file = TEMP.resolve(name);
try {
FileUtils.forceMkdirParent(file.toFile());

View file

@ -1,5 +1,6 @@
package io.xpipe.app.grid;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.extension.event.ErrorEvent;
import io.xpipe.extension.event.TrackEvent;
import io.xpipe.extension.util.HttpHelper;
@ -81,6 +82,12 @@ public class AppDownloads {
public static Optional<GHRelease> getLatestSuitableRelease() {
try {
var repo = getRepository();
// Always choose most up-to-date release as we assume that there are only full releases and prereleases
if (AppPrefs.get().updateToPrereleases().get()) {
return Optional.ofNullable(repo.listReleases().iterator().next());
}
return Optional.ofNullable(repo.getLatestRelease());
} catch (IOException e) {
ErrorEvent.fromThrowable(e).omit().handle();

View file

@ -8,7 +8,6 @@ import com.dlsc.preferencesfx.model.Category;
import com.dlsc.preferencesfx.model.Group;
import com.dlsc.preferencesfx.model.Setting;
import com.dlsc.preferencesfx.util.VisibilityProperty;
import io.xpipe.extension.util.XPipeDistributionType;
import io.xpipe.app.core.AppProperties;
import io.xpipe.app.core.AppStyle;
import io.xpipe.extension.event.ErrorEvent;
@ -16,6 +15,7 @@ import io.xpipe.extension.fxcomps.util.SimpleChangeListener;
import io.xpipe.extension.prefs.PrefsChoiceValue;
import io.xpipe.extension.prefs.PrefsHandler;
import io.xpipe.extension.prefs.PrefsProvider;
import io.xpipe.extension.util.XPipeDistributionType;
import javafx.beans.property.*;
import javafx.beans.value.ObservableBooleanValue;
import javafx.beans.value.ObservableValue;
@ -114,14 +114,17 @@ public class AppPrefs {
private final SingleSelectionField<ExternalStartupBehaviour> externalStartupBehaviourControl =
Field.ofSingleSelectionType(externalStartupBehaviourList, externalStartupBehaviour)
.render(() -> new TranslatableComboBoxControl<>());
// Automatically update
// ====================
private final BooleanProperty automaticallyUpdate =
typed(new SimpleBooleanProperty(XPipeDistributionType.get().supportsUpdate()), Boolean.class);
private final BooleanField automaticallyUpdateField = BooleanField.ofBooleanType(automaticallyUpdate)
.editable(XPipeDistributionType.get().supportsUpdate())
.render(() -> new ToggleControl());
private final BooleanProperty updateToPrereleases = typed(new SimpleBooleanProperty(true), Boolean.class);
private final BooleanField automaticallyUpdateField =
BooleanField.ofBooleanType(automaticallyUpdate).render(() -> new ToggleControl());
private final BooleanProperty updateToPrereleases = typed(new SimpleBooleanProperty(false), Boolean.class);
private final BooleanField updateToPrereleasesField =
BooleanField.ofBooleanType(updateToPrereleases).render(() -> new ToggleControl());
private final BooleanProperty confirmDeletions = typed(new SimpleBooleanProperty(true), Boolean.class);
// External startup behaviour
@ -383,11 +386,20 @@ public class AppPrefs {
Setting.of(
"externalStartupBehaviour",
externalStartupBehaviourControl,
externalStartupBehaviour),
externalStartupBehaviour
),
Setting.of("closeBehaviour", closeBehaviourControl, closeBehaviour),
Setting.of("automaticallyUpdate", automaticallyUpdateField, automaticallyUpdate),
Setting.of("automaticallyUpdate", automaticallyUpdateField, automaticallyUpdate)
.applyVisibility(VisibilityProperty.of(new SimpleBooleanProperty(
XPipeDistributionType.get().supportsUpdate()))),
Setting.of("updateToPrereleases", updateToPrereleasesField, updateToPrereleases)
.applyVisibility(VisibilityProperty.of(new SimpleBooleanProperty(
XPipeDistributionType.get().supportsUpdate()))),
Setting.of("storageDirectory", storageDirectoryControl, internalStorageDirectory),
Setting.of("logLevel", logLevelField, internalLogLevel))),
Setting.of("logLevel", logLevelField, internalLogLevel),
Setting.of("developerMode", developerModeField, internalDeveloperMode)
)
),
Category.of(
"appearance",
Group.of(
@ -396,8 +408,10 @@ public class AppPrefs {
Setting.of("theme", themeControl, themeInternal),
Setting.of("useSystemFont", useSystemFontInternal),
Setting.of("tooltipDelay", tooltipDelayInternal, tooltipDelayMin, tooltipDelayMax),
Setting.of("fontSize", fontSizeInternal, fontSizeMin, fontSizeMax)),
Group.of("windowOptions", Setting.of("saveWindowLocation", saveWindowLocationInternal))),
Setting.of("fontSize", fontSizeInternal, fontSizeMin, fontSizeMax)
),
Group.of("windowOptions", Setting.of("saveWindowLocation", saveWindowLocationInternal))
),
Category.of(
"integrations",
Group.of(
@ -410,30 +424,41 @@ public class AppPrefs {
"editorReloadTimeout",
editorReloadTimeout,
editorReloadTimeoutMin,
editorReloadTimeoutMax))),
editorReloadTimeoutMax
)
)
),
Category.of(
"developer",
Setting.of("developerMode", developerModeField, internalDeveloperMode),
Setting.of(
"developerDisableUpdateVersionCheck",
developerDisableUpdateVersionCheckField,
developerDisableUpdateVersionCheck),
developerDisableUpdateVersionCheck
),
Setting.of(
"developerDisableGuiRestrictions",
developerDisableGuiRestrictionsField,
developerDisableGuiRestrictions),
developerDisableGuiRestrictions
),
Setting.of(
"developerDisableConnectorInstallationVersionCheck",
developerDisableConnectorInstallationVersionCheckField,
developerDisableConnectorInstallationVersionCheck),
developerDisableConnectorInstallationVersionCheck
),
Setting.of(
"developerShowHiddenEntries",
developerShowHiddenEntriesField,
developerShowHiddenEntries),
developerShowHiddenEntries
),
Setting.of(
"developerShowHiddenProviders",
developerShowHiddenProvidersField,
developerShowHiddenProviders))));
developerShowHiddenProviders
)
)
));
categories.get(categories.size() - 1).setVisibilityProperty(VisibilityProperty.of(developerMode()));
var handler = new PrefsHandlerImpl(categories);
PrefsProvider.getAll().forEach(prov -> prov.addPrefs(handler));

View file

@ -10,6 +10,7 @@ windowOptions=Window Options
saveWindowLocation=Save window location on exit
startupShutdown=Startup / Shutdown
system=System
updateToPrereleases=Update to prereleases
storage=Storage
runOnStartup=Run on startup
closeBehaviour=Close behaviour

View file

@ -1,3 +1,3 @@
- Add ability to create desktop shortcuts for shell connections
- Improve terminal integration on MacOS
- Improve terminal integration on macOS
- Many bug fixes

View file

@ -36,7 +36,7 @@ public class FileEditAction implements DataStoreActionProvider<FileStore> {
EditorState.get().openInEditor(store.getFile());
} else {
EditorState.get()
.startEditing(store.getFileName(), store, () -> store.openInput(), () -> store.openOutput());
.startEditing(store.getFileName(), store.getFileExtension(), store, () -> store.openInput(), () -> store.openOutput());
}
}
}

View file

@ -1,7 +1,7 @@
task copyRuntimeLibs(type: Copy) {
into project.jar.destinationDirectory
from configurations.runtimeClasspath
exclude "${project.name}.jar"
exclude "${project.name}.jar", "${project.name.substring(0, project.name.length() - 1)}.jar"
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
copyRuntimeLibs.dependsOn(addDependenciesModuleInfo)