mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 00:50:31 +00:00
Rework shell license check
This commit is contained in:
parent
3211896045
commit
66b6fae017
7 changed files with 11 additions and 13 deletions
|
@ -32,9 +32,6 @@ public interface ShellStore extends DataStore, FileSystemStore, ValidatableStore
|
|||
default ShellSession newSession() throws Exception {
|
||||
var func = shellFunction();
|
||||
var c = func.control();
|
||||
if (!isInStorage()) {
|
||||
c.withoutLicenseCheck();
|
||||
}
|
||||
return new ShellSession(this, () -> c);
|
||||
}
|
||||
|
||||
|
|
|
@ -974,6 +974,6 @@ public abstract class DataStorage {
|
|||
}
|
||||
|
||||
public DataStoreEntry local() {
|
||||
return getStoreEntryIfPresent(LOCAL_ID).orElse(null);
|
||||
return getStoreEntryIfPresent(LOCAL_ID).orElseThrow(() -> new IllegalStateException("Missing local machine connection"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,6 @@ public class LocalShell {
|
|||
localPowershell = ProcessControlProvider.get()
|
||||
.createLocalProcessControl(false)
|
||||
.subShell(ShellDialects.POWERSHELL)
|
||||
.withoutLicenseCheck()
|
||||
.start();
|
||||
} catch (ProcessOutputException ex) {
|
||||
throw ProcessOutputException.withPrefix("Failed to start local powershell process", ex);
|
||||
|
|
|
@ -143,7 +143,7 @@ class ScanDialog extends DialogComp {
|
|||
|
||||
ThreadHelper.runFailableAsync(() -> {
|
||||
BooleanScope.executeExclusive(busy, () -> {
|
||||
var sc = entry.get().getStore().getOrStartSession().withoutLicenseCheck();
|
||||
var sc = entry.get().getStore().getOrStartSession();
|
||||
var a = applicable.apply(entry.get().get(), sc);
|
||||
Platform.runLater(() -> {
|
||||
if (a == null) {
|
||||
|
|
|
@ -54,8 +54,6 @@ public interface ShellControl extends ProcessControl {
|
|||
|
||||
ShellControl getMachineRootSession();
|
||||
|
||||
ShellControl withoutLicenseCheck();
|
||||
|
||||
String getOsName();
|
||||
|
||||
boolean isLicenseCheck();
|
||||
|
@ -106,6 +104,8 @@ public interface ShellControl extends ProcessControl {
|
|||
|
||||
ShellControl withErrorFormatter(Function<String, String> formatter);
|
||||
|
||||
void checkLicenseOrThrow();
|
||||
|
||||
String prepareIntermediateTerminalOpen(
|
||||
TerminalInitFunction content, TerminalInitScriptConfig config, WorkingDirectoryFunction workingDirectory)
|
||||
throws Exception;
|
||||
|
|
|
@ -106,11 +106,6 @@ public class WrapperShellControl implements ShellControl {
|
|||
return parent.getMachineRootSession();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShellControl withoutLicenseCheck() {
|
||||
return parent.withoutLicenseCheck();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOsName() {
|
||||
return parent.getOsName();
|
||||
|
@ -262,6 +257,11 @@ public class WrapperShellControl implements ShellControl {
|
|||
return parent.withErrorFormatter(formatter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkLicenseOrThrow() {
|
||||
parent.checkLicenseOrThrow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String prepareIntermediateTerminalOpen(
|
||||
TerminalInitFunction content, TerminalInitScriptConfig config, WorkingDirectoryFunction workingDirectory)
|
||||
|
|
|
@ -50,6 +50,8 @@ public class ConnectionFileSystem implements FileSystem {
|
|||
"Shell has a PTY allocated and as a result does not support file system operations");
|
||||
}
|
||||
|
||||
shellControl.checkLicenseOrThrow();
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue