Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

revert(remote): drop the yellow 'Allow LAN access' button + allow_lan_access command

purple94b3ef480594
diff --git a/src-tauri/src/commands/remote.rs b/src-tauri/src/commands/remote.rs
index 6982590d..827dce4c 100644
--- a/src-tauri/src/commands/remote.rs
+++ b/src-tauri/src/commands/remote.rs
@@ -3767,92 +3767,6 @@ fn ensure_lan_firewall_rule(port: u16) {
#[cfg(not(target_os = "windows"))]
fn ensure_lan_firewall_rule(_port: u16) {}
-/// User-triggered, ELEVATED counterpart to `ensure_lan_firewall_rule`. The
-/// best-effort version can't elevate, so a per-user install's inbound rule
-/// never gets created and a phone on the same Wi-Fi can't reach the (correct)
-/// LAN URL — David 2026-06-15: "manual URL works on the PC but not the phone".
-/// This relaunches `netsh` via a UAC prompt to add the rule once, then verifies
-/// it landed in a locale-independent way (exit code + port match, since David's
-/// Windows is German and netsh's text is localized).
-#[tauri::command]
-pub async fn allow_lan_access(port: Option<u16>) -> Result<String, String> {
- let port = port.unwrap_or(11435);
- #[cfg(target_os = "windows")]
- {
- use std::os::windows::process::CommandExt;
- use std::process::Command;
- const CREATE_NO_WINDOW: u32 = 0x08000000;
- let name = format!("Locally Uncensored Remote {}", port);
-
- // A tiny .cmd lets cmd.exe parse the spaced, quoted rule name natively
- // — avoids the PowerShell→netsh nested-quoting trap entirely.
- let script = format!(
- "@echo off\r\n\
- netsh advfirewall firewall delete rule name=\"{name}\" >nul 2>&1\r\n\
- netsh advfirewall firewall add rule name=\"{name}\" dir=in action=allow protocol=TCP localport={port} profile=private,domain\r\n",
- name = name, port = port
- );
- let cmd_path = std::env::temp_dir().join("lu_allow_lan.cmd");
- std::fs::write(&cmd_path, script)
- .map_err(|e| format!("Could not write helper script: {}", e))?;
-
- // Relaunch the .cmd elevated (UAC). -Wait so we know when it finished;
- // a cancelled UAC makes Start-Process throw → powershell exits non-zero.
- let ps = format!(
- "Start-Process -FilePath '{}' -Verb RunAs -WindowStyle Hidden -Wait",
- cmd_path.display()
- );
- let out = Command::new("powershell")
- .args(["-NoProfile", "-WindowStyle", "Hidden", "-Command", &ps])
- .creation_flags(CREATE_NO_WINDOW)
- .output()
- .map_err(|e| format!("Could not launch elevated helper: {}", e))?;
- let ps_ok = out.status.success();
- let ps_err = String::from_utf8_lossy(&out.stderr).trim().to_string();
-
- // Verify the rule exists now. Reading rules needs no admin. netsh
- // returns a non-zero exit when no rule matches, and the port number is
- // locale-independent — check both so a German Windows can't fool us.
- let check = Command::new("netsh")
- .args(["advfirewall", "firewall", "show", "rule", &format!("name={}", name)])
- .creation_flags(CREATE_NO_WINDOW)
- .output();
- let exists = match check {
- Ok(o) => o.status.success()
- || String::from_utf8_lossy(&o.stdout).contains(&port.to_string()),
- Err(_) => false,
- };
-
- let _ = std::fs::remove_file(&cmd_path); // best-effort cleanup
-
- if exists {
- Ok(format!(
- "LAN access enabled (inbound TCP {port} allowed). Re-scan the QR on your phone — same Wi-Fi."
- ))
- } else if !ps_ok {
- Err(format!(
- "Permission was declined, so LAN access wasn't changed{}. Click again and accept the Windows prompt, or run this once in an Admin PowerShell:\n\
- netsh advfirewall firewall add rule name=\"{name}\" dir=in action=allow protocol=TCP localport={port}",
- if ps_err.is_empty() { String::new() } else { format!(" ({})", ps_err) },
- name = name, port = port
- ))
- } else {
- Err(format!(
- "Tried to allow LAN access but couldn't confirm the firewall rule. Run this once in an Admin PowerShell:\n\
- netsh advfirewall firewall add rule name=\"{name}\" dir=in action=allow protocol=TCP localport={port}",
- name = name, port = port
- ))
- }
- }
- #[cfg(not(target_os = "windows"))]
- {
- Ok(format!(
- "Automatic firewall setup is Windows-only. On Linux/macOS, allow inbound TCP {} in your system firewall (e.g. `sudo ufw allow {}/tcp`).",
- port, port
- ))
- }
-}
-
#[tauri::command]
pub async fn start_remote_server(
app: AppHandle,
diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs
index 9e919866..65778b56 100644
--- a/src-tauri/src/main.rs
+++ b/src-tauri/src/main.rs
@@ -199,7 +199,6 @@ fn main() {
commands::remote::start_tunnel,
commands::remote::stop_tunnel,
commands::remote::tunnel_status,
- commands::remote::allow_lan_access,
// Proxy
commands::proxy::ollama_search,
commands::proxy::fetch_external,
diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsx
index 3ce01b9e..9025be1e 100644
--- a/src/components/layout/Sidebar.tsx
+++ b/src/components/layout/Sidebar.tsx
@@ -31,8 +31,6 @@ export function Sidebar() {
const [countdown, setCountdown] = useState('')
const [dispatchPicker, setDispatchPicker] = useState(false)
const [qrModalOpen, setQrModalOpen] = useState(false)
- const [lanFixMsg, setLanFixMsg] = useState<string | null>(null)
- const [lanFixing, setLanFixing] = useState(false)
const isCodingMode = chatMode === 'codex'
const isRemoteMode = chatMode === 'remote'
@@ -163,23 +161,6 @@ export function Sidebar() {
navigator.clipboard.writeText(text)
}
- // One-click LAN firewall fix: relaunch netsh elevated (UAC) to add the
- // inbound allow rule for the remote port, so a phone on the same Wi-Fi can
- // actually reach the server (David 2026-06-15: the QR/IP were correct but
- // Windows silently dropped the phone's connection — no inbound rule).
- const handleAllowLan = async () => {
- setLanFixing(true)
- setLanFixMsg('Requesting permission (accept the Windows prompt)…')
- try {
- const msg = await useRemoteStore.getState().allowLanAccess()
- setLanFixMsg(msg || 'LAN access allowed — re-scan the QR on your phone.')
- } catch (e) {
- setLanFixMsg(String(e))
- } finally {
- setLanFixing(false)
- }
- }
-
// Auto-hide the QR panel (a) as soon as the dispatched conversation
// receives its first message, OR (b) as soon as a mobile has authenticated.
// refreshDevices() itself sets qrVisible=false when devices.length > 0,
@@ -393,26 +374,6 @@ export function Sidebar() {
</p>
)}
- {/* LAN reachability helper — only relevant for LAN dispatch.
- Adds the Windows Firewall inbound rule (elevated UAC) so a
- phone on the same Wi-Fi can actually reach the server. */}
- {!tunnelActive && !awaitingTunnel && (mobileUrl || lanUrl) && (
- <div className="pt-0.5">
- <button
- onClick={handleAllowLan}
- disabled={lanFixing}
- title="If your phone can't open the URL on the same Wi-Fi, click to allow LAN access through Windows Firewall (requires admin)"
- className="w-full flex items-center justify-center gap-1 px-1.5 py-0.5 rounded text-[0.5rem] text-amber-400/90 hover:bg-amber-500/15 border border-amber-500/20 transition-all disabled:opacity-50"
- >
- <Wifi size={8} className={lanFixing ? 'animate-pulse' : ''} />
- {lanFixing ? 'Allowing…' : "Phone can't connect? Allow LAN access"}
- </button>
- {lanFixMsg && (
- <p className="text-[0.45rem] text-gray-400 leading-snug mt-0.5 break-words">{lanFixMsg}</p>
- )}
- </div>
- )}
-
{remoteError && (
<p className="text-[0.5rem] text-red-400 truncate">{remoteError}</p>
)}
diff --git a/src/stores/remoteStore.ts b/src/stores/remoteStore.ts
index ce4af771..74fe5949 100644
--- a/src/stores/remoteStore.ts
+++ b/src/stores/remoteStore.ts
@@ -95,7 +95,6 @@ interface RemoteState {
setPermissions: (perms: RemotePermissions) => Promise<void>
startTunnel: () => Promise<void>
stopTunnel: () => Promise<void>
- allowLanAccess: () => Promise<string>
dispatch: (conversationId: string, model: string, systemPrompt: string) => Promise<void>
undispatch: () => Promise<void>
restart: (model?: string, systemPrompt?: string) => Promise<void>
@@ -306,18 +305,6 @@ export const useRemoteStore = create<RemoteState>()((set, get) => ({
}
},
- // Open the LAN port in Windows Firewall so phones on the same Wi-Fi can
- // reach the remote server. This needs admin, so the Rust side relaunches
- // `netsh` elevated via a UAC prompt. Root cause of David's 2026-06-15
- // "manual URL works on PC but not the phone": no inbound firewall rule
- // existed (the QR/IP were correct all along). Returns a human-readable
- // result for the UI to show.
- allowLanAccess: async (): Promise<string> => {
- if (!isTauri()) return REMOTE_DEV_MODE_ERROR
- const port = get().port || 11435
- return await backendCall<string>('allow_lan_access', { port })
- },
-
dispatch: async (conversationId: string, model: string, systemPrompt: string) => {
const { enabled, stopServer, startServer } = get()
// Stop existing server if running