@apocaliss92/nodelink-js 0.1.14 → 0.1.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -45,6 +45,24 @@ The library includes a **complete web-based management interface** for easy came
45
45
  - 📱 **PWA Support** - Install as a Progressive Web App on mobile devices
46
46
  - 🌐 **Responsive Design** - Works on desktop, tablet, and mobile
47
47
 
48
+ ### External Requirements
49
+
50
+ To run the Manager UI outside Docker, you need:
51
+
52
+ Some features also rely on external binaries that must be available on the host when running outside Docker:
53
+
54
+ Install examples:
55
+
56
+ ```bash
57
+ # macOS
58
+ brew install ffmpeg
59
+
60
+ # Debian/Ubuntu
61
+ sudo apt-get update && sudo apt-get install -y ffmpeg
62
+ ```
63
+
64
+ If you use the Docker image, FFmpeg is already included (see Docker Deployment below).
65
+
48
66
  ### Quick Start (Development)
49
67
 
50
68
  ```bash
@@ -53,9 +71,6 @@ npm install
53
71
  npm run dev
54
72
  ```
55
73
 
56
- - Web UI: http://localhost:5173
57
- - API Server: http://localhost:3000
58
-
59
74
  ### Production Build
60
75
 
61
76
  ```bash
@@ -66,19 +81,23 @@ npm start
66
81
 
67
82
  Open http://localhost:3000 in your browser.
68
83
 
84
+ ### SSO (Authentik) via Trusted Proxy
85
+
86
+ See [documentation/authentik-nginx.md](documentation/authentik-nginx.md) for a step-by-step Authentik + NGINX setup and the required environment variables.
87
+
69
88
  ### Docker Deployment (Recommended)
70
89
 
71
90
  The easiest way to run the Manager UI is with Docker:
72
91
 
73
92
  ```bash
74
93
  # Using pre-built image
75
- docker pull ghcr.io/apocaliss92/nodelink-manager:latest
94
+ docker pull ghcr.io/apocaliss92/nodelink-js-manager:latest
76
95
 
77
96
  docker run -d \
78
97
  --name nodelink-manager \
79
98
  --network host \
80
99
  -v nodelink-data:/data \
81
- ghcr.io/apocaliss92/nodelink-manager:latest
100
+ ghcr.io/apocaliss92/nodelink-js-manager:latest
82
101
  ```
83
102
 
84
103
  Or with Docker Compose:
@@ -87,6 +106,38 @@ Or with Docker Compose:
87
106
  docker-compose up -d
88
107
  ```
89
108
 
109
+ #### WebRTC in Docker (bridge network)
110
+
111
+ If you run the container in **bridge** mode (i.e. with `ports:` mappings), WebRTC needs two things to work reliably:
112
+
113
+ 1. **A fixed UDP port range** exposed from container → host.
114
+ 2. ICE candidates that contain an address the browser can reach (usually your **host LAN IP**) — configured in **Settings → WebRTC (ICE)**.
115
+
116
+ Otherwise WebRTC may get stuck and you may see warnings like:
117
+
118
+ ```text
119
+ Video data channel not open for session ...: connecting
120
+ ```
121
+
122
+ Recommended example:
123
+
124
+ ```yaml
125
+ services:
126
+ nodelink-manager:
127
+ ports:
128
+ - "3000:3000" # Web UI and API
129
+ - "8554:8554" # RTSP proxy
130
+ - "50000-50100:50000-50100/udp" # WebRTC / ICE UDP
131
+ # Then configure Settings → WebRTC (ICE):
132
+ # - ICE UDP port range: 50000-50100
133
+ # - Additional host addresses: 192.168.1.123
134
+ ```
135
+
136
+ Notes:
137
+
138
+ - The **Additional host addresses** setting should be an IP address that your browser can reach (typically the host machine IP on your LAN).
139
+ - If you use `network_mode: host`, you usually **don’t need** any of the above (no port mapping).
140
+
90
141
  **Environment Variables:**
91
142
 
92
143
  | Variable | Default | Description |
@@ -95,6 +146,107 @@ docker-compose up -d
95
146
  | `RTSP_PORT` | `8554` | RTSP proxy port |
96
147
  | `DATA_PATH` | `/data` | Directory for settings.json and logs |
97
148
 
