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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build-meshviewer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ jobs:
- run: npm install
- run: npm audit
- run: npm run lint
- run: npm run test:unit
- run: npm run build
12 changes: 6 additions & 6 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ Map human readable names to the domain from the individual node as stated in the

Add Links to external Sites like wikis or monitoring. You might use one of the following variables as placeholders:

| variable | description |
| --------------- | --------------------------- |
| `{NODE_CUSTOM}` | node_name with custom regex |
| `{NODE_ID}` | mac address of the node |
| `{NODE_NAME}` | hostname |
| `{TIME}` | |
| variable | description |
| --------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `{NODE_CUSTOM}` | node_name with custom regex |
| `{NODE_ID}` | `node_id` from `meshviewer.json` (legacy 12-digit hex IDs, numeric IDs, or dotted IDs like `node.a03`; no `-` inside a node ID!) |
| `{NODE_NAME}` | hostname |
| `{TIME}` | |

Here are some examples:

Expand Down
16 changes: 16 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@

Hint: You can start a development server with `npm run dev`

### Local fixture mode

If you want to work against a committed local dummy dataset without touching `public/config.json`, use:

`npm run dev:fixtures`

This mode serves `dev-fixtures/config.json` as `/config.json` and `dev-fixtures/meshviewer.json` as `/fixtures/meshviewer.json` only in the Vite dev server. The files stay outside `public/` and are therefore not included in regular builds or release artifacts.

For timestamps in `dev-fixtures/meshviewer.json` you can use relative markers like `@now`, `@now-6d`, `@now-28h` or `@now-1w+2d`. They are expanded to ISO timestamps when the fixture endpoint is requested.

### Unit tests

For unit tests run:

`npm run test:unit`

### Build and run using Docker

