Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ app/api/
models/route.ts GET { models, modelList, defaultModel }
models-config/route.ts GET/PUT — read/write ~/.omp/agent/models.yml
models-config/test/route.ts POST test a configured model/provider
mobile-access/route.ts GET read-only Settings → Mobile app facts: bound hostname/port, exposure, password-configured boolean, phone-reachable addresses (MagicDNS/Tailscale/LAN) and the installer commands; never a credential and never changes the binding
omp-settings/route.ts GET/PUT native config.yml settings (allow-listed)
web-settings/route.ts GET/PUT omp-web's own server settings (auto-resume, agent tools, agent env, browser transport; a transport change is pushed to every open browser)
mcp/route.ts GET/POST/PUT/DELETE project MCP servers; `GET ?sessionId=&attach=1` reads a running session's live MCP status and never starts one (a cluster session on another member)
Expand Down Expand Up @@ -237,6 +238,7 @@ lib/
session-match-listing.ts server: lists a session's search hits counted per rendered text node (remark parse)
session-resume.ts running-session list for auto-resume after a restart
web-auth.ts password-hash check + session cookie signing
mobile-access.ts Settings → Mobile app facts: bind classification, phone-reachable addresses (a specific bind keeps its kind — a CGNAT `100.64.0.0/10` or Tailscale IPv6 `fd7a:115c:a1e0::/48` address is `tailscale`; IPv6 is bracketed), MagicDNS only when the bind covers the tailnet, and the installer command sequences
web-auth-secret.ts per-installation session-signing key (~/.omp/agent/omp-web/web-auth-secret.json)
web-password-hash.ts typed view of bin/omp-web-password-hash.js (the scrypt hash format)
web-settings.ts omp-web server settings (~/.omp/agent/omp-web-settings.json)
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ All notable changes to **omp-web** (`@kahme247/ompweb`) are documented in this f

## [Unreleased]

### Added

- **Settings → Mobile app shows how to reach this server from a phone.** The new card reports the bind (loopback, network or unknown), the port, whether a password is configured, and the addresses to type into the app: the Tailscale address first for a phone that is away from home, then LAN. MagicDNS appears only when the bind actually covers the tailnet — a wildcard bind, or a specific bind on the Tailscale IP — because a socket bound to a LAN address does not listen on the Tailscale one. A specific bind keeps its address kind (a CGNAT `100.64.0.0/10` or Tailscale IPv6 `fd7a:115c:a1e0::/48` address is labelled Tailscale, not LAN), and IPv6 addresses are bracketed so the URL parses. Each installer's command sequence is shown as a hidden-input flow that keeps the password and its hash out of the shell history and `ps`. The card is backed by `GET /api/mobile-access`, which is read-only, rides the normal auth gate and returns only whether a password is configured — never the hash.

## [v0.7.4] - 2026-11-20

### Fixed
Expand Down
53 changes: 53 additions & 0 deletions app/api/mobile-access/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import { networkInterfaces } from "node:os";
import {
candidateAddresses,
classifyExposure,
DEFAULT_MOBILE_PORT,
detectBindHostname,
mobileAccessMethods,
parseMobilePort,
probeMagicDnsName,
} from "@/lib/mobile-access";
import { isWebPasswordEnabled, webPasswordConfigurationProblem } from "@/lib/web-auth";

/**
* The port this server is actually listening on.
*
* `OMP_WEB_PORT` is written by `startProduction` from the bound listener, so it
* is the authoritative value for a production launch (`npm start`, the binary
* and the launcher all go through it). The request URL's port is only as good
* as the `Host` header a proxy forwards, and `PORT` is the launcher's *intent*,
* not what the socket ended up on. Order: bound port, then the URL, then PORT.
*/
function resolveServerPort(req: Request): number {
return parseMobilePort(process.env.OMP_WEB_PORT)
?? parseMobilePort(new URL(req.url).port)
?? parseMobilePort(process.env.PORT)
?? DEFAULT_MOBILE_PORT;
}

