🔥 Sync 2026-11-16 16:50:07
No files matched your search
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-netstat
|
||||
PKG_VERSION:=1.2.0
|
||||
PKG_RELEASE:=6
|
||||
PKG_RELEASE:=7
|
||||
|
||||
PKG_MAINTAINER:=NoobLK <liyanagelsofficial@gmail.com>
|
||||
PKG_LICENSE:=GPL-3.0
|
||||
|
||||
@@ -1,149 +1,128 @@
|
||||
<div align="center">
|
||||
|
||||
<img src="images/luci-app-netstat.png" alt="luci-app-netstat: live dashboard and usage history in LuCI" width="900">
|
||||
|
||||
# luci-app-netstat
|
||||
|
||||
**Live traffic rates and vnStat usage history for any OpenWrt router, in LuCI.**
|
||||
**Live traffic rates and usage history for any OpenWrt router, right inside LuCI.**
|
||||
|
||||
[](https://github.com/nooblk-98/luci-app-netstat/releases/latest)
|
||||
[](https://github.com/nooblk-98/luci-app-netstat/actions/workflows/build.yml)
|
||||
[](https://github.com/nooblk-98/luci-app-netstat/releases)
|
||||
[](https://openwrt.org)
|
||||
[](https://humdi.net/vnstat/)
|
||||
[](Makefile)
|
||||
|
||||
[Features](#features) • [Installation](#installation) • [Usage](#usage) • [Configuration](#configuration) • [How it works](#how-it-works) • [Troubleshooting](#troubleshooting)
|
||||
|
||||

|
||||
[Features](#features) • [Screenshots](#screenshots) • [Installation](#installation) • [Usage](#usage) • [Settings](#settings) • [Troubleshooting](#troubleshooting)
|
||||
|
||||
</div>
|
||||
|
||||
luci-app-netstat adds a live traffic dashboard to the LuCI status page and a **Netstat** page with daily and monthly usage charts. Live rates come straight from the kernel, and history comes from [vnStat 2](https://humdi.net/vnstat/).
|
||||
|
||||
It works on any OpenWrt router: there are no hard-coded interface names, device paths or board-specific files. The uplink is found from the routing table, and vnStat is set up to track your interfaces automatically.
|
||||
luci-app-netstat adds a live traffic dashboard to the LuCI **Status** page and a **Netstat** page with daily and monthly usage charts. It works on any OpenWrt router: it finds your internet connection automatically and starts recording usage history without any setup.
|
||||
|
||||
## Features
|
||||
|
||||
- **Live dashboard on Status → Overview:**
|
||||
- download and upload rates with sparklines, peaks and trend arrows;
|
||||
- total downloaded and uploaded;
|
||||
- internet status and public IP, as seen through Passwall or any other proxy;
|
||||
- CPU temperature, uptime, RAM and storage.
|
||||
- **Usage history:** daily or monthly charts per interface, read from `vnstat --json`.
|
||||
- **Automatic interface detection:** follows the device that holds the default route (PPPoE, DHCP, LTE/5G modems, VPNs, DSA ports), or the interface you choose.
|
||||
- **Zero-config vnStat:** interfaces are added to vnStat as they come up, so there is nothing to set up by hand.
|
||||
- **Follows your theme:** uses LuCI's standard sections and tabs, so it matches any theme in light or dark mode, including live switching.
|
||||
- **Lightweight:** shell, Lua and plain JavaScript only; packages are architecture-independent.
|
||||
- **Live dashboard** on Status → Overview, refreshed every two seconds:
|
||||
- download and upload speed with sparklines, peaks and trend arrows
|
||||
- total downloaded and uploaded
|
||||
- internet status and public IP, including through Passwall or another proxy
|
||||
- CPU temperature, uptime, RAM and storage
|
||||
- phone port status on routers with an RJ11 phone port (AW1000 with fxsd): on, off, ringing or in call
|
||||
- **Usage history:** daily or monthly download and upload charts per interface, powered by [vnStat 2](https://humdi.net/vnstat/).
|
||||
- **Automatic detection:** follows whatever connection holds the default route (PPPoE, DHCP, LTE/5G modem, VPN), or the interface you pick.
|
||||
- **No setup needed:** interfaces are added to usage tracking as they come up.
|
||||
- **Matches your theme** in light and dark mode, including live switching.
|
||||
- **Lightweight:** one small package that works on every router architecture.
|
||||
|
||||
## Screenshots
|
||||
|
||||
<img src="images/status-widget.png" alt="Live dashboard on the LuCI status page">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td width="50%"><img src="images/usage-light.png" alt="Network Usage tab in light mode"></td>
|
||||
<td width="50%"><img src="images/usage-dark.png" alt="Network Usage tab in dark mode"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">Usage history, light mode</td>
|
||||
<td align="center">Usage history, dark mode</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Installation
|
||||
|
||||
### Requirements
|
||||
**Requirements:** OpenWrt **24.10** or **25.x** with LuCI. vnStat 2 (`vnstat2`) is installed automatically.
|
||||
|
||||
- OpenWrt **24.10** or **25.x** with LuCI
|
||||
- **`vnstat2`** (vnStat 2.x): installed automatically as a dependency. The old vnStat 1.x `vnstat` package is not supported.
|
||||
1. Download the package for your OpenWrt version from the [latest release](https://github.com/nooblk-98/luci-app-netstat/releases/latest):
|
||||
- OpenWrt **25.x**: the `.apk` file
|
||||
- OpenWrt **24.10**: the `.ipk` file
|
||||
2. Copy it to the router (for example to `/tmp`) and install it:
|
||||
|
||||
### From a release
|
||||
```bash
|
||||
# OpenWrt 25.x
|
||||
apk update
|
||||
apk add --allow-untrusted /tmp/luci-app-netstat-*.apk
|
||||
|
||||
Download the package for your OpenWrt version from the [latest release](https://github.com/nooblk-98/luci-app-netstat/releases/latest), copy it to the router and install it:
|
||||
# OpenWrt 24.10
|
||||
opkg update
|
||||
opkg install /tmp/luci-app-netstat_*_all.ipk
|
||||
```
|
||||
|
||||
```bash
|
||||
# OpenWrt 25.x (apk)
|
||||
apk update
|
||||
apk add --allow-untrusted luci-app-netstat-*.apk
|
||||
|
||||
# OpenWrt 24.10 (opkg)
|
||||
opkg update
|
||||
opkg install luci-app-netstat_*_all.ipk
|
||||
```
|
||||
|
||||
### Build from source
|
||||
|
||||
Add the package to an OpenWrt buildroot or SDK that has the `luci` and `packages` feeds:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/nooblk-98/luci-app-netstat.git package/luci-app-netstat
|
||||
make menuconfig # LuCI → Applications → luci-app-netstat
|
||||
make package/luci-app-netstat/compile
|
||||
```
|
||||
3. Reload LuCI in your browser. The dashboard appears on **Status → Overview**.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> **Upgrading from 1.1.x?** That version used vnStat 1.x. Remove both packages, install `vnstat2`, then install the new package:
|
||||
> **Upgrading from 1.1.x?** That version used vnStat 1.x. Remove both packages first, then install the new package as above:
|
||||
>
|
||||
> ```bash
|
||||
> /etc/init.d/vnstat stop
|
||||
> apk del luci-app-netstat vnstat # or: opkg remove luci-app-netstat vnstat
|
||||
> ```
|
||||
>
|
||||
> To keep your history, set `DatabaseDir` in `/etc/vnstat.conf` to the folder that holds your old 1.x files (often `/etc/vnstat`) **before** vnStat 2 starts. It imports them on first start.
|
||||
> To keep your old history, set `DatabaseDir` in `/etc/vnstat.conf` to the folder that holds the old files (often `/etc/vnstat`) **before** vnStat 2 starts for the first time. It imports them automatically.
|
||||
|
||||
## Usage
|
||||
|
||||
### Live dashboard
|
||||
**Status → Overview** shows the live dashboard. Use **Hide** to collapse it.
|
||||
|
||||
Open **Status → Overview**. The Netstat widget refreshes every two seconds.
|
||||
|
||||

|
||||
|
||||
### Usage history
|
||||
|
||||
Open **Tools → Netstat**:
|
||||
**Tools → Netstat** has three tabs:
|
||||
|
||||
| Tab | What it shows |
|
||||
|---|---|
|
||||
| **Network Usage** | Daily or monthly download/upload for the tracked interface, with totals |
|
||||
| **Settings** | Traffic backend, default view, interface, vnStat database info and reset |
|
||||
| **Network Usage** | Daily or monthly download and upload for the tracked interface, with totals |
|
||||
| **Settings** | What to track and how totals are counted, plus the usage database and a reset button |
|
||||
| **About** | Project links, licence and support |
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><img src="images/usage-light.png" alt="Network Usage tab in light mode"></td>
|
||||
<td><img src="images/settings.png" alt="Settings tab"></td>
|
||||
</tr>
|
||||
</table>
|
||||
## Settings
|
||||
|
||||
## Configuration
|
||||
<img src="images/settings.png" alt="Netstat settings tab">
|
||||
|
||||
Settings live in `/etc/config/netstats` and can be changed from the **Settings** tab:
|
||||
|
||||
| Option | Default | Description |
|
||||
| Setting | Default | What it does |
|
||||
|---|---|---|
|
||||
| `prefer` | `''` | Interface to track. Empty means auto (the default-route device). Accepts a device (`eth1`) or a logical interface (`wan`). |
|
||||
| `backend` | `normal` | Downloaded/uploaded totals on the dashboard: `normal` counts since boot; `vnstat` shows this month from vnStat. Live rates always come from `/proc/net/dev`. |
|
||||
| `mode` | `daily` | Default view on the Network Usage tab: `daily` or `monthly`. |
|
||||
| `vnstat_autoadd` | `1` | Set to `0` to stop the app from adding interfaces to vnStat. |
|
||||
| **Traffic Backend** | Normal | *Normal* counts the dashboard's downloaded/uploaded totals since boot. *vnStat* shows this month's totals instead. Live speeds are always real time. |
|
||||
| **View Mode** | Daily | Whether the Network Usage tab opens on daily or monthly usage. |
|
||||
| **Preferred Interface** | Auto detect | The interface to track. Auto follows your internet connection; you can pick a device (`eth1`) or a network (`wan`). |
|
||||
|
||||
The same settings can be changed from the command line through `/etc/config/netstats`:
|
||||
|
||||
```bash
|
||||
uci set netstats.@config[0].backend='vnstat'
|
||||
uci set netstats.@config[0].backend='vnstat' # or 'normal'
|
||||
uci commit netstats
|
||||
```
|
||||
|
||||
## How it works
|
||||
|
||||
| Piece | Source |
|
||||
|---|---|
|
||||
| Live rates and since-boot totals | `/proc/net/dev` |
|
||||
| Uplink detection | `/proc/net/route` and `/proc/net/ipv6_route`; logical names resolved through `ubus` (netifd) |
|
||||
| History and monthly totals | `vnstat --json` and `vnstat --dbiflist` |
|
||||
| Public IP | `api.ipify.org` via `curl` or `uclient-fetch`, refreshed every 5 minutes |
|
||||
|
||||
OpenWrt starts `vnstatd` with `--noadd`, so out of the box it tracks only the interfaces listed in `/etc/config/vnstat`. This package fills that list for you:
|
||||
|
||||
- `/etc/hotplug.d/iface/90-netstat-vnstat` adds each interface's device when it comes up.
|
||||
- `/etc/uci-defaults/50_luci-netstat` does the same once at install for interfaces that are already up.
|
||||
- You can run `/usr/libexec/netstat-vnstat-track` by hand at any time.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**"No data available" on the Network Usage tab**
|
||||
vnStat writes to its database every few minutes, so a newly tracked interface takes a short while to show data. Check what is tracked with `vnstat --dbiflist 1`.
|
||||
|
||||
> [!WARNING]
|
||||
> OpenWrt's default vnStat database location, `/var/lib/vnstat`, is in RAM, so **history is lost on every reboot**. Set `DatabaseDir` in `/etc/vnstat.conf` to persistent storage (for example `/etc/vnstat`, or a USB disk to avoid flash wear), then run `service vnstat restart`. The Settings tab shows the current location.
|
||||
> By default OpenWrt keeps vnStat's database in RAM (`/var/lib/vnstat`), so **usage history is lost on every reboot**. Set `DatabaseDir` in `/etc/vnstat.conf` to permanent storage, such as `/etc/vnstat` or a USB disk to spare the flash, then run `service vnstat restart`. The Settings tab shows where the database is now.
|
||||
|
||||
**The dashboard still looks or behaves like the old version after an upgrade**
|
||||
LuCI caches view scripts in the browser until LuCI itself is updated. Clear the browser cache for the router, or open the page in a private window.
|
||||
**"No data available" on the Network Usage tab**
|
||||
vnStat saves usage every few minutes, so a newly tracked interface takes a short while to show data. You can list the tracked interfaces with `vnstat --dbiflist 1`.
|
||||
|
||||
**The dashboard looks the same after an upgrade**
|
||||
Your browser is still using the old cached files. Clear the cache for the router's address, or open LuCI in a private window.
|
||||
|
||||
**The IP card shows a private address**
|
||||
This is the WAN device's local address, shown until the public-IP lookup succeeds. The lookup needs internet access from the router itself; with Passwall, enable *localhost proxy* to see the proxied IP.
|
||||
That's your router's local WAN address. It's shown until the public IP lookup succeeds, which needs internet access from the router itself. With Passwall, enable *localhost proxy* to see the proxied IP.
|
||||
|
||||
**Something else?**
|
||||
Open an [issue](https://github.com/nooblk-98/luci-app-netstat/issues) with your OpenWrt version and a screenshot.
|
||||
|
||||
## Credits
|
||||
|
||||
Originally created by [SMALLPROGRAM](https://github.com/smallprogram); maintained by [nooblk-98](https://github.com/nooblk-98). Bug reports and ideas are welcome in [Issues](https://github.com/nooblk-98/luci-app-netstat/issues).
|
||||
Originally created by [SMALLPROGRAM](https://github.com/smallprogram), maintained by [nooblk-98](https://github.com/nooblk-98).
|
||||
@@ -196,8 +196,28 @@ function getNetdevStats()
|
||||
end
|
||||
end
|
||||
|
||||
-- ── RJ11 phone port (fxsd on the AW1000), left out when not installed ─────
|
||||
local phone = nil
|
||||
if nfs.access("/usr/sbin/fxsd") then
|
||||
local st = {}
|
||||
local sf = io.open("/var/run/fxsd.state", "r")
|
||||
if sf then
|
||||
for line in sf:lines() do
|
||||
local k, v = line:match("^(%w+)=(.*)$")
|
||||
if k then st[k] = v end
|
||||
end
|
||||
sf:close()
|
||||
end
|
||||
uci:unload("fxs")
|
||||
local on = os.execute("pidof fxsd >/dev/null 2>&1") == 0
|
||||
and uci:get("fxs", "main", "enabled") ~= "0"
|
||||
and (st.state or "stopped") ~= "stopped"
|
||||
phone = { on = on, state = st.state or "stopped", offhook = st.offhook == "1" }
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({ stats = stats, ip = ip, ip_source = ip_source,
|
||||
phone = phone,
|
||||
status = status,
|
||||
prefer_iface = prefer_iface,
|
||||
vnstat_total = vnstat_total,
|
||||
|
||||
@@ -119,7 +119,8 @@ function toData(r, ip) {
|
||||
disk_used: (r && r.disk_used) || 0,
|
||||
disk_total: (r && r.disk_total) || 0,
|
||||
preferred: (r && r.prefer_iface) ? [r.prefer_iface] : [],
|
||||
vnstat_total: (r && r.vnstat_total) || null
|
||||
vnstat_total: (r && r.vnstat_total) || null,
|
||||
phone: (r && r.phone) || null
|
||||
};
|
||||
}
|
||||
|
||||
@@ -278,6 +279,82 @@ function createStatusCard(status, ip) {
|
||||
]);
|
||||
}
|
||||
|
||||
// ─── Phone port card (RJ11 on the AW1000, only sent when fxsd is installed) ──
|
||||
const PHONE_SVG =
|
||||
'<svg viewBox="0 0 200 170" xmlns="http://www.w3.org/2000/svg">' +
|
||||
'<g class="shake">' +
|
||||
'<path class="cord" d="M36 66 C 8 92, 14 132, 40 150"/>' +
|
||||
'<path class="body" d="M44 84 Q48 66 72 66 L128 66 Q152 66 156 84 L168 146 Q170 158 156 158 L44 158 Q30 158 32 146 Z"/>' +
|
||||
'<rect class="body" x="46" y="58" width="16" height="10" rx="3"/>' +
|
||||
'<rect class="body" x="138" y="58" width="16" height="10" rx="3"/>' +
|
||||
'<g class="key">' +
|
||||
'<circle cx="82" cy="96" r="5"/><circle cx="100" cy="96" r="5"/><circle cx="118" cy="96" r="5"/>' +
|
||||
'<circle cx="82" cy="112" r="5"/><circle cx="100" cy="112" r="5"/><circle cx="118" cy="112" r="5"/>' +
|
||||
'<circle cx="82" cy="128" r="5"/><circle cx="100" cy="128" r="5"/><circle cx="118" cy="128" r="5"/>' +
|
||||
'<circle cx="82" cy="144" r="5"/><circle cx="100" cy="144" r="5"/><circle cx="118" cy="144" r="5"/>' +
|
||||
'</g>' +
|
||||
'<path class="handset" d="M26 52 Q26 30 50 30 L150 30 Q174 30 174 52 L174 58 Q174 66 164 66 L142 66 Q132 66 132 56 L132 48 L68 48 L68 56 Q68 66 58 66 L36 66 Q26 66 26 58 Z"/>' +
|
||||
'</g>' +
|
||||
'<g class="waves">' +
|
||||
'<path d="M178 18 q12 12 0 26"/><path d="M188 10 q20 20 0 42"/>' +
|
||||
'<path d="M22 18 q-12 12 0 26"/><path d="M12 10 q-20 20 0 42"/>' +
|
||||
'</g></svg>';
|
||||
|
||||
const PHONE_OFFHOOK = ['dialtone', 'digits', 'calling', 'talking', 'busy'];
|
||||
|
||||
// Kept here rather than in netstat.css: netstat_dark.css pulls that file in with
|
||||
// a plain @import, which browsers keep cached across package updates.
|
||||
const PHONE_CSS = `
|
||||
.netstat-box.is-phone { flex: 0.8 1 0 !important; align-items: center !important; }
|
||||
.ns-phone-art { color: var(--ns-status-up) !important; }
|
||||
.netstat-box.is-down .ns-phone-art { color: var(--ns-status-down) !important; opacity: 0.7; }
|
||||
.ns-phone-art svg { display: block; width: 46px; height: 40px; overflow: visible; margin: 2px auto 4px; }
|
||||
.ns-phone-art .body, .ns-phone-art .handset { fill: currentColor; }
|
||||
.ns-phone-art .key { fill: var(--ns-bg); }
|
||||
.ns-phone-art .cord, .ns-phone-art .waves path { fill: none; stroke: currentColor; stroke-width: 6; stroke-linecap: round; }
|
||||
.ns-phone-art .waves path { opacity: 0; }
|
||||
.ns-phone-art .handset { transition: transform 0.45s cubic-bezier(.3, 1.4, .5, 1); transform-origin: 100px 52px; }
|
||||
.is-offhook .ns-phone-art .handset { transform: translate(-6px, -34px) rotate(-14deg); }
|
||||
.is-ringing .ns-phone-art .shake { animation: ns-phone-shake 0.18s infinite; transform-origin: 100px 120px; }
|
||||
.is-ringing .ns-phone-art .waves path { animation: ns-phone-wave 1s infinite; }
|
||||
.is-ringing .ns-phone-art .waves path:nth-child(2) { animation-delay: 0.2s; }
|
||||
@keyframes ns-phone-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
|
||||
@keyframes ns-phone-wave { 0% { opacity: 0; } 40% { opacity: 1; } 100% { opacity: 0; } }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.is-ringing .ns-phone-art .shake { animation: none; }
|
||||
.is-ringing .ns-phone-art .waves path { animation: none; opacity: 1; }
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.netstat-box.is-phone { flex: 1 1 100% !important; order: 6 !important; }
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.netstat-box.is-phone { order: 7 !important; }
|
||||
}`;
|
||||
|
||||
function updatePhoneCard(card, phone) {
|
||||
const lifted = phone.on && (phone.offhook || PHONE_OFFHOOK.includes(phone.state));
|
||||
const ringing = phone.on && phone.state === 'ringing';
|
||||
card.className = 'netstat-box is-phone ' + (phone.on ? 'is-up' : 'is-down') +
|
||||
(lifted ? ' is-offhook' : '') + (ringing ? ' is-ringing' : '');
|
||||
patchText(card, '.netstat-center-status', !phone.on ? _('Off') :
|
||||
ringing ? _('Ringing') : phone.state === 'talking' ? _('In call') : _('On'));
|
||||
}
|
||||
|
||||
function createPhoneCard(phone) {
|
||||
if (!document.getElementById('ns-phone-css'))
|
||||
document.head.appendChild(E('style', { id: 'ns-phone-css' }, PHONE_CSS));
|
||||
|
||||
const art = E('div', { class: 'ns-phone-art' });
|
||||
art.innerHTML = PHONE_SVG;
|
||||
const card = E('div', { class: 'netstat-box is-phone' }, [
|
||||
art,
|
||||
E('div', { class: 'netstat-center-status' }),
|
||||
E('div', { class: 'netstat-label' }, _('phone'))
|
||||
]);
|
||||
updatePhoneCard(card, phone);
|
||||
return card;
|
||||
}
|
||||
|
||||
// ─── Inline SVG icons ─────────────────────────────────────────────────────────
|
||||
function svgIcon(path, color) {
|
||||
const ns = 'http://www.w3.org/2000/svg';
|
||||
@@ -456,6 +533,9 @@ function updateContainer(container, data, dt) {
|
||||
patchText(center, '.netstat-center-ip', data.ip || 'N/A');
|
||||
}
|
||||
|
||||
const phoneCard = container.querySelector('.is-phone');
|
||||
if (phoneCard && data.phone) updatePhoneCard(phoneCard, data.phone);
|
||||
|
||||
// totals
|
||||
const totals = container.querySelectorAll('.is-total');
|
||||
if (totals[0]) {
|
||||
@@ -594,11 +674,12 @@ return baseclass.extend({
|
||||
createTempCard(data.cpu_temp != null ? data.cpu_temp : null,
|
||||
formatUptime(data.uptime || 0)),
|
||||
createStatusCard(data.status || 'Disconnected', data.ip),
|
||||
data.phone ? createPhoneCard(data.phone) : null,
|
||||
createInfoCard(data.mem_pct || 0, data.mem_used || 0, data.mem_total || 0,
|
||||
data.disk_pct || 0, data.disk_used || 0, data.disk_total || 0),
|
||||
createStatBox(_('downloaded'), totalRx[0], totalRx[1], 'is-total is-downloaded'),
|
||||
createStatBox(_('uploaded'), totalTx[0], totalTx[1], 'is-total is-uploaded'),
|
||||
]);
|
||||
].filter(Boolean));
|
||||
|
||||
const container = E('div', { class: 'stats-grid netstat-wrap' }, row);
|
||||
_container = container;
|
||||
|
||||
|
Before Width: | Height: | Size: 318 KiB After Width: | Height: | Size: 315 KiB |
|
Before Width: | Height: | Size: 148 KiB After Width: | Height: | Size: 119 KiB |
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 49 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 93 KiB |
|
Before Width: | Height: | Size: 157 KiB After Width: | Height: | Size: 107 KiB |
@@ -1,8 +1,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-open-box
|
||||
PKG_VERSION:=0.1.448
|
||||
PKG_RELEASE:=82
|
||||
PKG_VERSION:=0.1.449
|
||||
PKG_RELEASE:=83
|
||||
|
||||
PKG_MAINTAINER:=liandu2024
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["luci-static/quickstart/FastnetInstallDialog.js","luci-static/quickstart/app.js","luci-static/quickstart/vendor.js","luci-static/quickstart/installClient.js"])))=>i.map(i=>d[i]);
|
||||
var kr=Object.defineProperty,wr=Object.defineProperties;var $r=Object.getOwnPropertyDescriptors;var ms=Object.getOwnPropertySymbols;var _l=Object.prototype.hasOwnProperty,yl=Object.prototype.propertyIsEnumerable;var fs=Math.pow,co=(s,t,n)=>t in s?kr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n,ye=(s,t)=>{for(var n in t||(t={}))_l.call(t,n)&&co(s,n,t[n]);if(ms)for(var n of ms(t))yl.call(t,n)&&co(s,n,t[n]);return s},Ne=(s,t)=>wr(s,$r(t));var kl=(s,t)=>{var n={};for(var l in s)_l.call(s,l)&&t.indexOf(l)<0&&(n[l]=s[l]);if(s!=null&&ms)for(var l of ms(s))t.indexOf(l)<0&&yl.call(s,l)&&(n[l]=s[l]);return n};var Nn=(s,t,n)=>co(s,typeof t!="symbol"?t+"":t,n);var B=(s,t,n)=>new Promise((l,u)=>{var c=v=>{try{p(n.next(v))}catch(h){u(h)}},r=v=>{try{p(n.throw(v))}catch(h){u(h)}},p=v=>v.done?l(v.value):Promise.resolve(v.value).then(c,r);p((n=n.apply(s,t)).next())});import{defineComponent as X,computed as R,openBlock as i,createElementBlock as d,normalizeStyle as pt,createElementVNode as e,toDisplayString as a,unref as o,createCommentVNode as T,resolveComponent as At,createVNode as G,renderSlot as Ct,withDirectives as W,vModelCheckbox as gt,createBlock as Y,withCtx as pe,ref as x,watch as We,onMounted as nt,Fragment as V,renderList as oe,vModelSelect as Be,vModelText as Oe,createStaticVNode as Hn,shallowRef as Na,nextTick as ot,onUnmounted as lt,Teleport as Fo,withModifiers as Ge,normalizeClass as _e,withKeys as Qt,reactive as Xe,readonly as Cr,markRaw as Kn,onErrorCaptured as Sr,resolveDynamicComponent as Aa,mergeProps as Zl,inject as ba,Transition as fn,createApp as cn,createTextVNode as ue,provide as ma,TransitionGroup as xr,toRef as uo,onBeforeUnmount as ga,vShow as Bs,vModelRadio as Mt,createSlots as Pr,defineAsyncComponent as Tr,h as vo,isRef as Mr,Suspense as Er,render as Us,withAsyncContext as Ir,useCssVars as Dr,vModelDynamic as Lr}from"/luci-static/quickstart/card-runtime-v1.js";import{a as Ar,c as Nr,d as Fs,u as Yl,i as Or,b as zr,e as qr,f as Ql,g as Xl,h as Rr,j as ei,k as as,l as ta,o as ti,m as Vr,n as ss,p as Br,q as Ur,r as Fr}from"./vendor.js?v=B46K-l76";const Bn={language:void 0,numberFormat:new Intl.NumberFormat("en",{notation:"compact"})},tj=s=>B(null,null,function*(){const t=window.vue_lang||(navigator.language.toLowerCase().startsWith("zh")?"zh-cn":"en");let n={};const l=window.vue_lang_data||(t==="zh-cn"?"":`/luci-static/quickstart/i18n/${t}.json`);if(l)try{const r=yield Ar({url:l,method:"GET"});r.data&&(n=r.data)}catch(r){console.log(r)}const u=Nr({defaultLanguage:t,mutedLanguages:["zh-cn"],translations:n,setGlobalProperties:!1,provideDirective:!1,provideComponent:!1});s.use(u),Bn.language=u;const{$gettext:c}=u;window.$i18n=c;try{Bn.numberFormat=new Intl.NumberFormat(t,{notation:"compact"})}catch(r){console.error("Intl.NumberFormat unsupported lang",t,r)}}),Ae=()=>{if(Bn.language)return Bn.language;throw new Error("I18N Uninitialized!")},Hs=()=>({$gettext:(s,t,n)=>{if(Bn.language)return Bn.language.$gettext(s,t,n);throw new Error("I18N Uninitialized!")},$ngettext:(s,t,n,l,u)=>{if(Bn.language)return Bn.language.$ngettext(s,t,n,l,u);throw new Error("I18N Uninitialized!")}}),bs=s=>typeof s=="number"?Bn.numberFormat.format(s):"?",{$gettext:Hr}=Hs(),ni=(s,t)=>B(null,null,function*(){return new Promise((n,l)=>B(null,null,function*(){try{const u=yield fetch(s,t);if(Math.floor(u.status/100)!=2)throw u.status+" "+u.statusText;const c=ye({},u);c.data=yield u.json(),n(c)}catch(u){const c=u;l(Hr("网络异常:")+((c==null?void 0:c.message)||u))}}))});class Ho{constructor(t){Nn(this,"config",{baseURL:"",headers:{}});Nn(this,"useRequest",t=>t);Nn(this,"useResponse",t=>t);Nn(this,"useError",t=>t);t.baseURL&&(this.config.baseURL=t.baseURL),t.headers&&(this.config.headers=t.headers)}static create(t){return new Ho(t)}Do(t,n){return B(this,null,function*(){return new Promise((l,u)=>B(this,null,function*(){try{const c=this.useRequest({baseURL:this.config.baseURL,headers:this.config.headers});t=`${c.baseURL||""}${t}`,n.headers==null&&(n.headers={}),c.headers&&(n.headers=ye({},c.headers));const p=yield fetch(t,n),v=ye({},p);v.data=yield p.json(),l(this.useResponse(v))}catch(c){this.useError(c),u(c)}}))})}TEXT(t,n){return B(this,null,function*(){return new Promise((l,u)=>B(this,null,function*(){try{const c=this.useRequest({baseURL:this.config.baseURL,headers:this.config.headers});t=`${c.baseURL||""}${t}`,n.headers==null&&(n.headers={}),c.headers&&(n.headers=ye({},c.headers));const p=yield fetch(t,n),v=ye({},p);v.data=yield p.text(),l(v)}catch(c){this.useError(c),u(c)}}))})}interceptors(){const t=this;return{requset:{use(n){t.useRequest=n}},response:{use(n,l){t.useResponse=n,l&&(t.useError=l)}}}}}const ai=Ho.create({});ai.interceptors().requset.use((s=>s));ai.interceptors().response.use((s=>(s.data&&s.data.success==null&&s.data.success==0,s)));const{$gettext:si}=Hs(),Gr="/cgi-bin/luci/istore",jr="/cgi-bin/luci/admin";let Ms=!1;const Pe=(s,t)=>{if(!["GET","HEAD","OPTIONS"].includes((t.method||"GET").tLine truncated
|
||||
var kr=Object.defineProperty,wr=Object.defineProperties;var $r=Object.getOwnPropertyDescriptors;var ms=Object.getOwnPropertySymbols;var _l=Object.prototype.hasOwnProperty,yl=Object.prototype.propertyIsEnumerable;var fs=Math.pow,co=(s,t,n)=>t in s?kr(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n,ye=(s,t)=>{for(var n in t||(t={}))_l.call(t,n)&&co(s,n,t[n]);if(ms)for(var n of ms(t))yl.call(t,n)&&co(s,n,t[n]);return s},Ne=(s,t)=>wr(s,$r(t));var kl=(s,t)=>{var n={};for(var l in s)_l.call(s,l)&&t.indexOf(l)<0&&(n[l]=s[l]);if(s!=null&&ms)for(var l of ms(s))t.indexOf(l)<0&&yl.call(s,l)&&(n[l]=s[l]);return n};var Nn=(s,t,n)=>co(s,typeof t!="symbol"?t+"":t,n);var B=(s,t,n)=>new Promise((l,u)=>{var c=v=>{try{p(n.next(v))}catch(h){u(h)}},r=v=>{try{p(n.throw(v))}catch(h){u(h)}},p=v=>v.done?l(v.value):Promise.resolve(v.value).then(c,r);p((n=n.apply(s,t)).next())});import{defineComponent as X,computed as R,openBlock as i,createElementBlock as d,normalizeStyle as pt,createElementVNode as e,toDisplayString as a,unref as o,createCommentVNode as T,resolveComponent as At,createVNode as G,renderSlot as Ct,withDirectives as W,vModelCheckbox as gt,createBlock as Y,withCtx as pe,ref as x,watch as We,onMounted as nt,Fragment as V,renderList as oe,vModelSelect as Be,vModelText as Oe,createStaticVNode as Hn,shallowRef as Na,nextTick as ot,onUnmounted as lt,Teleport as Fo,withModifiers as Ge,normalizeClass as _e,withKeys as Qt,reactive as Xe,readonly as Cr,markRaw as Kn,onErrorCaptured as Sr,resolveDynamicComponent as Aa,mergeProps as Zl,inject as ba,Transition as fn,createApp as cn,createTextVNode as ue,provide as ma,TransitionGroup as xr,toRef as uo,onBeforeUnmount as ga,vShow as Bs,vModelRadio as Mt,createSlots as Pr,defineAsyncComponent as Tr,h as vo,isRef as Mr,Suspense as Er,render as Us,withAsyncContext as Ir,useCssVars as Dr,vModelDynamic as Lr}from"/luci-static/quickstart/card-runtime-v1.js";import{a as Ar,c as Nr,d as Fs,u as Yl,i as Or,b as zr,e as qr,f as Ql,g as Xl,h as Rr,j as ei,k as as,l as ta,o as ti,m as Vr,n as ss,p as Br,q as Ur,r as Fr}from"./vendor.js?v=B46K-l76";const Bn={language:void 0,numberFormat:new Intl.NumberFormat("en",{notation:"compact"})},tj=s=>B(null,null,function*(){const t=window.vue_lang||(navigator.language.toLowerCase().startsWith("zh")?"zh-cn":"en");let n={};const l=window.vue_lang_data||(t==="zh-cn"?"":`/luci-static/quickstart/i18n/${t}.json`);if(l)try{const r=yield Ar({url:l,method:"GET"});r.data&&(n=r.data)}catch(r){console.log(r)}const u=Nr({defaultLanguage:t,mutedLanguages:["zh-cn"],translations:n,setGlobalProperties:!1,provideDirective:!1,provideComponent:!1});s.use(u),Bn.language=u;const{$gettext:c}=u;window.$i18n=c;try{Bn.numberFormat=new Intl.NumberFormat(t,{notation:"compact"})}catch(r){console.error("Intl.NumberFormat unsupported lang",t,r)}}),Ae=()=>{if(Bn.language)return Bn.language;throw new Error("I18N Uninitialized!")},Hs=()=>({$gettext:(s,t,n)=>{if(Bn.language)return Bn.language.$gettext(s,t,n);throw new Error("I18N Uninitialized!")},$ngettext:(s,t,n,l,u)=>{if(Bn.language)return Bn.language.$ngettext(s,t,n,l,u);throw new Error("I18N Uninitialized!")}}),bs=s=>typeof s=="number"?Bn.numberFormat.format(s):"?",{$gettext:Hr}=Hs(),ni=(s,t)=>B(null,null,function*(){return new Promise((n,l)=>B(null,null,function*(){try{const u=yield fetch(s,t);if(Math.floor(u.status/100)!=2)throw u.status+" "+u.statusText;const c=ye({},u);c.data=yield u.json(),n(c)}catch(u){const c=u;l(Hr("网络异常:")+((c==null?void 0:c.message)||u))}}))});class Ho{constructor(t){Nn(this,"config",{baseURL:"",headers:{}});Nn(this,"useRequest",t=>t);Nn(this,"useResponse",t=>t);Nn(this,"useError",t=>t);t.baseURL&&(this.config.baseURL=t.baseURL),t.headers&&(this.config.headers=t.headers)}static create(t){return new Ho(t)}Do(t,n){return B(this,null,function*(){return new Promise((l,u)=>B(this,null,function*(){try{const c=this.useRequest({baseURL:this.config.baseURL,headers:this.config.headers});t=`${c.baseURL||""}${t}`,n.headers==null&&(n.headers={}),c.headers&&(n.headers=ye({},c.headers));const p=yield fetch(t,n),v=ye({},p);v.data=yield p.json(),l(this.useResponse(v))}catch(c){this.useError(c),u(c)}}))})}TEXT(t,n){return B(this,null,function*(){return new Promise((l,u)=>B(this,null,function*(){try{const c=this.useRequest({baseURL:this.config.baseURL,headers:this.config.headers});t=`${c.baseURL||""}${t}`,n.headers==null&&(n.headers={}),c.headers&&(n.headers=ye({},c.headers));const p=yield fetch(t,n),v=ye({},p);v.data=yield p.text(),l(v)}catch(c){this.useError(c),u(c)}}))})}interceptors(){const t=this;return{requset:{use(n){t.useRequest=n}},response:{use(n,l){t.useResponse=n,l&&(t.useError=l)}}}}}const ai=Ho.create({});ai.interceptors().requset.use((s=>s));ai.interceptors().response.use((s=>(s.data&&s.data.success==null&&s.data.success==0,s)));const{$gettext:si}=Hs(),Gr="/cgi-bin/luci/istore",jr="/cgi-bin/luci/admin";let Ms=!1;const Pe=(s,t)=>{if(!["GET","HEAD","OPTIONS"].includes((t.method||"GET").tLine truncated
|
||||
`+p.value+`
|
||||
`+c.value,disabled:""},null,8,pI)]),e("div",hI,[e("div",{class:"close",onClick:g,disabled:u.value},a(o(t)("关闭")),9,mI),u.value?T("",!0):(i(),d("div",{key:0,class:"next",onClick:b,disabled:u.value},a(o(t)("运行")),9,fI))])])]),_:1}))}}),gI=le(bI,[["__scopeId","data-v-3fabbd23"]]),_I={class:"actioner-container"},yI={class:"actioner-container_header"},kI={class:"tabs"},wI={class:"actioner-container_body"},$I={key:0,class:"table"},CI={class:"tr"},SI={class:"td left"},xI={class:"td left"},PI={class:"tr"},TI={class:"td left"},MI={class:"td left"},EI={class:"tr"},II={class:"td left"},DI={class:"td left"},LI=["value"],AI=["value"],NI=["value"],OI={class:"actioner-container_footer"},zI=["disabled"],qI=X({__name:"disk-info",props:{close:{type:Function,required:!0},disk:{type:Object,required:!0}},setup(s){const{$gettext:t,$ngettext:n}=Ae(),l=s,u=x(!1),c=x("info"),r=m=>{switch(c.value=m,m){case"info":break;case"attribute":g();break;case"log":h();break;case"extend":b();break}},p=()=>{u.value=!0,l.close()},v=Xe({log:"",attribute:"",extend:""}),h=()=>B(null,null,function*(){try{const m=yield we.Smart.Test.Result.POST({type:"selftest",devicePath:l.disk.path||""});if(m.data){const{result:f,error:k}=m.data;f&&f.result&&(v.log=f.result),k&&(v.log=k)}}catch(m){v.log=m}}),g=()=>B(null,null,function*(){try{const m=yield we.Smart.Attribute.Result.POST({devicePath:l.disk.path||""});if(m.data){const{result:f,error:k}=m.data;f&&f.result&&(v.attribute=f.result),k&&(v.attribute=k)}}catch(m){v.attribute=m}}),b=()=>B(null,null,function*(){try{const m=yield we.Smart.Extend.Result.POST({devicePath:l.disk.path||""});if(m.data){const{result:f,error:k}=m.data;f&&f.result&&(v.extend=f.result),k&&(v.extend=k)}}catch(m){v.extend=m}});return(m,f)=>(i(),Y(Xs,null,{default:pe(()=>[e("div",_I,[e("div",yI,[e("ul",kI,[e("li",{class:_e({"active cbi-tab":c.value=="info"}),onClick:f[0]||(f[0]=k=>r("info"))},[e("a",null,a(o(t)("设备信息")),1)],2),e("li",{class:_e({"active cbi-tab":c.value=="attribute"}),onClick:f[1]||(f[1]=k=>r("attribute"))},[e("a",null,a(o(t)("属性")),1)],2),e("li",{class:_e({"active cbi-tab":c.value=="log"}),onClick:f[2]||(f[2]=k=>r("log"))},[e("a",null,a(o(t)("自检日志")),1)],2),e("li",{class:_e({"active cbi-tab":c.value=="extend"}),onClick:f[3]||(f[3]=k=>r("extend"))},[e("a",null,a(o(t)("扩展信息")),1)],2)])]),e("div",wI,[c.value=="info"?(i(),d("table",$I,[e("tr",CI,[e("td",SI,a(o(t)("设备")),1),e("td",xI,a(s.disk.path),1)]),e("tr",PI,[e("td",TI,a(o(t)("型号")),1),e("td",MI,a(s.disk.model),1)]),e("tr",EI,[e("td",II,a(o(t)("序号")),1),e("td",DI,a(s.disk.serial),1)])])):c.value=="attribute"?(i(),d("textarea",{key:1,disabled:"",value:v.attribute},null,8,LI)):c.value=="log"?(i(),d("textarea",{key:2,disabled:"",value:v.log},null,8,AI)):c.value=="extend"?(i(),d("textarea",{key:3,disabled:"",value:v.extend},null,8,NI)):T("",!0)]),e("div",OI,[e("div",{class:"close",onClick:p,disabled:u.value},a(o(t)("关闭")),9,zI)])])]),_:1}))}}),RI=le(qI,[["__scopeId","data-v-ba5f9eb4"]]),VI=s=>{const t=document.createElement("div");document.body.appendChild(t);const n=G(CE,Ne(ye({},s),{close:()=>{l()}})),l=()=>{t.remove()};Us(n,t)},BI=s=>{const t=document.createElement("div");document.body.appendChild(t);const n=G(cI,Ne(ye({},s),{close:()=>{l()}})),l=()=>{t.remove()};Us(n,t)},UI=s=>{const t=document.createElement("div");document.body.appendChild(t);const n=G(gI,Ne(ye({},s),{close:()=>{l()}})),l=()=>{t.remove()};Us(n,t)},FI=s=>{const t=document.createElement("div");document.body.appendChild(t);const n=G(RI,Ne(ye({},s),{close:()=>{l()}})),l=()=>{t.remove()};Us(n,t)},HI={class:"cbi-section"},GI={class:"cbi-value"},jI={class:"cbi-value-title"},WI={class:"cbi-value-field"},JI={class:"cbi-checkbox"},KI=["value"],ZI={class:"cbi-value"},YI={class:"cbi-value-title"},QI={class:"cbi-value-field"},XI={class:"cbi-checkbox"},eD={value:"never"},tD={value:"sleep"},nD={value:"standby"},aD={value:"idle"},sD={class:"cbi-value-description"},oD={class:"cbi-value"},lD={class:"cbi-value-title"},iD={class:"cbi-value-field"},rD={class:"cbi-checkbox"},cD={value:0},dD=["value"],uD={class:"cbi-value-description"},vD={class:"cbi-value"},pD={class:"cbi-value-title"},hD={class:"cbi-value-field"},mD={class:"cbi-checkbox"},fD={value:0},bD=["value"],gD={class:"cbi-value-description"},_D={class:"cbi-section cbi-tblsection",id:"cbi-nfs-mount"},yD={class:"table cbi-section-table"},kD={class:"tr cbi-section-table-titles anonymous"},wD={class:"th cbi-section-table-cell","data-widget":"value"},$D={class:"th cbi-section-table-cell","data-widget":"value"},CD={class:"th cbi-section-table-cell","data-widget":"value"},SD={class:"th cbi-section-table-cell","data-widget":"value"},xD={class:"th cbi-section-table-cell","data-widget":"value"},PD={class:"th cbi-section-table-cell","data-widget":"value"},TD={class:"th cbi-section-table-cell","data-widget":"value"},MD={class:"th cbi-section-table-cell","data-widget":"value"},ED={class:"tr cbi-section-table-row"},ID={class:"td cb
Line truncated
|
||||
${n("设备和单设备例外不会被删除。")}`))try{const H=(yield t.DeviceMangement.deviceGroupsV2.POST({action:"delete_group",groupId:he.id,expectedVersion:p.value})).data.result;if(H!=null&&H.error)throw new Error(H.error.message);yield it()}catch(H){c.value=(H==null?void 0:H.message)||n("删除失败")}}),it=()=>B(null,null,function*(){var he,H,J;l.value=!0,c.value="";try{const[ge,ze,Fe]=yield Promise.all([t.DeviceMangement.deviceGroupsV2.GET(),t.DeviceMangement.deviceInventoryV2.GET(),t.DeviceMangement.gatewayTargetsV2.GET().catch(()=>null)]),Ee=ge.data.result;if(Ee!=null&&Ee.error)throw new Error(Ee.error.message);$.value=(Ee==null?void 0:Ee.groups)||[],$e.value=(Ee==null?void 0:Ee.globalPolicy)||null,S.value=(Ee==null?void 0:Ee.effective)||[],p.value=(Ee==null?void 0:Ee.version)||"",v.value=(Ee==null?void 0:Ee.timezone)||"",h.value=(Ee==null?void 0:Ee.nextEvaluationAt)||"",y.value=Ee==null?void 0:Ee.lastBatch,w.value=((he=ze.data.result)==null?void 0:he.devices)||[],C.value=((J=(H=Fe==null?void 0:Fe.data)==null?void 0:H.result)==null?void 0:J.targets)||[]}catch(ge){c.value=(ge==null?void 0:ge.message)||n("读取设备分组失败")}finally{l.value=!1}});return it(),(he,H)=>(i(),d("section",eR,[e("header",tR,[e("div",null,[e("h2",nR,a(o(n)("分组与计划")),1),e("p",null,a(o(n)("把需要相同安排的设备放在一起,一次设置联网、速度、路线、时段或流量额度。")),1)]),e("div",aR,[e("button",{type:"button",onClick:re},a(o(n)("默认规则")),1),e("button",{type:"button",class:"primary",onClick:j},a(o(n)("新建分组")),1)])]),l.value?(i(),Y(yt,{key:0,kind:"loading",title:o(n)("正在读取设备分组")},null,8,["title"])):c.value?(i(),Y(yt,{key:1,kind:"error",title:o(n)("设备分组读取失败"),description:c.value,"action-label":o(n)("重新加载"),onAction:it},null,8,["title","description","action-label"])):(i(),d(V,{key:2},[e("div",sR,[e("span",null,a(o(n)("按路由器时间执行"))+" · "+a(v.value||"—"),1),e("span",null,a(o(n)("下次检查"))+" "+a(q(h.value)),1)]),y.value&&y.value.status!=="unchanged"?(i(),d("div",{key:0,class:_e(["batch-result",y.value.status]),role:"status"},[e("strong",null,a(K(y.value.status)),1),e("span",null,a(o(n)("成功"))+" "+a(y.value.applied)+" · "+a(o(n)("跳过"))+" "+a(y.value.skipped)+" · "+a(o(n)("失败"))+" "+a(y.value.failed),1)],2)):T("",!0),!$.value.length&&!g.value?(i(),Y(yt,{key:1,kind:"empty",title:o(n)("还没有设备分组"),description:o(n)("例如创建“儿童设备”,设置晚间暂停联网和每月流量额度。")},null,8,["title","description"])):(i(),d("div",oR,[(i(!0),d(V,null,oe($.value,J=>(i(),d("article",{key:J.id,class:"group-card"},[e("div",lR,[e("div",null,[e("strong",null,a(J.name),1),e("span",null,a(J.members.length)+" "+a(o(n)("台设备")),1)]),e("span",iR,"P"+a(J.priority),1)]),e("p",null,a(O(J.policy)),1),e("div",rR,a(F(J.members)),1),e("div",cR,[e("button",{type:"button",onClick:ge=>De(J)},a(o(n)("编辑")),9,dR),e("button",{type:"button",class:"danger-link",onClick:ge=>Ze(J)},a(o(n)("删除")),9,uR)])]))),128))])),S.value.length?(i(),d("details",vR,[e("summary",null,[ue(a(o(n)("查看最终生效结果与来源"))+" ",1),e("small",null,a(Math.min(S.value.length,50))+" / "+a(S.value.length),1)]),e("div",pR,[(i(!0),d(V,null,oe(S.value.slice(0,50),J=>(i(),d("div",{key:J.deviceId},[e("span",null,[e("strong",null,a(z(J.deviceId)),1),e("small",null,a(ve(J)),1)]),e("em",null,a(ce(J.sources)),1)]))),128))])])):T("",!0),g.value?(i(),d("form",{key:4,class:"editor",onSubmit:Ge(at,["prevent"])},[e("div",hR,[e("div",null,[e("h3",null,a(m.value?o(n)("默认规则"):b.value?o(n)("编辑分组"):o(n)("新建分组")),1),e("p",null,a(m.value?o(n)("只为没有更具体规则的设备提供默认值。"):o(n)("单设备例外始终优先;多个分组冲突时,优先级较高的生效。")),1)]),e("button",{type:"button",class:"close",onClick:Ke,"aria-label":o(n)("关闭")},"×",8,mR)]),m.value?T("",!0):(i(),d("div",fR,[e("label",null,[e("span",null,a(o(n)("分组名称")),1),W(e("input",{"onUpdate:modelValue":H[0]||(H[0]=J=>_.name=J),maxlength:"64",required:"",placeholder:o(n)("例如:儿童设备")},null,8,bR),[[Oe,_.name,void 0,{trim:!0}]])])])),m.value?T("",!0):(i(),d("details",gR,[e("summary",null,a(o(n)("高级设置")),1),e("label",null,[e("span",null,a(o(n)("优先级")),1),W(e("input",{"onUpdate:modelValue":H[1]||(H[1]=J=>_.priority=J),type:"number",min:"0",max:"999"},null,512),[[Oe,_.priority,void 0,{number:!0}]]),e("small",null,a(o(n)("单设备例外始终优先;多个分组冲突时,优先级较高的生效。")),1)])])),m.value?T("",!0):(i(),d("fieldset",_R,[e("legend",null,[ue(a(o(n)("选择设备"))+" ",1),e("small",null,a(o(n)("已选择"))+" "+a(_.members.length)+" "+a(o(n)("台设备")),1)]),W(e("input",{"onUpdate:modelValue":H[2]||(H[2]=J=>f.value=J),class:"device-search",type:"search",placeholder:o(n)("搜索名称、IP 或 MAC")},null,8,yR),[[Oe,f.value,void 0,{trim:
Line truncated
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
@keyframes bganimation-4cfdbcec{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}@keyframes rotateEnter-4cfdbcec{0%{transform:rotateY(180deg)}10%{transform:rotateY(198deg)}20%{transform:rotateY(216deg)}30%{transform:rotateY(234deg)}40%{transform:rotateY(252deg)}50%{transform:rotateY(270deg)}60%{transform:rotateY(288deg)}70%{transform:rotateY(306deg)}80%{transform:rotateY(324deg)}90%{transform:rotateY(342deg)}to{transform:rotateY(360deg)}}@keyframes turns-4cfdbcec{0%{-webkit-transform:rotate(0deg)}25%{-webkit-transform:rotate(90deg)}50%{-webkit-transform:rotate(180deg)}75%{-webkit-transform:rotate(270deg)}to{-webkit-transform:rotate(360deg)}}.rotate-enter-active[data-v-4cfdbcec]{animation:rotateEnter-4cfdbcec .7s;position:relative}.rotate-leave-active[data-v-4cfdbcec]{opacity:0;display:none;position:relative;z-index:-999}.app-container[data-v-4cfdbcec]{width:100%;background-color:var(--card-bg-color);box-shadow:var(--card-box-shadow);padding:10px 30px;border-radius:6px;position:relative}.disk-item-tooltip[data-v-4cfdbcec]{position:fixed;background:#000000b3;z-index:10111;color:#fff;padding:.5rem 1rem;font-size:1em;min-width:200px;line-height:24px}.disk-item-tooltip[data-v-4cfdbcec]:after{content:"";position:absolute;bottom:-6px;border-color:#4c4c4c rgba(0,0,0,0) rgba(0,0,0,0);left:0;right:0;text-align:center;width:0;margin:0 auto;border-width:6px 8px 0;border-style:solid}#main .app-btn,#actioner .app-btn{min-height:36px}@keyframes bganimation-425e333d{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}@keyframes rotateEnter-425e333d{0%{transform:rotateY(180deg)}10%{transform:rotateY(198deg)}20%{transform:rotateY(216deg)}30%{transform:rotateY(234deg)}40%{transform:rotateY(252deg)}50%{transform:rotateY(270deg)}60%{transform:rotateY(288deg)}70%{transform:rotateY(306deg)}80%{transform:rotateY(324deg)}90%{transform:rotateY(342deg)}to{transform:rotateY(360deg)}}@keyframes turns-425e333d{0%{-webkit-transform:rotate(0deg)}25%{-webkit-transform:rotate(90deg)}50%{-webkit-transform:rotate(180deg)}75%{-webkit-transform:rotate(270deg)}to{-webkit-transform:rotate(360deg)}}.rotate-enter-active[data-v-425e333d]{animation:rotateEnter-425e333d .7s;position:relative}.rotate-leave-active[data-v-425e333d]{opacity:0;display:none;position:relative;z-index:-999}.app-container[data-v-425e333d]{width:100%;background-color:var(--card-bg-color);box-shadow:var(--card-box-shadow);padding:10px 30px;border-radius:6px;position:relative}#main[data-v-425e333d]{width:100%}#main[data-v-425e333d],#main[data-v-425e333d] *{-webkit-box-sizing:border-box;-webkit-tap-highlight-color:transparent;box-sizing:border-box;word-wrap:break-word;outline:none}:root{--flow-bg-color: #fff;--flow-span-color: rgba(0, 0, 0, .6);--card-bg-color: #fff;--card-box-shadow: 0 0 10px 1px #bfbfbf24;--app-container_title-color: #1e1e1e;--app-container_status-label_block: black;--item-label_key-span-color: #333;--item-label_value-span-color: #333;--app-container_status-label_bg: #f3f3f3;--item_btn-border: 1px solid #553afb;--item_btn-color: #553afb;--tit-color: #1e1e1e;--popup-bg-color: #fff;--tag-bg-color: #f5f5f5;--gradient-bg-color:linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.8) 62%, rgba(255,255,255,1) 100%);--breadcrumbs-tit-color:#d6dbf8;--breadcrumbs-tit-color1:#f1f2f9;--border-color: #e5e5e5;--SystemUpdateBanner-bg-color: #eff6ff;--SystemUpdateBanner-border-color: #bedbff;--btn-border-color: #e5e5e5;--card-txt-color: #32325d;--SystemInfo-bg-color:#f9fafd;color-scheme:light}@media(prefers-color-scheme:light){:root{--flow-bg-color: #fff;--flow-span-color: rgba(0, 0, 0, .6);--card-bg-color: #fff;--card-box-shadow: 0 0 10px 1px #bfbfbf24;--app-container_title-color: #1e1e1e;--app-container_status-label_block: black;--item-label_key-span-color: #333;--item-label_value-span-color: #333;--app-container_status-label_bg: #f3f3f3;--item_btn-border: 1px solid #553afb;--item_btn-color: #553afb;--tit-color: #1e1e1e;--popup-bg-color: #fff;--tag-bg-color: #f5f5f5;--gradient-bg-color:linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.8) 62%, rgba(255,255,255,1) 100%);--breadcrumbs-tit-color:#d6dbf8;--breadcrumbs-tit-color1:#f1f2f9;--border-color: #e5e5e5;--SystemUpdateBanner-bg-color: #eff6ff;--SystemUpdateBanner-border-color: #bedbff;--btn-border-color: #e5e5e5;--card-txt-color: #32325d;--SystemInfo-bg-color:#f9fafd}}@media(prefers-color-scheme:dark){:root{--flow-bg-color: transparent;--flow-span-color: #cccccc;--card-bg-color: #88888822;--card-box-shadow: 0 0 .5rem 0 rgba(0, 0, 0, .35);--app-container_title-color: #cccccc;--app-container_status-label_block: #727272;--item-label_key-span-color: #cccccc;--item-label_value-span-color: #cccccc;--app-container_status-label_bg: #0000001a;--item_btn-border: 1px solid #cccccc;--item_btn-color: #cccccc;--tit-color: #cccccc;--popup-bg-color: #000;--tag-bg-color: #1e1e1e;--gradient-bg-color:linear-gradient(90deg, rgba(0,Line truncated
|
||||
.page-container>div>div>a:first-child,.info_content>.status_box{display:none !important}
|
||||
@keyframes bganimation-4cfdbcec{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}@keyframes rotateEnter-4cfdbcec{0%{transform:rotateY(180deg)}10%{transform:rotateY(198deg)}20%{transform:rotateY(216deg)}30%{transform:rotateY(234deg)}40%{transform:rotateY(252deg)}50%{transform:rotateY(270deg)}60%{transform:rotateY(288deg)}70%{transform:rotateY(306deg)}80%{transform:rotateY(324deg)}90%{transform:rotateY(342deg)}to{transform:rotateY(360deg)}}@keyframes turns-4cfdbcec{0%{-webkit-transform:rotate(0deg)}25%{-webkit-transform:rotate(90deg)}50%{-webkit-transform:rotate(180deg)}75%{-webkit-transform:rotate(270deg)}to{-webkit-transform:rotate(360deg)}}.rotate-enter-active[data-v-4cfdbcec]{animation:rotateEnter-4cfdbcec .7s;position:relative}.rotate-leave-active[data-v-4cfdbcec]{opacity:0;display:none;position:relative;z-index:-999}.app-container[data-v-4cfdbcec]{width:100%;background-color:var(--card-bg-color);box-shadow:var(--card-box-shadow);padding:10px 30px;border-radius:6px;position:relative}.disk-item-tooltip[data-v-4cfdbcec]{position:fixed;background:#000000b3;z-index:10111;color:#fff;padding:.5rem 1rem;font-size:1em;min-width:200px;line-height:24px}.disk-item-tooltip[data-v-4cfdbcec]:after{content:"";position:absolute;bottom:-6px;border-color:#4c4c4c rgba(0,0,0,0) rgba(0,0,0,0);left:0;right:0;text-align:center;width:0;margin:0 auto;border-width:6px 8px 0;border-style:solid}#main .app-btn,#actioner .app-btn{min-height:36px}@keyframes bganimation-425e333d{0%{background-position:0% 50%}50%{background-position:100% 50%}to{background-position:0% 50%}}@keyframes rotateEnter-425e333d{0%{transform:rotateY(180deg)}10%{transform:rotateY(198deg)}20%{transform:rotateY(216deg)}30%{transform:rotateY(234deg)}40%{transform:rotateY(252deg)}50%{transform:rotateY(270deg)}60%{transform:rotateY(288deg)}70%{transform:rotateY(306deg)}80%{transform:rotateY(324deg)}90%{transform:rotateY(342deg)}to{transform:rotateY(360deg)}}@keyframes turns-425e333d{0%{-webkit-transform:rotate(0deg)}25%{-webkit-transform:rotate(90deg)}50%{-webkit-transform:rotate(180deg)}75%{-webkit-transform:rotate(270deg)}to{-webkit-transform:rotate(360deg)}}.rotate-enter-active[data-v-425e333d]{animation:rotateEnter-425e333d .7s;position:relative}.rotate-leave-active[data-v-425e333d]{opacity:0;display:none;position:relative;z-index:-999}.app-container[data-v-425e333d]{width:100%;background-color:var(--card-bg-color);box-shadow:var(--card-box-shadow);padding:10px 30px;border-radius:6px;position:relative}#main[data-v-425e333d]{width:100%}#main[data-v-425e333d],#main[data-v-425e333d] *{-webkit-box-sizing:border-box;-webkit-tap-highlight-color:transparent;box-sizing:border-box;word-wrap:break-word;outline:none}:root{--flow-bg-color: #fff;--flow-span-color: rgba(0, 0, 0, .6);--card-bg-color: #fff;--card-box-shadow: 0 0 10px 1px #bfbfbf24;--app-container_title-color: #1e1e1e;--app-container_status-label_block: black;--item-label_key-span-color: #333;--item-label_value-span-color: #333;--app-container_status-label_bg: #f3f3f3;--item_btn-border: 1px solid #553afb;--item_btn-color: #553afb;--tit-color: #1e1e1e;--popup-bg-color: #fff;--tag-bg-color: #f5f5f5;--gradient-bg-color:linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.8) 62%, rgba(255,255,255,1) 100%);--breadcrumbs-tit-color:#d6dbf8;--breadcrumbs-tit-color1:#f1f2f9;--border-color: #e5e5e5;--SystemUpdateBanner-bg-color: #eff6ff;--SystemUpdateBanner-border-color: #bedbff;--btn-border-color: #e5e5e5;--card-txt-color: #32325d;--SystemInfo-bg-color:#f9fafd;color-scheme:light}@media(prefers-color-scheme:light){:root{--flow-bg-color: #fff;--flow-span-color: rgba(0, 0, 0, .6);--card-bg-color: #fff;--card-box-shadow: 0 0 10px 1px #bfbfbf24;--app-container_title-color: #1e1e1e;--app-container_status-label_block: black;--item-label_key-span-color: #333;--item-label_value-span-color: #333;--app-container_status-label_bg: #f3f3f3;--item_btn-border: 1px solid #553afb;--item_btn-color: #553afb;--tit-color: #1e1e1e;--popup-bg-color: #fff;--tag-bg-color: #f5f5f5;--gradient-bg-color:linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.8) 62%, rgba(255,255,255,1) 100%);--breadcrumbs-tit-color:#d6dbf8;--breadcrumbs-tit-color1:#f1f2f9;--border-color: #e5e5e5;--SystemUpdateBanner-bg-color: #eff6ff;--SystemUpdateBanner-border-color: #bedbff;--btn-border-color: #e5e5e5;--card-txt-color: #32325d;--SystemInfo-bg-color:#f9fafd}}@media(prefers-color-scheme:dark){:root{--flow-bg-color: transparent;--flow-span-color: #cccccc;--card-bg-color: #88888822;--card-box-shadow: 0 0 .5rem 0 rgba(0, 0, 0, .35);--app-container_title-color: #cccccc;--app-container_status-label_block: #727272;--item-label_key-span-color: #cccccc;--item-label_value-span-color: #cccccc;--app-container_status-label_bg: #0000001a;--item_btn-border: 1px solid #cccccc;--item_btn-color: #cccccc;--tit-color: #cccccc;--popup-bg-color: #000;--tag-bg-color: #1e1e1e;--gradient-bg-color:linear-gradient(90deg, rgba(0,Line truncated
|
||||
@@ -784,6 +784,7 @@ return view.extend({
|
||||
+'<br>'+_('If you are using custom login server but not providing an Auth Key, will redirect to the login page without pre-filling the key.')
|
||||
);
|
||||
customLoginAuthKey.placeholder = '';
|
||||
customLoginAuthKey.password = true;
|
||||
customLoginAuthKey.rmempty = true;
|
||||
|
||||
const logoutBtn = s.taboption('account', form.Button, '_logout', _('Logout'),
|
||||
|
||||
@@ -294,14 +294,14 @@ return baseclass.extend({
|
||||
'click': ui.createHandlerFn(self, function() {
|
||||
if (!confirm(_('Enable profile %s? The connection will re-establish.').format(p.iccid)))
|
||||
return;
|
||||
return callEsim(data.modem, 'enable', esimSlot, p.iccid, '', '').then(function(res) { ctx.notifyEsimApply(data.modem, res) });
|
||||
return wrpc.esimSwitchAsk(data.modem, 'enable', esimSlot, p.iccid).then(function(res) { ctx.notifyEsimApply(data.modem, res) });
|
||||
}) }, _('Enable')));
|
||||
else
|
||||
acts.push(E('button', { 'class': 'btn cbi-button',
|
||||
'click': ui.createHandlerFn(self, function() {
|
||||
if (!confirm(_('Disable the active profile %s?').format(p.iccid)))
|
||||
return;
|
||||
return callEsim(data.modem, 'disable', esimSlot, p.iccid, '', '').then(function(res) { ctx.notifyEsimApply(data.modem, res) });
|
||||
return wrpc.esimSwitchAsk(data.modem, 'disable', esimSlot, p.iccid).then(function(res) { ctx.notifyEsimApply(data.modem, res) });
|
||||
}) }, _('Disable')));
|
||||
acts.push(E('button', { 'class': 'btn cbi-button cbi-button-remove', 'style': 'margin-left:4px',
|
||||
'click': ui.createHandlerFn(self, function() {
|
||||
|
||||
@@ -33,6 +33,23 @@ function checked(decl) {
|
||||
}
|
||||
|
||||
var callSwitchSlot = checked({ object: 'wwand', method: 'modem_sim_switch_slot', params: [ 'modem', 'slot', 'force' ], expect: {} });
|
||||
var callEsim = checked({ object: 'wwand', method: 'modem_esim',
|
||||
params: [ 'modem', 'op', 'slot', 'iccid', 'activation_code', 'confirmation_code', 'auto_notify', 'force' ], expect: {} });
|
||||
|
||||
/* Shared by every button that changes the card in use: the daemon answers
|
||||
`sim_in_use` with the interface bound to that card (`option iccid`), and
|
||||
only a yes repeats the call with force. */
|
||||
function askBound(call) {
|
||||
return call(false).then(function(r) {
|
||||
if (!(r && r.error == 'sim_in_use'))
|
||||
return r;
|
||||
|
||||
if (!confirm(_('Interface %s is bound to the SIM card in use. Switching takes it down; it stays down until its next start, which switches back to its card. Switch anyway?').format(r.interface || '?')))
|
||||
return r;
|
||||
|
||||
return call(true);
|
||||
});
|
||||
}
|
||||
|
||||
return baseclass.extend({
|
||||
/* --- status flavours -------------------------------------------------
|
||||
@@ -85,15 +102,7 @@ return baseclass.extend({
|
||||
the card from under an interface bound to it (`option iccid`), naming
|
||||
the interface — asked here, and forced only on a yes. */
|
||||
switchSlotAsk: function(modem, slot) {
|
||||
return callSwitchSlot(modem, slot, false).then(function(r) {
|
||||
if (!(r && r.error == 'sim_in_use'))
|
||||
return r;
|
||||
|
||||
if (!confirm(_('Interface %s is bound to the SIM card in use. Switching takes it down; it stays down until its next start, which switches back to its card. Switch anyway?').format(r.interface || '?')))
|
||||
return r;
|
||||
|
||||
return callSwitchSlot(modem, slot, true);
|
||||
});
|
||||
return askBound(function(force) { return callSwitchSlot(modem, slot, force); });
|
||||
},
|
||||
pinVerify: checked({ object: 'wwand', method: 'modem_sim_pin_verify', params: [ 'modem', 'pin' ], expect: {} }),
|
||||
simPuk: checked({ object: 'wwand', method: 'modem_sim_puk', params: [ 'modem', 'puk', 'new_pin' ], expect: {} }),
|
||||
@@ -105,8 +114,17 @@ return baseclass.extend({
|
||||
esimProfiles: rpc.declare({ object: 'wwand', method: 'modem_esim_profiles',
|
||||
params: [ 'modem', 'slot' ], expect: {} }),
|
||||
|
||||
esim: checked({ object: 'wwand', method: 'modem_esim',
|
||||
params: [ 'modem', 'op', 'slot', 'iccid', 'activation_code', 'confirmation_code', 'auto_notify' ], expect: {} }),
|
||||
esim: callEsim,
|
||||
/* Enabling or disabling a profile changes the card in use just as a slot
|
||||
switch does, and is refused the same way. Only the bound-interface
|
||||
refusal is asked about: `esim_managed` is checked first by the daemon
|
||||
and comes back as it is, so a yes here never overrides a managing
|
||||
plugin. */
|
||||
esimSwitchAsk: function(modem, op, slot, iccid) {
|
||||
return askBound(function(force) {
|
||||
return callEsim(modem, op, slot, iccid, '', '', undefined, force);
|
||||
});
|
||||
},
|
||||
|
||||
/* --- settings / network selection ------------------------------------ */
|
||||
getSettings: rpc.declare({ object: 'wwand', method: 'modem_get_settings', params: [ 'modem' ], expect: {} }),
|
||||
|
||||
@@ -1187,7 +1187,7 @@ msgstr ""
|
||||
msgid "Interface"
|
||||
msgstr ""
|
||||
|
||||
#: htdocs/luci-static/resources/wwand/rpc.js:92
|
||||
#: htdocs/luci-static/resources/wwand/rpc.js:47
|
||||
msgid ""
|
||||
"Interface %s is bound to the SIM card in use. Switching takes it down; it "
|
||||
"stays down until its next start, which switches back to its card. Switch "
|
||||
|
||||
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
LUCI_TITLE:=LuCI Status Pages
|
||||
LUCI_DEPENDS:=+luci-base +luci-app-oui +luci-app-vantage +libiwinfo +rpcd-mod-iwinfo +rpcd-mod-rrdns +ucode +ucode-mod-fs +ucode-mod-ubus +ucode-mod-socket
|
||||
|
||||
PKG_RELEASE:=44
|
||||
PKG_RELEASE:=45
|
||||
PKG_BUILD_DEPENDS:=iwinfo
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
|
||||
@@ -119,7 +119,8 @@ function toData(r, ip) {
|
||||
disk_used: (r && r.disk_used) || 0,
|
||||
disk_total: (r && r.disk_total) || 0,
|
||||
preferred: (r && r.prefer_iface) ? [r.prefer_iface] : [],
|
||||
vnstat_total: (r && r.vnstat_total) || null
|
||||
vnstat_total: (r && r.vnstat_total) || null,
|
||||
phone: (r && r.phone) || null
|
||||
};
|
||||
}
|
||||
|
||||
@@ -278,6 +279,82 @@ function createStatusCard(status, ip) {
|
||||
]);
|
||||
}
|
||||
|
||||
// ─── Phone port card (RJ11 on the AW1000, only sent when fxsd is installed) ──
|
||||
const PHONE_SVG =
|
||||
'<svg viewBox="0 0 200 170" xmlns="http://www.w3.org/2000/svg">' +
|
||||
'<g class="shake">' +
|
||||
'<path class="cord" d="M36 66 C 8 92, 14 132, 40 150"/>' +
|
||||
'<path class="body" d="M44 84 Q48 66 72 66 L128 66 Q152 66 156 84 L168 146 Q170 158 156 158 L44 158 Q30 158 32 146 Z"/>' +
|
||||
'<rect class="body" x="46" y="58" width="16" height="10" rx="3"/>' +
|
||||
'<rect class="body" x="138" y="58" width="16" height="10" rx="3"/>' +
|
||||
'<g class="key">' +
|
||||
'<circle cx="82" cy="96" r="5"/><circle cx="100" cy="96" r="5"/><circle cx="118" cy="96" r="5"/>' +
|
||||
'<circle cx="82" cy="112" r="5"/><circle cx="100" cy="112" r="5"/><circle cx="118" cy="112" r="5"/>' +
|
||||
'<circle cx="82" cy="128" r="5"/><circle cx="100" cy="128" r="5"/><circle cx="118" cy="128" r="5"/>' +
|
||||
'<circle cx="82" cy="144" r="5"/><circle cx="100" cy="144" r="5"/><circle cx="118" cy="144" r="5"/>' +
|
||||
'</g>' +
|
||||
'<path class="handset" d="M26 52 Q26 30 50 30 L150 30 Q174 30 174 52 L174 58 Q174 66 164 66 L142 66 Q132 66 132 56 L132 48 L68 48 L68 56 Q68 66 58 66 L36 66 Q26 66 26 58 Z"/>' +
|
||||
'</g>' +
|
||||
'<g class="waves">' +
|
||||
'<path d="M178 18 q12 12 0 26"/><path d="M188 10 q20 20 0 42"/>' +
|
||||
'<path d="M22 18 q-12 12 0 26"/><path d="M12 10 q-20 20 0 42"/>' +
|
||||
'</g></svg>';
|
||||
|
||||
const PHONE_OFFHOOK = ['dialtone', 'digits', 'calling', 'talking', 'busy'];
|
||||
|
||||
// Kept here rather than in netstat.css: netstat_dark.css pulls that file in with
|
||||
// a plain @import, which browsers keep cached across package updates.
|
||||
const PHONE_CSS = `
|
||||
.netstat-box.is-phone { flex: 0.8 1 0 !important; align-items: center !important; }
|
||||
.ns-phone-art { color: var(--ns-status-up) !important; }
|
||||
.netstat-box.is-down .ns-phone-art { color: var(--ns-status-down) !important; opacity: 0.7; }
|
||||
.ns-phone-art svg { display: block; width: 46px; height: 40px; overflow: visible; margin: 2px auto 4px; }
|
||||
.ns-phone-art .body, .ns-phone-art .handset { fill: currentColor; }
|
||||
.ns-phone-art .key { fill: var(--ns-bg); }
|
||||
.ns-phone-art .cord, .ns-phone-art .waves path { fill: none; stroke: currentColor; stroke-width: 6; stroke-linecap: round; }
|
||||
.ns-phone-art .waves path { opacity: 0; }
|
||||
.ns-phone-art .handset { transition: transform 0.45s cubic-bezier(.3, 1.4, .5, 1); transform-origin: 100px 52px; }
|
||||
.is-offhook .ns-phone-art .handset { transform: translate(-6px, -34px) rotate(-14deg); }
|
||||
.is-ringing .ns-phone-art .shake { animation: ns-phone-shake 0.18s infinite; transform-origin: 100px 120px; }
|
||||
.is-ringing .ns-phone-art .waves path { animation: ns-phone-wave 1s infinite; }
|
||||
.is-ringing .ns-phone-art .waves path:nth-child(2) { animation-delay: 0.2s; }
|
||||
@keyframes ns-phone-shake { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
|
||||
@keyframes ns-phone-wave { 0% { opacity: 0; } 40% { opacity: 1; } 100% { opacity: 0; } }
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.is-ringing .ns-phone-art .shake { animation: none; }
|
||||
.is-ringing .ns-phone-art .waves path { animation: none; opacity: 1; }
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.netstat-box.is-phone { flex: 1 1 100% !important; order: 6 !important; }
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.netstat-box.is-phone { order: 7 !important; }
|
||||
}`;
|
||||
|
||||
function updatePhoneCard(card, phone) {
|
||||
const lifted = phone.on && (phone.offhook || PHONE_OFFHOOK.includes(phone.state));
|
||||
const ringing = phone.on && phone.state === 'ringing';
|
||||
card.className = 'netstat-box is-phone ' + (phone.on ? 'is-up' : 'is-down') +
|
||||
(lifted ? ' is-offhook' : '') + (ringing ? ' is-ringing' : '');
|
||||
patchText(card, '.netstat-center-status', !phone.on ? _('Off') :
|
||||
ringing ? _('Ringing') : phone.state === 'talking' ? _('In call') : _('On'));
|
||||
}
|
||||
|
||||
function createPhoneCard(phone) {
|
||||
if (!document.getElementById('ns-phone-css'))
|
||||
document.head.appendChild(E('style', { id: 'ns-phone-css' }, PHONE_CSS));
|
||||
|
||||
const art = E('div', { class: 'ns-phone-art' });
|
||||
art.innerHTML = PHONE_SVG;
|
||||
const card = E('div', { class: 'netstat-box is-phone' }, [
|
||||
art,
|
||||
E('div', { class: 'netstat-center-status' }),
|
||||
E('div', { class: 'netstat-label' }, _('phone'))
|
||||
]);
|
||||
updatePhoneCard(card, phone);
|
||||
return card;
|
||||
}
|
||||
|
||||
// ─── Inline SVG icons ─────────────────────────────────────────────────────────
|
||||
function svgIcon(path, color) {
|
||||
const ns = 'http://www.w3.org/2000/svg';
|
||||
@@ -456,6 +533,9 @@ function updateContainer(container, data, dt) {
|
||||
patchText(center, '.netstat-center-ip', data.ip || 'N/A');
|
||||
}
|
||||
|
||||
const phoneCard = container.querySelector('.is-phone');
|
||||
if (phoneCard && data.phone) updatePhoneCard(phoneCard, data.phone);
|
||||
|
||||
// totals
|
||||
const totals = container.querySelectorAll('.is-total');
|
||||
if (totals[0]) {
|
||||
@@ -594,11 +674,12 @@ return baseclass.extend({
|
||||
createTempCard(data.cpu_temp != null ? data.cpu_temp : null,
|
||||
formatUptime(data.uptime || 0)),
|
||||
createStatusCard(data.status || 'Disconnected', data.ip),
|
||||
data.phone ? createPhoneCard(data.phone) : null,
|
||||
createInfoCard(data.mem_pct || 0, data.mem_used || 0, data.mem_total || 0,
|
||||
data.disk_pct || 0, data.disk_used || 0, data.disk_total || 0),
|
||||
createStatBox(_('downloaded'), totalRx[0], totalRx[1], 'is-total is-downloaded'),
|
||||
createStatBox(_('uploaded'), totalTx[0], totalTx[1], 'is-total is-uploaded'),
|
||||
]);
|
||||
].filter(Boolean));
|
||||
|
||||
const container = E('div', { class: 'stats-grid netstat-wrap' }, row);
|
||||
_container = container;
|
||||
|
||||
@@ -193,8 +193,28 @@ function getNetdevStats()
|
||||
end
|
||||
end
|
||||
|
||||
-- ── RJ11 phone port (fxsd on the AW1000), left out when not installed ─────
|
||||
local phone = nil
|
||||
if nfs.access("/usr/sbin/fxsd") then
|
||||
local st = {}
|
||||
local sf = io.open("/var/run/fxsd.state", "r")
|
||||
if sf then
|
||||
for line in sf:lines() do
|
||||
local k, v = line:match("^(%w+)=(.*)$")
|
||||
if k then st[k] = v end
|
||||
end
|
||||
sf:close()
|
||||
end
|
||||
uci:unload("fxs")
|
||||
local on = os.execute("pidof fxsd >/dev/null 2>&1") == 0
|
||||
and uci:get("fxs", "main", "enabled") ~= "0"
|
||||
and (st.state or "stopped") ~= "stopped"
|
||||
phone = { on = on, state = st.state or "stopped", offhook = st.offhook == "1" }
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({ stats = stats, ip = ip, ip_source = ip_source,
|
||||
phone = phone,
|
||||
status = status,
|
||||
prefer_iface = prefer_iface,
|
||||
vnstat_total = vnstat_total,
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-theme-7dollar
|
||||
PKG_VERSION:=1.0.16
|
||||
PKG_RELEASE:=1
|
||||
PKG_VERSION:=1.0.17
|
||||
PKG_RELEASE:=2
|
||||
|
||||
LUCI_TITLE:=7Dollar — an elegant, lightweight LuCI theme
|
||||
LUCI_DESCRIPTION:=A calm, card based LuCI theme with five palettes, light/dark mode, \
|
||||
@@ -16,6 +16,11 @@ LUCI_DESCRIPTION:=A calm, card based LuCI theme with five palettes, light/dark m
|
||||
LUCI_DEPENDS:=+luci-base
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
# Ship CSS and JS as written. The buildroot's minifiers predate what the theme uses: csstidy
|
||||
# drops @container (the home page then falls into one column), jsmin misreads some regex literals.
|
||||
LUCI_MINIFY_CSS:=0
|
||||
LUCI_MINIFY_JS:=0
|
||||
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
PKG_MAINTAINER:=itsmaiGe <https://github.com/itsmaiGe>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<p align="center">
|
||||
<img alt="OpenWrt" src="https://img.shields.io/badge/OpenWrt-23.05%20%7C%2024.10%20%7C%2025.12-D97757?style=flat-square">
|
||||
<img alt="Size" src="https://img.shields.io/badge/size-48%20KB-8A7F72?style=flat-square">
|
||||
<img alt="Size" src="https://img.shields.io/badge/size-49%20KB-8A7F72?style=flat-square">
|
||||
<img alt="License" src="https://img.shields.io/badge/license-Apache--2.0-5B6F9A?style=flat-square">
|
||||
</p>
|
||||
|
||||
@@ -49,7 +49,7 @@ LuCI 原有功能全部保留,只调整了显示方式。
|
||||
- **5 套配色**:陶土、青瓷、雾蓝、暮紫、石墨,均有浅色和深色,可跟随系统设置
|
||||
- **应用卡片(可选)**:默认关闭。开启后,首页列出正在运行的插件,适用于任意插件。常见插件会额外显示一项关键信息,例如 OpenClash 代理模式(可直接切换)、PassWall 当前节点、文件共享剩余空间。信息只从插件配置中读取,不调用插件接口
|
||||
- **自适应布局**:在手机、平板和页面缩放时自动调整排版
|
||||
- **轻量**:不加载外部字体,不发起外部请求;CSS 16 KB(gzip),安装包 48 KB
|
||||
- **轻量**:不加载外部字体,不发起外部请求;CSS 16 KB(gzip),安装包 49 KB
|
||||
- **兼容原生页面**:LuCI 功能保持不变,原生图标统一为主题风格
|
||||
- **信息分层**:Wi‑Fi、接口和状态页默认只显示常用信息,MAC、BSSID、数据包数等内容点击「详情」查看
|
||||
|
||||
@@ -80,7 +80,7 @@ LuCI 原有功能全部保留,只调整了显示方式。
|
||||
|
||||
适用于 23.05 / 24.10。25.x 请使用方法二。
|
||||
|
||||
1. 下载安装包:[luci-theme-7dollar_1.0.16-r1_all.ipk](https://github.com/itsmaiGe/luci-theme-7dollar/releases/latest/download/luci-theme-7dollar_1.0.16-r1_all.ipk)(历史版本见 [Releases](https://github.com/itsmaiGe/luci-theme-7dollar/releases))
|
||||
1. 下载安装包:[luci-theme-7dollar_1.0.17-r1_all.ipk](https://github.com/itsmaiGe/luci-theme-7dollar/releases/latest/download/luci-theme-7dollar_1.0.17-r1_all.ipk)(历史版本见 [Releases](https://github.com/itsmaiGe/luci-theme-7dollar/releases))
|
||||
2. 在浏览器中打开路由器后台(通常为 `192.168.1.1`),输入密码登录
|
||||
3. 打开 **系统 → 软件包 → 上传软件包…**,选择下载的文件,点击 **上传**,再点击 **安装**
|
||||
4. 刷新页面(Windows 按 <kbd>F5</kbd>,Mac 按 <kbd>⌘ R</kbd>)
|
||||
@@ -208,9 +208,9 @@ install.sh / uninstall.sh 安装 / 卸载脚本
|
||||
- Optional Apps card (off by default): lists whatever plugins are running. Popular ones get one line that matters (OpenClash proxy-mode switch, PassWall node, file-sharing free space…), read from their config, never from their API.
|
||||
- Native LuCI pages restyled, icons included
|
||||
- Status pages (Wi‑Fi, interfaces, overview) show the essentials; MACs, BSSIDs, packet counts and the like sit behind *Details*
|
||||
- Responsive and zoom-friendly; no external fonts or requests; 48 KB package
|
||||
- Responsive and zoom-friendly; no external fonts or requests; 49 KB package
|
||||
|
||||
**Install**: upload [the ipk](https://github.com/itsmaiGe/luci-theme-7dollar/releases/latest/download/luci-theme-7dollar_1.0.16-r1_all.ipk) via *System → Software → Upload Package* (23.05 / 24.10), or run over SSH on any version (picks the ipk or the [apk](https://github.com/itsmaiGe/luci-theme-7dollar/tree/main/dist) automatically):
|
||||
**Install**: upload [the ipk](https://github.com/itsmaiGe/luci-theme-7dollar/releases/latest/download/luci-theme-7dollar_1.0.17-r1_all.ipk) via *System → Software → Upload Package* (23.05 / 24.10), or run over SSH on any version (picks the ipk or the [apk](https://github.com/itsmaiGe/luci-theme-7dollar/tree/main/dist) automatically):
|
||||
|
||||
```sh
|
||||
wget -qO- https://raw.githubusercontent.com/itsmaiGe/luci-theme-7dollar/main/install.sh | sh
|
||||
|
||||
@@ -1 +1 @@
|
||||
luci-theme-7dollar-1.0.16-r1.apk
|
||||
luci-theme-7dollar-1.0.17-r1.apk
|
||||
@@ -1 +1 @@
|
||||
luci-theme-7dollar_1.0.16-r1_all.ipk
|
||||
luci-theme-7dollar_1.0.17-r1_all.ipk
|
||||
@@ -169,6 +169,7 @@ kbd{font:11px var(--sans);padding:1px 6px;border:1px solid var(--line);border-ra
|
||||
.td-pop-box{width:min(560px,100%);max-height:70vh;display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--line-soft);border-radius:18px;box-shadow:var(--shadow-pop);overflow:hidden;animation:td-rise var(--base) var(--ease)}
|
||||
/* exits get their own keyframes: reusing td-fade/td-rise would not restart the finished entrance */
|
||||
.td-pop.td-out,.td-toast.td-out{animation:td-out var(--fast) var(--ease) both}
|
||||
.td-pop.td-out{pointer-events:none}
|
||||
.td-out .td-pop-box{animation:td-sink var(--fast) var(--ease) both}
|
||||
@keyframes td-out{to{opacity:0}}
|
||||
@keyframes td-sink{to{opacity:0;transform:translateY(6px)}}
|
||||
@@ -662,7 +663,7 @@ body.modal-overlay-active .modal{transform:none;transition-duration:var(--base)}
|
||||
.td-node.bad .ic{background:var(--bad-soft);color:var(--bad)}
|
||||
.td-node .ic svg{width:24px;height:24px}
|
||||
.td-node b{font-weight:500;margin-top:10px;font-size:14px;max-width:100%;overflow-wrap:anywhere}
|
||||
.td-node small{color:var(--ink-3);font-size:12.5px}
|
||||
.td-node small{color:var(--ink-3);font-size:12.5px;max-width:100%;overflow-wrap:anywhere}
|
||||
.td-link{flex:1 1 0;min-width:18px;display:flex;flex-direction:column;align-items:center;gap:6px;padding-top:clamp(6px,2.6cqi,12px)}
|
||||
.td-link .t{font-size:12px;color:var(--ink-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;line-height:17px}
|
||||
.td-link .ln{position:relative;width:100%;height:2px;background:repeating-linear-gradient(90deg,var(--line) 0 6px,transparent 6px 11px)}
|
||||
@@ -671,7 +672,7 @@ body.modal-overlay-active .modal{transform:none;transition-duration:var(--base)}
|
||||
.td-link.down .ln i{display:none}
|
||||
.td-link.down .ln{background:repeating-linear-gradient(90deg,var(--bad) 0 6px,transparent 6px 11px);opacity:.6}
|
||||
@keyframes td-flow{from{left:0;opacity:0}15%,85%{opacity:1}to{left:calc(100% - 8px);opacity:0}}
|
||||
@container (max-width:430px){.td-link .t{visibility:hidden}.td-node small{display:none}}
|
||||
@container (max-width:430px){.td-link .t{visibility:hidden}}
|
||||
.td-facts{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:14px 8px;margin:22px 0 0;padding-top:18px;border-top:1px solid var(--line-soft)}
|
||||
.td-facts dt{font-size:12.5px;color:var(--ink-3);font-weight:400}
|
||||
.td-facts dd{font-size:14.5px;margin:3px 0 0;overflow-wrap:anywhere;color:var(--ink)}
|
||||
|
||||
@@ -32,7 +32,7 @@ const callInfo = rpc.declare({ object: 'system', method: 'info' });
|
||||
const callServices = rpc.declare({ object: 'service', method: 'list', expect: { '': {} } });
|
||||
const callMounts = rpc.declare({ object: 'luci', method: 'getMountPoints', expect: { result: [] } });
|
||||
|
||||
const DEFAULTS = { palette: 'clay', mode: 'auto', hidden_cards: '', shown_cards: '' };
|
||||
const DEFAULTS = { palette: 'clay', mode: 'auto', hidden_cards: '', shown_cards: '', rate_unit: 'bit' };
|
||||
const OPT_IN = [ 'apps' ]; // cards that are off until switched on (they show plugin information)
|
||||
|
||||
const words = s => String(s || '').split(/[\s,]+/).filter(Boolean);
|
||||
@@ -306,6 +306,12 @@ function motion(name) {
|
||||
}
|
||||
|
||||
/* Exits mirror entrances: fade (and sink) out, then go. */
|
||||
/* A toggle button's state, for the eye (class) and for screen readers (aria-pressed) alike. */
|
||||
function press(el, on) {
|
||||
el.classList.toggle('on', on);
|
||||
el.setAttribute('aria-pressed', on);
|
||||
}
|
||||
|
||||
function leave(el) {
|
||||
if (el.classList.contains('td-out')) return;
|
||||
el.classList.add('td-out');
|
||||
@@ -338,7 +344,17 @@ function toast(msg) {
|
||||
|
||||
/* ---------------- formatting ---------------- */
|
||||
|
||||
function rate(bytesPerSec) {
|
||||
/* Live speed as [ number, unit ]: bits per second like broadband plans (Mbps), or bytes per
|
||||
* second like download tools (MB/s) when the user picked that. */
|
||||
function rate(bytesPerSec, inBytes) {
|
||||
if (inBytes) {
|
||||
const n = Math.max(0, bytesPerSec);
|
||||
if (n >= 1073741824) return [ (n / 1073741824).toFixed(2), 'GB/s' ];
|
||||
if (n >= 1048576) return [ (n / 1048576).toFixed(n >= 104857600 ? 0 : 1), 'MB/s' ];
|
||||
if (n >= 1024) return [ (n / 1024).toFixed(0), 'KB/s' ];
|
||||
return [ n.toFixed(0), 'B/s' ];
|
||||
}
|
||||
|
||||
const bits = Math.max(0, bytesPerSec * 8);
|
||||
if (bits >= 1e9) return [ (bits / 1e9).toFixed(2), 'Gbps' ];
|
||||
if (bits >= 1e6) return [ (bits / 1e6).toFixed(bits >= 1e8 ? 0 : 1), 'Mbps' ];
|
||||
@@ -684,7 +700,7 @@ return baseclass.extend({
|
||||
PALETTES: PALETTES, OPT_IN: OPT_IN, words: words, cardOn: cardOn,
|
||||
esc: esc, icon: icon, html: html,
|
||||
loadMenu: loadMenu, flatten: flatten, realNode: realNode, menuHas: menuHas, software: software, grouped: grouped, appIcon: appIcon, service: service,
|
||||
loadSettings: loadSettings, saveSettings: saveSettings, applyLook: applyLook, toast: toast, motion: motion, leave: leave,
|
||||
loadSettings: loadSettings, saveSettings: saveSettings, applyLook: applyLook, toast: toast, motion: motion, leave: leave, press: press,
|
||||
rate: rate, bytes: bytes, duration: duration, signal: signal, quality: quality, bandName: bandName, connName: connName,
|
||||
readFile: readFile, temperature: temperature, wifiInfo: wifiInfo, clients: clients, wan: wan, ports: ports, dnsName: dnsName, netdev: netdev, cpuStat: cpuStat,
|
||||
board: () => L.resolveDefault(callBoard(), {}),
|
||||
|
||||
@@ -107,7 +107,7 @@ return baseclass.extend({
|
||||
if (items.length < 2) return;
|
||||
|
||||
/* everyday pages first; the rest wait behind "More" unless one of them is open */
|
||||
const pill = (p, cls) => `<a href="${L.url(p.path)}" class="${p === current ? 'on' : cls || ''}">${esc(p.title)}</a>`;
|
||||
const pill = (p, cls) => `<a href="${L.url(p.path)}" ${p === current ? 'class="on" aria-current="page"' : `class="${cls || ''}"`}>${esc(p.title)}</a>`;
|
||||
const rest = items.filter(p => g.pages.indexOf(p.path) < 0);
|
||||
const fold = rest.length > 1 && rest.indexOf(current) < 0;
|
||||
box.innerHTML = (fold ? items.filter(p => rest.indexOf(p) < 0) : items).map(p => pill(p)).join('')
|
||||
@@ -171,9 +171,10 @@ return baseclass.extend({
|
||||
openSearch() {
|
||||
if (document.querySelector('.td-pop:not(.td-out)')) return;
|
||||
|
||||
const pop = td.html(`<div class="td-pop" role="dialog" aria-modal="true">
|
||||
const from = document.activeElement;
|
||||
const pop = td.html(`<div class="td-pop" role="dialog" aria-modal="true" aria-label="${esc(T('搜索', 'Search'))}">
|
||||
<div class="td-pop-box">
|
||||
<label class="td-pop-in">${icon('search')}<input type="search" placeholder="${esc(T('搜索功能或设置,例如“端口转发”', 'Search pages and settings'))}" autocomplete="off"><kbd>Esc</kbd></label>
|
||||
<label class="td-pop-in">${icon('search')}<input type="search" aria-label="${esc(T('搜索功能或设置', 'Search pages and settings'))}" placeholder="${esc(T('搜索功能或设置,例如“端口转发”', 'Search pages and settings'))}" autocomplete="off"><kbd>Esc</kbd></label>
|
||||
<div class="td-pop-list"></div>
|
||||
</div></div>`);
|
||||
document.body.appendChild(pop);
|
||||
@@ -194,14 +195,15 @@ return baseclass.extend({
|
||||
if (on) on.scrollIntoView({ block: 'nearest' });
|
||||
};
|
||||
|
||||
const close = () => td.leave(pop);
|
||||
/* closing hands the keyboard back to whatever opened the search */
|
||||
const close = pop._close = () => { td.leave(pop); if (from && from.focus) from.focus() };
|
||||
|
||||
input.addEventListener('input', () => { sel = 0; draw() });
|
||||
input.addEventListener('keydown', ev => {
|
||||
if (ev.key == 'ArrowDown') { sel = Math.min(sel + 1, shown.length - 1); draw(); ev.preventDefault() }
|
||||
else if (ev.key == 'ArrowUp') { sel = Math.max(sel - 1, 0); draw(); ev.preventDefault() }
|
||||
else if (ev.key == 'Enter' && shown[sel]) { location.href = L.url(shown[sel].path) }
|
||||
else if (ev.key == 'Escape') close();
|
||||
else if (ev.key == 'Tab') ev.preventDefault(); // the arrows move through the results; Tab must not wander to the page behind
|
||||
});
|
||||
list.addEventListener('mousemove', ev => {
|
||||
const a = ev.target.closest('a[data-i]');
|
||||
@@ -220,9 +222,9 @@ return baseclass.extend({
|
||||
|
||||
const rest = (this.groups || []).filter(g => g.mob === false || g.id == 'system');
|
||||
const body = rest.map(g => `<div class="grp">${esc(g.label)}</div>` +
|
||||
g.list.map(p => `<a href="${L.url(p.path)}" class="${this.current === p ? 'on' : ''}">${icon(g.id == 'apps' ? td.appIcon(p.path) : g.icon)}<span>${esc(p.title)}</span></a>`).join('')).join('');
|
||||
g.list.map(p => `<a href="${L.url(p.path)}"${this.current === p ? ' class="on" aria-current="page"' : ''}>${icon(g.id == 'apps' ? td.appIcon(p.path) : g.icon)}<span>${esc(p.title)}</span></a>`).join('')).join('');
|
||||
|
||||
const pop = td.html(`<div class="td-pop" role="dialog" aria-modal="true"><div class="td-pop-box">
|
||||
const pop = td.html(`<div class="td-pop" role="dialog" aria-modal="true" aria-label="${esc(T('更多', 'More'))}"><div class="td-pop-box">
|
||||
<div class="td-pop-list">${body}</div>
|
||||
<div class="td-sheet-tools">
|
||||
<button class="btn" type="button" data-act="search">${icon('search')}${esc(T('搜索', 'Search'))}</button>
|
||||
@@ -249,6 +251,10 @@ return baseclass.extend({
|
||||
const typing = /^(INPUT|TEXTAREA|SELECT)$/.test((ev.target || {}).tagName || '') || (ev.target || {}).isContentEditable;
|
||||
if ((ev.key == 'k' || ev.key == 'K') && (ev.metaKey || ev.ctrlKey)) { ev.preventDefault(); this.openSearch() }
|
||||
else if (ev.key == '/' && !typing && !document.body.classList.contains('modal-overlay-active')) { ev.preventDefault(); this.openSearch() }
|
||||
else if (ev.key == 'Escape') { // closes the search or the phone sheet, whichever is open
|
||||
const pop = document.querySelector('.td-pop:not(.td-out)');
|
||||
if (pop) (pop._close || (() => td.leave(pop)))();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ return view.extend({
|
||||
<h3 class="td-sect-t">${esc(T('首页卡片', 'Home cards'))}</h3>
|
||||
<p class="td-sect-d">${esc(T('“网络连接”卡片始终显示。', 'The Connection card is always shown.'))}</p>
|
||||
<div class="td-rows">${cards}</div>
|
||||
<div class="td-row"><div class="lb"><b>${esc(T('速率单位', 'Speed unit'))}</b></div>
|
||||
<div class="td-seg" id="td-units"><button type="button" data-m="bit">Mbps</button><button type="button" data-m="byte">MB/s</button></div></div>
|
||||
</section>
|
||||
|
||||
<div class="td-hint">${icon('info')}<span>${esc(T('换回原主题:系统 → 通用 → 语言和界面', 'Switch back: System → General → Language and Style'))}</span></div>
|
||||
@@ -65,6 +67,7 @@ return view.extend({
|
||||
|
||||
root.querySelectorAll('[data-pick]').forEach(b => b.addEventListener('click', () => this.update({ palette: b.dataset.pick })));
|
||||
root.querySelectorAll('#td-modes button').forEach(b => b.addEventListener('click', () => this.update({ mode: b.dataset.m })));
|
||||
root.querySelectorAll('#td-units button').forEach(b => b.addEventListener('click', () => this.update({ rate_unit: b.dataset.m })));
|
||||
root.querySelectorAll('[data-card]').forEach(b => b.addEventListener('click', () => {
|
||||
const k = b.dataset.card, field = td.OPT_IN.indexOf(k) > -1 ? 'shown_cards' : 'hidden_cards';
|
||||
const list = td.words(this.conf[field]), i = list.indexOf(k);
|
||||
@@ -85,9 +88,10 @@ return view.extend({
|
||||
|
||||
sync() {
|
||||
const c = this.conf;
|
||||
this.root.querySelectorAll('.td-pal').forEach(b => b.classList.toggle('on', b.dataset.pick == c.palette));
|
||||
this.root.querySelectorAll('#td-modes button').forEach(b => b.classList.toggle('on', b.dataset.m == c.mode));
|
||||
this.root.querySelectorAll('[data-card]').forEach(b => b.classList.toggle('on', td.cardOn(c, b.dataset.card)));
|
||||
this.root.querySelectorAll('.td-pal').forEach(b => td.press(b, b.dataset.pick == c.palette));
|
||||
this.root.querySelectorAll('#td-modes button').forEach(b => td.press(b, b.dataset.m == c.mode));
|
||||
this.root.querySelectorAll('#td-units button').forEach(b => td.press(b, b.dataset.m == c.rate_unit));
|
||||
this.root.querySelectorAll('[data-card]').forEach(b => td.press(b, td.cardOn(c, b.dataset.card)));
|
||||
},
|
||||
|
||||
update(patch) {
|
||||
|
||||
@@ -81,6 +81,7 @@ return view.extend({
|
||||
const software = td.software(menu);
|
||||
|
||||
this.s = {
|
||||
inBytes: conf.rate_unit == 'byte',
|
||||
down: new Array(N).fill(0), up: new Array(N).fill(0),
|
||||
last: null, cpu: td.cpuStat(stat), cpuPct: null, wan: wan, wifi: wifi || { radios: {}, aps: [] }, info: info, board: board,
|
||||
clients: [], ping: null, apps: apps, hasWifi: !!(wifi && Object.keys(wifi.radios).length), mode: mode
|
||||
@@ -269,6 +270,8 @@ return view.extend({
|
||||
|
||||
if (!ok) {
|
||||
this.set('td-proto', T('没有连接', 'Not connected'));
|
||||
[ 'td-wanip', 'td-dns', 'td-wanup', 'td-ping' ].forEach(id => this.set(id, '—')); // not the last connection's values
|
||||
this.set('td-lat', T('未连接', 'Offline'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -402,7 +405,7 @@ return view.extend({
|
||||
const rx = Math.max(0, (d.rx - this.s.last.rx) / dt), tx = Math.max(0, (d.tx - this.s.last.tx) / dt);
|
||||
this.s.down.push(rx); this.s.down.shift();
|
||||
this.s.up.push(tx); this.s.up.shift();
|
||||
const [ dv, du ] = td.rate(rx), [ uv, uu ] = td.rate(tx);
|
||||
const [ dv, du ] = td.rate(rx, this.s.inBytes), [ uv, uu ] = td.rate(tx, this.s.inBytes);
|
||||
this.set('td-down', dv); this.set('td-down-u', du);
|
||||
this.set('td-up', uv); this.set('td-up-u', uu);
|
||||
this.drawChart();
|
||||
@@ -493,13 +496,14 @@ return view.extend({
|
||||
|
||||
pingGateway() {
|
||||
const w = this.s.wan;
|
||||
if (!w || !w.gw || !/^[0-9.]+$/.test(w.gw)) {
|
||||
if (!w || !w.up || !w.gw || !/^[0-9.]+$/.test(w.gw)) {
|
||||
this.set('td-lat', w && w.up ? T('已连接', 'Connected') : T('未连接', 'Offline'));
|
||||
return Promise.resolve();
|
||||
}
|
||||
/* a gateway that never answers ping (many ISP modems) is retried every few minutes, not every 30 s */
|
||||
if (this.s.miss >= 3 && this.ticks % 18) return Promise.resolve();
|
||||
return L.resolveDefault(fs.exec('/bin/ping', [ '-c', '1', '-W', '1', w.gw ]), {}).then(r => {
|
||||
if (!this.s.wan || !this.s.wan.up || this.s.wan.gw != w.gw) return; // the connection changed while we waited
|
||||
const m = String((r || {}).stdout || '').match(/time[=<]([\d.]+)/);
|
||||
const v = m ? (+m[1] < 1 ? '<1' : Math.round(+m[1])) + ' ms' : null;
|
||||
this.s.miss = v ? 0 : (this.s.miss || 0) + 1;
|
||||
@@ -537,7 +541,7 @@ return view.extend({
|
||||
/* OpenClash's proxy mode, switched through its own switch_rule_mode call */
|
||||
ocSwitch(seg) {
|
||||
let mode = seg.dataset.oc;
|
||||
const mark = m => seg.querySelectorAll('button').forEach(b => b.classList.toggle('on', b.dataset.m == m));
|
||||
const mark = m => seg.querySelectorAll('button').forEach(b => td.press(b, b.dataset.m == m));
|
||||
mark(mode);
|
||||
seg.addEventListener('click', ev => {
|
||||
const b = ev.target.closest('button[data-m]');
|
||||
|
||||
@@ -16,7 +16,6 @@ own() { if $TAR --version | grep -q GNU; then echo "--format=gnu --owner=0 --gro
|
||||
|
||||
# ---- data ----
|
||||
D=$TMP/data
|
||||
sh scripts/check-jsmin.sh
|
||||
sh scripts/stage.sh "$D"
|
||||
SIZE=$(du -sk "$D" | cut -f1)
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Source builds (feeds / SDK) minify our JS with LuCI's jsmin, which is stricter than a browser:
|
||||
# for one, it misreads a regex literal that follows `return`. Run every script through the same
|
||||
# jsmin and make sure the result still parses. Needs cc, curl and node; skipped without them.
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
T=${TMPDIR:-/tmp}/7dollar-jsmin
|
||||
mkdir -p "$T"
|
||||
if [ ! -x "$T/jsmin" ]; then
|
||||
curl -sfL -o "$T/jsmin.c" https://raw.githubusercontent.com/openwrt/luci/master/modules/luci-base/src/jsmin.c \
|
||||
&& cc -o "$T/jsmin" "$T/jsmin.c" 2>/dev/null || { echo "check-jsmin: skipped (no cc or network)"; exit 0; }
|
||||
fi
|
||||
bad=0
|
||||
for f in $(find htdocs -name '*.js'); do
|
||||
"$T/jsmin" < "$f" > "$T/out.js" 2>/dev/null || continue # jsmin gave up: the buildroot then ships the file as it is
|
||||
node -e "new Function(require('fs').readFileSync('$T/out.js','utf8'))" 2>/dev/null || { echo "check-jsmin: $f breaks after jsmin"; bad=1; }
|
||||
done
|
||||
exit $bad
|
||||
@@ -13,7 +13,7 @@
|
||||
const mode = (conf.mode in [ 'light', 'dark', 'auto' ]) ? conf.mode : 'auto';
|
||||
const zh = !!match(dispatcher.lang ?? '', /^zh/);
|
||||
const T = (z, e) => zh ? z : e;
|
||||
const ver = '1.0.16';
|
||||
const ver = '1.0.17';
|
||||
const hostname = striptags(boardinfo.hostname ?? 'OpenWrt');
|
||||
const model = striptags(boardModel(boardinfo));
|
||||
const sprite = `${media}/icons.svg`;
|
||||
@@ -39,6 +39,10 @@
|
||||
{% if (css): %}
|
||||
<style title="text/css">{{ css }}</style>
|
||||
{% endif %}
|
||||
{# LuCI adds ?v= to every script it loads, taken from the first luci.js tag on the page. Its own
|
||||
value does not change when only the theme does (same firmware build date, a newer theme),
|
||||
so browsers kept mixing old and new theme files. This inert tag puts our version in. #}
|
||||
<script type="text/plain" src="{{ resource }}/luci.js?v={{ version.luciversion }}-{{ pkgs_update_time ?? 0 }}-{{ ver }}"></script>
|
||||
<script src="{{ dispatcher.build_url('admin/translations', dispatcher.lang) }}"></script>
|
||||
<script src="{{ resource }}/cbi.js?v={{ version.luciversion }}"></script>
|
||||
</head>
|
||||
|
||||
@@ -10,7 +10,7 @@ LUCI_DEPENDS:=+luci-base +curl +ca-bundle +flock
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_VERSION:=1.1.5
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
PKG_LICENSE:=Apache-2.0
|
||||
|
||||
# Keep modern CSS/JS intact (csstidy/jsmin do not understand
|
||||
|
||||
@@ -29,6 +29,7 @@ A clean, glass-style LuCI theme for OpenWrt — built for everyday users.
|
||||
## Features
|
||||
|
||||
- **Dashboard** on *Status → Overview*: live traffic chart for any interface, CPU / memory / storage rings, memory breakdown, load sparkline, connection count, uptime, temperature sensors (thermal zones and hwmon), WAN IPv4/IPv6, connected devices and interface status. LuCI's original status widgets are kept behind *Show detailed status* and stop polling while collapsed.
|
||||
- **Device upload/download speeds**: when an existing `nlbwmon` collector is available, Carbon reads its per-MAC counters and displays sampled averages at the configured collection interval (normally 30 seconds, minimum display interval 5 seconds). Only traffic observed by this router is included; bridge traffic, offloaded traffic and traffic through other gateways may be missing. The theme does not install or start a collector, change its settings, or modify firewall/offload rules. Unsupported systems keep the existing device list; initial samples, missing records and counter resets show `—`. Reads pause while the page is hidden. DHCP leases and their remaining time are independent of speed readings.
|
||||
- **Discovered devices** — DHCPv4/v6 leases, Wi‑Fi stations (band and signal) and IPv4 ARP neighbours are merged by MAC. Discovery still works with the local DHCP server disabled, including when LAN obtains its own address by DHCP. Gateways, neighbour entries and DHCP leases are labelled separately; a missing local lease does not imply a fixed IP. Devices are recognised by hostname and MAC vendor prefix (35 brands, ~9,200 IEEE OUI prefixes). The count includes devices known to this router, possibly offline ones, and is not a live census of the entire network. Recognisable separate uplinks are excluded; a gateway sharing LAN is retained and labelled. Without an interface named `lan`, custom interface roles may be ambiguous, so discoveries on those interfaces are retained.
|
||||
- **Simple / Pro navigation** — *Simple* shows only the pages most people need (overview, internet, Wi‑Fi, software, password, backup, reboot); *Pro* shows the full LuCI menu with an icon for every page.
|
||||
- **Frosted-glass sidebar** that collapses into an icon rail (button on the sidebar edge or <kbd>Ctrl</kbd>/<kbd>⌘</kbd> + <kbd>\\</kbd>); hovering a rail icon opens its sub-menu.
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
## 功能
|
||||
|
||||
- **仪表盘**(状态 → 概览):可选接口的实时流量图、CPU / 内存 / 存储圆环、内存构成条、负载迷你图、连接数、运行时间、温度传感器(热区与 hwmon)、外网 IPv4/IPv6、已发现设备和网络接口状态。LuCI 原有的状态信息保留在「显示详细状态」里,收起时停止轮询。
|
||||
- **设备上下行网速**:检测到已有的 `nlbwmon` 采集服务后,读取按 MAC 汇总的计数,按其现有采样周期显示平均网速(通常 30 秒,界面最快 5 秒)。仅包含本机观测到的流量,桥接、流量卸载及经过其他网关的流量可能不完整。主题不会安装或启动采集服务,不修改采样设置、防火墙或卸载规则。不支持时保留原设备列表;首次采样、记录缺失或计数重置时显示 `—`。页面隐藏时暂停读取,DHCP 租约与剩余时间独立刷新。
|
||||
- **已发现设备**:合并 DHCPv4/v6 租约、Wi‑Fi 关联列表(频段和信号)与 IPv4 ARP 邻居,按 MAC 去重。关闭本机 DHCP 服务后,仍可发现邻居和 Wi‑Fi 设备;LAN 自身通过 DHCP 获取地址也受支持。列表区分网关、邻居记录和 DHCP 租约,不把缺少本机租约的设备标为固定 IP;根据主机名和 MAC 厂商前缀识别品牌(35 个品牌,约 9200 条 IEEE OUI 前缀)。数量表示本机已发现的设备,可能包含离线设备,不代表全网实时在线数。自动排除可识别的独立上联接口;共用 LAN 的网关保留并标注。没有名为 `lan` 的接口时,自定义接口的角色可能无法判定,会保留不确定接口的发现结果。
|
||||
- **简洁 / 专业双模式**:简洁模式只显示常用功能(概览、上网、Wi‑Fi、软件包、密码、备份、重启);专业模式显示完整 LuCI 菜单,每个页面都有对应图标。
|
||||
- **毛玻璃侧栏**,可收起为只显示图标的窄栏(点侧栏边缘的圆形按钮,或按 <kbd>Ctrl</kbd>/<kbd>⌘</kbd> + <kbd>\\</kbd>),鼠标悬停图标弹出子菜单。
|
||||
|
||||
@@ -1879,6 +1879,9 @@ table { border-collapse: collapse; border-spacing: 0; }
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* LuCI keeps dropdown menus inside the cell; let an open menu extend beyond
|
||||
the last row without changing the rounded clipping of closed tables. */
|
||||
.table:has(.cbi-dropdown[open]) { overflow: visible; }
|
||||
.thead { display: table-header-group; }
|
||||
.tbody { display: table-row-group; }
|
||||
.tr { display: table-row; }
|
||||
@@ -2438,6 +2441,9 @@ textarea#syslog {
|
||||
max-width: 60%;
|
||||
}
|
||||
.cb-card-link { font-size: 13px; font-weight: 500; white-space: nowrap; }
|
||||
.cb-device-rate-note { margin: -4px 0 12px; color: var(--cb-text-2); font-size: 12px; }
|
||||
.cb-device-rates { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; color: var(--cb-text-2); }
|
||||
.cb-device-rate { font-family: var(--cb-mono); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
|
||||
/* hero */
|
||||
.cb-hero {
|
||||
@@ -2889,7 +2895,10 @@ body:has(#maincontent .table) { --cb-content-max: var(--cb-content-wide); }
|
||||
text-overflow: ellipsis;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.table .td.cbi-dropdown-open { overflow: visible; }
|
||||
/* Plugin cells may contain a dropdown without LuCI's .cbi-value-field,
|
||||
so they never receive the .cbi-dropdown-open helper class. */
|
||||
.table .td.cbi-dropdown-open,
|
||||
.table .td:has(.cbi-dropdown[open]) { overflow: visible; }
|
||||
.table .tr:hover > .td { background: transparent !important; }
|
||||
.tr.table-titles,
|
||||
.cbi-section-table-titles,
|
||||
|
||||
@@ -711,6 +711,71 @@
|
||||
schedule();
|
||||
};
|
||||
|
||||
/* LuCI's legacy realtime plots cache their pixel width at initialization.
|
||||
* Fit their existing coordinates to the current viewport without changing
|
||||
* samples, polling or the time window. Only curves and time-grid positions
|
||||
* scale horizontally; text and stroke widths retain their original size. */
|
||||
const realtimeRoots = new WeakSet();
|
||||
C.initRealtimeCharts = function (root) {
|
||||
if (!root || realtimeRoots.has(root) ||
|
||||
!/(?:^|-)status-realtime(?:-|$)/.test(document.body.getAttribute('data-page') || '')) return;
|
||||
realtimeRoots.add(root);
|
||||
const graphs = new Set();
|
||||
let pending = false;
|
||||
const schedule = () => {
|
||||
if (pending) return;
|
||||
pending = true;
|
||||
requestAnimationFrame(sync);
|
||||
};
|
||||
const resize = window.ResizeObserver ? new ResizeObserver(schedule) : null;
|
||||
function sync() {
|
||||
pending = false;
|
||||
for (const svg of graphs) {
|
||||
if (!root.contains(svg)) {
|
||||
if (resize) resize.unobserve(svg);
|
||||
graphs.delete(svg);
|
||||
}
|
||||
}
|
||||
root.querySelectorAll('#view svg').forEach((svg) => {
|
||||
// Leave modern responsive SVGs and unrelated plugin charts alone.
|
||||
if (svg.hasAttribute('viewBox') || svg.getAttribute('width') !== '100%' ||
|
||||
!svg.querySelector('#label_25') || !svg.querySelector('#label_50') || !svg.querySelector('#label_75')) return;
|
||||
if (!graphs.has(svg)) {
|
||||
graphs.add(svg);
|
||||
if (resize) resize.observe(svg);
|
||||
}
|
||||
const lines = Array.from(svg.children).filter((el) => el.localName === 'polyline');
|
||||
const drawn = lines.find((el) => el.points.numberOfItems > 1);
|
||||
if (!drawn || !svg.clientWidth) return;
|
||||
// LuCI closes each filled curve at (cached width, baseline).
|
||||
const width = drawn.points.getItem(drawn.points.numberOfItems - 1).x;
|
||||
if (!(width > 0)) return;
|
||||
const scale = svg.clientWidth / width;
|
||||
for (const el of svg.children) {
|
||||
const vertical = el.localName === 'line' &&
|
||||
el.getAttribute('x1') === el.getAttribute('x2');
|
||||
if (el.localName === 'polyline' || vertical) {
|
||||
el.setAttribute('transform', 'scale(' + scale + ' 1)');
|
||||
el.setAttribute('vector-effect', 'non-scaling-stroke');
|
||||
}
|
||||
else if (el.localName === 'text' && !el.id && el.x.baseVal.numberOfItems) {
|
||||
const x = el.x.baseVal.getItem(0).value;
|
||||
el.setAttribute('transform', 'translate(' + (x * (scale - 1)) + ' 0)');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
const watch = new MutationObserver(schedule);
|
||||
watch.observe(root, { childList: true, subtree: true, attributes: true, attributeFilter: ['points'] });
|
||||
window.addEventListener('resize', schedule, { passive: true });
|
||||
if (!resize) {
|
||||
// Older browsers: cover sidebar transitions and reduced-motion changes.
|
||||
watch.observe(rootEl, { attributes: true, attributeFilter: ['class'] });
|
||||
window.addEventListener('transitionend', schedule);
|
||||
}
|
||||
schedule();
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* Language switch (rendered once the installed catalogues are known)
|
||||
* ------------------------------------------------------------------ */
|
||||
@@ -774,6 +839,7 @@
|
||||
C.initShell = function (opts) {
|
||||
opts = opts || {};
|
||||
C.initTabs(document.getElementById('maincontent'));
|
||||
C.initRealtimeCharts(document.getElementById('maincontent'));
|
||||
C.initLeaseAvatars(document.getElementById('maincontent'));
|
||||
const body = document.body;
|
||||
const burger = document.getElementById('cb-burger');
|
||||
@@ -1267,6 +1333,8 @@
|
||||
* wireless() → ubus network.wireless status
|
||||
* stations(ifnames) → [{ ifname, mac, signal }] from iwinfo assoclist (optional)
|
||||
* neighbors() → contents of /proc/net/arp (optional)
|
||||
* deviceTraffic() → { interval: seconds, columns, data } from an existing
|
||||
* per-MAC collector (optional, read-only)
|
||||
* hostHints() → luci-rpc getHostHints (optional)
|
||||
* conntrack() → [count, max]
|
||||
* temperatures() → [{ name, value (millidegrees) }]
|
||||
@@ -1391,6 +1459,43 @@
|
||||
* → [{ macaddr, hostname, ipaddr, ip6addr, expires, lease, active, wifi, gateway }]
|
||||
* ------------------------------------------------------------------ */
|
||||
const MAC_RE = /^([0-9a-f]{2}:){5}[0-9a-f]{2}$/;
|
||||
|
||||
/* Sampled averages from cumulative per-MAC counters. Missing records, resets,
|
||||
* failed reads and suspended tabs never count as zero. Records cannot create
|
||||
* discovered devices, and query frequency never exceeds the collector cadence. */
|
||||
C.DeviceRates = function () { this.previous = null; };
|
||||
C.DeviceRates.prototype.reset = function () { this.previous = null; };
|
||||
C.DeviceRates.prototype.update = function (sample, now) {
|
||||
const invalid = () => { this.reset(); return null; };
|
||||
if (!sample || !Number.isFinite(now) || !Number.isFinite(sample.interval) || sample.interval < 5 ||
|
||||
!Array.isArray(sample.columns) || !Array.isArray(sample.data)) return invalid();
|
||||
const fields = ['mac', 'rx_bytes', 'tx_bytes'].map((k) => sample.columns.indexOf(k));
|
||||
if (fields.some((i) => i < 0)) return invalid();
|
||||
const counters = new Map();
|
||||
for (const row of sample.data) {
|
||||
if (!Array.isArray(row)) return invalid();
|
||||
const mac = String(row[fields[0]] || '').toLowerCase();
|
||||
if (!MAC_RE.test(mac) || mac === '00:00:00:00:00:00') continue;
|
||||
const rx = row[fields[1]], tx = row[fields[2]];
|
||||
if (!Number.isSafeInteger(rx) || rx < 0 || !Number.isSafeInteger(tx) || tx < 0) return invalid();
|
||||
const old = counters.get(mac) || { rx: 0, tx: 0 };
|
||||
if (!Number.isSafeInteger(old.rx + rx) || !Number.isSafeInteger(old.tx + tx)) return invalid();
|
||||
counters.set(mac, { rx: old.rx + rx, tx: old.tx + tx });
|
||||
}
|
||||
const rates = new Map(), previous = this.previous;
|
||||
const dt = previous ? (now - previous.time) / 1000 : 0;
|
||||
const continuous = previous && previous.interval === sample.interval && dt >= sample.interval && dt <= sample.interval * 2.5;
|
||||
if (continuous) counters.forEach((value, mac) => {
|
||||
const old = previous.counters.get(mac);
|
||||
if (old && value.rx >= old.rx && value.tx >= old.tx)
|
||||
rates.set(mac, { down: (value.rx - old.rx) / dt, up: (value.tx - old.tx) / dt });
|
||||
});
|
||||
// An early read must not move the baseline closer to the next sample.
|
||||
if (!previous || dt <= 0 || dt >= sample.interval || previous.interval !== sample.interval)
|
||||
this.previous = { counters: counters, interval: sample.interval, time: now };
|
||||
return { rates: rates, interval: sample.interval, seconds: continuous ? dt : null };
|
||||
};
|
||||
|
||||
C.parseArp = function (text, devices, ifs) {
|
||||
const gateways = new Set();
|
||||
(ifs || []).forEach((i) => {
|
||||
@@ -1708,9 +1813,11 @@
|
||||
ui.clientCount = h('span', { class: 'cb-count' });
|
||||
ui.clients = h('ul', { class: 'cb-list' });
|
||||
ui.clientMore = h('button', { type: 'button', class: 'cb-more hidden' });
|
||||
ui.clientRateNodes = new Map();
|
||||
ui.clientRateNote = h('p', { class: 'cb-device-rate-note hidden', title: t('Device speeds use existing traffic statistics. Only traffic observed by this router is included.') });
|
||||
dash.appendChild(h('div', { class: 'cb-card cb-clients span-8' }, [
|
||||
h('div', { class: 'cb-card-head' }, [h('h3', null, [deviceTitle(), ui.clientCount]), manage(urls.devices)]),
|
||||
ui.clients, ui.clientMore
|
||||
ui.clientRateNote, ui.clients, ui.clientMore
|
||||
]));
|
||||
|
||||
/* wireless + interfaces */
|
||||
@@ -1736,8 +1843,10 @@
|
||||
const st = {
|
||||
dev: null, devAlt: null, prevNet: null, prevCpu: null, showAll: false, devices: [], wifiCount: null,
|
||||
traffic: store.get('carbon.traffic', 'auto'), trafficKey: '', ifs: null, hints: null, hintsAt: 0, aps: null,
|
||||
netdevs: null, netdevsAt: 0
|
||||
netdevs: null, netdevsAt: 0,
|
||||
rateData: null, rateSeen: false, rateNext: 0, rateGeneration: 0
|
||||
};
|
||||
const deviceRates = new C.DeviceRates();
|
||||
const safe = (fn) => {
|
||||
if (typeof fn !== 'function') return Promise.resolve(null);
|
||||
try { return Promise.resolve(fn()).catch(() => null); }
|
||||
@@ -1755,6 +1864,7 @@
|
||||
function renderClients() {
|
||||
const list = st.devices;
|
||||
ui.clients.innerHTML = '';
|
||||
ui.clientRateNodes.clear();
|
||||
ui.clientCount.textContent = list ? String(list.length) : '';
|
||||
ui.tDevices.val.textContent = list ? String(list.length) : '—';
|
||||
ui.tDevices.sub.textContent = st.wifiCount != null ? t('%d on Wi-Fi', st.wifiCount) :
|
||||
@@ -1776,6 +1886,10 @@
|
||||
}
|
||||
else if (l.active && !l.wifi) lease = t('Neighbor entry');
|
||||
const wifi = l.wifi ? [l.wifi.band, l.wifi.signal != null ? l.wifi.signal + ' dBm' : null].filter(Boolean).join(' · ') : '';
|
||||
const down = h('span', { class: 'cb-device-rate', title: t('Download') });
|
||||
const up = h('span', { class: 'cb-device-rate', title: t('Upload') });
|
||||
const speeds = h('span', { class: 'cb-device-rates hidden' }, [down, up]);
|
||||
ui.clientRateNodes.set(l.macaddr, { row: speeds, down: down, up: up });
|
||||
ui.clients.appendChild(h('li', null, [
|
||||
deviceAvatar(l, id),
|
||||
h('div', { class: 'cb-list-main' }, [
|
||||
@@ -1783,7 +1897,8 @@
|
||||
h('span', { class: 'cb-list-sub' }, [
|
||||
kind ? h('span', { class: 'cb-kind', text: kind }) : null,
|
||||
h('span', { class: 'cb-mono', text: l.ipaddr || l.ip6addr || '' })
|
||||
])
|
||||
]),
|
||||
speeds
|
||||
]),
|
||||
h('div', { class: 'cb-list-aside' }, [
|
||||
h('span', { class: 'cb-mono cb-hide-sm', text: (l.macaddr || '').toUpperCase() }),
|
||||
@@ -1800,7 +1915,44 @@
|
||||
ui.clientMore.textContent = st.showAll ? t('Show less') : t('Show all %d devices', list.length);
|
||||
}
|
||||
else ui.clientMore.classList.add('hidden');
|
||||
renderDeviceRates();
|
||||
}
|
||||
|
||||
function renderDeviceRates() {
|
||||
const data = st.rateData;
|
||||
ui.clientRateNote.classList.toggle('hidden', !st.rateSeen);
|
||||
ui.clientRateNote.textContent = t('Device speeds') + ' · ' + (!data ? t('Unavailable') :
|
||||
(data.seconds == null ? t('Waiting for next sample') : t('%d s average', Math.round(data.seconds))));
|
||||
ui.clientRateNodes.forEach((nodes, mac) => {
|
||||
nodes.row.classList.toggle('hidden', !st.rateSeen);
|
||||
const rate = data && data.rates.get(mac);
|
||||
const text = (v) => v == null ? '—' : fmt.bytes(v, true).join(' ');
|
||||
nodes.down.textContent = '↓ ' + text(rate && rate.down);
|
||||
nodes.up.textContent = '↑ ' + text(rate && rate.up);
|
||||
nodes.down.setAttribute('aria-label', t('Download') + ' ' + text(rate && rate.down));
|
||||
nodes.up.setAttribute('aria-label', t('Upload') + ' ' + text(rate && rate.up));
|
||||
});
|
||||
}
|
||||
|
||||
async function readDeviceRates() {
|
||||
if (Date.now() < st.rateNext) return;
|
||||
const generation = st.rateGeneration;
|
||||
const sample = await safe(P.deviceTraffic);
|
||||
if (generation !== st.rateGeneration) return;
|
||||
const now = Date.now();
|
||||
// Responses arriving after the page is hidden cannot establish a baseline.
|
||||
st.rateData = deviceRates.update(document.hidden ? null : sample, now);
|
||||
if (st.rateData) st.rateSeen = true;
|
||||
st.rateNext = now + (st.rateData ? st.rateData.interval : 60) * 1000;
|
||||
renderDeviceRates();
|
||||
}
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
st.rateGeneration++;
|
||||
deviceRates.reset();
|
||||
st.rateData = null;
|
||||
st.rateNext = 0;
|
||||
renderDeviceRates();
|
||||
});
|
||||
ui.clientMore.addEventListener('click', () => { st.showAll = !st.showAll; renderClients(); });
|
||||
C.loadBrands().then((d) => { if (d && st.devices) renderClients(); });
|
||||
|
||||
@@ -2067,6 +2219,7 @@
|
||||
setTimeout(() => loop(slow, 10000), 10000);
|
||||
});
|
||||
loop(mid, 5000);
|
||||
if (typeof P.deviceTraffic === 'function') loop(readDeviceRates, 5000);
|
||||
|
||||
return dash;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d Kerne",
|
||||
"%d min": "%d Min.",
|
||||
"%d on Wi-Fi": "%d im WLAN",
|
||||
"%d s average": "Durchschnitt über %d s",
|
||||
"%dd %dh": "%d T. %d Std.",
|
||||
"%dh %dm": "%d Std. %d Min.",
|
||||
"%ds ago": "vor %d s",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "Aktuelles Logo",
|
||||
"Dark": "Dunkel",
|
||||
"Device speeds": "Gerätegeschwindigkeit",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "Die Gerätegeschwindigkeit nutzt vorhandene Verkehrsstatistiken. Nur von diesem Router erfasster Verkehr wird berücksichtigt.",
|
||||
"DHCP client": "DHCP-Client",
|
||||
"DHCP lease": "DHCP-Lease",
|
||||
"Discovered devices": "Erkannte Geräte",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "Belegt",
|
||||
"Verifying update…": "Update wird geprüft…",
|
||||
"View releases on GitHub": "Releases auf GitHub ansehen",
|
||||
"Waiting for next sample": "Warten auf nächste Messung",
|
||||
"WAN IP": "WAN-IP",
|
||||
"WAN IPv6": "WAN-IPv6",
|
||||
"Wi-Fi": "WLAN",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d núcleos",
|
||||
"%d min": "%d min",
|
||||
"%d on Wi-Fi": "%d por Wi-Fi",
|
||||
"%d s average": "Promedio de %d s",
|
||||
"%dd %dh": "%d d %d h",
|
||||
"%dh %dm": "%d h %d min",
|
||||
"%ds ago": "hace %d s",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "Logotipo actual",
|
||||
"Dark": "Oscuro",
|
||||
"Device speeds": "Velocidad de los dispositivos",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "La velocidad utiliza estadísticas de tráfico existentes. Solo incluye el tráfico observado por este router.",
|
||||
"DHCP client": "Cliente DHCP",
|
||||
"DHCP lease": "Concesión DHCP",
|
||||
"Discovered devices": "Dispositivos detectados",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "Usado",
|
||||
"Verifying update…": "Verificando actualización…",
|
||||
"View releases on GitHub": "Ver versiones en GitHub",
|
||||
"Waiting for next sample": "Esperando la siguiente muestra",
|
||||
"WAN IP": "IP WAN",
|
||||
"WAN IPv6": "IPv6 WAN",
|
||||
"Wi-Fi": "Wi-Fi",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d cœurs",
|
||||
"%d min": "%d min",
|
||||
"%d on Wi-Fi": "%d en Wi-Fi",
|
||||
"%d s average": "Moyenne sur %d s",
|
||||
"%dd %dh": "%d j %d h",
|
||||
"%dh %dm": "%d h %d min",
|
||||
"%ds ago": "il y a %d s",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "Logo actuel",
|
||||
"Dark": "Sombre",
|
||||
"Device speeds": "Débit des appareils",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "Le débit utilise les statistiques de trafic existantes. Seul le trafic observé par ce routeur est inclus.",
|
||||
"DHCP client": "Client DHCP",
|
||||
"DHCP lease": "Bail DHCP",
|
||||
"Discovered devices": "Appareils détectés",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "Utilisé",
|
||||
"Verifying update…": "Vérification de la mise à jour…",
|
||||
"View releases on GitHub": "Voir les versions sur GitHub",
|
||||
"Waiting for next sample": "En attente de la prochaine mesure",
|
||||
"WAN IP": "IP WAN",
|
||||
"WAN IPv6": "IPv6 WAN",
|
||||
"Wi-Fi": "Wi-Fi",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d core",
|
||||
"%d min": "%d min",
|
||||
"%d on Wi-Fi": "%d in Wi-Fi",
|
||||
"%d s average": "Media su %d s",
|
||||
"%dd %dh": "%d g %d h",
|
||||
"%dh %dm": "%d h %d min",
|
||||
"%ds ago": "%d s fa",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "Logo attuale",
|
||||
"Dark": "Scuro",
|
||||
"Device speeds": "Velocità dei dispositivi",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "La velocità usa le statistiche di traffico esistenti. Include solo il traffico osservato da questo router.",
|
||||
"DHCP client": "Client DHCP",
|
||||
"DHCP lease": "Lease DHCP",
|
||||
"Discovered devices": "Dispositivi rilevati",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "Usata",
|
||||
"Verifying update…": "Verifica dell’aggiornamento…",
|
||||
"View releases on GitHub": "Vedi le release su GitHub",
|
||||
"Waiting for next sample": "In attesa del prossimo campione",
|
||||
"WAN IP": "IP WAN",
|
||||
"WAN IPv6": "IPv6 WAN",
|
||||
"Wi-Fi": "Wi-Fi",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d コア",
|
||||
"%d min": "%d 分",
|
||||
"%d on Wi-Fi": "Wi-Fi 接続 %d 台",
|
||||
"%d s average": "直近 %d 秒の平均",
|
||||
"%dd %dh": "%d 日 %d 時間",
|
||||
"%dh %dm": "%d 時間 %d 分",
|
||||
"%ds ago": "%d 秒前",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "現在のロゴ",
|
||||
"Dark": "ダーク",
|
||||
"Device speeds": "端末の通信速度",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "端末の通信速度は既存の通信統計を使用します。このルーターで観測された通信のみが対象です。",
|
||||
"DHCP client": "DHCP クライアント",
|
||||
"DHCP lease": "DHCP リース",
|
||||
"Discovered devices": "検出したデバイス",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "使用中",
|
||||
"Verifying update…": "更新を検証しています…",
|
||||
"View releases on GitHub": "GitHub でリリースを見る",
|
||||
"Waiting for next sample": "次の測定を待機中",
|
||||
"WAN IP": "WAN IP",
|
||||
"WAN IPv6": "WAN IPv6",
|
||||
"Wi-Fi": "Wi-Fi",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d코어",
|
||||
"%d min": "%d분",
|
||||
"%d on Wi-Fi": "Wi-Fi %d대",
|
||||
"%d s average": "최근 %d초 평균",
|
||||
"%dd %dh": "%d일 %d시간",
|
||||
"%dh %dm": "%d시간 %d분",
|
||||
"%ds ago": "%d초 전",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "현재 로고",
|
||||
"Dark": "다크",
|
||||
"Device speeds": "기기 통신 속도",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "기기 속도는 기존 트래픽 통계를 사용합니다. 이 라우터에서 관측한 트래픽만 포함됩니다.",
|
||||
"DHCP client": "DHCP 클라이언트",
|
||||
"DHCP lease": "DHCP 임대",
|
||||
"Discovered devices": "발견된 기기",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "사용 중",
|
||||
"Verifying update…": "업데이트 확인 중…",
|
||||
"View releases on GitHub": "GitHub에서 릴리스 보기",
|
||||
"Waiting for next sample": "다음 측정 대기 중",
|
||||
"WAN IP": "WAN IP",
|
||||
"WAN IPv6": "WAN IPv6",
|
||||
"Wi-Fi": "Wi-Fi",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d núcleos",
|
||||
"%d min": "%d min",
|
||||
"%d on Wi-Fi": "%d no Wi-Fi",
|
||||
"%d s average": "Média de %d s",
|
||||
"%dd %dh": "%d d %d h",
|
||||
"%dh %dm": "%d h %d min",
|
||||
"%ds ago": "há %d s",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "Logotipo atual",
|
||||
"Dark": "Escuro",
|
||||
"Device speeds": "Velocidade dos dispositivos",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "A velocidade usa as estatísticas de tráfego existentes. Inclui apenas o tráfego observado por este roteador.",
|
||||
"DHCP client": "Cliente DHCP",
|
||||
"DHCP lease": "Concessão DHCP",
|
||||
"Discovered devices": "Dispositivos detectados",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "Usado",
|
||||
"Verifying update…": "Verificando atualização…",
|
||||
"View releases on GitHub": "Ver versões no GitHub",
|
||||
"Waiting for next sample": "Aguardando a próxima amostra",
|
||||
"WAN IP": "IP da WAN",
|
||||
"WAN IPv6": "IPv6 da WAN",
|
||||
"Wi-Fi": "Wi-Fi",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "Ядер: %d",
|
||||
"%d min": "%d мин",
|
||||
"%d on Wi-Fi": "По Wi-Fi: %d",
|
||||
"%d s average": "Среднее за %d с",
|
||||
"%dd %dh": "%d д %d ч",
|
||||
"%dh %dm": "%d ч %d мин",
|
||||
"%ds ago": "%d с назад",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "ЦП",
|
||||
"Current logo": "Текущий логотип",
|
||||
"Dark": "Тёмная",
|
||||
"Device speeds": "Скорость устройств",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "Скорость рассчитывается по существующей статистике. Учитывается только трафик, наблюдаемый этим маршрутизатором.",
|
||||
"DHCP client": "DHCP-клиент",
|
||||
"DHCP lease": "Аренда DHCP",
|
||||
"Discovered devices": "Обнаруженные устройства",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "Занято",
|
||||
"Verifying update…": "Проверка обновления…",
|
||||
"View releases on GitHub": "Выпуски на GitHub",
|
||||
"Waiting for next sample": "Ожидание следующего замера",
|
||||
"WAN IP": "IP в WAN",
|
||||
"WAN IPv6": "IPv6 в WAN",
|
||||
"Wi-Fi": "Wi-Fi",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d çekirdek",
|
||||
"%d min": "%d dk",
|
||||
"%d on Wi-Fi": "Wi-Fi'de %d",
|
||||
"%d s average": "%d sn ortalaması",
|
||||
"%dd %dh": "%d g %d sa",
|
||||
"%dh %dm": "%d sa %d dk",
|
||||
"%ds ago": "%d sn önce",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "Geçerli logo",
|
||||
"Dark": "Koyu",
|
||||
"Device speeds": "Cihaz hızları",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "Cihaz hızları mevcut trafik istatistiklerini kullanır. Yalnızca bu yönlendiricinin gözlemlediği trafik dahil edilir.",
|
||||
"DHCP client": "DHCP istemcisi",
|
||||
"DHCP lease": "DHCP kirası",
|
||||
"Discovered devices": "Algılanan cihazlar",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "Kullanılan",
|
||||
"Verifying update…": "Güncelleme doğrulanıyor…",
|
||||
"View releases on GitHub": "Sürümleri GitHub'da görüntüle",
|
||||
"Waiting for next sample": "Sonraki ölçüm bekleniyor",
|
||||
"WAN IP": "WAN IP",
|
||||
"WAN IPv6": "WAN IPv6",
|
||||
"Wi-Fi": "Wi-Fi",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d nhân",
|
||||
"%d min": "%d phút",
|
||||
"%d on Wi-Fi": "%d qua Wi-Fi",
|
||||
"%d s average": "Trung bình %d giây",
|
||||
"%dd %dh": "%d ngày %d giờ",
|
||||
"%dh %dm": "%d giờ %d phút",
|
||||
"%ds ago": "%d giây trước",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "Logo hiện tại",
|
||||
"Dark": "Tối",
|
||||
"Device speeds": "Tốc độ thiết bị",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "Tốc độ thiết bị sử dụng thống kê lưu lượng hiện có. Chỉ bao gồm lưu lượng được bộ định tuyến này quan sát.",
|
||||
"DHCP client": "Máy khách DHCP",
|
||||
"DHCP lease": "Bản thuê DHCP",
|
||||
"Discovered devices": "Thiết bị đã phát hiện",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "Đã dùng",
|
||||
"Verifying update…": "Đang xác minh bản cập nhật…",
|
||||
"View releases on GitHub": "Xem các bản phát hành trên GitHub",
|
||||
"Waiting for next sample": "Đang chờ lần lấy mẫu tiếp theo",
|
||||
"WAN IP": "IP WAN",
|
||||
"WAN IPv6": "IPv6 WAN",
|
||||
"Wi-Fi": "Wi-Fi",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d 核",
|
||||
"%d min": "%d 分钟",
|
||||
"%d on Wi-Fi": "Wi‑Fi 连接 %d 台",
|
||||
"%d s average": "近 %d 秒平均",
|
||||
"%dd %dh": "%d 天 %d 小时",
|
||||
"%dh %dm": "%d 小时 %d 分",
|
||||
"%ds ago": "%d 秒前",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "当前 Logo",
|
||||
"Dark": "深色",
|
||||
"Device speeds": "设备网速",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "设备网速读取已有流量统计,仅包含本机观测到的流量。",
|
||||
"DHCP client": "DHCP 客户端",
|
||||
"DHCP lease": "DHCP 租约",
|
||||
"Discovered devices": "已发现设备",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "已用",
|
||||
"Verifying update…": "正在校验更新…",
|
||||
"View releases on GitHub": "在 GitHub 查看发布版本",
|
||||
"Waiting for next sample": "等待下一次采样",
|
||||
"WAN IP": "外网 IP",
|
||||
"WAN IPv6": "外网 IPv6",
|
||||
"Wi-Fi": "无线 Wi‑Fi",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"%d cores": "%d 核心",
|
||||
"%d min": "%d 分鐘",
|
||||
"%d on Wi-Fi": "Wi‑Fi 連線 %d 台",
|
||||
"%d s average": "近 %d 秒平均",
|
||||
"%dd %dh": "%d 天 %d 小時",
|
||||
"%dh %dm": "%d 小時 %d 分",
|
||||
"%ds ago": "%d 秒前",
|
||||
@@ -40,6 +41,8 @@
|
||||
"CPU": "CPU",
|
||||
"Current logo": "目前的 Logo",
|
||||
"Dark": "深色",
|
||||
"Device speeds": "裝置網速",
|
||||
"Device speeds use existing traffic statistics. Only traffic observed by this router is included.": "裝置網速讀取既有流量統計,僅包含本機觀測到的流量。",
|
||||
"DHCP client": "DHCP 用戶端",
|
||||
"DHCP lease": "DHCP 租約",
|
||||
"Discovered devices": "已發現裝置",
|
||||
@@ -162,6 +165,7 @@
|
||||
"Used": "已用",
|
||||
"Verifying update…": "正在驗證更新…",
|
||||
"View releases on GitHub": "在 GitHub 查看發布版本",
|
||||
"Waiting for next sample": "等待下一次取樣",
|
||||
"WAN IP": "外部 IP",
|
||||
"WAN IPv6": "外部 IPv6",
|
||||
"Wi-Fi": "無線 Wi‑Fi",
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
'require baseclass';
|
||||
'require fs';
|
||||
'require rpc';
|
||||
|
||||
/* Read-only adapter for OpenWrt's optional nlbwmon collector. Never starts a
|
||||
* service, flushes counters, commits a database or changes its configuration. */
|
||||
const callConfig = rpc.declare({ object: 'uci', method: 'get', params: ['config'], expect: { values: {} } });
|
||||
let config = null, configAt = 0;
|
||||
|
||||
function interval(values) {
|
||||
const sections = Object.values(values || {}).filter((s) => s && s['.type'] === 'nlbwmon');
|
||||
if (sections.length !== 1) return null;
|
||||
// 30 seconds is the upstream default when the option is omitted.
|
||||
const m = /^(\d+)([smhdw]?)$/.exec(String(sections[0].refresh_interval == null ? '30s' : sections[0].refresh_interval));
|
||||
if (!m) return null;
|
||||
const seconds = Number(m[1]) * ({ '': 1, s: 1, m: 60, h: 3600, d: 86400, w: 604800 })[m[2]];
|
||||
return seconds > 0 && seconds <= 2147483 ? Math.max(5, seconds) : null;
|
||||
}
|
||||
|
||||
return baseclass.extend({
|
||||
async read() {
|
||||
const now = Date.now();
|
||||
if (!config || now - configAt >= 300000) {
|
||||
config = await callConfig('nlbwmon');
|
||||
configAt = now;
|
||||
}
|
||||
const seconds = interval(config);
|
||||
if (seconds == null) return null;
|
||||
// Fixed command: device addresses and user input never become arguments.
|
||||
const data = await fs.exec_direct('/usr/sbin/nlbw', ['-c', 'json', '-g', 'mac', '-n'], 'json');
|
||||
return { interval: seconds, columns: data && data.columns, data: data && data.data };
|
||||
}
|
||||
});
|
||||
@@ -5,6 +5,7 @@
|
||||
'require rpc';
|
||||
'require fs';
|
||||
'require poll';
|
||||
'require carbon.traffic as traffic';
|
||||
|
||||
/*
|
||||
* Carbon — LuCI glue.
|
||||
@@ -94,6 +95,7 @@ const provider = {
|
||||
return [].concat.apply([], lists.filter(Boolean));
|
||||
}),
|
||||
neighbors: () => fs.read('/proc/net/arp'),
|
||||
deviceTraffic: () => traffic.read(),
|
||||
conntrack: () => Promise.all([
|
||||
fs.read('/proc/sys/net/netfilter/nf_conntrack_count'),
|
||||
fs.read('/proc/sys/net/netfilter/nf_conntrack_max').catch(() => null)
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d Min."
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "%d im WLAN"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "Durchschnitt über %d s"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d T. %d Std."
|
||||
@@ -165,6 +169,14 @@ msgstr "Aktuelles Logo"
|
||||
msgid "Dark"
|
||||
msgstr "Dunkel"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "Gerätegeschwindigkeit"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "Die Gerätegeschwindigkeit nutzt vorhandene Verkehrsstatistiken. Nur von diesem Router erfasster Verkehr wird berücksichtigt."
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "DHCP-Client"
|
||||
@@ -653,6 +665,10 @@ msgstr "Update wird geprüft…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "Releases auf GitHub ansehen"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "Warten auf nächste Messung"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "WAN-IP"
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d min"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "%d por Wi-Fi"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "Promedio de %d s"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d d %d h"
|
||||
@@ -165,6 +169,14 @@ msgstr "Logotipo actual"
|
||||
msgid "Dark"
|
||||
msgstr "Oscuro"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "Velocidad de los dispositivos"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "La velocidad utiliza estadísticas de tráfico existentes. Solo incluye el tráfico observado por este router."
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "Cliente DHCP"
|
||||
@@ -653,6 +665,10 @@ msgstr "Verificando actualización…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "Ver versiones en GitHub"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "Esperando la siguiente muestra"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "IP WAN"
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d min"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "%d en Wi-Fi"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "Moyenne sur %d s"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d j %d h"
|
||||
@@ -165,6 +169,14 @@ msgstr "Logo actuel"
|
||||
msgid "Dark"
|
||||
msgstr "Sombre"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "Débit des appareils"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "Le débit utilise les statistiques de trafic existantes. Seul le trafic observé par ce routeur est inclus."
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "Client DHCP"
|
||||
@@ -653,6 +665,10 @@ msgstr "Vérification de la mise à jour…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "Voir les versions sur GitHub"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "En attente de la prochaine mesure"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "IP WAN"
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d min"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "%d in Wi-Fi"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "Media su %d s"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d g %d h"
|
||||
@@ -165,6 +169,14 @@ msgstr "Logo attuale"
|
||||
msgid "Dark"
|
||||
msgstr "Scuro"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "Velocità dei dispositivi"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "La velocità usa le statistiche di traffico esistenti. Include solo il traffico osservato da questo router."
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "Client DHCP"
|
||||
@@ -653,6 +665,10 @@ msgstr "Verifica dell’aggiornamento…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "Vedi le release su GitHub"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "In attesa del prossimo campione"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "IP WAN"
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d 分"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "Wi-Fi 接続 %d 台"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "直近 %d 秒の平均"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d 日 %d 時間"
|
||||
@@ -165,6 +169,14 @@ msgstr "現在のロゴ"
|
||||
msgid "Dark"
|
||||
msgstr "ダーク"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "端末の通信速度"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "端末の通信速度は既存の通信統計を使用します。このルーターで観測された通信のみが対象です。"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "DHCP クライアント"
|
||||
@@ -653,6 +665,10 @@ msgstr "更新を検証しています…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "GitHub でリリースを見る"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "次の測定を待機中"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "WAN IP"
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d분"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "Wi-Fi %d대"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "최근 %d초 평균"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d일 %d시간"
|
||||
@@ -165,6 +169,14 @@ msgstr "현재 로고"
|
||||
msgid "Dark"
|
||||
msgstr "다크"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "기기 통신 속도"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "기기 속도는 기존 트래픽 통계를 사용합니다. 이 라우터에서 관측한 트래픽만 포함됩니다."
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "DHCP 클라이언트"
|
||||
@@ -653,6 +665,10 @@ msgstr "업데이트 확인 중…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "GitHub에서 릴리스 보기"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "다음 측정 대기 중"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "WAN IP"
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d min"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "%d no Wi-Fi"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "Média de %d s"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d d %d h"
|
||||
@@ -165,6 +169,14 @@ msgstr "Logotipo atual"
|
||||
msgid "Dark"
|
||||
msgstr "Escuro"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "Velocidade dos dispositivos"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "A velocidade usa as estatísticas de tráfego existentes. Inclui apenas o tráfego observado por este roteador."
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "Cliente DHCP"
|
||||
@@ -653,6 +665,10 @@ msgstr "Verificando atualização…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "Ver versões no GitHub"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "Aguardando a próxima amostra"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "IP da WAN"
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d мин"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "По Wi-Fi: %d"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "Среднее за %d с"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d д %d ч"
|
||||
@@ -165,6 +169,14 @@ msgstr "Текущий логотип"
|
||||
msgid "Dark"
|
||||
msgstr "Тёмная"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "Скорость устройств"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "Скорость рассчитывается по существующей статистике. Учитывается только трафик, наблюдаемый этим маршрутизатором."
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "DHCP-клиент"
|
||||
@@ -653,6 +665,10 @@ msgstr "Проверка обновления…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "Выпуски на GitHub"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "Ожидание следующего замера"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "IP в WAN"
|
||||
|
||||
@@ -14,6 +14,10 @@ msgstr ""
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr ""
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr ""
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr ""
|
||||
@@ -164,6 +168,14 @@ msgstr ""
|
||||
msgid "Dark"
|
||||
msgstr ""
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr ""
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr ""
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr ""
|
||||
@@ -652,6 +664,10 @@ msgstr ""
|
||||
msgid "View releases on GitHub"
|
||||
msgstr ""
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr ""
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr ""
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d dk"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "Wi-Fi'de %d"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "%d sn ortalaması"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d g %d sa"
|
||||
@@ -165,6 +169,14 @@ msgstr "Geçerli logo"
|
||||
msgid "Dark"
|
||||
msgstr "Koyu"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "Cihaz hızları"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "Cihaz hızları mevcut trafik istatistiklerini kullanır. Yalnızca bu yönlendiricinin gözlemlediği trafik dahil edilir."
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "DHCP istemcisi"
|
||||
@@ -653,6 +665,10 @@ msgstr "Güncelleme doğrulanıyor…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "Sürümleri GitHub'da görüntüle"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "Sonraki ölçüm bekleniyor"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "WAN IP"
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d phút"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "%d qua Wi-Fi"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "Trung bình %d giây"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d ngày %d giờ"
|
||||
@@ -165,6 +169,14 @@ msgstr "Logo hiện tại"
|
||||
msgid "Dark"
|
||||
msgstr "Tối"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "Tốc độ thiết bị"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "Tốc độ thiết bị sử dụng thống kê lưu lượng hiện có. Chỉ bao gồm lưu lượng được bộ định tuyến này quan sát."
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "Máy khách DHCP"
|
||||
@@ -653,6 +665,10 @@ msgstr "Đang xác minh bản cập nhật…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "Xem các bản phát hành trên GitHub"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "Đang chờ lần lấy mẫu tiếp theo"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "IP WAN"
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d 分钟"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "Wi‑Fi 连接 %d 台"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "近 %d 秒平均"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d 天 %d 小时"
|
||||
@@ -165,6 +169,14 @@ msgstr "当前 Logo"
|
||||
msgid "Dark"
|
||||
msgstr "深色"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "设备网速"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "设备网速读取已有流量统计,仅包含本机观测到的流量。"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "DHCP 客户端"
|
||||
@@ -653,6 +665,10 @@ msgstr "正在校验更新…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "在 GitHub 查看发布版本"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "等待下一次采样"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "外网 IP"
|
||||
|
||||
@@ -15,6 +15,10 @@ msgstr "%d 分鐘"
|
||||
msgid "%d on Wi-Fi"
|
||||
msgstr "Wi‑Fi 連線 %d 台"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%d s average"
|
||||
msgstr "近 %d 秒平均"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "%dd %dh"
|
||||
msgstr "%d 天 %d 小時"
|
||||
@@ -165,6 +169,14 @@ msgstr "目前的 Logo"
|
||||
msgid "Dark"
|
||||
msgstr "深色"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds"
|
||||
msgstr "裝置網速"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Device speeds use existing traffic statistics. Only traffic observed by this router is included."
|
||||
msgstr "裝置網速讀取既有流量統計,僅包含本機觀測到的流量。"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "DHCP client"
|
||||
msgstr "DHCP 用戶端"
|
||||
@@ -653,6 +665,10 @@ msgstr "正在驗證更新…"
|
||||
msgid "View releases on GitHub"
|
||||
msgstr "在 GitHub 查看發布版本"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "Waiting for next sample"
|
||||
msgstr "等待下一次取樣"
|
||||
|
||||
#: htdocs/luci-static/carbon/carbon.js
|
||||
msgid "WAN IP"
|
||||
msgstr "外部 IP"
|
||||
|
||||
@@ -132,6 +132,12 @@
|
||||
{ interface: 'guest', up: false, proto: 'static', device: 'br-guest', 'ipv4-address': [], route: [] }
|
||||
]),
|
||||
devStats: () => wait({ rx_bytes: Math.round(rx), tx_bytes: Math.round(tx) }),
|
||||
deviceTraffic: () => wait({
|
||||
interval: 5, columns: ['mac', 'rx_bytes', 'tx_bytes'],
|
||||
data: LEASES.slice(0, 9).map((l, i) => [l.macaddr,
|
||||
Math.floor((Date.now() - t0) / 5000) * (9 - i) * 180000,
|
||||
Math.floor((Date.now() - t0) / 5000) * (9 - i) * 12000])
|
||||
}),
|
||||
/* kernel devices (luci-rpc getNetworkDevices): physical ports show up in the traffic picker */
|
||||
netDevices: () => wait([
|
||||
['lo', true, { loopback: true }], ['eth0', true], ['wan', true], ['lan1', true], ['lan2', true], ['lan3', false], ['lan4', true],
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.1.5-r1
|
||||
1.1.5-r3
|
||||
@@ -2,6 +2,7 @@
|
||||
"luci-theme-carbon": {
|
||||
"description": "Carbon theme: read-only dashboard data and the interface language switch",
|
||||
"read": {
|
||||
"cgi-io": [ "exec" ],
|
||||
"ubus": {
|
||||
"system": [ "board", "info" ],
|
||||
"network.interface": [ "dump" ],
|
||||
@@ -13,6 +14,7 @@
|
||||
"uci": [ "get" ]
|
||||
},
|
||||
"file": {
|
||||
"/usr/sbin/nlbw -c json -g mac -n": [ "exec" ],
|
||||
"/proc/stat": [ "read" ],
|
||||
"/proc/net/arp": [ "read" ],
|
||||
"/proc/[0-9]*/net/arp": [ "read" ],
|
||||
@@ -31,7 +33,7 @@
|
||||
"/sys/devices/*/hwmon[0-9]*/name": [ "read" ],
|
||||
"/sys/devices/*/hwmon[0-9]*/temp*_input": [ "read" ]
|
||||
},
|
||||
"uci": [ "luci" ]
|
||||
"uci": [ "luci", "nlbwmon" ]
|
||||
},
|
||||
"write": {
|
||||
"ubus": {
|
||||
|
||||
@@ -15,6 +15,9 @@ table { border-collapse: collapse; border-spacing: 0; }
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* LuCI keeps dropdown menus inside the cell; let an open menu extend beyond
|
||||
the last row without changing the rounded clipping of closed tables. */
|
||||
.table:has(.cbi-dropdown[open]) { overflow: visible; }
|
||||
.thead { display: table-header-group; }
|
||||
.tbody { display: table-row-group; }
|
||||
.tr { display: table-row; }
|
||||
|
||||
@@ -55,6 +55,9 @@
|
||||
max-width: 60%;
|
||||
}
|
||||
.cb-card-link { font-size: 13px; font-weight: 500; white-space: nowrap; }
|
||||
.cb-device-rate-note { margin: -4px 0 12px; color: var(--cb-text-2); font-size: 12px; }
|
||||
.cb-device-rates { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 4px; color: var(--cb-text-2); }
|
||||
.cb-device-rate { font-family: var(--cb-mono); font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
|
||||
/* hero */
|
||||
.cb-hero {
|
||||
|
||||
@@ -147,7 +147,10 @@ body:has(#maincontent .table) { --cb-content-max: var(--cb-content-wide); }
|
||||
text-overflow: ellipsis;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.table .td.cbi-dropdown-open { overflow: visible; }
|
||||
/* Plugin cells may contain a dropdown without LuCI's .cbi-value-field,
|
||||
so they never receive the .cbi-dropdown-open helper class. */
|
||||
.table .td.cbi-dropdown-open,
|
||||
.table .td:has(.cbi-dropdown[open]) { overflow: visible; }
|
||||
.table .tr:hover > .td { background: transparent !important; }
|
||||
.tr.table-titles,
|
||||
.cbi-section-table-titles,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
| Suite | Command | Needs |
|
||||
|---|---|---|
|
||||
| Unit: formatting, i18n, devices, ARP, IPv6, brands (`carbon.test.js`) | `npm test` | Node 18+ |
|
||||
| Unit: per-device counter deltas, resets, sampling intervals and read-only collector permissions (`traffic-provider.test.js`) | `npm test` | Node 18+ |
|
||||
| Unit: LuCI glue — poll pause, language list/switch, menu cache | `npm test` | Node 18+ |
|
||||
| Unit: release-notes Markdown | `npm test` | Node 18+ |
|
||||
| Unit: settings backend — logo upload validation (types, size, unsafe SVG) (`settings-backend.test.js`; `CARBON_TEST_SH=/bin/dash` for a strict shell) | `npm test` | Node 18+, `sh` |
|
||||
@@ -13,10 +14,12 @@
|
||||
| Theme templates rendered by OpenWrt's ucode | see below | Docker |
|
||||
| Updater (APK and IPK) | see [online-update.md](../docs/online-update.md#maintainers) | Docker |
|
||||
|
||||
The browser suite also checks every bundled catalogue in the sidebar, the custom-logo hero, the settings page layout (`tests/fixtures/settings.html`), the language listbox, and the plugin adapters (DiskMan partition bar) against copied plugin markup. It serves the repository and a minified copy locally, runs `tests/navigation.html` at 390 × 844, loads the preview in Chinese/English × light/dark × desktop/phone (screenshots go to `.cache/screenshots/`), checks the dashboard data, the language switch, keyboard/touch behaviour of the rail and drawer, and compares computed styles of the minified release build with the sources.
|
||||
The browser suite also checks every bundled catalogue in the sidebar, the custom-logo hero, the settings page layout (`tests/fixtures/settings.html`), the language listbox, and the plugin adapters (DiskMan partition bar) against copied plugin markup. Table dropdown regressions use LuCI's open/closed DOM states to check that options beyond the last row receive pointer events, including plugin cells without `.cbi-value-field`, on desktop/phone and in light/dark mode against source/minified CSS. It serves the repository and a minified copy locally, runs `tests/navigation.html` at 390 × 844, loads the preview in Chinese/English × light/dark × desktop/phone (screenshots go to `.cache/screenshots/`), checks the dashboard data, the language switch, keyboard/touch behaviour of the rail and drawer, and compares computed styles of the minified release build with the sources.
|
||||
|
||||
Device regressions cover DHCP-disabled side routers with static or DHCP-client LAN, failed DHCP RPC calls, retained leases, gateway labels, and separate static WAN neighbours. These use the production dashboard with simulated provider responses. `CARBON_TEST_BROWSER` can point to an installed Chromium executable instead of Playwright's bundled browser. On a real router, also verify ARP reads after logging out and back in following an upgrade; an older session may lack the dashboard permissions. An IPv6-only device without a lease or local Wi-Fi association is not discoverable: this provider reads IPv4 ARP, while IPv6 addresses come from leases and host hints.
|
||||
|
||||
Realtime graph regressions (`node --test tests/browser/realtime.test.js`) execute pinned OpenWrt 24.10 load, bandwidth and connection plotting code with simulated RPC replies. They verify sidebar collapse/expansion, desktop/mobile resizing, continued polling, retained samples, unscaled text, hidden interface charts and the fallback without `ResizeObserver`, against source and minified theme scripts. Modern SVGs with their own `viewBox` and charts outside realtime pages are left alone. On a router, open Status → Realtime Graphs, wait for samples, collapse/expand the sidebar and resize the window; curves and time markers should fill the plot without refreshing the page.
|
||||
|
||||
Render the templates with the real ucode runtime:
|
||||
|
||||
```bash
|
||||
@@ -33,6 +36,8 @@ Also verify in a disposable LuCI environment: open a multi-page app with an acti
|
||||
|
||||
For signed APK and native IPK updater integration tests, see [online-update.md](../docs/online-update.md#maintainers).
|
||||
|
||||
Device-speed browser coverage checks upload/download values, missing records, untouched DHCP lease labels, unsupported collectors, hidden-tab suspension/resume, error backoff and mobile overflow. Real-device checks should compare network/DHCP/firewall/nlbwmon configuration before and after installing the theme, and keep the collector's existing interval and running state. An inactive or absent collector is expected to leave the speed display hidden; do not enable it as part of a theme test.
|
||||
|
||||
## Release notes
|
||||
|
||||
Run `node --test tests/markdown.test.js` to check the built-in Markdown renderer (`htdocs/luci-static/resources/carbon/markdown.js`): release-note structures, unsafe HTML/URLs, pathological input and unchanged-content polling. In LuCI, check for updates and confirm the notes render as headings, lists, links, tables and code, in both appearance modes and at 390px width. Long code/table content must scroll inside the notes; status polling must retain the reading position and text selection.
|
||||
@@ -134,6 +134,79 @@ test('side-router discovery works without DHCP and distinguishes neighbours, gat
|
||||
}
|
||||
});
|
||||
|
||||
test('device speeds preserve leases, handle missing data and pause when hidden', async () => {
|
||||
const mock = fs.readFileSync(path.join(ROOT, 'preview', 'mock.js'), 'utf8');
|
||||
const context = await browser.newContext({ viewport: { width: 390, height: 844 } });
|
||||
const page = await context.newPage();
|
||||
try {
|
||||
await page.route('**/preview/mock.js', (route) => route.fulfill({ contentType: 'text/javascript', body: mock + '\n(' + (() => {
|
||||
window.trafficReads = 0;
|
||||
window.trafficFail = false;
|
||||
window.CarbonPreview.provider.deviceTraffic = async () => {
|
||||
window.trafficReads++;
|
||||
if (window.trafficFail) throw new Error('collector unavailable');
|
||||
return { interval: 5, columns: ['mac', 'rx_bytes', 'tx_bytes'], data: [
|
||||
['A6:83:E7:2C:91:0F', window.trafficReads * 10240, window.trafficReads * 5120],
|
||||
['00:11:22:33:44:99', 99999999, 99999999]
|
||||
] };
|
||||
};
|
||||
}).toString() + ')();' }));
|
||||
await page.clock.install();
|
||||
await page.goto(base + '/src/preview/index.html?lang=en');
|
||||
await dashboardReady(page);
|
||||
const phone = page.locator('.cb-clients li').filter({ hasText: 'iPhone-15-Pro' });
|
||||
const laptop = page.locator('.cb-clients li').filter({ hasText: 'MacBook-Air' });
|
||||
assert.match(await phone.textContent(), /DHCP lease · 10h 33m left/);
|
||||
assert.equal(await phone.locator('.cb-device-rates').textContent(), '↓ —↑ —');
|
||||
const count = await page.textContent('.cb-count');
|
||||
await page.clock.runFor(5100);
|
||||
assert.match(await phone.locator('.cb-device-rates').textContent(), /↓ [\d.]+ KB\/s↑ [\d.]+ [KB]+\/s/);
|
||||
assert.equal(await laptop.locator('.cb-device-rates').textContent(), '↓ —↑ —');
|
||||
assert.equal(await page.textContent('.cb-count'), count, 'historical traffic cannot create devices');
|
||||
assert.match(await phone.textContent(), /DHCP lease · 10h 33m left/);
|
||||
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true);
|
||||
await page.screenshot({ path: path.join(SHOTS, 'device-speeds-phone.png'), fullPage: true });
|
||||
await page.evaluate(() => {
|
||||
Object.defineProperty(document, 'hidden', { configurable: true, value: true });
|
||||
document.dispatchEvent(new Event('visibilitychange'));
|
||||
});
|
||||
const reads = await page.evaluate(() => window.trafficReads);
|
||||
await page.clock.runFor(20000);
|
||||
assert.equal(await page.evaluate(() => window.trafficReads), reads);
|
||||
await page.evaluate(() => {
|
||||
Object.defineProperty(document, 'hidden', { configurable: true, value: false });
|
||||
document.dispatchEvent(new Event('visibilitychange'));
|
||||
});
|
||||
await page.clock.runFor(5000);
|
||||
assert.equal(await phone.locator('.cb-device-rates').textContent(), '↓ —↑ —', 'resume establishes a fresh baseline');
|
||||
await page.clock.runFor(5000);
|
||||
assert.match(await phone.locator('.cb-device-rates').textContent(), /KB\/s/);
|
||||
await page.evaluate(() => { window.trafficFail = true; });
|
||||
await page.clock.runFor(5000);
|
||||
assert.equal(await phone.locator('.cb-device-rates').textContent(), '↓ —↑ —');
|
||||
assert.match(await page.textContent('.cb-device-rate-note'), /Unavailable/);
|
||||
const failedReads = await page.evaluate(() => window.trafficReads);
|
||||
await page.clock.runFor(55000);
|
||||
assert.equal(await page.evaluate(() => window.trafficReads), failedReads, 'failed sources back off for a minute');
|
||||
assert.match(await phone.textContent(), /DHCP lease/);
|
||||
} finally { await context.close(); }
|
||||
});
|
||||
|
||||
test('firmware without a traffic collector keeps the device list without misleading zero speeds', async () => {
|
||||
const mock = fs.readFileSync(path.join(ROOT, 'preview', 'mock.js'), 'utf8');
|
||||
const context = await browser.newContext();
|
||||
const page = await context.newPage();
|
||||
try {
|
||||
await page.route('**/preview/mock.js', (route) => route.fulfill({ contentType: 'text/javascript',
|
||||
body: mock + '\nwindow.CarbonPreview.provider.deviceTraffic = async () => { throw new Error("unsupported"); };' }));
|
||||
await page.goto(base + '/src/preview/index.html?lang=en');
|
||||
await dashboardReady(page);
|
||||
assert.equal(await page.locator('.cb-device-rate-note').isVisible(), false);
|
||||
assert.equal(await page.locator('.cb-device-rates:visible').count(), 0);
|
||||
assert.match(await page.textContent('.cb-clients'), /DHCP lease/);
|
||||
} finally { await context.close(); }
|
||||
});
|
||||
|
||||
test('navigation regression page passes at phone width', async () => {
|
||||
const { page, context } = await open('/src/tests/navigation.html', { width: 390, height: 844 });
|
||||
await page.waitForFunction(() => /^(PASS|FAIL)/.test(document.title));
|
||||
@@ -306,6 +379,84 @@ test('DiskMan partition bar stays inside its card on desktop and phone', async (
|
||||
}
|
||||
});
|
||||
|
||||
/* Styling fixture for LuCI ui.Dropdown's closed/open DOM states. The menu
|
||||
stays inside its table cell, including plugins without .cbi-value-field. */
|
||||
function tableDropdownFixture(mount, tag, field, appearance) {
|
||||
const row = tag === 'table' ? 'tr' : 'div';
|
||||
const cell = tag === 'table' ? 'td' : 'div';
|
||||
return `<!doctype html><html data-darkmode="${appearance === 'dark'}"><head><meta charset="utf-8">
|
||||
<link rel="stylesheet" href="/${mount}/htdocs/luci-static/carbon/carbon.css">
|
||||
</head><body data-page="admin-system-diskman-disks"><main id="maincontent" style="padding:24px">
|
||||
<div class="cbi-section"><${tag} class="table cbi-section-table">
|
||||
<${row} class="tr"><${cell} class="td">/dev/nvme0n1p1 · /boot</${cell}></${row}>
|
||||
<${row} class="tr"><${cell} class="td${field ? ' cbi-value-field' : ''}">
|
||||
<div id="mount-device" class="cbi-dropdown" tabindex="0"><ul>
|
||||
<li selected="" placeholder="" display="0" data-value="">-- Please choose --</li>
|
||||
<li data-value="/dev/sda1">/dev/sda1</li><li data-value="/dev/sdb1">/dev/sdb1</li>
|
||||
</ul><span class="open">▾</span></div>
|
||||
</${cell}></${row}></${tag}></div>
|
||||
<div class="cbi-section"><h3>Create</h3><div class="cbi-section-node">RAID</div></div>
|
||||
</main></body></html>`;
|
||||
}
|
||||
|
||||
test('table dropdown options escape the last row and remain clickable', async () => {
|
||||
for (const mount of ['src', 'min']) {
|
||||
for (const width of [1280, 390]) {
|
||||
for (const appearance of ['light', 'dark']) {
|
||||
for (const [tag, field] of [['table', false], ['div', true]]) {
|
||||
const label = `${mount} ${width}px ${appearance} ${tag}`;
|
||||
const { page, context } = await open('/src/preview/index.html', { width, height: 800, appearance });
|
||||
try {
|
||||
await page.setContent(tableDropdownFixture(mount, tag, field, appearance), { waitUntil: 'load' });
|
||||
const closed = await page.locator('.table').boundingBox();
|
||||
await page.locator('#mount-device').evaluate((sb) => {
|
||||
const ul = sb.querySelector('ul');
|
||||
const preview = ul.cloneNode(true);
|
||||
preview.className = 'preview';
|
||||
const height = sb.offsetHeight;
|
||||
// These are the DOM changes made by LuCI's openDropdown().
|
||||
sb.setAttribute('open', '');
|
||||
sb.closest('.cbi-value-field')?.classList.add('cbi-dropdown-open');
|
||||
ul.className = 'dropdown';
|
||||
ul.style.top = height + 'px';
|
||||
ul.style.maxHeight = '300px';
|
||||
sb.insertBefore(preview, ul);
|
||||
ul.addEventListener('click', (event) => { sb.dataset.clicked = event.target.dataset.value; });
|
||||
});
|
||||
const options = await page.locator('ul.dropdown > li[data-value]:not([placeholder])').evaluateAll((items) => items.map((el) => {
|
||||
const rect = el.getBoundingClientRect();
|
||||
return {
|
||||
value: el.dataset.value,
|
||||
belowTable: rect.top > el.closest('.table').getBoundingClientRect().bottom,
|
||||
clickable: el.contains(document.elementFromPoint(rect.x + rect.width / 2, rect.y + rect.height / 2))
|
||||
};
|
||||
}));
|
||||
assert.equal(options.length, 2, label);
|
||||
for (const option of options) {
|
||||
assert.ok(option.belowTable, `${label}: ${option.value} exercises overflow beyond the table`);
|
||||
assert.ok(option.clickable, `${label}: ${option.value} must be visible and receive pointer events`);
|
||||
}
|
||||
await page.locator('ul.dropdown > li[data-value="/dev/sdb1"]').click({ timeout: 2000 });
|
||||
assert.equal(await page.locator('#mount-device').getAttribute('data-clicked'), '/dev/sdb1', label);
|
||||
if (mount === 'src' && tag === 'table')
|
||||
await page.screenshot({ path: path.join(SHOTS, `diskman-dropdown-${appearance}-${width}.png`) });
|
||||
await page.locator('#mount-device').evaluate((sb) => {
|
||||
sb.querySelector('.preview').remove();
|
||||
sb.removeAttribute('open');
|
||||
sb.closest('.cbi-value-field')?.classList.remove('cbi-dropdown-open');
|
||||
const ul = sb.querySelector('ul');
|
||||
ul.className = '';
|
||||
ul.removeAttribute('style');
|
||||
});
|
||||
assert.deepEqual(await page.locator('.table').boundingBox(), closed, `${label}: closing preserves the table layout`);
|
||||
assert.equal(await page.locator('.table').evaluate((el) => getComputedStyle(el).overflow), width > 760 ? 'hidden' : 'visible', `${label}: closed table keeps its original clipping`);
|
||||
} finally { await context.close(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('settings page: buttons, links, fields and status text share one centre line', async () => {
|
||||
for (const width of [1200, 390]) {
|
||||
const { page, context, errors } = await open('/src/tests/fixtures/settings.html', { width });
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
'use strict';
|
||||
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const http = require('node:http');
|
||||
const { chromium } = require('playwright');
|
||||
const { transform } = require('esbuild');
|
||||
|
||||
const ROOT = path.resolve(__dirname, '../..');
|
||||
const SHOTS = path.join(ROOT, '.cache/screenshots');
|
||||
const fixture = (name) => fs.readFileSync(path.join(ROOT, 'tests/fixtures/luci-realtime', name), 'utf8');
|
||||
let server, base, browser;
|
||||
|
||||
test.before(async () => {
|
||||
fs.mkdirSync(SHOTS, { recursive: true });
|
||||
const source = fs.readFileSync(path.join(ROOT, 'htdocs/luci-static/carbon/carbon.js'), 'utf8');
|
||||
const css = fs.readFileSync(path.join(ROOT, 'htdocs/luci-static/carbon/carbon.css'), 'utf8');
|
||||
const minified = (await transform(source, { minify: true, loader: 'js' })).code;
|
||||
server = http.createServer((req, res) => {
|
||||
const url = new URL(req.url, 'http://localhost');
|
||||
if (url.pathname.endsWith('.js')) {
|
||||
res.setHeader('content-type', 'text/javascript');
|
||||
res.end(url.pathname === '/min.js' ? minified : source);
|
||||
}
|
||||
else {
|
||||
res.setHeader('content-type', 'text/html');
|
||||
res.end(`<!doctype html><html lang="en"><head><style>${css}</style>
|
||||
<script src="/${url.searchParams.has('min') ? 'min' : 'source'}.js"></script></head>
|
||||
<body data-page="${url.searchParams.has('outside') ? 'admin-status-overview' : 'admin-status-realtime-load'}"><div class="cb-app">
|
||||
<aside class="cb-sidebar"><button id="cb-collapse"></button></aside>
|
||||
<main class="cb-main"><div id="maincontent" class="cb-content"><div id="view"></div></div></main>
|
||||
</div><script>Carbon.initShell();</script></body></html>`);
|
||||
}
|
||||
});
|
||||
await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve));
|
||||
base = 'http://127.0.0.1:' + server.address().port;
|
||||
browser = await chromium.launch({ executablePath: process.env.CARBON_TEST_BROWSER || undefined });
|
||||
});
|
||||
|
||||
test.after(async () => {
|
||||
if (browser) await browser.close();
|
||||
if (server) await new Promise((resolve) => server.close(resolve));
|
||||
});
|
||||
|
||||
async function mount(page, kind, count = 1) {
|
||||
await page.evaluate(({ source, svg, kind, count }) => {
|
||||
const ticks = [];
|
||||
let timestamp = 1000;
|
||||
window.rpcCalls = 0;
|
||||
const rpc = { declare: (spec) => () => {
|
||||
if (spec.method !== 'getRealtimeStats') return Promise.resolve([]);
|
||||
window.rpcCalls++;
|
||||
const start = timestamp;
|
||||
timestamp += 60;
|
||||
return Promise.resolve(Array.from({ length: 60 }, (_, i) =>
|
||||
[start + i, 10000 + i * 100, 20000 + i * 80, 30 + i % 5]));
|
||||
} };
|
||||
const L = { bind: (fn, ctx) => fn.bind(ctx), resolveDefault: (p, value) => Promise.resolve(p).catch(() => value) };
|
||||
const view = new Function('view', 'poll', 'request', 'rpc', 'L', source)(
|
||||
{ extend: (v) => v }, { add: (fn) => ticks.push(fn) }, {}, rpc, L);
|
||||
// The connection table is independent of the SVG plot under test.
|
||||
view.updateConntrack = () => {};
|
||||
const ids = { load: ['load01', 'load05', 'load15'], bandwidth: ['rx', 'tx'], connections: ['tcp', 'udp', 'other'] }[kind];
|
||||
window.graphs = [];
|
||||
for (let i = 0; i < count; i++) {
|
||||
const container = document.createElement('div');
|
||||
container.style.cssText = 'width:100%;height:300px;border:1px solid #000;background:#fff';
|
||||
container.innerHTML = svg.slice(svg.indexOf('<svg'));
|
||||
document.querySelector('#view').appendChild(container);
|
||||
const lines = ids.map((line) => ({ line, counter: kind === 'bandwidth' }));
|
||||
if (kind === 'bandwidth') view.updateGraph('eth' + i, container, lines);
|
||||
else view.updateGraph(container, lines);
|
||||
graphs.push(container);
|
||||
}
|
||||
view.pollData();
|
||||
window.tick = () => Promise.all(ticks.map((fn) => fn()));
|
||||
}, { source: fixture(kind + '.js'), svg: fixture(kind + '.svg'), kind, count });
|
||||
await page.evaluate(() => tick());
|
||||
}
|
||||
|
||||
async function settle(page) {
|
||||
await page.waitForFunction(() => !document.querySelector('.cb-main').getAnimations().length);
|
||||
await page.evaluate(() => new Promise((resolve) => requestAnimationFrame(() => requestAnimationFrame(resolve))));
|
||||
}
|
||||
|
||||
async function geometry(page, index = 0) {
|
||||
return page.evaluate((index) => {
|
||||
const svg = graphs[index].firstElementChild;
|
||||
const edge = svg.getBoundingClientRect().right;
|
||||
const lines = [...svg.querySelectorAll('polyline')];
|
||||
const end = (line) => {
|
||||
const p = line.points.getItem(line.points.numberOfItems - 1);
|
||||
return new DOMPoint(p.x, p.y).matrixTransform(line.getScreenCTM()).x;
|
||||
};
|
||||
return {
|
||||
gaps: lines.map((line) => edge - end(line)),
|
||||
points: lines.map((line) => line.getAttribute('points')),
|
||||
labels: [...svg.querySelectorAll('text')].map((el) => {
|
||||
const m = el.getScreenCTM();
|
||||
return { scaleX: m.a, scaleY: m.d };
|
||||
}),
|
||||
grid: [...svg.querySelectorAll('line')].filter((el) => el.getAttribute('x1') === el.getAttribute('x2')).map((el) => {
|
||||
const p = new DOMPoint(el.x1.baseVal.value, 0).matrixTransform(el.getScreenCTM());
|
||||
return (edge - p.x) / svg.clientWidth;
|
||||
})
|
||||
};
|
||||
}, index);
|
||||
}
|
||||
|
||||
function fillsPlot(result) {
|
||||
for (const gap of result.gaps) assert(Math.abs(gap) < 1, 'curve must reach the right edge; gap=' + gap);
|
||||
for (const label of result.labels) assert.deepEqual(label, { scaleX: 1, scaleY: 1 }, 'labels must not stretch');
|
||||
}
|
||||
|
||||
for (const kind of ['load', 'bandwidth', 'connections']) {
|
||||
for (const min of [false, true]) {
|
||||
test(`${kind} fills the plot after sidebar and viewport changes (${min ? 'minified' : 'source'})`, async () => {
|
||||
const page = await browser.newPage({ viewport: { width: 1280, height: 850 } });
|
||||
const errors = [];
|
||||
page.on('pageerror', (error) => errors.push(error.message));
|
||||
try {
|
||||
await page.goto(base + (min ? '/?min' : '/'));
|
||||
await mount(page, kind);
|
||||
await settle(page);
|
||||
const initial = await geometry(page);
|
||||
fillsPlot(initial);
|
||||
const calls = await page.evaluate(() => rpcCalls);
|
||||
await page.locator('#cb-collapse').click();
|
||||
await settle(page);
|
||||
const collapsed = await geometry(page);
|
||||
fillsPlot(collapsed);
|
||||
if (kind === 'load' && !min) await page.screenshot({ path: path.join(SHOTS, 'realtime-load-collapsed.png') });
|
||||
assert.deepEqual(collapsed.points, initial.points, 'resizing preserves samples');
|
||||
initial.grid.forEach((v, i) => assert(Math.abs(v - collapsed.grid[i]) < 0.001, 'time grid stays aligned'));
|
||||
assert.equal(await page.evaluate(() => rpcCalls), calls, 'resizing does not fetch new data');
|
||||
await page.evaluate(() => tick());
|
||||
await settle(page);
|
||||
fillsPlot(await geometry(page));
|
||||
assert.notDeepEqual((await geometry(page)).points, initial.points, 'native polling still updates samples');
|
||||
await page.locator('#cb-collapse').click();
|
||||
await settle(page);
|
||||
fillsPlot(await geometry(page));
|
||||
for (const width of [1600, 1100, 390, 1280]) {
|
||||
await page.setViewportSize({ width, height: 850 });
|
||||
await settle(page);
|
||||
fillsPlot(await geometry(page));
|
||||
if (kind === 'load' && !min && width === 390) await page.screenshot({ path: path.join(SHOTS, 'realtime-load-mobile.png') });
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
}
|
||||
finally { await page.close(); }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
test('hidden interface charts resize when revealed; unrelated SVGs are untouched', async () => {
|
||||
const page = await browser.newPage({ viewport: { width: 1280, height: 850 } });
|
||||
try {
|
||||
await page.goto(base);
|
||||
await mount(page, 'bandwidth', 2);
|
||||
await page.evaluate(() => {
|
||||
graphs[1].hidden = true;
|
||||
document.querySelector('#view').insertAdjacentHTML('beforeend', '<svg id="unrelated" viewBox="0 0 100 100"><polyline points="0,100 100,0 100,100"/></svg>');
|
||||
const modern = graphs[0].firstElementChild.cloneNode(true);
|
||||
modern.id = 'modern';
|
||||
modern.setAttribute('viewBox', '0 0 934 298');
|
||||
modern.querySelectorAll('[transform]').forEach((el) => el.removeAttribute('transform'));
|
||||
document.querySelector('#view').appendChild(modern);
|
||||
});
|
||||
await page.locator('#cb-collapse').click();
|
||||
await settle(page);
|
||||
await page.evaluate(() => { graphs[1].hidden = false; });
|
||||
await settle(page);
|
||||
fillsPlot(await geometry(page, 1));
|
||||
assert.equal(await page.locator('#unrelated polyline').getAttribute('transform'), null);
|
||||
assert.equal(await page.locator('#modern polyline').first().getAttribute('transform'), null);
|
||||
}
|
||||
finally { await page.close(); }
|
||||
});
|
||||
|
||||
test('legacy resize fallback handles sidebar changes with and without motion', async () => {
|
||||
const page = await browser.newPage({ viewport: { width: 1280, height: 850 } });
|
||||
try {
|
||||
await page.addInitScript(() => { window.ResizeObserver = undefined; });
|
||||
await page.goto(base);
|
||||
await mount(page, 'load');
|
||||
for (const reducedMotion of ['no-preference', 'reduce']) {
|
||||
await page.emulateMedia({ reducedMotion });
|
||||
await page.locator('#cb-collapse').click();
|
||||
await settle(page);
|
||||
fillsPlot(await geometry(page));
|
||||
}
|
||||
await page.setViewportSize({ width: 1600, height: 850 });
|
||||
await settle(page);
|
||||
fillsPlot(await geometry(page));
|
||||
}
|
||||
finally { await page.close(); }
|
||||
});
|
||||
|
||||
test('the adapter does not modify matching SVGs outside realtime pages', async () => {
|
||||
const page = await browser.newPage();
|
||||
try {
|
||||
await page.goto(base + '/?outside');
|
||||
await mount(page, 'load');
|
||||
await page.locator('#cb-collapse').click();
|
||||
await settle(page);
|
||||
assert.equal(await page.locator('#load01').getAttribute('transform'), null);
|
||||
}
|
||||
finally { await page.close(); }
|
||||
});
|
||||
@@ -81,6 +81,39 @@ test('byte formatting', () => {
|
||||
assert.deepEqual(Array.from(C.fmt.bytes(null)), ['—', '']);
|
||||
});
|
||||
|
||||
test('device speeds use per-MAC counter deltas with correct directions and actual elapsed time', () => {
|
||||
const tracker = new (load().DeviceRates)();
|
||||
const sample = (data) => ({ interval: 30, columns: ['tx_bytes', 'mac', 'rx_bytes'], data });
|
||||
assert.equal(tracker.update(sample([[100, 'AA:11:22:33:44:55', 200]]), 1000).rates.size, 0);
|
||||
const r = tracker.update(sample([[400, 'aa:11:22:33:44:55', 1700], [50, '00:11:22:33:44:66', 100]]), 31000);
|
||||
assert.deepEqual(JSON.parse(JSON.stringify(r.rates.get('aa:11:22:33:44:55'))), { down: 50, up: 10 });
|
||||
assert.equal(r.rates.has('00:11:22:33:44:66'), false, 'new records need a baseline');
|
||||
assert.equal(tracker.update(sample([[400, 'aa:11:22:33:44:55', 1700]]), 61000).rates.get('aa:11:22:33:44:55').down, 0);
|
||||
});
|
||||
|
||||
test('counter reset, missing device, failed read, suspend and changed interval do not show false device speeds', () => {
|
||||
const tracker = new (load().DeviceRates)();
|
||||
const sample = (n, interval = 30) => ({ interval, columns: ['mac', 'rx_bytes', 'tx_bytes'], data: [['00:11:22:33:44:55', n, n]] });
|
||||
tracker.update(sample(1000), 0);
|
||||
assert.equal(tracker.update(sample(10), 30000).rates.size, 0, 'reset');
|
||||
assert.equal(tracker.update({ ...sample(20), data: [] }, 60000).rates.size, 0, 'missing');
|
||||
assert.equal(tracker.update(sample(30), 90000).rates.size, 0, 'reappearing');
|
||||
assert.equal(tracker.update(null, 120000), null);
|
||||
assert.equal(tracker.update(sample(100), 150000).rates.size, 0, 'first read after error');
|
||||
assert.equal(tracker.update(sample(1000), 400000).rates.size, 0, 'suspend');
|
||||
assert.equal(tracker.update(sample(1100, 60), 460000).rates.size, 0, 'cadence changed');
|
||||
assert.equal(tracker.update(sample(NaN), 520000), null);
|
||||
assert.equal(tracker.update(sample(Number.MAX_SAFE_INTEGER + 1), 550000), null);
|
||||
});
|
||||
|
||||
test('early reads do not move the device-speed baseline or invent short-window spikes', () => {
|
||||
const tracker = new (load().DeviceRates)();
|
||||
const sample = (n) => ({ interval: 30, columns: ['mac', 'rx_bytes', 'tx_bytes'], data: [['00:11:22:33:44:55', n, n]] });
|
||||
tracker.update(sample(0), 0);
|
||||
assert.equal(tracker.update(sample(100), 5000).rates.size, 0);
|
||||
assert.equal(tracker.update(sample(300), 30000).rates.get('00:11:22:33:44:55').down, 10);
|
||||
});
|
||||
|
||||
test('language matching maps LuCI codes to the installed catalogue', () => {
|
||||
const C = load();
|
||||
const options = [{ code: 'en' }, { code: 'zh_cn' }, { code: 'zh_tw' }, { code: 'pt_br' }];
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# LuCI realtime graph fixtures
|
||||
|
||||
Files copied from OpenWrt LuCI's `openwrt-24.10` branch at
|
||||
[`aa4865e8e6472d6ba68e541688065fc2235bbd83`](https://github.com/openwrt/luci/tree/aa4865e8e6472d6ba68e541688065fc2235bbd83/modules/luci-mod-status/htdocs/luci-static/resources):
|
||||
|
||||
- `view/status/{load,bandwidth,connections}.js`
|
||||
- `svg/{load,bandwidth,connections}.svg`
|
||||
|
||||
Only trailing whitespace has been removed; the upstream code is otherwise unchanged.
|
||||
|
||||
The browser regression executes the original `updateGraph()` and `pollData()`
|
||||
methods with simulated RPC replies. Only the unrelated connection table update
|
||||
is stubbed. This retains the fixed-width drawing behavior behind issue #8,
|
||||
including subsequent polls overwriting the SVG points. These fixtures are test
|
||||
inputs only and are never installed on the router.
|
||||
@@ -0,0 +1,322 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require dom';
|
||||
'require poll';
|
||||
'require request';
|
||||
'require ui';
|
||||
'require rpc';
|
||||
'require network';
|
||||
|
||||
var callLuciRealtimeStats = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getRealtimeStats',
|
||||
params: [ 'mode', 'device' ],
|
||||
expect: { result: [] }
|
||||
});
|
||||
|
||||
var graphPolls = [],
|
||||
pollInterval = 3;
|
||||
|
||||
Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; };
|
||||
|
||||
function rate(n, br) {
|
||||
n = (n || 0).toFixed(2);
|
||||
return [ '%1024.2mbit/s'.format(n * 8), br ? E('br') : ' ', '(%1024.2mB/s)'.format(n) ]
|
||||
}
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
this.loadSVG(L.resource('svg/bandwidth.svg')),
|
||||
network.getDevices()
|
||||
]);
|
||||
},
|
||||
|
||||
updateGraph: function(ifname, svg, lines, cb) {
|
||||
var G = svg.firstElementChild;
|
||||
|
||||
var view = document.querySelector('#view');
|
||||
|
||||
var width = view.offsetWidth - 2;
|
||||
var height = 300 - 2;
|
||||
var step = 5;
|
||||
|
||||
var data_wanted = Math.floor(width / step);
|
||||
|
||||
var data_values = [],
|
||||
line_elements = [];
|
||||
|
||||
for (var i = 0; i < lines.length; i++)
|
||||
if (lines[i] != null)
|
||||
data_values.push([]);
|
||||
|
||||
var info = {
|
||||
line_current: [],
|
||||
line_average: [],
|
||||
line_peak: []
|
||||
};
|
||||
|
||||
/* prefill datasets */
|
||||
for (var i = 0; i < data_values.length; i++)
|
||||
for (var j = 0; j < data_wanted; j++)
|
||||
data_values[i][j] = 0;
|
||||
|
||||
/* plot horizontal time interval lines */
|
||||
for (var i = width % (step * 60); i < width; i += step * 60) {
|
||||
var line = document.createElementNS('http://www.w3.org/2000/svg', 'line');
|
||||
line.setAttribute('x1', i);
|
||||
line.setAttribute('y1', 0);
|
||||
line.setAttribute('x2', i);
|
||||
line.setAttribute('y2', '100%');
|
||||
line.setAttribute('style', 'stroke:black;stroke-width:0.1');
|
||||
|
||||
var text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
||||
text.setAttribute('x', i + 5);
|
||||
text.setAttribute('y', 15);
|
||||
text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000');
|
||||
text.appendChild(document.createTextNode(Math.round((width - i) / step / 60) + 'm'));
|
||||
|
||||
G.appendChild(line);
|
||||
G.appendChild(text);
|
||||
}
|
||||
|
||||
info.interval = pollInterval;
|
||||
info.timeframe = data_wanted / 60;
|
||||
|
||||
graphPolls.push({
|
||||
ifname: ifname,
|
||||
svg: svg,
|
||||
lines: lines,
|
||||
cb: cb,
|
||||
info: info,
|
||||
width: width,
|
||||
height: height,
|
||||
step: step,
|
||||
values: data_values,
|
||||
timestamp: 0,
|
||||
fill: 1
|
||||
});
|
||||
},
|
||||
|
||||
pollData: function() {
|
||||
poll.add(L.bind(function() {
|
||||
var tasks = [];
|
||||
|
||||
for (var i = 0; i < graphPolls.length; i++) {
|
||||
var ctx = graphPolls[i];
|
||||
tasks.push(L.resolveDefault(callLuciRealtimeStats('interface', ctx.ifname), []));
|
||||
}
|
||||
|
||||
return Promise.all(tasks).then(L.bind(function(datasets) {
|
||||
for (var gi = 0; gi < graphPolls.length; gi++) {
|
||||
var ctx = graphPolls[gi],
|
||||
data = datasets[gi],
|
||||
values = ctx.values,
|
||||
lines = ctx.lines,
|
||||
info = ctx.info;
|
||||
|
||||
var data_scale = 0;
|
||||
var data_wanted = Math.floor(ctx.width / ctx.step);
|
||||
var last_timestamp = NaN;
|
||||
|
||||
for (var i = 0, di = 0; di < lines.length; di++) {
|
||||
if (lines[di] == null)
|
||||
continue;
|
||||
|
||||
var multiply = (lines[di].multiply != null) ? lines[di].multiply : 1,
|
||||
offset = (lines[di].offset != null) ? lines[di].offset : 0;
|
||||
|
||||
for (var j = ctx.timestamp ? 0 : 1; j < data.length; j++) {
|
||||
/* skip overlapping entries */
|
||||
if (data[j][0] <= ctx.timestamp)
|
||||
continue;
|
||||
|
||||
if (i == 0) {
|
||||
ctx.fill++;
|
||||
last_timestamp = data[j][0];
|
||||
}
|
||||
|
||||
if (lines[di].counter) {
|
||||
/* normalize difference against time interval */
|
||||
if (j > 0) {
|
||||
var time_delta = data[j][0] - data[j - 1][0];
|
||||
if (time_delta) {
|
||||
info.line_current[i] = (data[j][di + 1] * multiply - data[j - 1][di + 1] * multiply) / time_delta;
|
||||
info.line_current[i] -= Math.min(info.line_current[i], offset);
|
||||
values[i].push(info.line_current[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
info.line_current[i] = data[j][di + 1] * multiply;
|
||||
info.line_current[i] -= Math.min(info.line_current[i], offset);
|
||||
values[i].push(info.line_current[i]);
|
||||
}
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
/* cut off outdated entries */
|
||||
ctx.fill = Math.min(ctx.fill, data_wanted);
|
||||
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
var len = values[i].length;
|
||||
values[i] = values[i].slice(len - data_wanted, len);
|
||||
|
||||
/* find peaks, averages */
|
||||
info.line_peak[i] = NaN;
|
||||
info.line_average[i] = 0;
|
||||
|
||||
for (var j = 0; j < values[i].length; j++) {
|
||||
info.line_peak[i] = isNaN(info.line_peak[i]) ? values[i][j] : Math.max(info.line_peak[i], values[i][j]);
|
||||
info.line_average[i] += values[i][j];
|
||||
}
|
||||
|
||||
info.line_average[i] = info.line_average[i] / ctx.fill;
|
||||
}
|
||||
|
||||
info.peak = Math.max.apply(Math, info.line_peak);
|
||||
|
||||
/* remember current timestamp, calculate horizontal scale */
|
||||
if (!isNaN(last_timestamp))
|
||||
ctx.timestamp = last_timestamp;
|
||||
|
||||
var size = Math.floor(Math.log2(info.peak)),
|
||||
div = Math.pow(2, size - (size % 10)),
|
||||
mult = info.peak / div,
|
||||
mult = (mult < 5) ? 2 : ((mult < 50) ? 10 : ((mult < 500) ? 100 : 1000));
|
||||
|
||||
info.peak = info.peak + (mult * div) - (info.peak % (mult * div));
|
||||
|
||||
data_scale = ctx.height / info.peak;
|
||||
|
||||
/* plot data */
|
||||
for (var i = 0, di = 0; di < lines.length; di++) {
|
||||
if (lines[di] == null)
|
||||
continue;
|
||||
|
||||
var el = ctx.svg.firstElementChild.getElementById(lines[di].line),
|
||||
pt = '0,' + ctx.height,
|
||||
y = 0;
|
||||
|
||||
if (!el)
|
||||
continue;
|
||||
|
||||
for (var j = 0; j < values[i].length; j++) {
|
||||
var x = j * ctx.step;
|
||||
|
||||
y = ctx.height - Math.floor(values[i][j] * data_scale);
|
||||
//y -= Math.floor(y % (1 / data_scale));
|
||||
|
||||
y = isNaN(y) ? ctx.height : y;
|
||||
|
||||
pt += ' ' + x + ',' + y;
|
||||
}
|
||||
|
||||
pt += ' ' + ctx.width + ',' + y + ' ' + ctx.width + ',' + ctx.height;
|
||||
|
||||
el.setAttribute('points', pt);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
info.label_25 = 0.25 * info.peak;
|
||||
info.label_50 = 0.50 * info.peak;
|
||||
info.label_75 = 0.75 * info.peak;
|
||||
|
||||
if (typeof(ctx.cb) == 'function')
|
||||
ctx.cb(ctx.svg, info);
|
||||
}
|
||||
}, this));
|
||||
}, this), pollInterval);
|
||||
},
|
||||
|
||||
loadSVG: function(src) {
|
||||
return request.get(src).then(function(response) {
|
||||
if (!response.ok)
|
||||
throw new Error(response.statusText);
|
||||
|
||||
return E('div', {
|
||||
'style': 'width:100%;height:300px;border:1px solid #000;background:#fff'
|
||||
}, E(response.text()));
|
||||
});
|
||||
},
|
||||
|
||||
render: function([svg, devs]) {
|
||||
|
||||
var v = E('div', { 'class': 'cbi-map', 'id': 'map' }, E('div'));
|
||||
|
||||
for (var i = 0; i < devs.length; i++) {
|
||||
var ifname = devs[i].getName();
|
||||
const ssid = devs[i].wif?.getSSID?.() || null;
|
||||
|
||||
if (!ifname || !devs[i].isUp() || devs[i].wif?.isDisabled())
|
||||
continue;
|
||||
|
||||
var csvg = svg.cloneNode(true);
|
||||
|
||||
v.firstElementChild.appendChild(E('div', { 'class': 'cbi-section', 'data-tab': ifname, 'data-tab-title': ssid ? `${ifname} ${ssid}` : ifname }, [
|
||||
csvg,
|
||||
E('div', { 'class': 'right' }, E('small', { 'id': 'scale' }, '-')),
|
||||
E('br'),
|
||||
|
||||
E('table', { 'class': 'table', 'style': 'width:100%;table-layout:fixed' }, [
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td right top' }, E('strong', { 'style': 'border-bottom:2px solid blue' }, [ _('Inbound:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'rx_bw_cur' }, rate(0, true)),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Average:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'rx_bw_avg' }, rate(0, true)),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Peak:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'rx_bw_peak' }, rate(0, true))
|
||||
]),
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td right top' }, E('strong', { 'style': 'border-bottom:2px solid green' }, [ _('Outbound:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'tx_bw_cur' }, rate(0, true)),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Average:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'tx_bw_avg' }, rate(0, true)),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Peak:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'tx_bw_peak' }, rate(0, true))
|
||||
])
|
||||
]),
|
||||
E('div', {'class': 'cbi-section-create'})
|
||||
]));
|
||||
|
||||
this.updateGraph(ifname, csvg, [ { line: 'rx', counter: true }, null, { line: 'tx', counter: true } ], function(svg, info) {
|
||||
var G = svg.firstElementChild, tab = svg.parentNode;
|
||||
|
||||
G.getElementById('label_25').firstChild.data = rate(info.label_25).join('');
|
||||
G.getElementById('label_50').firstChild.data = rate(info.label_50).join('');
|
||||
G.getElementById('label_75').firstChild.data = rate(info.label_75).join('');
|
||||
|
||||
tab.querySelector('#scale').firstChild.data = _('(%d minute window, %d second interval)').format(info.timeframe, info.interval);
|
||||
|
||||
dom.content(tab.querySelector('#rx_bw_cur'), rate(info.line_current[0], true));
|
||||
dom.content(tab.querySelector('#rx_bw_avg'), rate(info.line_average[0], true));
|
||||
dom.content(tab.querySelector('#rx_bw_peak'), rate(info.line_peak[0], true));
|
||||
|
||||
dom.content(tab.querySelector('#tx_bw_cur'), rate(info.line_current[1], true));
|
||||
dom.content(tab.querySelector('#tx_bw_avg'), rate(info.line_average[1], true));
|
||||
dom.content(tab.querySelector('#tx_bw_peak'), rate(info.line_peak[1], true));
|
||||
});
|
||||
}
|
||||
|
||||
ui.tabs.initTabGroup(v.firstElementChild.childNodes);
|
||||
|
||||
this.pollData();
|
||||
|
||||
return E([], [
|
||||
E('h2', _('Bandwidth')),
|
||||
E('div', {'class': 'cbi-map-descr'}, _('This page displays the bandwidth used for all available physical interfaces.')),
|
||||
v
|
||||
]);
|
||||
},
|
||||
|
||||
handleSaveApply: null,
|
||||
handleSave: null,
|
||||
handleReset: null
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
|
||||
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||
<polyline id="rx" points="" style="fill:blue;fill-opacity:0.4;stroke:blue;stroke-width:1" />
|
||||
<polyline id="tx" points="" style="fill:green;fill-opacity:0.4;stroke:green;stroke-width:1" />
|
||||
|
||||
<line x1="0" y1="25%" x2="100%" y2="25%" style="stroke:black;stroke-width:0.1" />
|
||||
<text id="label_75" x="20" y="24%" style="fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000"> </text>
|
||||
|
||||
<line x1="0" y1="50%" x2="100%" y2="50%" style="stroke:black;stroke-width:0.1" />
|
||||
<text id="label_50" x="20" y="49%" style="fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000"> </text>
|
||||
|
||||
<line x1="0" y1="75%" x2="100%" y2="75%" style="stroke:black;stroke-width:0.1" />
|
||||
<text id="label_25" x="20" y="74%" style="fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000"> </text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1,473 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require poll';
|
||||
'require request';
|
||||
'require rpc';
|
||||
|
||||
var callLuciRealtimeStats = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getRealtimeStats',
|
||||
params: [ 'mode', 'device' ],
|
||||
expect: { result: [] }
|
||||
});
|
||||
|
||||
var callLuciConntrackList = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getConntrackList',
|
||||
expect: { result: [] }
|
||||
});
|
||||
|
||||
var callNetworkRrdnsLookup = rpc.declare({
|
||||
object: 'network.rrdns',
|
||||
method: 'lookup',
|
||||
params: [ 'addrs', 'timeout', 'limit' ],
|
||||
expect: { '': {} }
|
||||
});
|
||||
|
||||
var graphPolls = [],
|
||||
pollInterval = 3,
|
||||
dns_cache = {},
|
||||
enableLookups = false,
|
||||
filterText = '';
|
||||
|
||||
var recheck_lookup_queue = {};
|
||||
|
||||
Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; };
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
this.loadSVG(L.resource('svg/connections.svg'))
|
||||
]);
|
||||
},
|
||||
|
||||
updateGraph: function(svg, lines, cb) {
|
||||
var G = svg.firstElementChild;
|
||||
|
||||
var view = document.querySelector('#view');
|
||||
|
||||
var width = view.offsetWidth - 2;
|
||||
var height = 300 - 2;
|
||||
var step = 5;
|
||||
|
||||
var data_wanted = Math.floor(width / step);
|
||||
|
||||
var data_values = [],
|
||||
line_elements = [];
|
||||
|
||||
for (var i = 0; i < lines.length; i++)
|
||||
if (lines[i] != null)
|
||||
data_values.push([]);
|
||||
|
||||
var info = {
|
||||
line_current: [],
|
||||
line_average: [],
|
||||
line_peak: []
|
||||
};
|
||||
|
||||
/* prefill datasets */
|
||||
for (var i = 0; i < data_values.length; i++)
|
||||
for (var j = 0; j < data_wanted; j++)
|
||||
data_values[i][j] = 0;
|
||||
|
||||
/* plot horizontal time interval lines */
|
||||
for (var i = width % (step * 60); i < width; i += step * 60) {
|
||||
var line = document.createElementNS('http://www.w3.org/2000/svg', 'line');
|
||||
line.setAttribute('x1', i);
|
||||
line.setAttribute('y1', 0);
|
||||
line.setAttribute('x2', i);
|
||||
line.setAttribute('y2', '100%');
|
||||
line.setAttribute('style', 'stroke:black;stroke-width:0.1');
|
||||
|
||||
var text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
||||
text.setAttribute('x', i + 5);
|
||||
text.setAttribute('y', 15);
|
||||
text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000');
|
||||
text.appendChild(document.createTextNode(Math.round((width - i) / step / 60) + 'm'));
|
||||
|
||||
G.appendChild(line);
|
||||
G.appendChild(text);
|
||||
}
|
||||
|
||||
info.interval = pollInterval;
|
||||
info.timeframe = data_wanted / 60;
|
||||
|
||||
graphPolls.push({
|
||||
svg: svg,
|
||||
lines: lines,
|
||||
cb: cb,
|
||||
info: info,
|
||||
width: width,
|
||||
height: height,
|
||||
step: step,
|
||||
values: data_values,
|
||||
timestamp: 0,
|
||||
fill: 1
|
||||
});
|
||||
},
|
||||
|
||||
updateConntrack: function(conn) {
|
||||
var lookup_queue = [ ];
|
||||
var rows = [];
|
||||
|
||||
conn.sort(function(a, b) {
|
||||
return b.bytes - a.bytes;
|
||||
});
|
||||
|
||||
for (var i = 0; i < conn.length; i++)
|
||||
{
|
||||
var c = conn[i];
|
||||
|
||||
if ((c.src == '127.0.0.1' && c.dst == '127.0.0.1') ||
|
||||
(c.src == '::1' && c.dst == '::1'))
|
||||
continue;
|
||||
|
||||
if (!dns_cache[c.src] && lookup_queue.indexOf(c.src) == -1)
|
||||
lookup_queue.push(c.src);
|
||||
|
||||
if (!dns_cache[c.dst] && lookup_queue.indexOf(c.dst) == -1)
|
||||
lookup_queue.push(c.dst);
|
||||
|
||||
var src = dns_cache[c.src] || (c.layer3 == 'ipv6' ? '[' + c.src + ']' : c.src);
|
||||
var dst = dns_cache[c.dst] || (c.layer3 == 'ipv6' ? '[' + c.dst + ']' : c.dst);
|
||||
|
||||
const network = c.layer3.toUpperCase();
|
||||
const protocol = c.layer4.toUpperCase();
|
||||
const source ='%h'.format(c.hasOwnProperty('sport') ? (src + ':' + c.sport) : src);
|
||||
const destination = '%h'.format(c.hasOwnProperty('dport') ? (dst + ':' + c.dport) : dst);
|
||||
const transfer = [ c.bytes, '%1024.2mB (%d %s)'.format(c.bytes, c.packets, _('Pkts.')) ];
|
||||
|
||||
if (filterText) {
|
||||
let filterTextExpressions = filterText.split(' ');
|
||||
if (filterTextExpressions.some((element) => element.toUpperCase() !== network && element.toUpperCase() !== protocol
|
||||
&& !(c.src.includes(element) || source.includes(element))
|
||||
&& !(c.dst.includes(element) || destination.includes(element)))) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
rows.push([
|
||||
network,
|
||||
protocol,
|
||||
source,
|
||||
destination,
|
||||
transfer,
|
||||
]);
|
||||
}
|
||||
|
||||
cbi_update_table('#connections', rows, E('em', _('No information available')));
|
||||
|
||||
if (enableLookups && lookup_queue.length > 0) {
|
||||
var reduced_lookup_queue = lookup_queue;
|
||||
|
||||
if (lookup_queue.length > 100)
|
||||
reduced_lookup_queue = lookup_queue.slice(0, 100);
|
||||
|
||||
callNetworkRrdnsLookup(reduced_lookup_queue, 5000, 1000).then(function(replies) {
|
||||
for (var index in reduced_lookup_queue) {
|
||||
var address = reduced_lookup_queue[index];
|
||||
|
||||
if (!address)
|
||||
continue;
|
||||
|
||||
if (replies[address]) {
|
||||
dns_cache[address] = replies[address];
|
||||
lookup_queue.splice(reduced_lookup_queue.indexOf(address), 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (recheck_lookup_queue[address] > 2) {
|
||||
dns_cache[address] = (address.match(/:/)) ? '[' + address + ']' : address;
|
||||
lookup_queue.splice(index, 1);
|
||||
}
|
||||
else {
|
||||
recheck_lookup_queue[address] = (recheck_lookup_queue[address] || 0) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
var btn = document.querySelector('.btn.toggle-lookups');
|
||||
if (btn) {
|
||||
btn.firstChild.data = enableLookups ? _('Disable DNS lookups') : _('Enable DNS lookups');
|
||||
btn.classList.remove('spinning');
|
||||
btn.disabled = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
pollData: function() {
|
||||
poll.add(L.bind(function() {
|
||||
var tasks = [
|
||||
L.resolveDefault(callLuciConntrackList(), [])
|
||||
];
|
||||
|
||||
for (var i = 0; i < graphPolls.length; i++) {
|
||||
var ctx = graphPolls[i];
|
||||
tasks.push(L.resolveDefault(callLuciRealtimeStats('conntrack'), []));
|
||||
}
|
||||
|
||||
return Promise.all(tasks).then(L.bind(function(datasets) {
|
||||
this.updateConntrack(datasets[0]);
|
||||
|
||||
for (var gi = 0; gi < graphPolls.length; gi++) {
|
||||
var ctx = graphPolls[gi],
|
||||
data = datasets[gi + 1],
|
||||
values = ctx.values,
|
||||
lines = ctx.lines,
|
||||
info = ctx.info;
|
||||
|
||||
var data_scale = 0;
|
||||
var data_wanted = Math.floor(ctx.width / ctx.step);
|
||||
var last_timestamp = NaN;
|
||||
|
||||
for (var i = 0, di = 0; di < lines.length; di++) {
|
||||
if (lines[di] == null)
|
||||
continue;
|
||||
|
||||
var multiply = (lines[di].multiply != null) ? lines[di].multiply : 1,
|
||||
offset = (lines[di].offset != null) ? lines[di].offset : 0;
|
||||
|
||||
for (var j = ctx.timestamp ? 0 : 1; j < data.length; j++) {
|
||||
/* skip overlapping entries */
|
||||
if (data[j][0] <= ctx.timestamp)
|
||||
continue;
|
||||
|
||||
if (i == 0) {
|
||||
ctx.fill++;
|
||||
last_timestamp = data[j][0];
|
||||
}
|
||||
|
||||
info.line_current[i] = data[j][di + 1] * multiply;
|
||||
info.line_current[i] -= Math.min(info.line_current[i], offset);
|
||||
values[i].push(info.line_current[i]);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
/* cut off outdated entries */
|
||||
ctx.fill = Math.min(ctx.fill, data_wanted);
|
||||
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
var len = values[i].length;
|
||||
values[i] = values[i].slice(len - data_wanted, len);
|
||||
|
||||
/* find peaks, averages */
|
||||
info.line_peak[i] = NaN;
|
||||
info.line_average[i] = 0;
|
||||
|
||||
for (var j = 0; j < values[i].length; j++) {
|
||||
info.line_peak[i] = isNaN(info.line_peak[i]) ? values[i][j] : Math.max(info.line_peak[i], values[i][j]);
|
||||
info.line_average[i] += values[i][j];
|
||||
}
|
||||
|
||||
info.line_average[i] = info.line_average[i] / ctx.fill;
|
||||
}
|
||||
|
||||
info.peak = Math.max.apply(Math, info.line_peak);
|
||||
|
||||
/* remember current timestamp, calculate horizontal scale */
|
||||
if (!isNaN(last_timestamp))
|
||||
ctx.timestamp = last_timestamp;
|
||||
|
||||
var size = Math.floor(Math.log2(info.peak)),
|
||||
div = Math.pow(2, size - (size % 10)),
|
||||
mult = info.peak / div,
|
||||
mult = (mult < 5) ? 2 : ((mult < 50) ? 10 : ((mult < 500) ? 100 : 1000));
|
||||
|
||||
info.peak = info.peak + (mult * div) - (info.peak % (mult * div));
|
||||
|
||||
data_scale = ctx.height / info.peak;
|
||||
|
||||
/* plot data */
|
||||
for (var i = 0, di = 0; di < lines.length; di++) {
|
||||
if (lines[di] == null)
|
||||
continue;
|
||||
|
||||
var el = ctx.svg.firstElementChild.getElementById(lines[di].line),
|
||||
pt = '0,' + ctx.height,
|
||||
y = 0;
|
||||
|
||||
if (!el)
|
||||
continue;
|
||||
|
||||
for (var j = 0; j < values[i].length; j++) {
|
||||
var x = j * ctx.step;
|
||||
|
||||
y = ctx.height - Math.floor(values[i][j] * data_scale);
|
||||
//y -= Math.floor(y % (1 / data_scale));
|
||||
|
||||
y = isNaN(y) ? ctx.height : y;
|
||||
|
||||
pt += ' ' + x + ',' + y;
|
||||
}
|
||||
|
||||
pt += ' ' + ctx.width + ',' + y + ' ' + ctx.width + ',' + ctx.height;
|
||||
|
||||
el.setAttribute('points', pt);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
info.label_25 = 0.25 * info.peak;
|
||||
info.label_50 = 0.50 * info.peak;
|
||||
info.label_75 = 0.75 * info.peak;
|
||||
|
||||
if (typeof(ctx.cb) == 'function')
|
||||
ctx.cb(ctx.svg, info);
|
||||
}
|
||||
}, this));
|
||||
}, this), pollInterval);
|
||||
},
|
||||
|
||||
loadSVG: function(src) {
|
||||
return request.get(src).then(function(response) {
|
||||
if (!response.ok)
|
||||
throw new Error(response.statusText);
|
||||
|
||||
return E('div', {
|
||||
'style': 'width:100%;height:300px;border:1px solid #000;background:#fff'
|
||||
}, E(response.text()));
|
||||
});
|
||||
},
|
||||
|
||||
render: function(data) {
|
||||
var svg = data[0];
|
||||
|
||||
var v = E('div', { 'class': 'cbi-map', 'id': 'map' }, [
|
||||
E('h2', _('Connections')),
|
||||
E('div', {'class': 'cbi-map-descr'}, _('This page displays the active connections via this device.')),
|
||||
E('div', { 'class': 'cbi-section' }, [
|
||||
svg,
|
||||
E('div', { 'class': 'right' }, E('small', { 'id': 'scale' }, '-')),
|
||||
E('br'),
|
||||
|
||||
E('table', { 'class': 'table', 'style': 'width:100%;table-layout:fixed' }, [
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td right top' }, E('strong', { 'style': 'border-bottom:2px solid blue' }, [ _('UDP:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_udp_cur' }, [ '0' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Average:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_udp_avg' }, [ '0' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Peak:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_udp_peak' }, [ '0' ])
|
||||
]),
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td right top' }, E('strong', { 'style': 'border-bottom:2px solid green' }, [ _('TCP:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_tcp_cur' }, [ '0' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Average:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_tcp_avg' }, [ '0' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Peak:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_tcp_peak' }, [ '0' ])
|
||||
]),
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td right top' }, E('strong', { 'style': 'border-bottom:2px solid red' }, [ _('Other:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_otr_cur' }, [ '0' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Average:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_otr_avg' }, [ '0' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Peak:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_otr_peak' }, [ '0' ])
|
||||
])
|
||||
]),
|
||||
|
||||
E('br'),
|
||||
|
||||
E('div', {
|
||||
id: 'settings-row',
|
||||
style: 'display: flex',
|
||||
}, [
|
||||
E('span', {
|
||||
class: 'filter',
|
||||
style: 'flex: auto',
|
||||
}, [
|
||||
E('input', {
|
||||
id: 'filter-connections',
|
||||
type: 'text',
|
||||
placeholder: '192.168.1.15 / UDP 1.15 / :443',
|
||||
class: 'cbi-input-text',
|
||||
style: 'width: 100%',
|
||||
keyup: function(ev) {
|
||||
filterText = this.value;
|
||||
}
|
||||
})
|
||||
]),
|
||||
E('span', {
|
||||
class: 'right',
|
||||
style: 'flex: auto',
|
||||
}, [
|
||||
E('button', {
|
||||
'class': 'btn cbi-button cbi-button-apply toggle-lookups',
|
||||
'click': function(ev) {
|
||||
if (!enableLookups) {
|
||||
ev.currentTarget.classList.add('spinning');
|
||||
ev.currentTarget.disabled = true;
|
||||
enableLookups = true;
|
||||
}
|
||||
else {
|
||||
ev.currentTarget.firstChild.data = _('Enable DNS lookups');
|
||||
enableLookups = false;
|
||||
}
|
||||
|
||||
this.blur();
|
||||
}
|
||||
}, [ enableLookups ? _('Disable DNS lookups') : _('Enable DNS lookups') ])
|
||||
]),
|
||||
]),
|
||||
|
||||
E('br'),
|
||||
|
||||
E('div', { 'class': 'cbi-section-node' }, [
|
||||
E('table', { 'class': 'table', 'id': 'connections' }, [
|
||||
E('tr', { 'class': 'tr table-titles' }, [
|
||||
E('th', { 'class': 'th col-2 hide-xs' }, [ _('Network') ]),
|
||||
E('th', { 'class': 'th col-2' }, [ _('Protocol') ]),
|
||||
E('th', { 'class': 'th col-7' }, [ _('Source') ]),
|
||||
E('th', { 'class': 'th col-7' }, [ _('Destination') ]),
|
||||
E('th', { 'class': 'th col-4' }, [ _('Transfer') ])
|
||||
]),
|
||||
E('tr', { 'class': 'tr placeholder' }, [
|
||||
E('td', { 'class': 'td' }, [
|
||||
E('em', {}, [ _('Collecting data...') ])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
])
|
||||
]);
|
||||
|
||||
this.updateGraph(svg, [ { line: 'udp' }, { line: 'tcp' }, { line: 'other' } ], function(svg, info) {
|
||||
var G = svg.firstElementChild, tab = svg.parentNode;
|
||||
|
||||
G.getElementById('label_25').firstChild.data = '%d'.format(info.label_25);
|
||||
G.getElementById('label_50').firstChild.data = '%d'.format(info.label_50);
|
||||
G.getElementById('label_75').firstChild.data = '%d'.format(info.label_75);
|
||||
|
||||
tab.querySelector('#scale').firstChild.data = _('(%d minute window, %d second interval)').format(info.timeframe, info.interval);
|
||||
|
||||
tab.querySelector('#lb_udp_cur').firstChild.data = '%d'.format(info.line_current[0]);
|
||||
tab.querySelector('#lb_udp_avg').firstChild.data = '%d'.format(info.line_average[0]);
|
||||
tab.querySelector('#lb_udp_peak').firstChild.data = '%d'.format(info.line_peak[0]);
|
||||
|
||||
tab.querySelector('#lb_tcp_cur').firstChild.data = '%d'.format(info.line_current[1]);
|
||||
tab.querySelector('#lb_tcp_avg').firstChild.data = '%d'.format(info.line_average[1]);
|
||||
tab.querySelector('#lb_tcp_peak').firstChild.data = '%d'.format(info.line_peak[1]);
|
||||
|
||||
tab.querySelector('#lb_otr_cur').firstChild.data = '%d'.format(info.line_current[2]);
|
||||
tab.querySelector('#lb_otr_avg').firstChild.data = '%d'.format(info.line_average[2]);
|
||||
tab.querySelector('#lb_otr_peak').firstChild.data = '%d'.format(info.line_peak[2]);
|
||||
});
|
||||
|
||||
this.pollData();
|
||||
|
||||
return v;
|
||||
},
|
||||
|
||||
handleSaveApply: null,
|
||||
handleSave: null,
|
||||
handleReset: null
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
|
||||
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||
<polyline id="tcp" points="" style="fill:green;fill-opacity:0.4;stroke:green;stroke-width:1" />
|
||||
<polyline id="udp" points="" style="fill:blue;fill-opacity:0.4;stroke:blue;stroke-width:1" />
|
||||
<polyline id="other" points="" style="fill:red;fill-opacity:0.4;stroke:red;stroke-width:1" />
|
||||
|
||||
<line x1="0" y1="25%" x2="100%" y2="25%" style="stroke:black;stroke-width:0.1" />
|
||||
<text id="label_75" x="20" y="24%" style="fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000"> </text>
|
||||
|
||||
<line x1="0" y1="50%" x2="100%" y2="50%" style="stroke:black;stroke-width:0.1" />
|
||||
<text id="label_50" x="20" y="49%" style="fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000"> </text>
|
||||
|
||||
<line x1="0" y1="75%" x2="100%" y2="75%" style="stroke:black;stroke-width:0.1" />
|
||||
<text id="label_25" x="20" y="74%" style="fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000"> </text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1,299 @@
|
||||
'use strict';
|
||||
'require view';
|
||||
'require poll';
|
||||
'require request';
|
||||
'require rpc';
|
||||
|
||||
var callLuciRealtimeStats = rpc.declare({
|
||||
object: 'luci',
|
||||
method: 'getRealtimeStats',
|
||||
params: [ 'mode', 'device' ],
|
||||
expect: { result: [] }
|
||||
});
|
||||
|
||||
var graphPolls = [],
|
||||
pollInterval = 3;
|
||||
|
||||
Math.log2 = Math.log2 || function(x) { return Math.log(x) * Math.LOG2E; };
|
||||
|
||||
return view.extend({
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
this.loadSVG(L.resource('svg/load.svg'))
|
||||
]);
|
||||
},
|
||||
|
||||
updateGraph: function(svg, lines, cb) {
|
||||
var G = svg.firstElementChild;
|
||||
|
||||
var view = document.querySelector('#view');
|
||||
|
||||
var width = view.offsetWidth - 2;
|
||||
var height = 300 - 2;
|
||||
var step = 5;
|
||||
|
||||
var data_wanted = Math.floor(width / step);
|
||||
|
||||
var data_values = [],
|
||||
line_elements = [];
|
||||
|
||||
for (var i = 0; i < lines.length; i++)
|
||||
if (lines[i] != null)
|
||||
data_values.push([]);
|
||||
|
||||
var info = {
|
||||
line_current: [],
|
||||
line_average: [],
|
||||
line_peak: []
|
||||
};
|
||||
|
||||
/* prefill datasets */
|
||||
for (var i = 0; i < data_values.length; i++)
|
||||
for (var j = 0; j < data_wanted; j++)
|
||||
data_values[i][j] = 0;
|
||||
|
||||
/* plot horizontal time interval lines */
|
||||
for (var i = width % (step * 60); i < width; i += step * 60) {
|
||||
var line = document.createElementNS('http://www.w3.org/2000/svg', 'line');
|
||||
line.setAttribute('x1', i);
|
||||
line.setAttribute('y1', 0);
|
||||
line.setAttribute('x2', i);
|
||||
line.setAttribute('y2', '100%');
|
||||
line.setAttribute('style', 'stroke:black;stroke-width:0.1');
|
||||
|
||||
var text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
||||
text.setAttribute('x', i + 5);
|
||||
text.setAttribute('y', 15);
|
||||
text.setAttribute('style', 'fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000');
|
||||
text.appendChild(document.createTextNode(Math.round((width - i) / step / 60) + 'm'));
|
||||
|
||||
G.appendChild(line);
|
||||
G.appendChild(text);
|
||||
}
|
||||
|
||||
info.interval = pollInterval;
|
||||
info.timeframe = data_wanted / 60;
|
||||
|
||||
graphPolls.push({
|
||||
svg: svg,
|
||||
lines: lines,
|
||||
cb: cb,
|
||||
info: info,
|
||||
width: width,
|
||||
height: height,
|
||||
step: step,
|
||||
values: data_values,
|
||||
timestamp: 0,
|
||||
fill: 1
|
||||
});
|
||||
},
|
||||
|
||||
pollData: function() {
|
||||
poll.add(L.bind(function() {
|
||||
var tasks = [];
|
||||
|
||||
for (var i = 0; i < graphPolls.length; i++) {
|
||||
var ctx = graphPolls[i];
|
||||
tasks.push(L.resolveDefault(callLuciRealtimeStats('load'), []));
|
||||
}
|
||||
|
||||
return Promise.all(tasks).then(L.bind(function(datasets) {
|
||||
for (var gi = 0; gi < graphPolls.length; gi++) {
|
||||
var ctx = graphPolls[gi],
|
||||
data = datasets[gi],
|
||||
values = ctx.values,
|
||||
lines = ctx.lines,
|
||||
info = ctx.info;
|
||||
|
||||
var data_scale = 0;
|
||||
var data_wanted = Math.floor(ctx.width / ctx.step);
|
||||
var last_timestamp = NaN;
|
||||
|
||||
for (var i = 0, di = 0; di < lines.length; di++) {
|
||||
if (lines[di] == null)
|
||||
continue;
|
||||
|
||||
var multiply = (lines[di].multiply != null) ? lines[di].multiply : 1,
|
||||
offset = (lines[di].offset != null) ? lines[di].offset : 0;
|
||||
|
||||
for (var j = ctx.timestamp ? 0 : 1; j < data.length; j++) {
|
||||
/* skip overlapping entries */
|
||||
if (data[j][0] <= ctx.timestamp)
|
||||
continue;
|
||||
|
||||
if (i == 0) {
|
||||
ctx.fill++;
|
||||
last_timestamp = data[j][0];
|
||||
}
|
||||
|
||||
info.line_current[i] = data[j][di + 1] * multiply;
|
||||
info.line_current[i] -= Math.min(info.line_current[i], offset);
|
||||
values[i].push(info.line_current[i]);
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
/* cut off outdated entries */
|
||||
ctx.fill = Math.min(ctx.fill, data_wanted);
|
||||
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
var len = values[i].length;
|
||||
values[i] = values[i].slice(len - data_wanted, len);
|
||||
|
||||
/* find peaks, averages */
|
||||
info.line_peak[i] = NaN;
|
||||
info.line_average[i] = 0;
|
||||
|
||||
for (var j = 0; j < values[i].length; j++) {
|
||||
info.line_peak[i] = isNaN(info.line_peak[i]) ? values[i][j] : Math.max(info.line_peak[i], values[i][j]);
|
||||
info.line_average[i] += values[i][j];
|
||||
}
|
||||
|
||||
info.line_average[i] = info.line_average[i] / ctx.fill;
|
||||
}
|
||||
|
||||
info.peak = Math.max.apply(Math, info.line_peak);
|
||||
|
||||
/* remember current timestamp, calculate horizontal scale */
|
||||
if (!isNaN(last_timestamp))
|
||||
ctx.timestamp = last_timestamp;
|
||||
|
||||
var size = Math.floor(Math.log2(info.peak)),
|
||||
div = Math.pow(2, size - (size % 10)),
|
||||
mult = info.peak / div,
|
||||
mult = (mult < 5) ? 2 : ((mult < 50) ? 10 : ((mult < 500) ? 100 : 1000));
|
||||
|
||||
info.peak = info.peak + (mult * div) - (info.peak % (mult * div));
|
||||
|
||||
data_scale = ctx.height / info.peak;
|
||||
|
||||
/* plot data */
|
||||
for (var i = 0, di = 0; di < lines.length; di++) {
|
||||
if (lines[di] == null)
|
||||
continue;
|
||||
|
||||
var el = ctx.svg.firstElementChild.getElementById(lines[di].line),
|
||||
pt = '0,' + ctx.height,
|
||||
y = 0;
|
||||
|
||||
if (!el)
|
||||
continue;
|
||||
|
||||
for (var j = 0; j < values[i].length; j++) {
|
||||
var x = j * ctx.step;
|
||||
|
||||
y = ctx.height - Math.floor(values[i][j] * data_scale);
|
||||
//y -= Math.floor(y % (1 / data_scale));
|
||||
|
||||
y = isNaN(y) ? ctx.height : y;
|
||||
|
||||
pt += ' ' + x + ',' + y;
|
||||
}
|
||||
|
||||
pt += ' ' + ctx.width + ',' + y + ' ' + ctx.width + ',' + ctx.height;
|
||||
|
||||
el.setAttribute('points', pt);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
info.label_25 = 0.25 * info.peak;
|
||||
info.label_50 = 0.50 * info.peak;
|
||||
info.label_75 = 0.75 * info.peak;
|
||||
|
||||
if (typeof(ctx.cb) == 'function')
|
||||
ctx.cb(ctx.svg, info);
|
||||
}
|
||||
}, this));
|
||||
}, this), pollInterval);
|
||||
},
|
||||
|
||||
loadSVG: function(src) {
|
||||
return request.get(src).then(function(response) {
|
||||
if (!response.ok)
|
||||
throw new Error(response.statusText);
|
||||
|
||||
return E('div', {
|
||||
'style': 'width:100%;height:300px;border:1px solid #000;background:#fff'
|
||||
}, E(response.text()));
|
||||
});
|
||||
},
|
||||
|
||||
render: function(data) {
|
||||
var svg = data[0];
|
||||
|
||||
var v = E('div', { 'class': 'cbi-map', 'id': 'map' }, [
|
||||
E('h2', _('System load')),
|
||||
E('div', {'class': 'cbi-map-descr'}, _('Load Average is a metric that is used by Linux to keep track of system resources.')),
|
||||
E('div', { 'class': 'cbi-section' }, [
|
||||
svg,
|
||||
E('div', { 'class': 'right' }, E('small', { 'id': 'scale' }, '-')),
|
||||
E('br'),
|
||||
|
||||
E('table', { 'class': 'table', 'style': 'width:100%;table-layout:fixed' }, [
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td right top' }, E('strong', { 'style': 'border-bottom:2px solid #f00' }, [ _('1 Minute Load:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_load01_cur' }, [ '0.00' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Average:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_load01_avg' }, [ '0.00' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Peak:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_load01_peak' }, [ '0.00' ])
|
||||
]),
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td right top' }, E('strong', { 'style': 'border-bottom:2px solid #f60' }, [ _('5 Minute Load:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_load05_cur' }, [ '0.00' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Average:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_load05_avg' }, [ '0.00' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Peak:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_load05_peak' }, [ '0.00' ])
|
||||
]),
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td right top' }, E('strong', { 'style': 'border-bottom:2px solid #fa0' }, [ _('15 Minute Load:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_load15_cur' }, [ '0.00' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Average:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_load15_avg' }, [ '0.00' ]),
|
||||
|
||||
E('td', { 'class': 'td right top' }, E('strong', {}, [ _('Peak:') ])),
|
||||
E('td', { 'class': 'td', 'id': 'lb_load15_peak' }, [ '0.00' ])
|
||||
])
|
||||
])
|
||||
])
|
||||
]);
|
||||
|
||||
this.updateGraph(svg, [ { line: 'load01' }, { line: 'load05' }, { line: 'load15' } ], function(svg, info) {
|
||||
var G = svg.firstElementChild, tab = svg.parentNode;
|
||||
|
||||
G.getElementById('label_25').firstChild.data = '%.2f'.format(info.label_25 / 100);
|
||||
G.getElementById('label_50').firstChild.data = '%.2f'.format(info.label_50 / 100);
|
||||
G.getElementById('label_75').firstChild.data = '%.2f'.format(info.label_75 / 100);
|
||||
|
||||
tab.querySelector('#scale').firstChild.data = _('(%d minute window, %d second interval)').format(info.timeframe, info.interval);
|
||||
|
||||
tab.querySelector('#lb_load01_cur').firstChild.data = '%.2f'.format(info.line_current[0] / 100);
|
||||
tab.querySelector('#lb_load01_avg').firstChild.data = '%.2f'.format(info.line_average[0] / 100);
|
||||
tab.querySelector('#lb_load01_peak').firstChild.data = '%.2f'.format(info.line_peak[0] / 100);
|
||||
|
||||
tab.querySelector('#lb_load05_cur').firstChild.data = '%.2f'.format(info.line_current[1] / 100);
|
||||
tab.querySelector('#lb_load05_avg').firstChild.data = '%.2f'.format(info.line_average[1] / 100);
|
||||
tab.querySelector('#lb_load05_peak').firstChild.data = '%.2f'.format(info.line_peak[1] / 100);
|
||||
|
||||
tab.querySelector('#lb_load15_cur').firstChild.data = '%.2f'.format(info.line_current[2] / 100);
|
||||
tab.querySelector('#lb_load15_avg').firstChild.data = '%.2f'.format(info.line_average[2] / 100);
|
||||
tab.querySelector('#lb_load15_peak').firstChild.data = '%.2f'.format(info.line_peak[2] / 100);
|
||||
});
|
||||
|
||||
this.pollData();
|
||||
|
||||
return v;
|
||||
},
|
||||
|
||||
handleSaveApply: null,
|
||||
handleSave: null,
|
||||
handleReset: null
|
||||
});
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
|
||||
<svg width="100%" height="100%" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
||||
<polyline id="load01" points="" style="fill:#ff0000;fill-opacity:0.4;stroke:#ff0000;stroke-width:1" />
|
||||
<polyline id="load05" points="" style="fill:#ff6600;fill-opacity:0.4;stroke:#ff6600;stroke-width:1" />
|
||||
<polyline id="load15" points="" style="fill:#ffaa00;fill-opacity:0.4;stroke:#ffaa00;stroke-width:1" />
|
||||
|
||||
<line x1="0" y1="25%" x2="100%" y2="25%" style="stroke:black;stroke-width:0.1" />
|
||||
<text id="label_75" x="20" y="24%" style="fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000"> </text>
|
||||
|
||||
<line x1="0" y1="50%" x2="100%" y2="50%" style="stroke:black;stroke-width:0.1" />
|
||||
<text id="label_50" x="20" y="49%" style="fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000"> </text>
|
||||
|
||||
<line x1="0" y1="75%" x2="100%" y2="75%" style="stroke:black;stroke-width:0.1" />
|
||||
<text id="label_25" x="20" y="74%" style="fill:#eee; font-size:9pt; font-family:sans-serif; text-shadow:1px 1px 1px #000"> </text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
@@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const vm = require('node:vm');
|
||||
const source = fs.readFileSync('htdocs/luci-static/resources/carbon/traffic.js', 'utf8');
|
||||
|
||||
function load(values, result = { columns: ['mac', 'rx_bytes', 'tx_bytes'], data: [] }) {
|
||||
const calls = [];
|
||||
const subject = vm.runInNewContext('(function() {\n' + source + '\n})()', {
|
||||
baseclass: { extend: (x) => x },
|
||||
rpc: { declare: (spec) => async (...args) => { calls.push([spec.object, spec.method, ...args]); return values; } },
|
||||
fs: { exec_direct: async (...args) => { calls.push(['exec', ...args]); if (result instanceof Error) throw result; return result; } }
|
||||
});
|
||||
return { subject, calls };
|
||||
}
|
||||
|
||||
test('traffic adapter follows the collector cadence and only invokes the fixed read command', async () => {
|
||||
for (const [input, expected] of [['30s', 30], ['2m', 120], ['1', 5], [undefined, 30]]) {
|
||||
const f = load({ config: { '.type': 'nlbwmon', refresh_interval: input } });
|
||||
assert.equal((await f.subject.read()).interval, expected);
|
||||
await f.subject.read();
|
||||
assert.deepEqual(JSON.parse(JSON.stringify(f.calls)), [
|
||||
['uci', 'get', 'nlbwmon'],
|
||||
['exec', '/usr/sbin/nlbw', ['-c', 'json', '-g', 'mac', '-n'], 'json'],
|
||||
['exec', '/usr/sbin/nlbw', ['-c', 'json', '-g', 'mac', '-n'], 'json']
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
test('missing, ambiguous or invalid collector configuration never starts a command', async () => {
|
||||
for (const config of [{}, { one: { '.type': 'nlbwmon', refresh_interval: '0' } },
|
||||
{ one: { '.type': 'nlbwmon', refresh_interval: '30;reboot' } },
|
||||
{ one: { '.type': 'nlbwmon' }, two: { '.type': 'nlbwmon' } }]) {
|
||||
const f = load(config);
|
||||
assert.equal(await f.subject.read(), null);
|
||||
assert.equal(f.calls.length, 1);
|
||||
}
|
||||
});
|
||||
|
||||
test('unavailable collector is propagated for the dashboard to handle without changing configuration', async () => {
|
||||
const f = load({ cfg: { '.type': 'nlbwmon' } }, new Error('not running'));
|
||||
await assert.rejects(f.subject.read(), /not running/);
|
||||
assert.equal(f.calls.length, 2);
|
||||
});
|
||||
|
||||
test('traffic permissions grant only the fixed counter read and read-only collector configuration', () => {
|
||||
const acl = JSON.parse(fs.readFileSync('root/usr/share/rpcd/acl.d/luci-theme-carbon.json'))['luci-theme-carbon'];
|
||||
assert.deepEqual(acl.read.file['/usr/sbin/nlbw -c json -g mac -n'], ['exec']);
|
||||
assert.deepEqual(Object.entries(acl.read.file).filter(([, rights]) => rights.includes('exec')).map(([name]) => name),
|
||||
['/usr/sbin/nlbw -c json -g mac -n']);
|
||||
assert.ok(acl.read.uci.includes('nlbwmon'));
|
||||
assert.deepEqual(acl.write.uci, ['luci']);
|
||||
});
|
||||
@@ -22,11 +22,11 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wwand-ims
|
||||
PKG_VERSION:=0.1.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/ddimension/wwand-ims.git
|
||||
PKG_SOURCE_VERSION:=1ec70fa685404c54e060c53f3d13db0dad5ebaeb
|
||||
PKG_SOURCE_VERSION:=747443df0318ed305bc11c3ee2ba4d60d8df4083
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
|
||||
@@ -50,12 +50,12 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=wwand
|
||||
PKG_VERSION:=1.9.0_pre49
|
||||
PKG_RELEASE:=95
|
||||
PKG_VERSION:=1.9.0_pre50
|
||||
PKG_RELEASE:=96
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/ddimension/wwand.git
|
||||
PKG_SOURCE_VERSION:=25e69856de205e6be33acbaba5a7657e89089de5
|
||||
PKG_SOURCE_VERSION:=844b15e01892f6804d411036ef499061987205cb
|
||||
PKG_MIRROR_HASH:=skip
|
||||
|
||||
PKG_LICENSE:=GPL-2.0-only
|
||||
@@ -415,7 +415,18 @@ define Package/wwand-mbim/install
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/atcmd_mbim.uc $(1)$(UCDIR)/
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/atcmd_mbim_lazy.uc $(1)$(UCDIR)/
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/codec/mbim.uc $(1)$(UCDIR)/codec/
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/codec/mbim_schema/*.uc $(1)$(UCDIR)/codec/mbim_schema/
|
||||
# The service schemas by name, like every other module here. They are
|
||||
# loaded by name at run time (wwand.codec.mbim_schema.<service>), so one
|
||||
# missing from this list is an import failure on a live modem — which is
|
||||
# what tools/check-packaging.py in the wwand tree is run for at every
|
||||
# version bump.
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/codec/mbim_schema/basic_connect.uc $(1)$(UCDIR)/codec/mbim_schema/
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/codec/mbim_schema/compal.uc $(1)$(UCDIR)/codec/mbim_schema/
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/codec/mbim_schema/fibocom.uc $(1)$(UCDIR)/codec/mbim_schema/
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/codec/mbim_schema/ms_basic_connect_ext.uc $(1)$(UCDIR)/codec/mbim_schema/
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/codec/mbim_schema/ms_voice_ext.uc $(1)$(UCDIR)/codec/mbim_schema/
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/codec/mbim_schema/qmi_passthrough.uc $(1)$(UCDIR)/codec/mbim_schema/
|
||||
$(INSTALL_DATA) $(WWAND_UCODE)/codec/mbim_schema/quectel.uc $(1)$(UCDIR)/codec/mbim_schema/
|
||||
endef
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||