149
+ **WebRTC / ICE (Docker bridge mode):**
150
+
151
+ - Configure the UDP port mapping in Docker.
152
+ - Configure ICE options in **Settings → WebRTC (ICE)**.
153
+
154
+ **Dashboard authentication (optional):**
155
+
156
+ | Variable | Default | Description |
157
+ | ---------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- |
158
+ | `AUTH_ENABLED` | (unset) | Enable auth when set to `1/true` (or disable with `0/false`). If unset, auth auto-enables when `ADMIN_PASSWORD` is set. |
159
+ | `ADMIN_PASSWORD` | (unset) | Sets the `admin` password. This credential works for both the web login form and HTTP Basic auth. |
160
+
161
+ ### Streaming Authentication (RTSP / MJPEG / HLS / WebRTC)
162
+
163
+ When authentication is enabled (see `AUTH_ENABLED` / `ADMIN_PASSWORD`), **all streaming endpoints are protected**.
164
+
165
+ #### Step-by-step
166
+
167
+ 1. **Login to the Manager UI** (or use the API login) to obtain an auth token.
168
+ 2. (Recommended) **Generate a long-lived personal token** from **Settings → Personal token**.
169
+ 3. Use the correct auth mechanism depending on the streaming protocol:
170
+
171
+ - RTSP: **Digest** with username/password
172
+ - MJPEG/HLS: token in query string `?token=...`
173
+ - WebRTC signaling + status endpoints: `Authorization: Bearer ...`
174
+ - WebSocket logs: `?token=...` in the WS URL
175
+
176
+ There are two auth mechanisms depending on the protocol:
177
+
178
+ 1. **RTSP (RTSP proxy): Digest auth with username/password**
179
+
180
+ - URL format: `rtsp://<host>:<RTSP_PORT>/<camera>/<main|sub|ext>`
181
+ - Credentials: the same **Users** list used by the dashboard.
182
+ - Digest realm: `RTSP Proxy`
183
+ - You can toggle whether auth is required via the Manager UI setting **“Require auth for RTSP connections”**.
184
+
185
+ Examples:
186
+
187
+ ```bash
188
+ # ffmpeg (Digest)
189
+ ffmpeg -rtsp_transport tcp -i "rtsp://USERNAME:PASSWORD@HOST:8554/camera/main" -f null -
190
+
191
+ # VLC (it will prompt for credentials, or use URL user:pass)
192
+ vlc "rtsp://USERNAME:PASSWORD@HOST:8554/camera/main"
193
+ ```
194
+
195
+ 2. **HTTP-based streaming (MJPEG / HLS): token in query string**
196
+
197
+ Browsers cannot reliably attach custom headers (like `Authorization`) to media tags (`<img>`, `<video>`), so MJPEG/HLS streams must be accessed with the auth token in the URL query string:
198
+
199
+ - MJPEG: `/api/mpeg/<camera>/<profile>?token=...`
200
+ - HLS playlist: `/api/hls/<camera>/<profile>/playlist.m3u8?token=...` (and segment requests will inherit the query param)
201
+
202
+ Examples:
203
+
204
+ ```text
205
+ MJPEG:
206
+ http://HOST:3000/api/mpeg/camera/main?token=YOUR_TOKEN
207
+
208
+ HLS:
209
+ http://HOST:3000/api/hls/camera/main/playlist.m3u8?token=YOUR_TOKEN
210
+ ```
211
+
212
+ Security note: query tokens may end up in logs/history. Treat them like passwords.
213
+
214
+ 3. **WebRTC control endpoints: Bearer token in Authorization header**
215
+
216
+ WebRTC signaling uses JSON endpoints (create session, send ICE candidates, send answer) and supports standard Bearer auth:
217
+
218
+ ```bash
219
+ # 1) Login to obtain a token
220
+ curl -sS -X POST http://HOST:3000/api/auth/login \
221
+ -H 'content-type: application/json' \
222
+ -d '{"username":"admin","password":"YOUR_PASSWORD"}'
223
+
224
+ # 2) Use the returned token for WebRTC signaling
225
+ curl -sS http://HOST:3000/api/webrtc/status \
226
+ -H "Authorization: Bearer YOUR_TOKEN"
227
+ ```
228
+
229
+ You can also generate a personal token via API (requires an existing valid token):
230
+
231
+ ```bash
232
+ curl -sS -X POST http://HOST:3000/api/auth/personal-token \
233
+ -H "Authorization: Bearer YOUR_TOKEN" \
234
+ -H 'content-type: application/json' \
235
+ -d '{}'
236
+ ```
237
+
238
+ 4. **WebSocket logs: token in query string**
239
+
240
+ The browser WebSocket handshake cannot reliably attach custom headers, so use:
241
+
242
+ ```text
243
+ ws://HOST:3000/ws/logs?token=YOUR_TOKEN
244
+ ```
245
+
246
+ If authentication is disabled, these endpoints work without credentials.
247
+
248
+ Tip: a personal token is ideal for integrations (Home Assistant, scripts, etc.) because it does not expire.
249
+
98
250
  📖 **[Full Docker documentation →](./DOCKER.md)**
99
251
 
100
252
  ---
@@ -9,7 +9,7 @@ import {
9
9
  runMultifocalDiagnosticsConsecutively,
10
10
  sampleStreams,
11
11
  testChannelStreams
12
- } from "./chunk-QEA2V52E.js";
12
+ } from "./chunk-ZE7D7LI4.js";
13
13
  export {
14
14
  collectCgiDiagnostics,
15
15
  collectMultifocalDiagnostics,
@@ -22,4 +22,4 @@ export {
22
22
  sampleStreams,
23
23
  testChannelStreams
24
24
  };
25
- //# sourceMappingURL=DiagnosticsTools-YEML4E5V.js.map
25
+ //# sourceMappingURL=DiagnosticsTools-6WEMO4L4.js.map