fix(mitm): gate sudo prompts on server platform (#822)
This commit is contained in:
1 parent
a463ee00ff
commit
e40f7ffb98
7 files changed
+62
-37
No files matched your search
@@ -18,6 +18,7 @@ export default function MitmToolCard({
|
||||
serverRunning,
|
||||
dnsActive,
|
||||
hasCachedPassword,
|
||||
needsSudoPassword,
|
||||
apiKeys,
|
||||
activeProviders,
|
||||
hasActiveProviders,
|
||||
@@ -36,7 +37,7 @@ export default function MitmToolCard({
|
||||
const [currentEditingAlias, setCurrentEditingAlias] = useState(null);
|
||||
|
||||
const mitmHosts = TOOL_HOSTS[tool.id] ?? [];
|
||||
const isWindows = typeof navigator !== "undefined" && navigator.userAgent?.includes("Windows");
|
||||
const canRunWithoutPassword = hasCachedPassword || needsSudoPassword === false;
|
||||
|
||||
useEffect(() => {
|
||||
if (isExpanded) loadSavedMappings();
|
||||
@@ -85,7 +86,7 @@ export default function MitmToolCard({
|
||||
const handleDnsToggle = () => {
|
||||
if (!serverRunning) return;
|
||||
const action = dnsActive ? "disable" : "enable";
|
||||
if (isWindows || hasCachedPassword) {
|
||||
if (canRunWithoutPassword) {
|
||||
doDnsAction(action, "");
|
||||
} else {
|
||||
setPendingDnsAction(action);
|
||||
|
||||
Reference in new issue
Block a user