/**
* GET /api/mobile-access — read-only facts for Settings → Mobile app. The
* endpoint cannot change the binding and never returns the password (only
* whether one is configured).
*/
export async function GET(req: Request) {
const hostname = detectBindHostname();
const port = resolveServerPort(req);
// Optional and time-boxed inside the helper: a missing tailscale binary
// resolves without spawning, and a slow one is cut off by its timeout.
const magicDnsName = await probeMagicDnsName();
return Response.json({
binding: {
hostname,
exposure: classifyExposure(hostname),
port,
},
password: {
configured: isWebPasswordEnabled(),
problem: webPasswordConfigurationProblem() !== null,
},
addresses: candidateAddresses({ hostname, port, magicDnsName, interfaces: networkInterfaces() }),
methods: mobileAccessMethods(),
});
}
24 changes: 23 additions & 1 deletion bin/network-addresses.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,26 @@ function isTailscaleAddress(ifaceName, address) {
if (parts.length === 4 && parts[0] === 100 && parts[1] >= 64 && parts[1] <= 127) {
return true;
}
// Tailscale IPv6 uses the ULA range fd7a:115c:a1e0::/48. A bind on that
// address is the tailnet address just like a CGNAT IPv4 one; without this
// an IPv6 tailnet bind was reported as plain LAN.
if (isTailscaleIpv6(address)) return true;
}
return false;
}

/** First 48 bits of `fd7a:115c:a1e0::/48`; brackets and a zone id are tolerated. */
function isTailscaleIpv6(address) {
const bare = address.trim().replace(/^\[|\]$/g, "").split("%")[0].toLowerCase();
if (!bare.includes(":")) return false;
// Only the leading groups matter for a /48. With `::` compression the groups
// after it are zeros, so a prefix that ends before the third group cannot be
// this range.
const groups = bare.split("::")[0].split(":");
if (groups.length < 3) return false;
return parseInt(groups[0], 16) === 0xfd7a && parseInt(groups[1], 16) === 0x115c && parseInt(groups[2], 16) === 0xa1e0;
}

