# Airlink inside the router

Airlink now builds two entry points from the same dashboard code:

- **Browser userscript:** the existing installation flow, available now. It replaces the stock page in a supported browser with a userscript extension.
- **Router-hosted page:** a static HTML and JavaScript payload intended to live at `/airlink/` on the router itself. Once a supported installation method exists, any browser on its network can open this page without an extension. The payload is a development preview; there is no verified B818 installer yet.

## Current B818 status

The connected router is **B818-263**, firmware **10.0.2.2(H190SP5C74)**, WebUI **10.0.2.2(W2SP6C74)**. Dashboard login, session handling, LTE bands and feature reads have been checked through the userscript. This establishes API compatibility, not permission to install files inside the router. Native settings writes were verified on the live device on October 30, 2026; see [the verification notes](ui-verification.md).

Read-only checks on October 3, 2026 found TCP ports 22 (SSH), 23 (Telnet), and 5555 (network ADB) closed in an earlier check and timing out in a later check. Neither check found a reachable installation service. The installed Android SDK's `adb devices -l` listed no devices. The owner confirmed stock firmware and no known root access. The `/airlink/` route returns a stock page without the standalone marker. These observations do not prove that every possible installation route is unavailable.

Huawei's [B818-263 product description](https://wimoodshop.com/downloads/1885_HUAWEI%20B818-263.pdf), hardware specifications, lists power, Ethernet, telephone, antenna and SIM ports; it does not list an external USB port. Do not assume the ADB instructions from a MiFi installer apply to this router.

**Installation remains unverified. Do not upload this archive through Huawei's firmware-update page.** It contains web files, not signed firmware. The implementation does not flash firmware, enable root, add shell/CGI endpoints, or edit modem NV data.

Huawei modifications documented for [older Balong routers](https://github.com/Huawei-LTE-routers-mods/README) use model-specific access and firmware. They do not establish compatibility with this B818 firmware. Before enabling an installer, we need a verified way to write an isolated WebUI directory, a backup of the exact original assets and an independently checked restoration method on this model and firmware.

## Payload contract

### Review of the suggested `huawei_simple` method

[MulMic/huawei_simple](https://github.com/MulMic/huawei_simple) was reviewed at commit [9d13dd1](https://github.com/MulMic/huawei_simple/tree/9d13dd1379cd4c8bf70e1137628f4597eb507da4). Its [Bash source](https://github.com/MulMic/huawei_simple/blob/9d13dd1379cd4c8bf70e1137628f4597eb507da4/huawei_simple) runs on the calling computer and uses `curl` to send HTTP GET/POST requests to the router's `/api/` endpoints. The `/tmp` logs and cookie files are local to that computer. The reviewed repository contains no router shell-access method, WebUI asset installer, firmware installer or restoration procedure. Its implemented login uses the older `user/login` flow; SCRAM is listed as unfinished.

Airlink already implements same-origin API requests, tokens, SCRAM and encrypted writes. This reference does not establish a way to install Airlink files inside the stock B818. Installation status remains unverified. The script was inspected without executing it or changing router settings.

Run `npm run overlay:build`. Generated files:

- `site/router-hosted/index.html` and `airlink.js`: the standalone entry and shared dashboard bundle.
- `site/router-hosted/manifest.json`: version, intended entry path, SHA-256 hashes and explicit installation status.
- `site/router-hosted/compatibility.json`: separate API and installation compatibility.
- `site/airlink-router-preview.tar.gz`: static payload for review. It contains `airlink/index.html`, `airlink/airlink.js`, `compatibility.json`, `manifest.json`, and this README. `site/airlink-router-preview.sha256` verifies the download.

The `airlink/` subtree must be served by the router's own web server, on the **same origin as `/api/`**. Preserve Huawei's root page and authentication routes. Placing the files on the public landing site, a separate LAN server, or another port does not connect them to the router. A verified installer must check static-route behavior, exact firmware compatibility, backup and restore before writing. No universal filesystem path or shell command is assumed here.

The standalone page checks the local origin and Huawei login API before showing a password field. Public hosting shows an explanatory message and makes no router request. All dashboard traffic goes to the current origin; authentication, rotating tokens, encryption, capability handling and confirmations reuse the userscript client. No router password is stored. Session cookies and public-key preferences remain shared on the router origin. No service worker is included in the router payload.

Version 0.5.0 userscripts reserve `/airlink/`, preventing two dashboard instances from competing for tokens. Update an older userscript before using both flows. `/?airlink=off` restores Huawei's page; it does not disable the separate router-hosted page. Both entry points retain the Arabic/English switch, automatic device locale, Latin digits, and “Keep me signed in”. Huawei's root page remains available at `/?airlink=off`.

On a verified installation, bookmark `http://192.168.8.1/airlink/`. A shortcut opens the router-hosted page directly, so it does not depend on extension execution. Available Home Screen options vary by browser. HTTP LAN hosting does not meet the secure-origin requirement for a browser-promoted PWA installation; no full PWA or offline-router operation is promised. See [MDN's installation requirements](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Making_PWAs_installable).

## Verification and next router

`npm run router:check -- http://192.168.8.1` performs GET requests and TCP connectivity probes only. It reports model/version fields, whether the standalone marker is present, and port reachability; an open port does not establish authenticated root access. It sends no password and changes no settings. `npm run site:check` verifies payload hashes, archive contents, and version consistency.

`node overlay/test/mock-router.mjs --port 8103` serves both the injected userscript at `/` and standalone page at `/airlink/` against a mock B818. This validates dashboard behavior and same-origin authentication without installing anything on a real router.

The other Huawei mobile router remains untested. On connection, identify its exact model, firmware and WebUI; run read-only capability and installation checks first. Missing APIs must show unavailable controls without ending a valid session. An installer may only become selectable as supported after its installation and restoration have been verified on that exact firmware.
