From c084a55d1578144668b7f0d6008286bb0910dbea Mon Sep 17 00:00:00 2001 From: crschnick Date: Thu, 17 Oct 2024 08:21:57 +0000 Subject: [PATCH] Logging fixes --- .../main/java/io/xpipe/app/prefs/LoggingCategory.java | 6 +++--- .../main/java/io/xpipe/app/util/TerminalLauncher.java | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java b/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java index 9c4d9353b..b4348b901 100644 --- a/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java +++ b/app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java @@ -7,6 +7,7 @@ import io.xpipe.app.issue.ErrorEvent; import io.xpipe.app.util.DesktopHelper; import io.xpipe.app.util.LicenseProvider; +import io.xpipe.app.util.LicensedFeature; import io.xpipe.app.util.OptionsBuilder; import java.io.IOException; @@ -22,9 +23,8 @@ protected String getId() { @Override protected Comp create() { var prefs = AppPrefs.get(); - var supported = LicenseProvider.get() - .getFeature("logging") - .isSupported(); + var feature = LicenseProvider.get().getFeature("logging"); + var supported = feature.isSupported() || feature.isPreviewSupported(); var title = AppI18n.observable("sessionLogging") .map(s -> s + (supported ? "" diff --git a/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java b/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java index 8e34d4e32..70e7fd265 100644 --- a/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java +++ b/app/src/main/java/io/xpipe/app/util/TerminalLauncher.java @@ -96,10 +96,13 @@ private static ExternalTerminalType.LaunchConfiguration createConfig( var launcherScript = d.terminalLauncherScript(request, adjustedTitle); var preparationScript = ScriptHelper.createLocalExecScript(launcherScript); - var supported = LicenseProvider.get() - .getFeature("logging") + var feature = LicenseProvider.get().getFeature("logging"); + var supported = feature .isSupported(); - if (!AppPrefs.get().enableTerminalLogging().get() || !supported) { + if (!supported) { + throw new LicenseRequiredException(feature); + } + if (!AppPrefs.get().enableTerminalLogging().get()) { var config = new ExternalTerminalType.LaunchConfiguration( entry != null ? color : null, adjustedTitle, cleanTitle, preparationScript, d); return config; @@ -136,7 +139,7 @@ private static ExternalTerminalType.LaunchConfiguration createConfig( var suffix = sc.getOsType() == OsType.MACOS ? "This command is available in the util-linux package which can be installed via homebrew." : "This command is available in the util-linux package."; throw ErrorEvent.expected(new IllegalStateException("Logging requires the script command to be installed. " + suffix)); } - + var content = sc.getOsType() == OsType.MACOS || sc.getOsType() == OsType.BSD ? """ echo "Transcript started, output file is sessions/%s"