dsh-hello 0.1.4 → 0.1.6
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/LICENSE +21 -21
- package/README.md +73 -54
- package/cordis.patch.yml +3 -3
- package/lib/admin.d.ts +25 -0
- package/lib/admin.d.ts.map +1 -0
- package/lib/admin.js +179 -0
- package/lib/admin.js.map +1 -0
- package/lib/client.js +313 -10
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +3 -6
- package/lib/config.js.map +1 -1
- package/lib/devices.d.ts +2 -5
- package/lib/devices.d.ts.map +1 -1
- package/lib/devices.js +1 -16
- package/lib/devices.js.map +1 -1
- package/lib/files.d.ts +2 -2
- package/lib/files.d.ts.map +1 -1
- package/lib/files.js +5 -5
- package/lib/files.js.map +1 -1
- package/lib/host.d.ts +7 -12
- package/lib/host.d.ts.map +1 -1
- package/lib/http.d.ts +1 -2
- package/lib/http.d.ts.map +1 -1
- package/lib/http.js +0 -3
- package/lib/http.js.map +1 -1
- package/lib/index.d.ts +0 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4328 -6945
- package/lib/index.js.map +4 -4
- package/lib/interaction-routes.d.ts +8 -0
- package/lib/interaction-routes.d.ts.map +1 -0
- package/lib/interaction-routes.js +126 -0
- package/lib/interaction-routes.js.map +1 -0
- package/lib/pairing.d.ts +0 -1
- package/lib/pairing.d.ts.map +1 -1
- package/lib/pairing.js +0 -3
- package/lib/pairing.js.map +1 -1
- package/lib/protocol.d.ts +4 -2
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +4 -2
- package/lib/protocol.js.map +1 -1
- package/lib/qr.d.ts +13 -0
- package/lib/qr.d.ts.map +1 -0
- package/lib/qr.js +34 -0
- package/lib/qr.js.map +1 -0
- package/lib/route-deps.d.ts +41 -0
- package/lib/route-deps.d.ts.map +1 -0
- package/lib/route-deps.js +2 -0
- package/lib/route-deps.js.map +1 -0
- package/lib/route-util.d.ts +7 -0
- package/lib/route-util.d.ts.map +1 -0
- package/lib/route-util.js +21 -0
- package/lib/route-util.js.map +1 -0
- package/lib/routes.d.ts +1 -39
- package/lib/routes.d.ts.map +1 -1
- package/lib/routes.js +95 -769
- package/lib/routes.js.map +1 -1
- package/lib/schedule-routes.d.ts +9 -0
- package/lib/schedule-routes.d.ts.map +1 -0
- package/lib/schedule-routes.js +131 -0
- package/lib/schedule-routes.js.map +1 -0
- package/lib/schedules.d.ts +2 -2
- package/lib/schedules.d.ts.map +1 -1
- package/lib/schedules.js +2 -2
- package/lib/schedules.js.map +1 -1
- package/lib/server-facts.d.ts +8 -0
- package/lib/server-facts.d.ts.map +1 -0
- package/lib/server-facts.js +60 -0
- package/lib/server-facts.js.map +1 -0
- package/lib/sessions.d.ts.map +1 -1
- package/lib/sessions.js +2 -24
- package/lib/sessions.js.map +1 -1
- package/lib/speech.d.ts +1 -1
- package/lib/speech.d.ts.map +1 -1
- package/lib/speech.js +3 -3
- package/lib/speech.js.map +1 -1
- package/lib/terminal-routes.d.ts +5 -0
- package/lib/terminal-routes.d.ts.map +1 -0
- package/lib/terminal-routes.js +122 -0
- package/lib/terminal-routes.js.map +1 -0
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 xdnote
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 xdnote
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -41,8 +41,8 @@ dsh plugin --profile web add ./dsh-hello-<version>.tgz
|
|
|
41
41
|
Restart `dsh web`. The terminal prints:
|
|
42
42
|
|
|
43
43
|
```text
|
|
44
|
-
[dsh-hello] dsh 0.2.2-rc.3 satisfies >=0.2.
|
|
45
|
-
[dsh-hello] routes mounted at /dsh-hello (protocol
|
|
44
|
+
[dsh-hello] dsh 0.2.2-rc.3 satisfies >=0.2.2-0 <0.3.0
|
|
45
|
+
[dsh-hello] routes mounted at /dsh-hello (protocol 2, push none)
|
|
46
46
|
[dsh-hello] pairing code 1234 — open the app, enter the server URL, then this code.
|
|
47
47
|
```
|
|
48
48
|
|
|
@@ -51,11 +51,13 @@ the terminal prints the next one.
|
|
|
51
51
|
|
|
52
52
|
### Pairing and compatibility
|
|
53
53
|
|
|
54
|
-
The
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
The pairing code is **four digits** by default (`1234`). The Settings page offers
|
|
55
|
+
three modes: **One-time** (fresh code, `pairingTtlMs` TTL), **Permanent** (does
|
|
56
|
+
not expire until changed) and **Locked** (no new devices; paired ones keep
|
|
57
|
+
working). Each client address gets `pairingMaxAttempts` (8) tries per TTL. Four
|
|
58
|
+
digits are convenient but low entropy: keep dsh on a trusted LAN/Tailscale, or
|
|
59
|
+
raise `pairingCodeLength` / lower `pairingMaxAttempts` before exposing it to the
|
|
60
|
+
internet.
|
|
59
61
|
|
|
60
62
|
The Host's compatibility gate enforces the `engines.dsh` range at install and
|
|
61
63
|
profile startup. If a linked or exempted install runs outside the tested range,
|
|
@@ -67,12 +69,10 @@ Prerelease suffixes (`alpha`, `rc`) do not create a new line; `0.2.2-rc.1` and
|
|
|
67
69
|
`0.2.2-rc.3` are one line. The current matrix and test record live in
|
|
68
70
|
[`docs/COMPATIBILITY.md`](docs/COMPATIBILITY.md) and `compat/versions.json`.
|
|
69
71
|
|
|
70
|
-
`engines.dsh`
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
then fills the missing cursor with that cut. See `tests/compat.test.ts`. The
|
|
75
|
-
floor will move to `>=0.2.2-0` when the 0.2.1 shims are removed.
|
|
72
|
+
`engines.dsh` reads `>=0.2.2-0 <0.3.0`. 0.2.1 is outside the support window: it
|
|
73
|
+
lacks `sessionController.state()` and the page cursor, so the plugin no longer
|
|
74
|
+
carries shims for it. A Host outside the range still loads with a warning and
|
|
75
|
+
reports `dshCompatible: false` in `/health`.
|
|
76
76
|
|
|
77
77
|
## Usage
|
|
78
78
|
|
|
@@ -98,8 +98,8 @@ available** and a **Versions** section; **Update** removes the old version,
|
|
|
98
98
|
installs the selected one, keeps the bundle enabled, and recomposes with HMR or
|
|
99
99
|
asks for a restart. A failed update restores the previous version when possible.
|
|
100
100
|
|
|
101
|
-
The **Update / Versions** section is a dsh 0.2.2 feature.
|
|
102
|
-
|
|
101
|
+
The **Update / Versions** section is a dsh 0.2.2 feature. When the page has no
|
|
102
|
+
update action, update from the CLI instead:
|
|
103
103
|
|
|
104
104
|
```sh
|
|
105
105
|
dsh plugin --profile web remove dsh-hello
|
|
@@ -256,7 +256,7 @@ the app probes `/dsh-hello/health`, and pairings live under `dsh-hello/*`.
|
|
|
256
256
|
maxBodyBytes: 65536
|
|
257
257
|
rateLimitWindowMs: 60000
|
|
258
258
|
rateLimitMax: 240
|
|
259
|
-
dshVersionRange: '>=0.2.
|
|
259
|
+
dshVersionRange: '>=0.2.2-0 <0.3.0'
|
|
260
260
|
push:
|
|
261
261
|
provider: none # none | fcm | apns | relay
|
|
262
262
|
# provider: relay
|
|
@@ -269,9 +269,9 @@ the app probes `/dsh-hello/health`, and pairings live under `dsh-hello/*`.
|
|
|
269
269
|
|
|
270
270
|
`relay` mode sends only the notification payload and host token to your relay;
|
|
271
271
|
the relay holds the FCM/APNs credentials. Device tokens are registered with the
|
|
272
|
-
relay automatically when the app calls `
|
|
272
|
+
relay automatically when the app calls `PUT /devices/me/push`.
|
|
273
273
|
|
|
274
|
-
The `notify*` config values are host-wide defaults. Each device can then set its own `approval`, `question` and `turnEnd` subscriptions with `PUT /push/subscriptions`; both direct sending and relay mode filter unsubscribed devices. Turn-end pushes are sent only when no app has a live global SSE connection. A connected app handles the event locally instead.
|
|
274
|
+
The `notify*` config values are host-wide defaults. Each device can then set its own `approval`, `question` and `turnEnd` subscriptions with `PUT /devices/me/push/subscriptions`; both direct sending and relay mode filter unsubscribed devices. Turn-end pushes are sent only when no app has a live global SSE connection. A connected app handles the event locally instead.
|
|
275
275
|
|
|
276
276
|
Push credentials are BYO. Put secrets in the dsh credential store under the
|
|
277
277
|
owner-scoped record `dsh-hello/push` when possible; the plugin reads that record
|
|
@@ -314,60 +314,79 @@ The plugin talks directly to Google/Apple; there is no author-operated relay.
|
|
|
314
314
|
|
|
315
315
|
All routes are under `basePath` (default `/dsh-hello`). Except for `/health`
|
|
316
316
|
and `/pair`, every route requires `Authorization: Bearer <device token>`.
|
|
317
|
+
`/admin/*` instead accepts the Host's own browser session (or a loopback
|
|
318
|
+
caller), because the settings page talks to it.
|
|
317
319
|
|
|
318
320
|
| Method | Path | Purpose |
|
|
319
321
|
|---|---|---|
|
|
320
|
-
| GET | `/health` | Public capability and version facts |
|
|
321
|
-
| GET | `/pair` |
|
|
322
|
-
|
|
|
323
|
-
|
|
|
324
|
-
|
|
|
325
|
-
|
|
|
326
|
-
|
|
|
327
|
-
|
|
|
328
|
-
|
|
|
329
|
-
|
|
|
330
|
-
|
|
|
331
|
-
|
|
|
332
|
-
| GET | `/schedules` | Automation catalog; `available: false` when the profile has no schedule service |
|
|
333
|
-
| GET | `/schedule-marks` | Active scheduled-task counts per Session, for the drawer clock mark |
|
|
334
|
-
| GET | `/schedules/:id` | One task with target, last delivery and execution flags |
|
|
335
|
-
| GET | `/schedules/:id/history?limit=20&before=` | Delivery history, newest first |
|
|
336
|
-
| POST | `/schedules/:id/run` | Deliver one occurrence now without moving the schedule |
|
|
337
|
-
| PUT | `/schedules/:id` | Pause/resume (`{ "active": boolean, "expectedUpdatedAt"?: string }`) |
|
|
338
|
-
| DELETE | `/schedules/:id` | Delete the task and its saved deliveries |
|
|
339
|
-
| GET | `/sessions` | Session list with title projections and optional `vitals` (context %, tokens, turns, todos, goal, plan, model) |
|
|
322
|
+
| GET | `/health` | Public capability and version facts (also reports `pairingOpen`) |
|
|
323
|
+
| GET/POST | `/pair/code` | Loopback-only current/rotated code + QR payload |
|
|
324
|
+
| POST | `/pair` | One-time code → device token (`201`) |
|
|
325
|
+
| GET | `/devices/me` | This device's record, including push subscriptions |
|
|
326
|
+
| DELETE | `/devices/me` | Unpair this device and close its streams |
|
|
327
|
+
| PUT | `/devices/me/push` | Register/replace this device's FCM/APNs token |
|
|
328
|
+
| PUT | `/devices/me/push/subscriptions` | Set `approval` / `question` / `turnEnd` |
|
|
329
|
+
| DELETE | `/devices/me/push` | Remove this device's push registration |
|
|
330
|
+
| POST | `/presence` | Foreground claim (`{ foreground: boolean }`) |
|
|
331
|
+
| GET | `/speech` | Host speech provider readiness |
|
|
332
|
+
| POST | `/speech/transcribe` | Transcribe a raw WAV body (`audio/wav`; optional `?language=&providerId=`) |
|
|
333
|
+
| GET | `/sessions` | Session list with title projections and optional `vitals` |
|
|
340
334
|
| POST | `/sessions` | Create/reuse a blank Session |
|
|
341
|
-
|
|
|
342
|
-
|
|
|
343
|
-
|
|
|
335
|
+
| PATCH | `/sessions/:id` | Rename (`{ "title": string }`) |
|
|
336
|
+
| PUT | `/sessions/:id/pin` | Pin/unpin (`{ "pinned": boolean }`) |
|
|
337
|
+
| PUT | `/sessions/:id/archive` | Archive/unarchive (`{ "archived": boolean, "stopActivity"?: boolean }`) |
|
|
338
|
+
| PUT | `/sessions/:id/model` | Select provider/model (`{ provider, model, reasoningEffort? }`) |
|
|
339
|
+
| GET | `/sessions/:id/model` | Current selection |
|
|
340
|
+
| GET | `/sessions/:id/transcript?beforeSeq=&limit=` | Message-aligned history page |
|
|
344
341
|
| GET | `/sessions/:id/state` | Running/queue state + projections |
|
|
342
|
+
| POST | `/sessions/:id/prompt` | Send text (`queue` or `steer`), `202` |
|
|
343
|
+
| POST | `/sessions/:id/cancel` | Stop the current turn, `202` |
|
|
344
|
+
| POST | `/sessions/:id/fork` | Child Session at an optional inclusive `atSeq`, `201` |
|
|
345
|
+
| POST | `/sessions/:id/uploads` | Raw attachment bytes (`?kind=&name=&mediaType=`), `201` |
|
|
346
|
+
| GET | `/sessions/:id/events` | SSE follow stream (snapshot + events) |
|
|
347
|
+
| GET | `/sessions/:id/files?path=` | Directory listing inside the Session cwd (300 entries max) |
|
|
348
|
+
| GET | `/sessions/:id/file?path=`, `/sessions/:id/raw?path=` | UTF-8 preview / base64 byte chunk |
|
|
349
|
+
| GET | /sessions/:id/image?path=, /workspaces/:id/image?path= | Raw image bytes for markdown image tags (device header auth, 24 MiB cap) |
|
|
345
350
|
| GET | `/sessions/:id/terminals` | List retained phone terminals |
|
|
346
351
|
| POST | `/sessions/:id/terminals` | Open a PTY in the Session working directory |
|
|
347
352
|
| GET | `/sessions/:id/terminals/:tid/events` | SSE replay + live terminal output |
|
|
348
353
|
| POST | `/sessions/:id/terminals/:tid/input` | Write terminal input |
|
|
349
354
|
| POST | `/sessions/:id/terminals/:tid/resize` | Resize the PTY |
|
|
350
|
-
| DELETE | `/sessions/:id/terminals/:tid` | Terminate the terminal |
|
|
351
|
-
|
|
|
352
|
-
| POST | `/sessions/:id/prompt` | Send text (`queue` or `steer`) |
|
|
353
|
-
| POST | `/sessions/:id/rename` | Rename |
|
|
354
|
-
| POST | `/sessions/:id/fork` | Create a child Session at an optional inclusive `atSeq` prefix |
|
|
355
|
+
| DELETE | `/sessions/:id/terminals/:tid` | Terminate the terminal (`204`) |
|
|
356
|
+
| POST | `/sessions/:id/questions/:callId/answer` | Answer a continued question |
|
|
355
357
|
| GET | `/workspaces` | Workspace registry (id, path, title) |
|
|
356
358
|
| POST | `/workspaces` | Adopt an existing directory (`{ "path", "title"? }`) |
|
|
357
|
-
| PUT | `/workspaces/:id` | Rename a workspace (`{ "title": string }`)
|
|
358
|
-
|
|
|
359
|
-
| GET | `/
|
|
360
|
-
| GET | `/
|
|
361
|
-
|
|
|
359
|
+
| PUT | `/workspaces/:id` | Rename a workspace (`{ "title": string }`) |
|
|
360
|
+
| GET | `/workspaces/:id/files`, `/workspaces/:id/file`, `/workspaces/:id/raw` | Same file surface, keyed by workspace |
|
|
361
|
+
| GET | `/schedules` | Automation catalog; `available: false` without a schedule service |
|
|
362
|
+
| GET | `/schedules/marks` | Active scheduled-task counts per Session (drawer clock) |
|
|
363
|
+
| GET | `/schedules/:id` | One task with target, last delivery and execution flags |
|
|
364
|
+
| GET | `/schedules/:id/history?limit=&before=` | Delivery history, newest first |
|
|
365
|
+
| POST | `/schedules/:id/run` | Deliver one occurrence now |
|
|
366
|
+
| PUT | `/schedules/:id` | Pause/resume (`{ "active": boolean, "expectedUpdatedAt"?: string }`) |
|
|
367
|
+
| DELETE | `/schedules/:id` | Delete the task and its saved deliveries |
|
|
368
|
+
| GET | `/read-state` | Shared read watermarks (proxied to dsh-tag) |
|
|
369
|
+
| PATCH | `/read-state` | Merge this device's watermarks and return the merged map |
|
|
362
370
|
| GET | `/events` | Global SSE: approvals, questions, sessions, turn end |
|
|
363
|
-
| GET | `/approvals` | Pending approvals
|
|
364
|
-
| POST | `/approvals/:id` | `allow` / `always` / `deny` |
|
|
371
|
+
| GET | `/approvals` | Pending approvals |
|
|
372
|
+
| POST | `/approvals/:id/decision` | `allow` / `always` / `deny` |
|
|
365
373
|
| GET | `/questions` | Pending questions |
|
|
366
374
|
| POST | `/questions/:id/answer` | Structured answer batch |
|
|
367
|
-
|
|
|
375
|
+
| GET | `/web-url` | This Host's Web UI, launch token attached |
|
|
368
376
|
| POST | `/debug/approval` | Debug-only synthetic approval (enableDebugRoutes) |
|
|
369
377
|
| POST | `/debug/question` | Debug-only synthetic question (enableDebugRoutes) |
|
|
370
378
|
|
|
379
|
+
Admin page (browser session or loopback):
|
|
380
|
+
|
|
381
|
+
| Method | Path | Purpose |
|
|
382
|
+
|---|---|---|
|
|
383
|
+
| GET | `/admin/data` | Code, QR, lock, policy, paired devices |
|
|
384
|
+
| POST | `/admin/pair-code` | Rotate / set fixed / auto |
|
|
385
|
+
| POST | `/admin/interaction` | `phone-first` / `browser-first` / `browser-only` |
|
|
386
|
+
| POST | `/admin/lock` | Lock or unlock pairing |
|
|
387
|
+
| PUT | `/admin/devices/:id` | Rename a paired device |
|
|
388
|
+
| DELETE | `/admin/devices/:id` | Revoke a paired device |
|
|
389
|
+
|
|
371
390
|
A schedule delivery receipt acknowledges that the target Session persisted the
|
|
372
391
|
message, not that the Agent finished or succeeded. Open the target Session for
|
|
373
392
|
the actual result. `GET /health` advertises `schedules`, `scheduleActions` and
|
package/cordis.patch.yml
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
- insert:
|
|
2
|
-
- id: dsh-hello
|
|
3
|
-
name: dsh-hello
|
|
1
|
+
- insert:
|
|
2
|
+
- id: dsh-hello
|
|
3
|
+
name: dsh-hello
|
package/lib/admin.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Config } from './config.js';
|
|
2
|
+
import type { DeviceStore } from './devices.js';
|
|
3
|
+
import type { HostContext } from './host.js';
|
|
4
|
+
import type { HttpRouter, RouteContext } from './http.js';
|
|
5
|
+
import type { PairingManager } from './pairing.js';
|
|
6
|
+
import type { SseHub } from './streams.js';
|
|
7
|
+
/**
|
|
8
|
+
* The admin page's BFF: pairing code, lock, interaction policy and the paired
|
|
9
|
+
* device list. Every route is `public` because the page authenticates with the
|
|
10
|
+
* Host's own browser session; `adminAuthorized` accepts that session (via
|
|
11
|
+
* `connection.admit`) or a loopback caller.
|
|
12
|
+
*/
|
|
13
|
+
export interface AdminDependencies {
|
|
14
|
+
config: Config;
|
|
15
|
+
ctx: HostContext;
|
|
16
|
+
pairing: PairingManager;
|
|
17
|
+
devices: DeviceStore;
|
|
18
|
+
hub: SseHub;
|
|
19
|
+
interactionTarget?: () => Config['interactionTarget'];
|
|
20
|
+
saveInteractionTarget?: (target: Config['interactionTarget']) => Promise<void>;
|
|
21
|
+
/** `scheme://authority` of the request, for origins the page can reach. */
|
|
22
|
+
requestOrigin(rc: RouteContext): string | null;
|
|
23
|
+
}
|
|
24
|
+
export declare function registerAdminRoutes(router: HttpRouter, deps: AdminDependencies): void;
|
|
25
|
+
//# sourceMappingURL=admin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAE5C,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,WAAW,CAAA;IAChB,OAAO,EAAE,cAAc,CAAA;IACvB,OAAO,EAAE,WAAW,CAAA;IACpB,GAAG,EAAE,MAAM,CAAA;IACX,iBAAiB,CAAC,EAAE,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAA;IACrD,qBAAqB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,mBAAmB,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC9E,2EAA2E;IAC3E,aAAa,CAAC,EAAE,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CAAA;CAC/C;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAiGrF"}
|
package/lib/admin.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { HttpError, sendJson } from './http.js';
|
|
2
|
+
import { renderQrSvg } from './qr.js';
|
|
3
|
+
export function registerAdminRoutes(router, deps) {
|
|
4
|
+
const originOf = (rc) => requestBase(rc) ?? deps.requestOrigin(rc) ?? '';
|
|
5
|
+
router.add({
|
|
6
|
+
method: 'GET',
|
|
7
|
+
pattern: '/admin/data',
|
|
8
|
+
auth: 'public',
|
|
9
|
+
handler: async (rc) => {
|
|
10
|
+
if (!adminAuthorized(deps, rc))
|
|
11
|
+
throw unauthorized();
|
|
12
|
+
sendJson(rc.res, 200, await adminData(deps, originOf(rc)));
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
router.add({
|
|
16
|
+
method: 'POST',
|
|
17
|
+
pattern: '/admin/pair-code',
|
|
18
|
+
auth: 'public',
|
|
19
|
+
handler: async (rc) => {
|
|
20
|
+
if (!adminAuthorized(deps, rc))
|
|
21
|
+
throw unauthorized();
|
|
22
|
+
const body = (rc.body ?? {});
|
|
23
|
+
try {
|
|
24
|
+
if (body.action === 'fixed') {
|
|
25
|
+
if (typeof body.code !== 'string')
|
|
26
|
+
throw new HttpError(400, 'bad-code', 'code is required');
|
|
27
|
+
await deps.pairing.setFixedCode(body.code);
|
|
28
|
+
}
|
|
29
|
+
else if (body.action === 'auto' || body.action === 'rotate') {
|
|
30
|
+
if (body.action === 'auto')
|
|
31
|
+
await deps.pairing.setFixedCode(null);
|
|
32
|
+
else
|
|
33
|
+
deps.pairing.rotate();
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
throw new HttpError(400, 'bad-action', 'action must be rotate, fixed, or auto');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
if (error instanceof HttpError)
|
|
41
|
+
throw error;
|
|
42
|
+
throw new HttpError(400, 'bad-code', error instanceof Error ? error.message : String(error));
|
|
43
|
+
}
|
|
44
|
+
sendJson(rc.res, 200, await adminData(deps, originOf(rc)));
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
router.add({
|
|
48
|
+
method: 'POST',
|
|
49
|
+
pattern: '/admin/interaction',
|
|
50
|
+
auth: 'public',
|
|
51
|
+
handler: async (rc) => {
|
|
52
|
+
if (!adminAuthorized(deps, rc))
|
|
53
|
+
throw unauthorized();
|
|
54
|
+
const body = (rc.body ?? {});
|
|
55
|
+
const target = body.target;
|
|
56
|
+
if (target !== 'phone-first' && target !== 'browser-first' && target !== 'browser-only') {
|
|
57
|
+
throw new HttpError(400, 'bad-target', 'target must be phone-first, browser-first, or browser-only');
|
|
58
|
+
}
|
|
59
|
+
if (deps.saveInteractionTarget === undefined) {
|
|
60
|
+
throw new HttpError(503, 'interaction-unavailable', 'this Host cannot change the interaction policy');
|
|
61
|
+
}
|
|
62
|
+
await deps.saveInteractionTarget(target);
|
|
63
|
+
sendJson(rc.res, 200, await adminData(deps, originOf(rc)));
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
router.add({
|
|
67
|
+
method: 'POST',
|
|
68
|
+
pattern: '/admin/lock',
|
|
69
|
+
auth: 'public',
|
|
70
|
+
handler: async (rc) => {
|
|
71
|
+
if (!adminAuthorized(deps, rc))
|
|
72
|
+
throw unauthorized();
|
|
73
|
+
const body = (rc.body ?? {});
|
|
74
|
+
if (typeof body.locked !== 'boolean')
|
|
75
|
+
throw new HttpError(400, 'bad-lock', 'locked must be true or false');
|
|
76
|
+
await deps.pairing.setLocked(body.locked);
|
|
77
|
+
sendJson(rc.res, 200, await adminData(deps, originOf(rc)));
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
router.add({
|
|
81
|
+
method: 'DELETE',
|
|
82
|
+
pattern: '/admin/devices/:id',
|
|
83
|
+
auth: 'public',
|
|
84
|
+
handler: async (rc) => {
|
|
85
|
+
if (!adminAuthorized(deps, rc))
|
|
86
|
+
throw unauthorized();
|
|
87
|
+
const removed = await deps.devices.revoke(rc.params.id);
|
|
88
|
+
if (!removed)
|
|
89
|
+
throw new HttpError(404, 'device-not-found', 'no such device');
|
|
90
|
+
deps.hub.closeDevice(rc.params.id);
|
|
91
|
+
sendJson(rc.res, 200, await adminData(deps, originOf(rc)));
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
router.add({
|
|
95
|
+
method: 'PUT',
|
|
96
|
+
pattern: '/admin/devices/:id',
|
|
97
|
+
auth: 'public',
|
|
98
|
+
handler: async (rc) => {
|
|
99
|
+
if (!adminAuthorized(deps, rc))
|
|
100
|
+
throw unauthorized();
|
|
101
|
+
const body = (rc.body ?? {});
|
|
102
|
+
const name = typeof body.name === 'string' ? body.name.trim().slice(0, 120) : '';
|
|
103
|
+
if (name.length === 0)
|
|
104
|
+
throw new HttpError(400, 'bad-device-name', 'a non-empty device name is required');
|
|
105
|
+
const renamed = await deps.devices.rename(rc.params.id, name);
|
|
106
|
+
if (!renamed)
|
|
107
|
+
throw new HttpError(404, 'device-not-found', 'no such device');
|
|
108
|
+
sendJson(rc.res, 200, await adminData(deps, originOf(rc)));
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
function unauthorized() {
|
|
113
|
+
return new HttpError(401, 'admin-unauthorized', 'open this page from an authenticated dsh browser');
|
|
114
|
+
}
|
|
115
|
+
async function adminData(deps, origin) {
|
|
116
|
+
const view = deps.pairing.current();
|
|
117
|
+
const payload = JSON.stringify({ v: 1, url: `${origin}${deps.config.basePath}`, code: view.code });
|
|
118
|
+
const { svg: qrSvg, error: qrError } = await renderQrSvg(payload);
|
|
119
|
+
return {
|
|
120
|
+
code: view.code,
|
|
121
|
+
formatted: view.formatted,
|
|
122
|
+
fixed: view.fixed,
|
|
123
|
+
locked: deps.pairing.isLocked(),
|
|
124
|
+
interactionTarget: deps.interactionTarget?.() ?? deps.config.interactionTarget,
|
|
125
|
+
expiresAt: view.fixed ? null : view.expiresAt,
|
|
126
|
+
origin,
|
|
127
|
+
basePath: deps.config.basePath,
|
|
128
|
+
qrSvg,
|
|
129
|
+
qrError,
|
|
130
|
+
time: Date.now(),
|
|
131
|
+
devices: deps.devices.list().map(device => ({
|
|
132
|
+
deviceId: device.deviceId,
|
|
133
|
+
deviceName: device.deviceName,
|
|
134
|
+
platform: device.platform,
|
|
135
|
+
appVersion: device.appVersion,
|
|
136
|
+
authorities: device.authorities,
|
|
137
|
+
pairedAt: device.pairedAt,
|
|
138
|
+
lastSeenAt: device.lastSeenAt,
|
|
139
|
+
push: device.push !== undefined,
|
|
140
|
+
})),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function adminAuthorized(deps, rc) {
|
|
144
|
+
const connection = deps.ctx.get('connection');
|
|
145
|
+
if (connection !== undefined && typeof connection.admit === 'function') {
|
|
146
|
+
try {
|
|
147
|
+
const admission = connection.admit({ headers: rc.req.headers });
|
|
148
|
+
if (admission.peer !== undefined)
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
catch {
|
|
152
|
+
// Fall through to the loopback check.
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return rc.clientAddress === '127.0.0.1' || rc.clientAddress === '::1' || rc.clientAddress.startsWith('127.');
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* The admin page sends the base directory it was loaded from (`new URL('.',
|
|
159
|
+
* location.href)`). It is the URL the user is actually using, so the Settings
|
|
160
|
+
* QR follows the public URL without any Host-side public-URL configuration.
|
|
161
|
+
* A loopback page yields a loopback QR; the phone can edit the address.
|
|
162
|
+
*/
|
|
163
|
+
function requestBase(rc) {
|
|
164
|
+
const value = rc.query.get('base');
|
|
165
|
+
if (value === null || value.length === 0 || value.length > 2048)
|
|
166
|
+
return null;
|
|
167
|
+
try {
|
|
168
|
+
const url = new URL(value);
|
|
169
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:')
|
|
170
|
+
return null;
|
|
171
|
+
if (url.username !== '' || url.password !== '' || url.search !== '' || url.hash !== '')
|
|
172
|
+
return null;
|
|
173
|
+
return `${url.origin}${url.pathname.replace(/\/+$/, '')}`;
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=admin.js.map
|
package/lib/admin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin.js","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AAG/C,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAqBrC,MAAM,UAAU,mBAAmB,CAAC,MAAkB,EAAE,IAAuB;IAC7E,MAAM,QAAQ,GAAG,CAAC,EAAgB,EAAU,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,CAAA;IAE9F,MAAM,CAAC,GAAG,CAAC;QACT,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,aAAa;QACtB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YACpB,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC;gBAAE,MAAM,YAAY,EAAE,CAAA;YACpD,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAC5D,CAAC;KACF,CAAC,CAAA;IAEF,MAAM,CAAC,GAAG,CAAC;QACT,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,kBAAkB;QAC3B,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YACpB,IAAI,CAAC,eAAe,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