dsh-notify-me 1.14.7 → 1.16.0
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/CHANGELOG.md +60 -0
- package/README.en.md +131 -6
- package/README.md +131 -6
- package/cordis.patch.yml +74 -0
- package/lib/client.js +815 -13
- package/lib/host-fallback.js +302 -0
- package/lib/index.js +434 -119
- package/lib/page-bridge.js +728 -0
- package/lib/relay.js +193 -0
- package/package.json +7 -3
package/cordis.patch.yml
CHANGED
|
@@ -2,6 +2,80 @@
|
|
|
2
2
|
# plugin package. The entry is a normal cordis loader entry (id + package
|
|
3
3
|
# name); the browser half is picked up by dsh-client-modules through the
|
|
4
4
|
# package's dsh.client declaration, exactly like the shipped ui-* packages.
|
|
5
|
+
#
|
|
6
|
+
# Two optional host-side modules hang off the same entry, both OFF by default:
|
|
7
|
+
#
|
|
8
|
+
# hostFallback pushes "needs you" / "reply finished" from the host's session
|
|
9
|
+
# feed, so alerts arrive with no page open.
|
|
10
|
+
# relay a same-origin route that lets the page reach an authenticated
|
|
11
|
+
# notification gateway the browser cannot talk to.
|
|
12
|
+
#
|
|
13
|
+
# HOW TO OVERRIDE
|
|
14
|
+
# A profile patch row that names the same id REPLACES the entry's `config`
|
|
15
|
+
# wholesale — the loader assigns the field, it does not deep-merge. So a
|
|
16
|
+
# minimal override only has to name what it changes, but it must not expect the
|
|
17
|
+
# values below to survive: the plugin's own defaults (lib/index.js normalizeConfig)
|
|
18
|
+
# fill every key the override leaves out, using the same values written here.
|
|
19
|
+
# Example, in ~/.dsh/profiles/<profile>/cordis.patch.yml:
|
|
20
|
+
#
|
|
21
|
+
# - id: notify-me
|
|
22
|
+
# config:
|
|
23
|
+
# hostFallback:
|
|
24
|
+
# enabled: true
|
|
25
|
+
#
|
|
26
|
+
# That alone is enough: the gateway target below is empty and JS defaults keep
|
|
27
|
+
# everything else off, but `hostFallback.target` still has to name the gateway.
|
|
28
|
+
#
|
|
29
|
+
# CREDENTIALS
|
|
30
|
+
# `credentialsFile` is a JSON file readable by the host user only (chmod 600)
|
|
31
|
+
# holding either {"user": "...", "password": "..."} (sent as HTTP Basic) or
|
|
32
|
+
# {"authorization": "Bearer ..."} (sent verbatim; a bare token gets "Bearer ").
|
|
33
|
+
# It never goes into this file: the patch layer is world-readable and ends up in
|
|
34
|
+
# the profile directory, so a password here would be a plaintext secret on disk.
|
|
35
|
+
# A rotated password needs no restart — a 401/403 re-reads the file once.
|
|
36
|
+
# Leave it empty when the gateway needs no authentication (a plain webhook):
|
|
37
|
+
# deliveries then go out without an Authorization header, and an empty path is
|
|
38
|
+
# never reported as a credential problem.
|
|
39
|
+
#
|
|
40
|
+
# `allowedOrigins` (top level, one key for all three routes) is the
|
|
41
|
+
# deployment's public origin list. It does two things: it is the Origin
|
|
42
|
+
# allow-list, and its host names are the public `Host` values the shared
|
|
43
|
+
# request gate accepts — behind a tunnel or reverse proxy the Host header is
|
|
44
|
+
# the public domain, not the loopback address the listener binds. It lives at
|
|
45
|
+
# the top level and not under relay or hostFallback because every gated route
|
|
46
|
+
# (the page bridge, the relay, the health probe) consults the same list, and a
|
|
47
|
+
# deployment that enables only one of the modules still has to be reachable
|
|
48
|
+
# through that public name.
|
|
5
49
|
- insert:
|
|
6
50
|
- id: notify-me
|
|
7
51
|
name: 'dsh-notify-me'
|
|
52
|
+
config:
|
|
53
|
+
# Public origin(s) of this deployment, e.g. ['https://dsh.example.com'];
|
|
54
|
+
# empty means loopback / bind-address requests only.
|
|
55
|
+
allowedOrigins: []
|
|
56
|
+
# Notification gateway, shared by the relay and the host fallback; each
|
|
57
|
+
# module may override target/credentialsFile below.
|
|
58
|
+
gateway:
|
|
59
|
+
target: '' # e.g. https://cue.example/notify/<key>
|
|
60
|
+
credentialsFile: '' # mode-0600 JSON, see CREDENTIALS above
|
|
61
|
+
headers: {} # extra request headers, optional
|
|
62
|
+
# Patch 1: fallback push while no page is open.
|
|
63
|
+
hostFallback:
|
|
64
|
+
enabled: false
|
|
65
|
+
target: '' # empty = use gateway.target
|
|
66
|
+
credentialsFile: '' # empty = use gateway.credentialsFile
|
|
67
|
+
events: ['turn/end', 'approval/asked']
|
|
68
|
+
includeSubagents: false
|
|
69
|
+
turnEndThrottleMs: 15000
|
|
70
|
+
titlePrefix: 'DSH'
|
|
71
|
+
language: 'auto' # auto | zh | en
|
|
72
|
+
pageLeaseMs: 60000 # 0 = no coordination with the page (duplicates while it is open)
|
|
73
|
+
healthPath: '/__dsh-notify-me/host-fallback'
|
|
74
|
+
# Patch 2: same-origin relay (page -> host -> gateway, host adds the
|
|
75
|
+
# authentication). Keep a random token in the path: the path is the
|
|
76
|
+
# capability, so it is worth as much as a password.
|
|
77
|
+
relay:
|
|
78
|
+
enabled: false
|
|
79
|
+
path: '' # exact route, e.g. /__dsh-notify-me/relay/<32 hex token>
|
|
80
|
+
target: ''
|
|
81
|
+
credentialsFile: ''
|