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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(remote): explain that the internet way takes the LU app (#232)
purplecc5dfe0051ed
diff --git a/docs/remote-access/index.html b/docs/remote-access/index.htmlindex 6cc08de7..4d25309e 100644--- a/docs/remote-access/index.html+++ b/docs/remote-access/index.html@@ -77,7 +77,7 @@<p>Two ways to connect, both started by you:</p><ul><li><strong>LAN</strong>: phone and PC in the same Wi-Fi. The traffic stays in your network.</li>-<li><strong>Internet</strong>: LU starts a Cloudflare tunnel and gets a public https address. Nothing to set up on your router.</li>+<li><strong>Internet</strong>: LU starts a Cloudflare tunnel and gets a public https address. Nothing to set up on your router. This works only with the LU app on the phone; a browser on the phone reaches LU only in the same Wi-Fi.</li></ul><h2 id="lan">1. Over your own Wi-Fi (LAN)</h2>@@ -91,7 +91,8 @@<div class="step-body"><p>The phone asks for the "Access Code". Type the six digits from the desktop and tap "Connect". The QR code does not contain the passcode, so you always type it.</p></div></div><h2 id="tunnel">2. From anywhere (Internet)</h2>-<p>Press "Dispatch", then "Internet", then pick the folder. The panel shows "Connecting to Cloudflare…" and holds the QR code back until the public address works; LU waits up to 15 seconds. The address ends in <code>trycloudflare.com/mobile</code>, is new for every session and exists only while it runs. Scan and type the passcode as above. Right after scanning the first connection can take 5 to 10 seconds; if the phone shows a DNS error, wait a moment and reload.</p>+<p>Over the internet only the LU app on the phone gets through, over its own encrypted channel. A browser does not: the phone page and the passcode work only in the same Wi-Fi as the PC (chapter 1). Opened in a browser, the public address shows only a short note that it works with the LU app.</p>+<p>Press "Dispatch", then "Internet", then pick the folder. The panel shows "Connecting to Cloudflare…" and holds the QR code back until the public address works; LU waits up to 15 seconds. The address ends in <code>trycloudflare.com</code>, is new for every session and exists only while it runs. Open the LU app on the phone and scan the QR code in the panel; then allow the phone on the PC. Right after scanning the first connection can take 5 to 10 seconds; if the app shows a DNS error, wait a moment and try again.</p><p>You do not need to install anything for this. The helper program cloudflared is downloaded by LU itself the first time, from Cloudflare's releases on GitHub, and fetched again when the copy is more than 30 days old.</p><h2 id="passcode">3. The six-digit passcode</h2>@@ -126,10 +127,11 @@<table><tr><th>Symptom</th><th>Cause and fix</th></tr><tr><td>"Dispatch" is greyed out</td><td>No chat model picked. Pick or install one.</td></tr>-<tr><td>Phone cannot open the address (LAN)</td><td>The phone is on mobile data, a guest network or a different Wi-Fi. Put it on the same network as the PC. Otherwise use Internet.</td></tr>+<tr><td>Phone cannot open the address (LAN)</td><td>The phone is on mobile data, a guest network or a different Wi-Fi. Put it on the same network as the PC. Otherwise use Internet with the LU app.</td></tr><tr><td>"Connection failed" in the same Wi-Fi</td><td>Windows: the firewall. LU adds the rule "LU Remote 11435" for private networks only when it runs with administrator rights; otherwise allow LU once in the Windows firewall and make sure your Wi-Fi counts as a private network.<br>Linux: allow port 11435 in your firewall if one is active.</td></tr><tr><td>"Invalid access code"</td><td>Typo, or the code changed (after 15 minutes, after the circular arrow, after Restart). Type the code the desktop shows now.</td></tr><tr><td>"Too many attempts. Try again in (N)s"</td><td>Three wrong codes. Wait, then type the current code.</td></tr>+<tr><td>A browser on the phone shows "This address works only with the LU app"</td><td>That is the internet address. A browser reaches LU only in the same Wi-Fi. Over the internet, scan the QR code in the panel with the LU app.</td></tr><tr><td>"…no public URL appeared within 15 s…"</td><td>cloudflared cannot reach Cloudflare, usually a firewall or VPN. LAN still works. Fix it, then press "Stop" and dispatch again with "Internet".</td></tr><tr><td>"Could not bind 0.0.0.0:11435"</td><td>Port 11435 is taken, usually by a second LU or an earlier session. Press "Stop", quit other LU instances from the tray, dispatch again.</td></tr><tr><td>The phone suddenly asks for the passcode</td><td>Restart was pressed, the device was disconnected, or 24 hours passed. Pair again.</td></tr>diff --git a/src-tauri/src/commands/remote.rs b/src-tauri/src/commands/remote.rsindex 08f42a41..a25b3cb4 100644--- a/src-tauri/src/commands/remote.rs+++ b/src-tauri/src/commands/remote.rs@@ -2575,24 +2575,30 @@ mod page_title_tests {struct QrResponse {qr_png_base64: String,url: String,+ /// The tunnel runs: over the internet only the LU app gets through, the+ /// browser QR still points at the home network (#232).+ #[serde(rename = "internetAppOnly")]+ internet_app_only: bool,+}++/// The address the browser QR names. Always the LAN page: the tunnel+/// listener has no `/mobile` (E3), so `<tunnel>/mobile` would only ever+/// show the notice page (#232). The second value says whether the tunnel+/// runs, so the panel can say that the internet needs the LU app.+fn browser_qr_target(lan_ip: &str, port: u16, tunnel_active: bool) -> (String, bool) {+ (format!("http://{}:{}/mobile", lan_ip, port), tunnel_active)}async fn handle_qr(AxumState(state): AxumState<RemoteState>) -> Json<QrResponse> {- // Use tunnel URL if active, otherwise LAN- let tunnel_url = state.tunnel_url.lock().await.clone();- let url = if let Some(ref turl) = tunnel_url {- format!("{}/mobile", turl)- } else {- let lan_ip = super::lan_address::lan_address();- let port = 11435u16;- format!("http://{}:{}/mobile", lan_ip, port)- };+ let tunnel_active = state.tunnel_url.lock().await.is_some();+ let lan_ip = super::lan_address::lan_address();+ let (url, internet_app_only) = browser_qr_target(&lan_ip, 11435u16, tunnel_active);// Generate QR code as PNG image — never panic, just return an empty// image if the QR encoder rejects the URL.let qr = match qrcode::QrCode::new(url.as_bytes()) {Ok(q) => q,- Err(_) => return Json(QrResponse { qr_png_base64: String::new(), url }),+ Err(_) => return Json(QrResponse { qr_png_base64: String::new(), url, internet_app_only }),};let qr_image = qr.render::<image::Luma<u8>>().quiet_zone(true)@@ -2604,7 +2610,61 @@ async fn handle_qr(AxumState(state): AxumState<RemoteState>) -> Json<QrResponse>let qr_base64 = base64::Engine::encode(&base64::engine::general_purpose::STANDARD, &png_bytes);- Json(QrResponse { qr_png_base64: qr_base64, url })+ Json(QrResponse { qr_png_base64: qr_base64, url, internet_app_only })+}++#[cfg(test)]+mod browser_qr_tests {+ use super::*;++ fn state() -> RemoteState {+ let server = RemoteServer::new();+ RemoteState {+ memory_revoked: server.memory_revoked.clone(),+ jwt_secret: server.jwt_secret.clone(),+ passcode: server.passcode.clone(),+ ollama_base: String::new(),+ backend_kind: "ollama".into(),+ openai_base: String::new(),+ openai_key: String::new(),+ comfy_port: 0,+ comfy_host: "127.0.0.1".into(),+ permissions: server.permissions.clone(),+ connected_devices: server.connected_devices.clone(),+ tunnel_url: server.tunnel_url.clone(),+ dispatched_model: server.dispatched_model.clone(),+ dispatched_system_prompt: server.dispatched_system_prompt.clone(),+ page_title: server.page_title.clone(),+ app_handle: RemoteDesktop::unavailable(),+ sealed: None,+ create: server.create.clone(),+ chats: server.chats.clone(),+ }+ }++ #[test]+ fn the_browser_qr_names_the_lan_page_also_with_the_tunnel() {+ assert_eq!(browser_qr_target("192.168.1.5", 11435, false), ("http://192.168.1.5:11435/mobile".to_string(), false));+ assert_eq!(browser_qr_target("192.168.1.5", 11435, true), ("http://192.168.1.5:11435/mobile".to_string(), true));+ }++ /// #232: with the tunnel up the QR used to say `<tunnel>/mobile`, an+ /// address that never works. Now the LAN page plus the app-only flag.+ #[tokio::test]+ async fn handle_qr_with_an_active_tunnel_gives_the_lan_address() {+ let state = state();+ let Json(before) = handle_qr(AxumState(state.clone())).await;+ assert!(!before.internet_app_only);+ *state.tunnel_url.lock().await = Some("https://quiet-river-1234.trycloudflare.com".into());+ let Json(qr) = handle_qr(AxumState(state)).await;+ assert!(qr.internet_app_only);+ assert!(qr.url.starts_with("http://") && qr.url.ends_with(":11435/mobile"), "{}", qr.url);+ assert!(!qr.url.contains("trycloudflare"), "{}", qr.url);+ assert_eq!(qr.url, before.url);+ assert!(!qr.qr_png_base64.is_empty());+ let v = serde_json::to_value(&qr).unwrap();+ assert_eq!(v["internetAppOnly"], true);+ }}// ─── Devices ───@@ -3780,15 +3840,11 @@ pub async fn remote_qr_code(return Err("Remote server not running".into());}- // Use tunnel URL if active, otherwise LAN- let tunnel_url = tunnel_url_arc.lock().await;- let url = if let Some(ref turl) = *tunnel_url {- format!("{}/mobile", turl)- } else {- let lan_ip = super::lan_address::lan_address();- format!("http://{}:{}/mobile", lan_ip, port)- };- drop(tunnel_url);+ // The browser QR always names the LAN page, also while the tunnel runs:+ // over the internet only the LU app gets through (#232, E3).+ let tunnel_active = tunnel_url_arc.lock().await.is_some();+ let lan_ip = super::lan_address::lan_address();+ let (url, internet_app_only) = browser_qr_target(&lan_ip, port, tunnel_active);let qr = qrcode::QrCode::new(url.as_bytes()).map_err(|e| e.to_string())?;let qr_image = qr.render::<image::Luma<u8>>()@@ -3809,6 +3865,7 @@ pub async fn remote_qr_code("qr_png_base64": qr_base64,"url": url,"passcode": passcode,+ "internetAppOnly": internet_app_only,}))}@@ -4404,8 +4461,58 @@ async fn handle_sealed_tunnel(handle_sealed(state, sealed::Listener::Tunnel, source, addr, headers, body).await}+/// What a browser sees under the tunnel address (#232). Static: no script,+/// no outside resource, no version, no path, nothing about this desktop.+const TUNNEL_NOTICE_HTML: &str = r#"<!doctype html>+<html lang="en">+<head>+<meta charset="utf-8">+<meta name="viewport" content="width=device-width, initial-scale=1">+<meta name="robots" content="noindex">+<title>Locally Uncensored</title>+<style>+body{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;background:#111;color:#e5e5e5;font:16px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif}+main{max-width:30rem;padding:24px}+h1{font-size:20px;margin:0 0 12px}+p{margin:0 0 12px;color:#bdbdbd}+@media (prefers-color-scheme:light){body{background:#fafafa;color:#1a1a1a}p{color:#444}}+</style>+</head>+<body>+<main>+<h1>This address works only with the LU app</h1>+<p>Open the LU app on your phone and scan the pairing QR code in the Remote panel on your computer.</p>+<p>In a browser, Remote works only on your home Wi-Fi.</p>+</main>+</body>+</html>+"#;++/// Strict headers for the notice page: no script, no frame, no referrer,+/// only the inline style of the page itself.+const TUNNEL_NOTICE_CSP: &str = "default-src 'none'; style-src 'unsafe-inline'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";++/// The tunnel listener's answer to everything it does not know. A browser+/// (GET or HEAD outside `/remote-api/`) gets the notice page with status 404,+/// everything else stays an empty 404 as before.+async fn tunnel_fallback(method: Method, uri: axum::http::Uri) -> Response {+ let browser = (method == Method::GET || method == Method::HEAD) && !uri.path().starts_with("/remote-api/");+ if !browser {+ return StatusCode::NOT_FOUND.into_response();+ }+ let mut res = (StatusCode::NOT_FOUND, Html(TUNNEL_NOTICE_HTML)).into_response();+ let h = res.headers_mut();+ h.insert(header::CONTENT_SECURITY_POLICY, header::HeaderValue::from_static(TUNNEL_NOTICE_CSP));+ h.insert(header::X_CONTENT_TYPE_OPTIONS, header::HeaderValue::from_static("nosniff"));+ h.insert(header::X_FRAME_OPTIONS, header::HeaderValue::from_static("DENY"));+ h.insert(header::REFERRER_POLICY, header::HeaderValue::from_static("no-referrer"));+ h.insert(header::CACHE_CONTROL, header::HeaderValue::from_static("no-store"));+ res+}+/// The listener cloudflared points at. It knows two routes and nothing else:/// no `/mobile` page, no code login, no plain API over the internet (E3).+/// A browser that lands here gets a short notice instead of a blank page.fn build_tunnel_router(state: RemoteState) -> Router {async fn not_found() -> StatusCode {StatusCode::NOT_FOUND@@ -4413,7 +4520,7 @@ fn build_tunnel_router(state: RemoteState) -> Router {Router::new().route("/remote-api/status", get(handle_status_tunnel)).route("/remote-api/sealed", post(handle_sealed_tunnel))- .fallback(not_found)+ .fallback(tunnel_fallback).method_not_allowed_fallback(not_found).layer(middleware::from_fn_with_state(state.clone(), tunnel_gate)).layer(middleware::from_fn(access_log))@@ -6707,6 +6814,7 @@ mod remote_hardening_tests {let json = serde_json::to_value(QrResponse {qr_png_base64: "AAA".into(),url: "http://192.168.1.10:11435/mobile".into(),+ internet_app_only: false,}).unwrap();assert!(json.get("passcode").is_none(), "the QR payload leaks the pairing code");diff --git a/src-tauri/src/commands/remote_sealed/tests.rs b/src-tauri/src/commands/remote_sealed/tests.rsindex 5df3b3d4..c1a0c4a3 100644--- a/src-tauri/src/commands/remote_sealed/tests.rs+++ b/src-tauri/src/commands/remote_sealed/tests.rs@@ -273,6 +273,58 @@ async fn the_tunnel_listener_knows_only_status_and_the_sealed_door() {assert_eq!(v["name"], "Studio PC");}+/// #232: a browser under the tunnel address sees a notice, not a blank+/// page. The page sits behind the same gate, the API answers stay empty.+#[tokio::test]+async fn a_browser_on_the_tunnel_gets_the_app_only_notice() {+ let rig = rig().await;+ for path in ["/", "/mobile", "/mobile?x=1", "/anything/else"] {+ let (status, headers, body) = send(&rig, Via::Tunnel("203.0.113.5"), "GET", path, Vec::new()).await;+ assert_eq!(status, StatusCode::NOT_FOUND, "{path}");+ assert!(headers["content-type"].to_str().unwrap().starts_with("text/html"), "{path}");+ let csp = headers["content-security-policy"].to_str().unwrap();+ assert!(csp.contains("default-src 'none'") && csp.contains("frame-ancestors 'none'"), "{csp}");+ assert!(!csp.contains("script-src"), "{csp}");+ assert_eq!(headers["x-content-type-options"], "nosniff");+ assert_eq!(headers["cache-control"], "no-store");+ let html = String::from_utf8(body).unwrap();+ assert!(html.contains("works only with the LU app"), "{path}");+ assert!(html.contains("home Wi-Fi"), "{path}");+ let lower = html.to_ascii_lowercase();+ for banned in ["<script", "http://", "https://", "src=", "href=", "studio pc", env!("CARGO_PKG_VERSION")] {+ assert!(!lower.contains(&banned.to_ascii_lowercase()), "{path}: {banned}");+ }+ }+ // Other methods and the API paths stay empty.+ for (method, path) in [+ ("POST", "/"),+ ("POST", "/mobile"),+ ("PUT", "/"),+ ("DELETE", "/mobile"),+ ("GET", "/remote-api/sealed"),+ ("GET", "/remote-api/qr"),+ ("POST", "/remote-api/status"),+ ] {+ let (status, _, body) = send(&rig, Via::Tunnel("203.0.113.5"), method, path, Vec::new()).await;+ assert_eq!(status, StatusCode::NOT_FOUND, "{method} {path}");+ assert!(body.is_empty(), "{method} {path} answered with a body");+ }+ // The gate still comes first: a foreign name gets nothing.+ let mut req = Request::builder().method("GET").uri("/").header("host", "evil.example").body(Body::empty()).unwrap();+ req.extensions_mut().insert(ConnectInfo("127.0.0.1:40000".parse::<SocketAddr>().unwrap()));+ let res = rig.routers.tunnel.clone().oneshot(req).await.unwrap();+ assert_eq!(res.status(), StatusCode::NOT_FOUND);+ assert!(axum::body::to_bytes(res.into_body(), usize::MAX).await.unwrap().is_empty());+ // The sealed door is still reachable: an empty frame is refused by the+ // channel itself, not by the fallback.+ let (status, headers, _) = send(&rig, Via::Tunnel("203.0.113.5"), "POST", "/remote-api/sealed", Vec::new()).await;+ assert_ne!(status, StatusCode::NOT_FOUND);+ assert!(headers.get("content-security-policy").is_none());+ let (status, _, _) = send(&rig, Via::Tunnel("203.0.113.5"), "GET", "/remote-api/status", Vec::new()).await;+ assert_eq!(status, StatusCode::OK);+}++// ── Pairing ──// ── Pairing ──#[tokio::test]diff --git a/src/components/layout/Sidebar.tsx b/src/components/layout/Sidebar.tsxindex 7ecc59fd..6fd1ff7e 100644--- a/src/components/layout/Sidebar.tsx+++ b/src/components/layout/Sidebar.tsx@@ -10,7 +10,7 @@ import { useCompareStore } from '../../stores/compareStore'import { useModelStore } from '../../stores/modelStore'import { useSettingsStore } from '../../stores/settingsStore'import { useCodexStore } from '../../stores/codexStore'-import { useRemoteStore, REMOTE_DEV_MODE_ERROR } from '../../stores/remoteStore'+import { useRemoteStore, REMOTE_DEV_MODE_ERROR, remoteAddressView } from '../../stores/remoteStore'import { RemoteFirewallNotice } from '../remote/RemoteFirewallNotice'import { workspaceRejectedMessage } from '../../lib/workspace-rejected'import { CHAT_BASE_SYSTEM_PROMPT } from '../../lib/system-prompt'@@ -82,6 +82,7 @@ export function Sidebar() {const remoteError = useRemoteStore((s) => s.error)const tunnelActive = useRemoteStore((s) => s.tunnelActive)const tunnelUrl = useRemoteStore((s) => s.tunnelUrl)+ const internetAppOnly = useRemoteStore((s) => s.internetAppOnly)const tunnelLoading = useRemoteStore((s) => s.tunnelLoading)const awaitingTunnel = useRemoteStore((s) => s.awaitingTunnel)const qrVisible = useRemoteStore((s) => s.qrVisible)@@ -420,8 +421,10 @@ export function Sidebar() {const showAppQr = !!appQrPngBase64 && (tunnelActive || qrKind === 'app')const qrPngBase64 = showAppQr ? appQrPngBase64 : (tunnelActive ? '' : browserQrPngBase64)- // Over the tunnel there is no page to open, only the address the app uses.- const shownAddress = tunnelActive && tunnelUrl ? tunnelUrl : (mobileUrl || lanUrl)+ // The tunnel has no page to open (#232): the address shown and copied is+ // always the browser page in the same Wi-Fi, and the internet way gets a+ // hint that it takes the LU app.+ const { address: shownAddress, appOnlyHint } = remoteAddressView({ tunnelActive, internetAppOnly, mobileUrl, lanUrl })// A code (and the app's ticket) exists only while the QR panel or the// large QR shows: opening makes one, closing ends it on the server.@@ -895,13 +898,13 @@ export function Sidebar() {</div></div>- {/* URL — prefer tunnel URL when tunnel is active */}+ {/* Browser address, same Wi-Fi only, also in internet mode (#232). */}<div className="flex items-center gap-1.25">{tunnelLoading ? (<code className="text-[10px] text-emerald-400/70 truncate flex-1 animate-pulse">Starting Cloudflare tunnel…</code>) : (<>- <code className={`text-[10px] truncate flex-1 ${tunnelActive ? 'text-emerald-400' : 'text-blue-400'}`}>+ <code className="text-[10px] truncate flex-1 text-blue-400">{shownAddress}</code><button@@ -923,9 +926,12 @@ export function Sidebar() {not available" on first scan, panic, and clickRestart. The note is small + auto-disappears once adevice authenticates (qrVisible flips false). */}+ {appOnlyHint && (+ <p className="t-micro text-gray-500 leading-snug">{appOnlyHint}</p>+ )}{tunnelActive && tunnelUrl && (<p className="text-[10px] text-gray-500/70 leading-snug">- First connection may take 5 to 10 s while DNS propagates. If you see a DNS error, wait a moment and reload.+ First connection may take 5 to 10 s while DNS propagates. If the app shows a DNS error, wait a moment and try again.</p>)}@@ -1506,7 +1512,7 @@ export function Sidebar() {)}<div className="w-full flex items-center gap-2.5 px-3.75 py-2.5 rounded-[5px] bg-white/[0.04] border border-white/5">- <code className={`text-[13px] truncate flex-1 ${tunnelActive ? 'text-emerald-700 dark:text-emerald-400' : 'text-blue-700 dark:text-blue-400'}`}>+ <code className="text-[13px] truncate flex-1 text-blue-700 dark:text-blue-400">{shownAddress}</code><button@@ -1520,6 +1526,7 @@ export function Sidebar() {</div><p className="text-[12px] text-gray-500 text-center">+ {appOnlyHint && <span className="block mb-1.25">{appOnlyHint}</span>}{showAppQr? 'Scan the QR with the LU app, then allow the phone here. At home the app can also pair with the 6-digit code.': 'Scan the QR or enter the 6-digit code on your phone.'}diff --git a/src/components/layout/__tests__/internet-takes-only-the-app.test.ts b/src/components/layout/__tests__/internet-takes-only-the-app.test.tsnew file mode 100644index 00000000..9211adf1--- /dev/null+++ b/src/components/layout/__tests__/internet-takes-only-the-app.test.ts@@ -0,0 +1,101 @@+/**+ * #232: over the internet only the LU app gets through (sealed channel, E3).+ * The tunnel address has no browser page, so the panel used to hand out an+ * address that showed a blank screen on the phone. Now the panel shows the+ * Wi-Fi address for the browser and says that the internet takes the app.+ *+ * Run: npx vitest run src/components/layout/__tests__/internet-takes-only-the-app.test.ts+ */+import { describe, it, expect, vi, beforeEach } from 'vitest'+import fs from 'node:fs'+import path from 'node:path'++const mockBackendCall = vi.fn()+vi.mock('../../../api/backend', () => ({+ backendCall: (...args: unknown[]) => mockBackendCall(...args),+ isTauri: () => true,+}))++import { useRemoteStore, remoteAddressView, INTERNET_APP_ONLY_HINT } from '../../../stores/remoteStore'++const ROOT = path.join(__dirname, '..', '..', '..', '..')+const SIDEBAR = fs.readFileSync(path.join(ROOT, 'src', 'components', 'layout', 'Sidebar.tsx'), 'utf8')++const LAN = { mobileUrl: 'http://192.168.1.20:11435/mobile', lanUrl: 'http://192.168.1.20:11435' }++describe('the panel hint for the internet way', () => {+ it('says that the internet takes the LU app and a browser the same Wi-Fi', () => {+ expect(INTERNET_APP_ONLY_HINT).toBe('Internet works only with the LU app. A browser on your phone needs the same Wi-Fi.')+ expect(INTERNET_APP_ONLY_HINT).not.toMatch(/[–—]/)+ })++ it('shows the hint and the Wi-Fi address while the tunnel runs', () => {+ const v = remoteAddressView({ tunnelActive: true, ...LAN })+ expect(v.appOnlyHint).toBe(INTERNET_APP_ONLY_HINT)+ expect(v.address).toBe(LAN.mobileUrl)+ expect(v.address).not.toContain('trycloudflare')+ })++ it('shows the hint when the QR answer says internetAppOnly', () => {+ expect(remoteAddressView({ tunnelActive: false, internetAppOnly: true, ...LAN }).appOnlyHint).toBe(INTERNET_APP_ONLY_HINT)+ })++ // Negative control: in the Wi-Fi only mode there is nothing to explain.+ it('has no hint without the tunnel', () => {+ const v = remoteAddressView({ tunnelActive: false, internetAppOnly: false, ...LAN })+ expect(v.appOnlyHint).toBe('')+ expect(v.address).toBe(LAN.mobileUrl)+ expect(remoteAddressView({ tunnelActive: false, mobileUrl: '', lanUrl: LAN.lanUrl }).address).toBe(LAN.lanUrl)+ })+})++describe('the store keeps internetAppOnly from remote_qr_code', () => {+ beforeEach(() => {+ mockBackendCall.mockReset()+ useRemoteStore.setState({ internetAppOnly: false, qrPngBase64: '' })+ })++ it('takes the flag from the desktop answer', async () => {+ mockBackendCall.mockImplementation(async (cmd: string) => {+ if (cmd === 'remote_qr_code') return { qr_png_base64: 'QQ', url: LAN.mobileUrl, passcode: '123456', internetAppOnly: true }+ throw new Error('no app qr here')+ })+ await useRemoteStore.getState().fetchQrCode()+ expect(useRemoteStore.getState().internetAppOnly).toBe(true)+ expect(useRemoteStore.getState().qrPngBase64).toBe('QQ')+ })++ it('reads a missing or odd flag as false', async () => {+ useRemoteStore.setState({ internetAppOnly: true })+ mockBackendCall.mockImplementation(async (cmd: string) => {+ if (cmd === 'remote_qr_code') return { qr_png_base64: 'QQ', url: LAN.mobileUrl, passcode: '', internetAppOnly: 'yes' }+ throw new Error('no app qr here')+ })+ await useRemoteStore.getState().fetchQrCode()+ expect(useRemoteStore.getState().internetAppOnly).toBe(false)+ })+})++describe('the Sidebar panel', () => {+ it('takes its address and hint from remoteAddressView', () => {+ expect(SIDEBAR).toContain('remoteAddressView({ tunnelActive, internetAppOnly, mobileUrl, lanUrl })')+ // Small panel and large QR both say it.+ expect(SIDEBAR.match(/\{appOnlyHint\}/g)?.length).toBe(2)+ })++ // Negative control: the tunnel address is no longer handed out as the+ // address to open.+ it('no longer shows the tunnel address as the address to open', () => {+ expect(SIDEBAR).not.toMatch(/tunnelActive && tunnelUrl \? tunnelUrl/)+ expect(SIDEBAR).not.toMatch(/copyToClipboard\(tunnelUrl/)+ })++ it('keeps the hint grey like the notes around it, not yellow', () => {+ const lines = SIDEBAR.split('\n').filter((l) => l.includes('{appOnlyHint}'))+ expect(lines[0]).toContain('t-micro text-gray-500')+ for (const l of lines) expect(l).not.toMatch(/amber|yellow/)+ // The large QR: inside the grey note under the address.+ const modal = SIDEBAR.slice(SIDEBAR.indexOf('<span className="block mb-1.25">{appOnlyHint}</span>') - 120)+ expect(modal.slice(0, 120)).toContain('text-gray-500')+ })+})diff --git a/src/stores/remoteStore.ts b/src/stores/remoteStore.tsindex 717a108d..9a4ffb63 100644--- a/src/stores/remoteStore.ts+++ b/src/stores/remoteStore.ts@@ -78,7 +78,7 @@ function revokeRemoteMemory(): Promise<void> {await backendCall('stop_remote_server')useRemoteStore.setState({enabled: false, passcode: '', qrPngBase64: '', appQrPngBase64: '', connectedDevices: [],- tunnelActive: false, tunnelUrl: '', awaitingTunnel: false, qrVisible: false,+ tunnelActive: false, tunnelUrl: '', internetAppOnly: false, awaitingTunnel: false, qrVisible: false,error: REMOTE_MEMORY_CHANGED, memoryNotice: REMOTE_MEMORY_CHANGED,})} catch {@@ -407,6 +407,25 @@ export function normalizePairedDevices(raw: unknown): { info: SealedInfo; device}}+/** #232: the internet way takes only the LU app. The tunnel address has no+ * browser page, so the panel says so and keeps showing the Wi-Fi address. */+export const INTERNET_APP_ONLY_HINT = 'Internet works only with the LU app. A browser on your phone needs the same Wi-Fi.'++/** The address the panel shows and copies: always the browser page in the+ * home network, never the tunnel, plus the hint while the internet way runs. */+export function remoteAddressView(s: {+ tunnelActive: boolean+ internetAppOnly?: boolean+ mobileUrl: string+ lanUrl: string+}): { address: string; appOnlyHint: string } {+ const internet = s.tunnelActive || s.internetAppOnly === true+ return {+ address: s.mobileUrl || s.lanUrl,+ appOnlyHint: internet ? INTERNET_APP_ONLY_HINT : '',+ }+}+interface RemoteState {enabled: booleanport: number@@ -415,6 +434,9 @@ interface RemoteState {lanUrl: stringmobileUrl: stringqrPngBase64: string+ /** Set by `remote_qr_code` while the tunnel runs: the browser QR names the+ * Wi-Fi page, the internet takes only the LU app (#232). */+ internetAppOnly: booleanconnectedDevices: ConnectedDevice[]permissions: RemotePermissionstunnelActive: boolean@@ -501,6 +523,7 @@ export const useRemoteStore = create<RemoteState>()((set, get) => ({lanUrl: '',mobileUrl: '',qrPngBase64: '',+ internetAppOnly: false,connectedDevices: [],permissions: { filesystem: false, downloads: false, process_control: false, shell: false, create: false },tunnelActive: false,@@ -641,6 +664,7 @@ export const useRemoteStore = create<RemoteState>()((set, get) => ({connectedDevices: [],tunnelActive: false,tunnelUrl: '',+ internetAppOnly: false,awaitingTunnel: false,dispatchedConversationId: null,qrVisible: false,@@ -751,8 +775,8 @@ export const useRemoteStore = create<RemoteState>()((set, get) => ({fetchQrCode: async () => {try {- const qr = await backendCall<{ qr_png_base64: string; url: string; passcode: string }>('remote_qr_code')- set({ qrPngBase64: qr.qr_png_base64 })+ const qr = await backendCall<{ qr_png_base64: string; url: string; passcode: string; internetAppOnly?: unknown }>('remote_qr_code')+ set({ qrPngBase64: qr.qr_png_base64, internetAppOnly: qr.internetAppOnly === true })} catch {// Non-critical}@@ -984,7 +1008,7 @@ export const useRemoteStore = create<RemoteState>()((set, get) => ({stopTunnel: async () => {try {await backendCall('stop_tunnel')- set({ tunnelActive: false, tunnelUrl: '' })+ set({ tunnelActive: false, tunnelUrl: '', internetAppOnly: false })// Refresh QR to show LAN IP againget().fetchQrCode()} catch (err) {@@ -1097,7 +1121,7 @@ export const useRemoteStore = create<RemoteState>()((set, get) => ({qrVisible: true, // Bug #16: fresh restart → fresh passcode → show QR})// Tunnel gets torn down on stop, so reset its state in the UI.- set({ tunnelActive: false, tunnelUrl: '' })+ set({ tunnelActive: false, tunnelUrl: '', internetAppOnly: false })// Re-fetch QR for the new passcodeget().fetchQrCode()} catch (err) {