diff --git a/CHANGELOG.md b/CHANGELOG.md index 0658bc0..8eeece3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,15 @@ Versions after 2.17 are `MAJOR.MINOR.PATCH` (2.17 is followed by 2.17.1 or 2.18. `docs/testing.md`, "Versions and releases"); the headings below keep the numbers as they were released. +## 2.27.4 — 2026-11-21 + +- camex 4.4.1 in the tunnel (#296): Decoder no longer takes the device's one VPN from another + app (vectis, microsnander, the camex app) by itself. The start of the tunnel at the app's + start and its restart for a new web page port wait while another app's VPN is up (`Waiting + for the VPN` in Settings, `waiting` in `/stats.json` and on the web page) and connect when + that VPN ends; a tunnel whose VPN another app takes waits the same way instead of asking for + the consent. Save with Join a camex server on takes the VPN now, as before. + ## 2.27.3 — 2026-11-20 - Cancel and Save in every window follow the brass rule now (#294), not only in Settings: the diff --git a/README.md b/README.md index 3b00cfe..91a3880 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ Every item, the remote, sharing a URL from another app and **Reset**: [Usage](do ## Network (a tunnel to the cameras) -Decoder has a tunnel built in, [OpenIPC camex](https://github.com/OpenIPC/camex) 4.2.0: cameras that are clients of the same camex server are watched from anywhere, without a separate VPN app. **Network** in the menu (a row under the grid) opens the **Settings** dialog. Its **Decoder** section holds **Allow remote access** (the debug page; off, the app opens no port at all), the page's port and its password. Its **Camex** section holds **Join a camex server** (connect now and at every start; off by default) and the tunnel's state, then the server (`host:port`), the client name (the box's ID on the server; by default `decoder-` and the last four characters of the device's Android ID), **Proto** (UDP or TCP), the server's public key, the pre-shared key (hidden, with **Show the key** under it), MTU, keepalive and the server timeout, as the camex library lists them. The server gives the address, MTU and routes; only the tunnel network and the server's routes (none wider than a /8) go through it, the local network is reached as before. The state is shown in the dialog (Connecting, Connected with the address, VPN consent needed, Failed) and in a notification. A camera reached through the tunnel plays over TCP with Auto. The debug page is on port 8085 unless Network sets another; when that port is taken (another app on the device serves its page there), Decoder takes the next free one (8086, 8087, …) and shows the real address. Decoder tells the server the port its page really is on (for nginx there; a camex server 3.19.0 or later), and the tunnel lets in only that port of Decoder's own page: another app's page is not reached through it. The password, when set, guards that page from the local network and through the tunnel alike; empty (the default), the page is open. +Decoder has a tunnel built in, [OpenIPC camex](https://github.com/OpenIPC/camex) 4.4.1: cameras that are clients of the same camex server are watched from anywhere, without a separate VPN app. **Network** in the menu (a row under the grid) opens the **Settings** dialog. Its **Decoder** section holds **Allow remote access** (the debug page; off, the app opens no port at all), the page's port and its password. Its **Camex** section holds **Join a camex server** (connect now and at every start; off by default) and the tunnel's state, then the server (`host:port`), the client name (the box's ID on the server; by default `decoder-` and the last four characters of the device's Android ID), **Proto** (UDP or TCP), the server's public key, the pre-shared key (hidden, with **Show the key** under it), MTU, keepalive and the server timeout, as the camex library lists them. The server gives the address, MTU and routes; only the tunnel network and the server's routes (none wider than a /8) go through it, the local network is reached as before. The state is shown in the dialog (Connecting, Connected with the address, VPN consent needed, Failed, Waiting for the VPN) and in a notification. Android holds one VPN: when another app (vectis, the camex app) holds it, Decoder does not take it at its start but waits and connects when that VPN ends; Save with Join on takes it now. A camera reached through the tunnel plays over TCP with Auto. The debug page is on port 8085 unless Network sets another; when that port is taken (another app on the device serves its page there), Decoder takes the next free one (8086, 8087, …) and shows the real address. Decoder tells the server the port its page really is on (for nginx there; a camex server 3.19.0 or later), and the tunnel lets in only that port of Decoder's own page: another app's page is not reached through it. The password, when set, guards that page from the local network and through the tunnel alike; empty (the default), the page is open.