You have to copy `config.example.json` to `public/config.json`.
Expand Down
18 changes: 18 additions & 0 deletions dev-fixtures/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"siteName": "Meshviewer Local Fixtures",
"dataPath": ["/fixtures/"],
"fixedCenter": [
[52.54, 13.0],
[52.48, 13.45]
],
"mapLayers": [
{
"name": "CartoDB",
"url": "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",
"config": {
"maxZoom": 22,
"attribution": "&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>, &copy; | <a href=\"https://carto.com/attribution\">CARTO</a>"
}
}
]
}
306 changes: 306 additions & 0 deletions dev-fixtures/meshviewer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
{
"timestamp": "@now",
"nodes": [
{
"node_id": "021122334401",
"hostname": "Sirius",
"domain": "lab",
"firstseen": "@now-6d",
"lastseen": "@now",
"is_online": true,
"location": {
"latitude": 52.5119,
"longitude": 13.3041
},
"firmware": {
"release": "1.0.0",
"base": "openwrt"
},
"uptime": 86400000,
"nproc": 1,
"loadavg": 0.12,
"memory_usage": 0.32,
"model": "TP-Link Archer C7 v2",
"clients": 4,
"clients_wifi24": 2,
"clients_wifi5": 1,
"clients_other": 1,
"is_gateway": false,
"addresses": ["fd00::11", "10.0.0.11"],
"gateway_nexthop": "1004",
"gateway": "1004",
"gateway6": "1004",
"autoupdater": {
"enabled": true,
"branch": "stable"
}
},
{
"node_id": "1004",
"hostname": "Vega",
"domain": "lab",
"firstseen": "@now-7d",
"lastseen": "@now",
"is_online": true,
"location": {
"latitude": 52.5127,
"longitude": 13.3056
},
"firmware": {
"release": "1.0.0",
"base": "openwrt"
},
"uptime": 172800000,
"nproc": 1,
"loadavg": 0.2,
"memory_usage": 0.28,
"model": "Ubiquiti NanoStation M5",
"clients": 3,
"clients_wifi24": 1,
"clients_wifi5": 2,
"clients_other": 0,
"is_gateway": true,
"addresses": ["fd00::12", "10.0.0.12"],
"gateway_nexthop": "1004",
"gateway": "1004",
"gateway6": "1004",
"autoupdater": {
"enabled": true,
"branch": "stable"
}
},
{
"node_id": "node.a03",
"hostname": "Arktur",
"domain": "lab",
"firstseen": "@now-38d",
"lastseen": "@now",
"is_online": true,
"location": {
"latitude": 52.5219,
"longitude": 13.4132
},
"firmware": {
"release": "1.0.0",
"base": "openwrt"
},
"uptime": 259200000,
"nproc": 1,
"loadavg": 0.16,
"memory_usage": 0.27,
"model": "MikroTik hAP ac2",
"clients": 6,
"clients_wifi24": 2,
"clients_wifi5": 3,
"clients_other": 1,
"is_gateway": true,
"addresses": ["fd00::13", "10.0.0.13"],
"gateway_nexthop": "node.a03",
"gateway": "node.a03",
"gateway6": "node.a03",
"autoupdater": {
"enabled": true,
"branch": "stable"
}
},
{
"node_id": "021122334404",
"hostname": "Aldebaran",
"domain": "lab",
"firstseen": "@now-39d",
"lastseen": "@now",
"is_online": true,
"location": {
"latitude": 52.5212,
"longitude": 13.4148
},
"firmware": {
"release": "1.0.0",
"base": "openwrt"
},
"uptime": 43200000,
"nproc": 1,
"loadavg": 0.08,
"memory_usage": 0.21,
"model": "AVM FRITZ!Box 4040",
"clients": 2,
"clients_wifi24": 1,
"clients_wifi5": 1,
"clients_other": 0,
"is_gateway": false,
"addresses": ["fd00::14", "10.0.0.14"],
"gateway_nexthop": "node.a03",
"gateway": "node.a03",
"gateway6": "node.a03",
"autoupdater": {
"enabled": true,
"branch": "stable"
}
},
{
"node_id": "rgl5x",
"hostname": "Rigel",
"domain": "lab",
"firstseen": "@now-10d",
"lastseen": "@now",
"is_online": true,
"location": {
"latitude": 52.4987,
"longitude": 13.4035
},
"firmware": {
"release": "1.0.0",
"base": "openwrt"
},
"uptime": 345600000,
"nproc": 1,
"loadavg": 0.24,
"memory_usage": 0.31,
"model": "TP-Link EAP225",
"clients": 8,
"clients_wifi24": 3,
"clients_wifi5": 4,
"clients_other": 1,
"is_gateway": true,
"addresses": ["fd00::15", "10.0.0.15"],
"gateway_nexthop": "rgl5x",
"gateway": "rgl5x",
"gateway6": "rgl5x",
"autoupdater": {
"enabled": true,
"branch": "stable"
}
},
{
"node_id": "021122334406",
"hostname": "Deneb",
"domain": "lab",
"firstseen": "@now-11d",
"lastseen": "@now-28h",
"is_online": false,
"location": {
"latitude": 52.5001,
"longitude": 13.4067
},
"firmware": {
"release": "1.0.0",
"base": "openwrt"
},
"uptime": 64800000,
"nproc": 1,
"loadavg": 0.05,
"memory_usage": 0.19,
"model": "GL.iNet GL-B1300",
"clients": 0,
"clients_wifi24": 0,
"clients_wifi5": 0,
"clients_other": 0,
"is_gateway": false,
"addresses": ["fd00::16", "10.0.0.16"],
"gateway_nexthop": "rgl5x",
"gateway": "rgl5x",
"gateway6": "rgl5x",
"autoupdater": {
"enabled": false,
"branch": "stable"
}
},
{
"node_id": "021122334407",
"hostname": "Capella",
"domain": "lab",
"firstseen": "@now-12d",
"lastseen": "@now-54h",
"is_online": false,
"location": {
"latitude": 52.5074,
"longitude": 13.3221
},
"firmware": {
"release": "1.0.0",
"base": "openwrt"
},
"uptime": 28800000,
"nproc": 1,
"loadavg": 0.03,
"memory_usage": 0.17,
"model": "Linksys EA8300",
"clients": 0,
"clients_wifi24": 0,
"clients_wifi5": 0,
"clients_other": 0,
"is_gateway": false,
"addresses": ["fd00::17", "10.0.0.17"],
"gateway_nexthop": "rgl5x",
"gateway": "rgl5x",
"gateway6": "rgl5x",
"autoupdater": {
"enabled": false,
"branch": "stable"
}
},
{
"node_id": "021122334408",
"hostname": "Antares",
"domain": "lab",
"firstseen": "@now-13d",
"lastseen": "@now",
"is_online": true,
"location": {
"latitude": 52.4995,
"longitude": 13.4051
},
"firmware": {
"release": "1.0.0",
"base": "openwrt"
},
"uptime": 129600000,
"nproc": 1,
"loadavg": 0.14,
"memory_usage": 0.26,
"model": "CPE210 v3",
"clients": 2,
"clients_wifi24": 1,
"clients_wifi5": 1,
"clients_other": 0,
"is_gateway": false,
"addresses": ["fd00::18", "10.0.0.18"],
"gateway_nexthop": "rgl5x",
"gateway": "rgl5x",
"gateway6": "rgl5x",
"autoupdater": {
"enabled": true,
"branch": "stable"
}
}
],
"links": [
{
"type": "wifi24",
"source": "021122334401",
"target": "1004",
"source_addr": "02:11:22:33:44:01",
"target_addr": "02:11:22:33:44:02",
"source_tq": 0.93,
"target_tq": 0.91
},
{
"type": "wifi24",
"source": "node.a03",
"target": "021122334404",
"source_addr": "02:11:22:33:44:03",
"target_addr": "02:11:22:33:44:04",
"source_tq": 0.91,
"target_tq": 0.89
},
{
"type": "wifi5",
"source": "rgl5x",
"target": "021122334408",
"source_addr": "02:11:22:33:44:05",
"target_addr": "02:11:22:33:44:08",
"source_tq": 0.95,
"target_tq": 0.93
}
]
}
3 changes: 2 additions & 1 deletion lib/map/clientlayer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as helper from "../utils/helper.js";
import { Node } from "../utils/node.js";
import { ObjectsLinksAndNodes } from "../datadistributor.js";
import { Coords } from "leaflet";
import { nodeIdToStartAngle } from "./clientlayerUtils.js";

export const ClientLayer = L.GridLayer.extend({
mapRTree: function mapRTree(node: Node) {
Expand All @@ -22,7 +23,7 @@ export const ClientLayer = L.GridLayer.extend({

// pre-calculate start angles
this.data.all().forEach(function (positionedNode: { startAngle: number; node: Node }) {
positionedNode.startAngle = (parseInt(positionedNode.node.node_id.substr(10, 2), 16) / 255) * 2 * Math.PI;
positionedNode.startAngle = nodeIdToStartAngle(positionedNode.node.node_id);
});
this.redraw();
},
Expand Down
Loading