mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-09-22 00:15:41 +00:00
Add sudo cache
This commit is contained in:
@@ -271,4 +271,6 @@ public interface ShellControl extends ProcessControl {
|
||||
CommandControl command(CommandBuilder builder);
|
||||
|
||||
void exitAndWait() throws IOException;
|
||||
|
||||
SudoCache getSudoCache();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package io.xpipe.app.process;
|
||||
|
||||
import io.xpipe.core.FilePath;
|
||||
|
||||
public interface SudoCache {
|
||||
|
||||
void setRequiresPassword();
|
||||
|
||||
boolean requiresPassword() throws Exception;
|
||||
|
||||
FilePath getSudoExecutable() throws Exception;
|
||||
}
|
||||
@@ -364,4 +364,9 @@ public class WrapperShellControl implements ShellControl {
|
||||
public void exitAndWait() throws IOException {
|
||||
parent.exitAndWait();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SudoCache getSudoCache() {
|
||||
return parent.getSudoCache();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,12 +88,18 @@ public class SecretManager {
|
||||
return r;
|
||||
}
|
||||
|
||||
public static synchronized void completeRequest(UUID request) {
|
||||
if (progress.removeIf(
|
||||
secretQueryProgress -> secretQueryProgress.getRequestId().equals(request))) {
|
||||
public static synchronized List<SecretQueryProgress> completeRequest(UUID request) {
|
||||
var found = progress.stream().filter(
|
||||
secretQueryProgress -> secretQueryProgress.getRequestId().equals(request))
|
||||
.toList();
|
||||
|
||||
if (progress.removeAll(found)) {
|
||||
TrackEvent.withTrace("Completed secret request")
|
||||
.tag("uuid", request)
|
||||
.handle();
|
||||
return found;
|
||||
} else {
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user