The Network dialog on a TV box: connected, the server and the client name diff --git a/README.ru.md b/README.ru.md index ebd9529..eac28dc 100644 --- a/README.ru.md +++ b/README.ru.md @@ -89,7 +89,7 @@ ## Network (туннель к камерам) -В Decoder встроен туннель [OpenIPC camex](https://github.com/OpenIPC/camex) 4.2.0: камеры, подключённые клиентами к тому же серверу camex, видны откуда угодно, без отдельного VPN-приложения. Пункт **Network** в меню (ряд под сеткой) открывает окно **Settings**. Раздел **Decoder**: **Allow remote access** (отладочная страница; выключено — у приложения нет ни одного сетевого порта), порт и пароль страницы. Раздел **Camex**: **Join a camex server** (подключиться сейчас и при каждом запуске; по умолчанию выключено) и состояние туннеля, затем сервер (`host:port`), имя клиента (идентификатор приставки на сервере; по умолчанию `decoder-` и четыре последних знака Android ID устройства), **Proto** (UDP или TCP), открытый ключ сервера, общий ключ (psk; скрыт, под ним **Show the key**), MTU, keepalive и таймаут сервера — как их перечисляет библиотека camex. Адрес, MTU и маршруты выдаёт сервер; через туннель идут только его сеть и маршруты сервера (не шире /8), локальная сеть доступна как прежде. Состояние видно в окне (Connecting, Connected с адресом, VPN consent needed, Failed) и в уведомлении. Камера за туннелем в режиме Auto идёт по TCP. Отладочная страница — на порту 8085, если в Network не задан другой; если порт занят (на устройстве его держит страница другого приложения), Decoder берёт следующий свободный (8086, 8087, …) и показывает настоящий адрес. Серверу Decoder сообщает порт, на котором страница на самом деле (для nginx на сервере; нужен сервер camex 3.19.0 или новее), а туннель пропускает только этот порт собственной страницы Decoder: страница другого приложения через него недоступна. Пароль, если задан, закрывает эту страницу одинаково из локальной сети и через туннель; пустой (по умолчанию) — страница открыта. +В Decoder встроен туннель [OpenIPC camex](https://github.com/OpenIPC/camex) 4.4.1: камеры, подключённые клиентами к тому же серверу camex, видны откуда угодно, без отдельного VPN-приложения. Пункт **Network** в меню (ряд под сеткой) открывает окно **Settings**. Раздел **Decoder**: **Allow remote access** (отладочная страница; выключено — у приложения нет ни одного сетевого порта), порт и пароль страницы. Раздел **Camex**: **Join a camex server** (подключиться сейчас и при каждом запуске; по умолчанию выключено) и состояние туннеля, затем сервер (`host:port`), имя клиента (идентификатор приставки на сервере; по умолчанию `decoder-` и четыре последних знака Android ID устройства), **Proto** (UDP или TCP), открытый ключ сервера, общий ключ (psk; скрыт, под ним **Show the key**), MTU, keepalive и таймаут сервера — как их перечисляет библиотека camex. Адрес, MTU и маршруты выдаёт сервер; через туннель идут только его сеть и маршруты сервера (не шире /8), локальная сеть доступна как прежде. Состояние видно в окне (Connecting, Connected с адресом, VPN consent needed, Failed, Waiting for the VPN) и в уведомлении. VPN в Android один: если его держит другое приложение (vectis, приложение camex), Decoder при запуске его не забирает, а ждёт и подключается, когда тот VPN закончится; Save с включённым Join забирает его сразу. Камера за туннелем в режиме Auto идёт по TCP. Отладочная страница — на порту 8085, если в Network не задан другой; если порт занят (на устройстве его держит страница другого приложения), Decoder берёт следующий свободный (8086, 8087, …) и показывает настоящий адрес. Серверу Decoder сообщает порт, на котором страница на самом деле (для nginx на сервере; нужен сервер camex 3.19.0 или новее), а туннель пропускает только этот порт собственной страницы Decoder: страница другого приложения через него недоступна. Пароль, если задан, закрывает эту страницу одинаково из локальной сети и через туннель; пустой (по умолчанию) — страница открыта.

