mirror of
https://github.com/xpipe-io/xpipe.git
synced 2025-04-17 01:33:36 +00:00
Various fixes and cleanup [stage] [noannounce]
This commit is contained in:
parent
0b31eed2a5
commit
c70d6da314
9 changed files with 57 additions and 52 deletions
|
@ -5,8 +5,8 @@ import lombok.Getter;
|
|||
import lombok.Singular;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArraySet;
|
||||
|
||||
@Builder
|
||||
@Getter
|
||||
|
@ -34,11 +34,13 @@ public class ErrorEvent {
|
|||
}
|
||||
|
||||
public static ErrorEventBuilder fromThrowable(Throwable t) {
|
||||
return builder().throwable(t).description(ExceptionConverter.convertMessage(t));
|
||||
var unreportable = UNREPORTABLE.remove(t);
|
||||
return builder().throwable(t).reportable(!unreportable).description(ExceptionConverter.convertMessage(t));
|
||||
}
|
||||
|
||||
public static ErrorEventBuilder fromThrowable(String msg, Throwable t) {
|
||||
return builder().throwable(t).description(msg);
|
||||
var unreportable = UNREPORTABLE.remove(t);
|
||||
return builder().throwable(t).reportable(!unreportable).description(msg);
|
||||
}
|
||||
|
||||
public static ErrorEventBuilder fromMessage(String msg) {
|
||||
|
@ -73,4 +75,26 @@ public class ErrorEvent {
|
|||
build().handle();
|
||||
}
|
||||
}
|
||||
|
||||
private static Set<Throwable> UNREPORTABLE = new CopyOnWriteArraySet<>();
|
||||
|
||||
public static <T extends Throwable> T unreportableIfEndsWith(T t, String... s) {
|
||||
return unreportableIf(t, t.getMessage() != null && Arrays.stream(s).anyMatch(string->t.getMessage().toLowerCase(Locale.ROOT).endsWith(string)));
|
||||
}
|
||||
|
||||
public static <T extends Throwable> T unreportableIfContains(T t, String... s) {
|
||||
return unreportableIf(t, t.getMessage() != null && Arrays.stream(s).anyMatch(string->t.getMessage().toLowerCase(Locale.ROOT).contains(string)));
|
||||
}
|
||||
|
||||
public static <T extends Throwable> T unreportableIf(T t, boolean b) {
|
||||
if (b) {
|
||||
UNREPORTABLE.add(t);
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
public static <T extends Throwable> T unreportable(T t) {
|
||||
UNREPORTABLE.add(t);
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,19 +41,20 @@ public class SentryErrorHandler implements ErrorHandler {
|
|||
options.setTag("os", System.getProperty("os.name"));
|
||||
options.setTag("osVersion", System.getProperty("os.version"));
|
||||
options.setTag("arch", System.getProperty("os.arch"));
|
||||
options.setTag("updatesEnabled", AppPrefs.get() != null ? AppPrefs.get().automaticallyUpdate().getValue().toString() : "unknown");
|
||||
options.setDist(XPipeDistributionType.get().getId());
|
||||
if (AppProperties.get().isStaging()) {
|
||||
options.setTag("staging", "true");
|
||||
}
|
||||
options.setTag("staging", String.valueOf(AppProperties.get().isStaging()));
|
||||
});
|
||||
}
|
||||
init = true;
|
||||
}
|
||||
|
||||
var id = createReport(ee);
|
||||
if (id == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var text = ee.getUserReport();
|
||||
if (text != null && text.length() > 0) {
|
||||
if (text != null && !text.isEmpty()) {
|
||||
var fb = new UserFeedback(id);
|
||||
fb.setComments(text);
|
||||
Sentry.captureUserFeedback(fb);
|
||||
|
@ -61,6 +62,10 @@ public class SentryErrorHandler implements ErrorHandler {
|
|||
}
|
||||
|
||||
private static SentryId createReport(ErrorEvent ee) {
|
||||
if (!ee.isReportable()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: Ignore breadcrumbs for now
|
||||
*/
|
||||
|
@ -100,6 +105,7 @@ public class SentryErrorHandler implements ErrorHandler {
|
|||
.toList();
|
||||
atts.forEach(attachment -> s.addAttachment(attachment));
|
||||
|
||||
s.setTag("updatesEnabled", AppPrefs.get() != null ? AppPrefs.get().automaticallyUpdate().getValue().toString() : "unknown");
|
||||
s.setTag("initError", String.valueOf(OperationMode.isInStartup()));
|
||||
s.setTag(
|
||||
"developerMode",
|
||||
|
|
|
@ -118,7 +118,7 @@ public abstract class ExternalApplicationType implements PrefsChoiceValue {
|
|||
|
||||
protected abstract Optional<Path> determineInstallation();
|
||||
|
||||
private Optional<Path> determineFromPath() {
|
||||
protected Optional<Path> determineFromPath() {
|
||||
// Try to locate if it is in the Path
|
||||
try (var cc = LocalStore.getShell()
|
||||
.command(ShellDialects.getPlatformDefault().getWhichCommand("code.cmd"))
|
||||
|
|
|
@ -173,15 +173,19 @@ public interface ExternalEditorType extends PrefsChoiceValue {
|
|||
|
||||
@Override
|
||||
public void launch(Path file) throws Exception {
|
||||
var path = determineInstallation();
|
||||
if (path.isEmpty()) {
|
||||
throw new IOException("Unable to find installation of " + toTranslatedString());
|
||||
var location = determineFromPath();
|
||||
if (location.isEmpty()) {
|
||||
location = determineInstallation();
|
||||
if (location.isEmpty()) {
|
||||
throw new IOException("Unable to find installation of " + toTranslatedString());
|
||||
}
|
||||
}
|
||||
|
||||
Optional<Path> finalLocation = location;
|
||||
ApplicationHelper.executeLocalApplication(
|
||||
sc -> String.format(
|
||||
"%s %s",
|
||||
sc.getShellDialect().fileArgument(path.get().toString()),
|
||||
sc.getShellDialect().fileArgument(finalLocation.get().toString()),
|
||||
sc.getShellDialect().fileArgument(file.toString())),
|
||||
detach());
|
||||
}
|
||||
|
|
|
@ -21,15 +21,14 @@ public interface CommandControl extends ProcessControl {
|
|||
CLOSE
|
||||
}
|
||||
|
||||
CommandControl withExceptionConverter(Function<Exception, Exception> converter);
|
||||
|
||||
CommandControl withMessageFormatter(Function<String, String> formatter);
|
||||
|
||||
CommandControl terminalExitMode(TerminalExitMode mode);
|
||||
|
||||
CommandControl doesNotObeyReturnValueConvention();
|
||||
|
||||
@Override
|
||||
CommandControl sensitive();
|
||||
|
||||
CommandControl complex();
|
||||
|
||||
CommandControl notComplex();
|
||||
|
|
|
@ -15,8 +15,6 @@ public interface ProcessControl extends Closeable, AutoCloseable {
|
|||
|
||||
ExecutorService getStderrReader();
|
||||
|
||||
ProcessControl sensitive();
|
||||
|
||||
String prepareTerminalOpen(String displayName) throws Exception;
|
||||
|
||||
void closeStdin() throws IOException;
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package io.xpipe.core.store;
|
||||
|
||||
import io.xpipe.core.process.CommandControl;
|
||||
|
||||
public interface CommandExecutionStore extends DataStore, LaunchableStore {
|
||||
|
||||
@Override
|
||||
default String prepareLaunchCommand(String displayName) throws Exception {
|
||||
return create().prepareTerminalOpen(displayName);
|
||||
}
|
||||
|
||||
CommandControl create();
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package io.xpipe.core.store;
|
||||
|
||||
import io.xpipe.core.process.ShellControl;
|
||||
|
||||
public interface DelegateShellStore extends ShellStore {
|
||||
|
||||
@Override
|
||||
default ShellControl createBasicControl() {
|
||||
return getDelegateHost().control();
|
||||
}
|
||||
|
||||
ShellStore getDelegateHost();
|
||||
}
|
14
dist/changelogs/1.5.0.md
vendored
14
dist/changelogs/1.5.0.md
vendored
|
@ -3,18 +3,18 @@
|
|||
This is the largest update yet and comes with loads of improvements and changes.
|
||||
As a side effect, it will also break some existing connections, so be prepared for that.
|
||||
|
||||
#### Passwords & Password managers
|
||||
### Passwords & Password managers
|
||||
|
||||
This update comes with a first attempt of supporting the retrieval of passwords from external sources.
|
||||
Due to the variety of available password managers and formats, I went with the most straightforward approach here which is essentially delegating that task to the CLI of your password manager.
|
||||
|
||||
Essentially, you're able to specify a command template to retrieve your passwords.
|
||||
For example, by specifying the command template `mypasswordmgr get $KEY`, you can then choose the password went creating connections by just supplying the key argument.
|
||||
For example, by specifying the command template `mypasswordmgr get $KEY`, you can then choose the password when creating connections by just supplying the key argument.
|
||||
XPipe will call the command, read the password, and supply it from there.
|
||||
|
||||
There's also support to specify an arbitrary command or to dynamically prompt the password on each login.
|
||||
|
||||
#### Fish
|
||||
### Fish
|
||||
|
||||
This update brings support for fish as another possible shell type.
|
||||
|
||||
|
@ -22,7 +22,7 @@ Note that there are several limitations with this implementation as fish does
|
|||
not support an interactive mode in headless environments,
|
||||
resulting in XPipe having to use a fallback shell for certain operations.
|
||||
|
||||
#### CLI
|
||||
### CLI
|
||||
|
||||
This update lays the foundation for future advancements in the command-line interface of XPipe.
|
||||
To start off, it comes with a few new commands to read and write files on remote systems directly from your terminal.
|
||||
|
@ -41,19 +41,19 @@ Then you can execute on your local machine: `xpipe drain ssh-windows "C:\myfile.
|
|||
The XPipe CLI should be put automatically in your path upon installation, you can test that with `xpipe --help`.
|
||||
Otherwise, you will find it in `<xpipe dir>/cli/bin/xpipe`.
|
||||
|
||||
#### Antivirus adjustments
|
||||
### Antivirus adjustments
|
||||
|
||||
As it turns out, several antivirus programs do not like XPipe and what it is doing with shells.
|
||||
As a result, some of them quarantine XPipe and even the system shells itself as they get confused of who is making the calls.
|
||||
|
||||
This update aims to reduce any unexpected issues caused by antivirus programs by automatically detecting whether a problematic antivirus is installed and giving the user the chance to prepare for any upcoming issues.
|
||||
|
||||
#### Cygwin and MSYS2
|
||||
### Cygwin and MSYS2
|
||||
|
||||
XPipe can now automatically detect Cygwin and MSYS2 environments on your machine.
|
||||
This also comes with full support of the feature set for these environments
|
||||
|
||||
#### Misc
|
||||
### Misc
|
||||
|
||||
- Separate staging and production storage directories
|
||||
- For every system, XPipe will now also display the appropriate OS/distro logo (if recognized)
|
||||
|
|
Loading…
Add table
Reference in a new issue