function isIgnoredAddress(ifaceName, address) {
if (!address || typeof address !== "string") return true;
// APIPA (Automatic Private IP Addressing: 169.254.0.0/16)
Expand Down Expand Up @@ -106,8 +122,14 @@ function getAccessibleAddresses({ hostname, port, interfaces = os.networkInterfa
}

if (!isWildcardHost(hostname)) {
// A specific-IP bind listens on that address only, so it is one entry — but
// it is still the Tailscale address when the bind is on the tailnet, and a
// bare IPv6 host needs brackets in a URL (`getBrowserUrl` adds them).
return {
entries: [{ label: "Network", url: `http://${hostname}:${port}` }],
entries: [{
label: isTailscaleAddress(undefined, hostname.trim()) ? "Tailscale" : "Network",
url: getBrowserUrl(hostname.trim(), port),
}],
};
}

Expand Down
106 changes: 106 additions & 0 deletions components/SettingsConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,110 @@
const HostsConfig = dynamic(() => import("./HostsConfig").then((module) => module.HostsConfig), { loading: SettingsTabLoading });
const UsageConfig = dynamic(() => import("./UsageConfig").then((module) => module.UsageConfig), { loading: SettingsTabLoading });

type MobileAccessData = {
binding: { hostname: string | null; exposure: "loopback" | "network" | "unknown"; port: number };
password: { configured: boolean; problem: boolean };
addresses: Array<{ url: string; label: "magicdns" | "tailscale" | "lan" }>;
methods: Array<{ id: "cli" | "windowsTray" | "systemd" | "launchd"; commands: string[] }>;
};

/** Read-only guide for the Android app: binding, password state, addresses, exact commands. */
function MobileAppCard() {
const { t } = useI18n();
const [data, setData] = useState<MobileAccessData | null>(null);
const [failed, setFailed] = useState(false);
useEffect(() => {
let alive = true;
fetch("/api/mobile-access")
.then((res) => (res.ok ? res.json() as Promise<MobileAccessData> : Promise.reject(new Error(`HTTP ${res.status}`))))
.then((next) => { if (alive) setData(next); })
.catch(() => { if (alive) setFailed(true); });
return () => { alive = false; };
}, []);
const bindingText = data === null ? ""
: t(`settingsConfig.mobileAppBinding.${data.binding.exposure}`, {

Check failure on line 72 in components/SettingsConfig.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

TypeError: undefined is not an object (evaluating 'data.binding.exposure')

at MobileAppCard (/home/runner/work/ompweb/ompweb/components/SettingsConfig.tsx:72:49) at react_stack_bottom_frame (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) at renderWithHooks (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) at updateFunctionComponent (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) at runWithFiberInDEV (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) at performUnitOfWork (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) at workLoopSync (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) at renderRootSync (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) at performWorkOnRoot (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:18957:7)

Check failure on line 72 in components/SettingsConfig.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

TypeError: undefined is not an object (evaluating 'data.binding.exposure')

at MobileAppCard (/home/runner/work/ompweb/ompweb/components/SettingsConfig.tsx:72:49) at react_stack_bottom_frame (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) at renderWithHooks (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) at updateFunctionComponent (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) at runWithFiberInDEV (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) at performUnitOfWork (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) at workLoopSync (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) at renderRootSync (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) at performWorkOnRoot (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:18957:7)

Check failure on line 72 in components/SettingsConfig.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

TypeError: undefined is not an object (evaluating 'data.binding.exposure')

at MobileAppCard (/home/runner/work/ompweb/ompweb/components/SettingsConfig.tsx:72:49) at react_stack_bottom_frame (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) at renderWithHooks (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) at updateFunctionComponent (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) at runWithFiberInDEV (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) at performUnitOfWork (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) at workLoopSync (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) at renderRootSync (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) at performWorkOnRoot (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:18957:7)

Check failure on line 72 in components/SettingsConfig.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

TypeError: undefined is not an object (evaluating 'data.binding.exposure')

at MobileAppCard (/home/runner/work/ompweb/ompweb/components/SettingsConfig.tsx:72:49) at react_stack_bottom_frame (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) at renderWithHooks (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) at updateFunctionComponent (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) at runWithFiberInDEV (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) at performUnitOfWork (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) at workLoopSync (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) at renderRootSync (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) at performWorkOnRoot (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:18957:7)

Check failure on line 72 in components/SettingsConfig.tsx

View workflow job for this annotation

GitHub Actions / Verify (ubuntu-latest)

TypeError: undefined is not an object (evaluating 'data.binding.exposure')

at MobileAppCard (/home/runner/work/ompweb/ompweb/components/SettingsConfig.tsx:72:49) at react_stack_bottom_frame (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) at renderWithHooks (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) at updateFunctionComponent (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) at runWithFiberInDEV (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) at performUnitOfWork (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) at workLoopSync (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) at renderRootSync (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) at performWorkOnRoot (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (/home/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:18957:7)

Check failure on line 72 in components/SettingsConfig.tsx

View workflow job for this annotation

GitHub Actions / Verify (macos-latest)

TypeError: undefined is not an object (evaluating 'data.binding.exposure')

at MobileAppCard (/Users/runner/work/ompweb/ompweb/components/SettingsConfig.tsx:72:49) at react_stack_bottom_frame (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) at renderWithHooks (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) at updateFunctionComponent (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) at runWithFiberInDEV (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) at performUnitOfWork (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) at workLoopSync (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) at renderRootSync (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) at performWorkOnRoot (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:18957:7)

Check failure on line 72 in components/SettingsConfig.tsx

View workflow job for this annotation

GitHub Actions / Verify (macos-latest)

TypeError: undefined is not an object (evaluating 'data.binding.exposure')

at MobileAppCard (/Users/runner/work/ompweb/ompweb/components/SettingsConfig.tsx:72:49) at react_stack_bottom_frame (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) at renderWithHooks (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) at updateFunctionComponent (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) at runWithFiberInDEV (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) at performUnitOfWork (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) at workLoopSync (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) at renderRootSync (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) at performWorkOnRoot (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:18957:7)

Check failure on line 72 in components/SettingsConfig.tsx

View workflow job for this annotation

GitHub Actions / Verify (macos-latest)

TypeError: undefined is not an object (evaluating 'data.binding.exposure')

at MobileAppCard (/Users/runner/work/ompweb/ompweb/components/SettingsConfig.tsx:72:49) at react_stack_bottom_frame (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) at renderWithHooks (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) at updateFunctionComponent (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) at runWithFiberInDEV (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) at performUnitOfWork (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) at workLoopSync (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) at renderRootSync (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) at performWorkOnRoot (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:18957:7)

Check failure on line 72 in components/SettingsConfig.tsx

View workflow job for this annotation

GitHub Actions / Verify (macos-latest)

TypeError: undefined is not an object (evaluating 'data.binding.exposure')

at MobileAppCard (/Users/runner/work/ompweb/ompweb/components/SettingsConfig.tsx:72:49) at react_stack_bottom_frame (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) at renderWithHooks (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) at updateFunctionComponent (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) at runWithFiberInDEV (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) at performUnitOfWork (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) at workLoopSync (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) at renderRootSync (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) at performWorkOnRoot (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:18957:7)

Check failure on line 72 in components/SettingsConfig.tsx

View workflow job for this annotation

GitHub Actions / Verify (macos-latest)

TypeError: undefined is not an object (evaluating 'data.binding.exposure')

at MobileAppCard (/Users/runner/work/ompweb/ompweb/components/SettingsConfig.tsx:72:49) at react_stack_bottom_frame (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:25904:20) at renderWithHooks (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:7662:22) at updateFunctionComponent (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:10166:19) at runWithFiberInDEV (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:874:13) at performUnitOfWork (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17641:22) at workLoopSync (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17469:41) at renderRootSync (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:17450:11) at performWorkOnRoot (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:16583:35) at performWorkOnRootViaSchedulerTask (/Users/runner/work/ompweb/ompweb/node_modules/react-dom/cjs/react-dom-client.development.js:18957:7)
hostname: data.binding.hostname ?? "—",
port: String(data.binding.port),
});
const methodTitleKey: Record<MobileAccessData["methods"][number]["id"], string> = {
cli: "settingsConfig.mobileAppCli",
windowsTray: "settingsConfig.mobileAppWindowsTray",
systemd: "settingsConfig.mobileAppSystemd",
launchd: "settingsConfig.mobileAppLaunchd",
};
const methodHintKey: Record<MobileAccessData["methods"][number]["id"], string> = {
cli: "settingsConfig.mobileAppCliHint",
windowsTray: "settingsConfig.mobileAppWindowsTrayHint",
systemd: "settingsConfig.mobileAppSystemdHint",
launchd: "settingsConfig.mobileAppLaunchdHint",
};
return (
<section style={{ padding: 14, border: "1px solid var(--border)", borderRadius: "var(--radius-card)", background: "var(--bg-panel)", display: "flex", flexDirection: "column", gap: 12 }}>
<div>
<div className="settings-card-title" style={{ marginBottom: 4 }}>{t("settingsConfig.mobileAppTitle")}</div>
<div className="settings-card-desc">{t("settingsConfig.mobileAppDesc")}</div>
</div>
{failed && <Alert variant="warning" description={t("settingsConfig.mobileAppLoadFailed")} />}
{data !== null && (
<>
<div style={{ display: "flex", flexDirection: "column", gap: 4, fontSize: 12.5 }}>
<div>{bindingText}</div>
<div>{data.password.problem ? t("settingsConfig.mobileAppPasswordProblem") : data.password.configured ? t("settingsConfig.mobileAppPasswordSet") : t("settingsConfig.mobileAppPasswordMissing")}</div>
{data.binding.exposure !== "network" && <div style={{ color: "var(--warning, #b45309)" }}>{t("settingsConfig.mobileAppNetworkHint")}</div>}
</div>
<div style={{ display: "flex", flexDirection: "column", gap: 6 }}>
<div className="settings-section-title" style={{ fontSize: 12.5, fontWeight: 600 }}>{t("settingsConfig.mobileAppAddresses")}</div>
{data.addresses.length === 0
? <div style={{ color: "var(--text-muted)", fontSize: 12.5 }}>{t("settingsConfig.mobileAppNoAddresses")}</div>
: data.addresses.map((address) => (
<div key={address.url} style={{ display: "flex", alignItems: "center", gap: 8, flexWrap: "wrap" }}>
<code style={{ fontSize: 12.5 }}>{address.url}</code>
<span style={{ color: "var(--text-muted)", fontSize: 11.5 }}>{t(`settingsConfig.mobileAppLabel.${address.label}`)}</span>
<button
type="button"
onClick={() => { void copyText(address.url).catch(() => toast.error(t("appShell.commandCopyFailed"))); }}
title={t("appShell.copyCommand")}
aria-label={t("appShell.copyCommand")}
style={{ border: "none", background: "none", cursor: "pointer", color: "var(--text-muted)", padding: 2, display: "inline-flex" }}
>
<Copy size={13} />
</button>
</div>
))}
</div>
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
<div className="settings-section-title" style={{ fontSize: 12.5, fontWeight: 600 }}>{t("settingsConfig.mobileAppSteps")}</div>
{data.methods.map((method) => (
<div key={method.id} style={{ display: "flex", flexDirection: "column", gap: 4 }}>
<div style={{ fontSize: 12.5, fontWeight: 600 }}>{t(methodTitleKey[method.id])}</div>
<div style={{ color: "var(--text-muted)", fontSize: 12, lineHeight: 1.45 }}>{t(methodHintKey[method.id])}</div>
{method.commands.map((command) => (
<div key={command} style={{ display: "flex", alignItems: "center", gap: 6 }}>
<code style={{ fontSize: 12, overflowWrap: "anywhere", minWidth: 0 }}>{command}</code>
<button
type="button"
onClick={() => { void copyText(command).catch(() => toast.error(t("appShell.commandCopyFailed"))); }}
title={t("appShell.copyCommand")}
aria-label={t("appShell.copyCommand")}
style={{ border: "none", background: "none", cursor: "pointer", color: "var(--text-muted)", padding: 2, display: "inline-flex", flexShrink: 0 }}
>
<Copy size={13} />
</button>
</div>
))}
</div>
))}
</div>
</>
)}
</section>
);
}

/** Server-side omp-web setting (issue #104): KEY=VALUE text injected into the
* `omp` child process. Parsing/validation lives in lib/omp/agent-env.ts; this only
* feeds it localized messages and renders the result. */

type WindowsServiceStatus = {
isWindows: boolean;
isInstalled: boolean;
Expand Down Expand Up @@ -2030,6 +2134,8 @@
{appUpdateMessage && <Alert variant={appUpdateMessage.toLowerCase().includes("fail") || appUpdateMessage.toLowerCase().includes("error") ? "error" : "info"} description={appUpdateMessage} onDismiss={() => setAppUpdateMessage(null)} />}
</section>

<MobileAppCard />

{/* Windows Background Service & System Tray card (Windows only) */}
{windowsService?.isWindows && (
<section style={{ padding: 14, border: "1px solid var(--border)", borderRadius: "var(--radius-card)", background: "var(--bg-panel)", display: "flex", flexDirection: "column", gap: 12 }}>
Expand Down
26 changes: 25 additions & 1 deletion lib/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2045,5 +2045,29 @@
"modelsConfig.accountApiKey": "API key",
"modelsConfig.disconnectAccount": "Disconnect {label}",
"modelsConfig.disconnectAccountTitle": "Disconnect account?",
"modelsConfig.disconnectAccountBody": "omp will delete the stored credential for {label}. Other accounts for this provider stay connected."
"modelsConfig.disconnectAccountBody": "omp will delete the stored credential for {label}. Other accounts for this provider stay connected.",
"settingsConfig.mobileAppTitle": "Mobile app",
"settingsConfig.mobileAppDesc": "The Android app connects to this server directly. Use one of the addresses below, then sign in with your ompweb password.",
"settingsConfig.mobileAppBinding.loopback": "Server binding: {hostname}:{port} (loopback only).",
"settingsConfig.mobileAppBinding.network": "Server binding: {hostname}:{port} (reachable from your network).",
"settingsConfig.mobileAppBinding.unknown": "Server binding: unknown (port {port}).",
"settingsConfig.mobileAppPasswordSet": "Password protection is configured.",
"settingsConfig.mobileAppPasswordMissing": "No password is configured. Set one before exposing this server to the network.",
"settingsConfig.mobileAppPasswordProblem": "The password configuration is broken. Fix it before connecting a phone.",
"settingsConfig.mobileAppNetworkHint": "The server is not listening on the network. Restart it with one of the commands below and use the network address.",
"settingsConfig.mobileAppAddresses": "Addresses",
"settingsConfig.mobileAppNoAddresses": "No address a phone can reach was found. Expose the server to the network with one of the commands below, or start Tailscale.",
"settingsConfig.mobileAppLabel.magicdns": "Tailscale MagicDNS",
"settingsConfig.mobileAppLabel.tailscale": "Tailscale",
"settingsConfig.mobileAppLabel.lan": "Local network",
"settingsConfig.mobileAppSteps": "Expose this server",
"settingsConfig.mobileAppCli": "Command line",
"settingsConfig.mobileAppCliHint": "Generate a hash at a hidden prompt, paste it into a second hidden prompt, then start ompweb on all interfaces. Neither the password nor the hash is echoed or kept in the shell history.",
"settingsConfig.mobileAppWindowsTray": "Windows tray app",
"settingsConfig.mobileAppWindowsTrayHint": "Generate a hash, paste it into a hidden prompt that stores it for your user, then install the tray app bound to all interfaces. The hash never appears on a command line.",
"settingsConfig.mobileAppSystemd": "systemd service",
"settingsConfig.mobileAppSystemdHint": "Paste the hash into a hidden prompt, then run the installer; it writes the unit. Without a password hash the service refuses to start on a network address, so the unit would restart-loop.",
"settingsConfig.mobileAppLaunchd": "launchd service",
"settingsConfig.mobileAppLaunchdHint": "Paste the hash into a hidden prompt, then run the installer; it writes the plist. Without a password hash the service refuses to start on a network address, so the job would restart-loop.",
"settingsConfig.mobileAppLoadFailed": "Could not load the mobile access details."
}
Loading
Loading