Окно Network на ТВ-приставке: подключено, сервер и имя клиента diff --git a/README.zh-CN.md b/README.zh-CN.md index 5ee4f5b..94339ef 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -89,7 +89,7 @@ ## Network(通往摄像头的隧道) -Decoder 内置 [OpenIPC camex](https://github.com/OpenIPC/camex) 4.2.0 隧道:作为客户端接入同一台 camex 服务器的摄像头,可以在任何地方观看,无需另装 VPN 应用。菜单中的 **Network**(网格下方一行)打开 **Settings** 对话框。**Decoder** 部分包含 **Allow remote access**(调试页面;关闭时应用不打开任何端口)、页面端口和密码。**Camex** 部分包含 **Join a camex server**(立即连接并在每次启动时连接;默认关闭)和隧道状态,然后是服务器(`host:port`)、客户端名称(设备在服务器上的 ID;默认为 `decoder-` 加设备 Android ID 的后四位)、**Proto**(UDP 或 TCP)、服务器公钥、预共享密钥(隐藏,下方有 **Show the key**)、MTU、keepalive 和服务器超时,均按 camex 库列出。地址、MTU 和路由由服务器下发;只有隧道网络和服务器的路由(不宽于 /8)经过隧道,本地网络照常访问。状态显示在对话框(Connecting、Connected 及地址、VPN consent needed、Failed)和通知中。经隧道访问的摄像头在 Auto 模式下走 TCP。调试页面默认位于 8085 端口,可在 Network 中更改;若该端口被占用(设备上另一个应用的页面在用),Decoder 会使用下一个空闲端口(8086、8087……)并显示实际地址。Decoder 告知服务器页面实际所在的端口(供服务器上的 nginx 使用;需 camex 服务器 3.19.0 或更新版本),隧道只放行 Decoder 自身页面的这个端口:无法经隧道访问其他应用的页面。设置密码后,无论从本地网络还是经隧道访问,该页面都需要密码;为空(默认)时页面开放。 +Decoder 内置 [OpenIPC camex](https://github.com/OpenIPC/camex) 4.4.1 隧道:作为客户端接入同一台 camex 服务器的摄像头,可以在任何地方观看,无需另装 VPN 应用。菜单中的 **Network**(网格下方一行)打开 **Settings** 对话框。**Decoder** 部分包含 **Allow remote access**(调试页面;关闭时应用不打开任何端口)、页面端口和密码。**Camex** 部分包含 **Join a camex server**(立即连接并在每次启动时连接;默认关闭)和隧道状态,然后是服务器(`host:port`)、客户端名称(设备在服务器上的 ID;默认为 `decoder-` 加设备 Android ID 的后四位)、**Proto**(UDP 或 TCP)、服务器公钥、预共享密钥(隐藏,下方有 **Show the key**)、MTU、keepalive 和服务器超时,均按 camex 库列出。地址、MTU 和路由由服务器下发;只有隧道网络和服务器的路由(不宽于 /8)经过隧道,本地网络照常访问。状态显示在对话框(Connecting、Connected 及地址、VPN consent needed、Failed、Waiting for the VPN)和通知中。Android 只有一个 VPN:若另一个应用(vectis、camex 应用)正占用它,Decoder 启动时不会抢占,而是等待,待该 VPN 结束后再连接;在 Join 开启时按 Save 会立即占用。经隧道访问的摄像头在 Auto 模式下走 TCP。调试页面默认位于 8085 端口,可在 Network 中更改;若该端口被占用(设备上另一个应用的页面在用),Decoder 会使用下一个空闲端口(8086、8087……)并显示实际地址。Decoder 告知服务器页面实际所在的端口(供服务器上的 nginx 使用;需 camex 服务器 3.19.0 或更新版本),隧道只放行 Decoder 自身页面的这个端口:无法经隧道访问其他应用的页面。设置密码后,无论从本地网络还是经隧道访问,该页面都需要密码;为空(默认)时页面开放。

电视盒子上的 Network 对话框:已连接、服务器和客户端名称 diff --git a/android/app/build.gradle b/android/app/build.gradle index aeefb90..f091643 100755 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,8 +26,8 @@ android { applicationId "com.openipc.decoder" minSdk 21 targetSdk 36 - versionCode 66 - versionName "2.27.3" + versionCode 67 + versionName "2.27.4" // Keep only these locales of the libraries' resources, as in the other OpenIPC apps resourceConfigurations += ['en', 'ru', 'zh-rCN'] diff --git a/android/app/src/main/java/com/openipc/decoder/DebugServer.java b/android/app/src/main/java/com/openipc/decoder/DebugServer.java index 9b3ffc4..8216db1 100644 --- a/android/app/src/main/java/com/openipc/decoder/DebugServer.java +++ b/android/app/src/main/java/com/openipc/decoder/DebugServer.java @@ -934,7 +934,8 @@ private static void closeQuietly(Socket s) { + "xs==='connected'?'ok':xs==='failed'?'bad':'warn';worst(xc);" + "rows.push(brow(xc,'Camex',xs==='connected'?'connected'+(x.address?' \u00b7 '+x.address:'')" + ":xs==='failed'?'failed'+(x.error?' \u00b7 '+x.error:''):xs==='needs_consent'?'VPN consent " - + "needed':xs==='connecting'?'connecting'+(x.error?' \u00b7 '+x.error:''):(xs||'stopped')))}}" + + "needed':xs==='waiting'?'waiting for the VPN \u00b7 another app holds it'" + + ":xs==='connecting'?'connecting'+(x.error?' \u00b7 '+x.error:''):(xs||'stopped')))}}" + "$('board').innerHTML=rows.join('');$('ver2').textContent=s&&s.version?s.version:'';" + "document.title={ok:'Running',warn:'Attention',bad:'Error'}[all]+' \u00b7 Decoder';" + "$('fav').href='data:image/svg+xml,'+encodeURIComponent(':8085/` for every address of the device | | `server` | string | `listening`, or why no port could be opened | -| `camex` | object | the tunnel: `on` (Settings → Join a camex server), `state` (`stopped`, `connecting`, `connected`, `needs_consent`, `failed`), `address`, `error` | +| `camex` | object | the tunnel: `on` (Settings → Join a camex server), `state` (`stopped`, `connecting`, `connected`, `needs_consent`, `failed`, `waiting`), `address`, `error` | | `decoders` | list or `"loading"` | the device's video decoders, see [decoders](#decoders) | | `ui_thread` | string | `ok`, or `not responding within 1000 ms` (then only the fields above are present) | | `mode` | string | `single`, `multi-view`, `slides` (multi-view with Slides on), `udp` (U cell full-screen), `paused` (app in background); `no activity` when no activity is attached | diff --git a/tests/e2e.sh b/tests/e2e.sh index 3623427..e5ca4fe 100755 --- a/tests/e2e.sh +++ b/tests/e2e.sh @@ -251,8 +251,12 @@ if $ADB shell dumpsys activity activities | grep -q 'vpndialogs/.ConfirmDialog'; fi fi +# the tunnel's address: its interface is tun0 at the first start; camex 4.4.0 keeps the old TUN +# until the new one is up, so after a restart it is tun1 (#296) +tunip() { $ADB shell 'ip addr 2>/dev/null' | tr -d '\r' | sed -n 's/.*inet \([0-9.]*\)\/.* tun[0-9]*$/\1/p' | head -1; } + i=0 -until TUN=$($ADB shell 'ip addr show tun0 2>/dev/null' | sed -n 's/.*inet \([0-9.]*\).*/\1/p') && [ -n "$TUN" ]; do +until TUN=$(tunip) && [ -n "$TUN" ]; do i=$((i + 1)); [ $i -lt 90 ] || break # Android 5 on the emulator takes its time sleep 1 done @@ -422,7 +426,7 @@ if [ -z "$SHOTS" ]; then fi # the tunnel restarts in the same process: Network → Save stops it and starts it again with the -# saved values (a second run of the tunnel's native code in one process); tun0 comes back and the +# saved values (a second run of the tunnel's native code in one process); the TUN comes back and the # camera's address answers again if [ -z "$SHOTS" ]; then $ADB logcat -c 2>/dev/null || true @@ -439,7 +443,7 @@ if [ -z "$SHOTS" ]; then $ADB exec-out screencap -p > "$OUT/restart-saved.png" 2>/dev/null || true again="" for _ in $(seq 1 30); do - if $ADB shell 'ip addr show tun0 2>/dev/null' | grep -q 'inet ' && + if [ -n "$(tunip)" ] && $ADB shell ping -c 2 -W 2 "$LINUX_IP" | grep -q ' [12] received'; then again=1; break; fi sleep 2 done @@ -471,7 +475,7 @@ if [ -z "$SHOTS" ]; then if [ $((n % 10)) -eq 0 ] && ! $ADB shell ps | grep -q "$PKG"; then $ADB shell am start -n $ACTIVITY >/dev/null fi - TUN=$($ADB shell 'ip addr show tun0 2>/dev/null' | sed -n 's/.*inet \([0-9.]*\).*/\1/p') + TUN=$(tunip) if [ -n "$TUN" ] && [ "$(page "http://$TUN:8086/stats.json")" = 401 ]; then moved=1; break; fi sleep 2 done @@ -511,7 +515,7 @@ if [ -z "$SHOTS" ]; then ok "after an update the web page is back by itself" else bad "no web page after an update (tests/out/logcat-update.txt)"; fi sleep 5 - if [ "$(readers)" -le "$before" ] && ! $ADB shell 'ip addr show tun0 2>/dev/null' | grep -q 'inet ' && + if [ "$(readers)" -le "$before" ] && [ -z "$(tunip)" ] && ! $ADB shell dumpsys activity activities | grep -q "Resumed.*$PKG"; then ok "after an update: no camera read, no tunnel, no screen" else bad "after an update something more than the page started"; fi