@bom0792/herdgate 0.0.0-stage → 0.9.5
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 +167 -2
- package/app-mod/herdgate/main.js +395 -0
- package/app-mod/herdgate/mod.json +5 -0
- package/bin/herdgate.mjs +92 -0
- package/dist-readme.md +48 -0
- package/package.json +36 -3
- package/plugin/herdr-plugin.toml +36 -0
- package/plugin/server/common.mjs +79 -0
- package/plugin/server/e2e.d.mts +43 -0
- package/plugin/server/e2e.mjs +268 -0
- package/plugin/server/index.mjs +454 -0
- package/plugin/server/ssh.mjs +241 -0
- package/scripts/build-host-bundle.sh +12 -0
- package/scripts/deploy-vps.sh +74 -0
- package/scripts/patch-ssh2.mjs +32 -0
- package/src/agent/adapter.ts +23 -0
- package/src/agent/index.ts +183 -0
- package/src/cloud/gateway.ts +946 -0
- package/src/cloud/main.ts +88 -0
- package/src/cloud/pairing.ts +81 -0
- package/src/cloud/ssh-bridge.ts +212 -0
- package/src/cloud/sshd.ts +412 -0
- package/src/cloud/static.ts +142 -0
- package/src/cloud/stores.ts +180 -0
- package/src/cloud/util.ts +47 -0
- package/src/cloud/vapid.ts +105 -0
- package/src/dev/edge-sim.ts +99 -0
- package/src/dev/main.ts +33 -0
- package/src/host/herdr.ts +316 -0
- package/src/host/main.ts +105 -0
- package/src/host/ssh.ts +317 -0
- package/src/index.ts +5 -0
- package/src/protocol/agent.ts +84 -0
- package/src/protocol/device.ts +90 -0
- package/src/protocol/envelope.ts +58 -0
- package/src/protocol/index.ts +3 -0
- package/src/web/app.css +312 -0
- package/src/web/app.js +835 -0
- package/src/web/app.webmanifest +15 -0
- package/src/web/e2e.js +268 -0
- package/src/web/herdgate-host.zip +0 -0
- package/src/web/icons/icon-192.png +0 -0
- package/src/web/icons/icon-512.png +0 -0
- package/src/web/icons/icon.svg +6 -0
- package/src/web/index.html +99 -0
- package/src/web/sw.js +98 -0
package/src/web/app.css
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--bg: #11131a;
|
|
3
|
+
--surface: #181b24;
|
|
4
|
+
--line: #262a36;
|
|
5
|
+
--fg: #e7e9ee;
|
|
6
|
+
--muted: #9aa1b1;
|
|
7
|
+
--dim: #6b7285;
|
|
8
|
+
--accent: #7aa2f7;
|
|
9
|
+
--good: #6fcf97;
|
|
10
|
+
--bad: #f7768e;
|
|
11
|
+
--radius: 10px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media (prefers-color-scheme: light) {
|
|
15
|
+
:root {
|
|
16
|
+
--bg: #f6f7f9;
|
|
17
|
+
--surface: #ffffff;
|
|
18
|
+
--line: #e2e5ea;
|
|
19
|
+
--fg: #16181d;
|
|
20
|
+
--muted: #5b6472;
|
|
21
|
+
--dim: #858d9b;
|
|
22
|
+
--accent: #2f6fdd;
|
|
23
|
+
--good: #12805c;
|
|
24
|
+
--bad: #c0304a;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
* {
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
html,
|
|
33
|
+
body {
|
|
34
|
+
margin: 0;
|
|
35
|
+
height: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
body {
|
|
39
|
+
background: var(--bg);
|
|
40
|
+
color: var(--fg);
|
|
41
|
+
font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
|
|
42
|
+
padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
|
|
43
|
+
display: flex;
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
#bar {
|
|
48
|
+
display: flex;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 10px;
|
|
51
|
+
padding: 12px 16px;
|
|
52
|
+
border-bottom: 1px solid var(--line);
|
|
53
|
+
background: var(--surface);
|
|
54
|
+
position: sticky;
|
|
55
|
+
top: 0;
|
|
56
|
+
z-index: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
#bar strong {
|
|
60
|
+
font-size: 15px;
|
|
61
|
+
letter-spacing: 0.01em;
|
|
62
|
+
flex: 1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.pill {
|
|
66
|
+
font-size: 11.5px;
|
|
67
|
+
padding: 3px 9px;
|
|
68
|
+
border-radius: 999px;
|
|
69
|
+
background: var(--bg);
|
|
70
|
+
color: var(--dim);
|
|
71
|
+
border: 1px solid var(--line);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.pill[data-kind="good"] {
|
|
75
|
+
color: var(--good);
|
|
76
|
+
border-color: color-mix(in srgb, var(--good) 40%, var(--line));
|
|
77
|
+
}
|
|
78
|
+
.pill[data-kind="bad"] {
|
|
79
|
+
color: var(--bad);
|
|
80
|
+
border-color: color-mix(in srgb, var(--bad) 40%, var(--line));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
#menu {
|
|
84
|
+
background: none;
|
|
85
|
+
border: 1px solid var(--line);
|
|
86
|
+
color: var(--muted);
|
|
87
|
+
border-radius: 8px;
|
|
88
|
+
width: 32px;
|
|
89
|
+
height: 30px;
|
|
90
|
+
font-size: 16px;
|
|
91
|
+
line-height: 1;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
main {
|
|
96
|
+
flex: 1;
|
|
97
|
+
min-height: 0;
|
|
98
|
+
overflow-y: auto;
|
|
99
|
+
padding: 18px 16px 40px;
|
|
100
|
+
max-width: 720px;
|
|
101
|
+
width: 100%;
|
|
102
|
+
margin: 0 auto;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
h1 {
|
|
106
|
+
font-size: 19px;
|
|
107
|
+
margin: 4px 0 14px;
|
|
108
|
+
}
|
|
109
|
+
h2 {
|
|
110
|
+
font-size: 16px;
|
|
111
|
+
margin: 0 0 12px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.muted {
|
|
115
|
+
color: var(--muted);
|
|
116
|
+
}
|
|
117
|
+
.dim,
|
|
118
|
+
.small {
|
|
119
|
+
color: var(--dim);
|
|
120
|
+
font-size: 12.5px;
|
|
121
|
+
}
|
|
122
|
+
.error {
|
|
123
|
+
color: var(--bad);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
label {
|
|
127
|
+
display: block;
|
|
128
|
+
font-size: 12.5px;
|
|
129
|
+
color: var(--muted);
|
|
130
|
+
margin: 14px 0 6px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
input,
|
|
134
|
+
select,
|
|
135
|
+
button {
|
|
136
|
+
font: inherit;
|
|
137
|
+
color: var(--fg);
|
|
138
|
+
background: var(--surface);
|
|
139
|
+
border: 1px solid var(--line);
|
|
140
|
+
border-radius: var(--radius);
|
|
141
|
+
padding: 11px 12px;
|
|
142
|
+
width: 100%;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
input:focus,
|
|
146
|
+
select:focus,
|
|
147
|
+
button:focus-visible {
|
|
148
|
+
outline: 2px solid var(--accent);
|
|
149
|
+
outline-offset: 1px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
button {
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
background: var(--accent);
|
|
155
|
+
border-color: transparent;
|
|
156
|
+
color: #0b0d12;
|
|
157
|
+
font-weight: 600;
|
|
158
|
+
margin-top: 14px;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
button.danger {
|
|
162
|
+
background: none;
|
|
163
|
+
color: var(--bad);
|
|
164
|
+
border-color: var(--line);
|
|
165
|
+
font-weight: 500;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
button.link {
|
|
169
|
+
background: none;
|
|
170
|
+
border: none;
|
|
171
|
+
color: var(--accent);
|
|
172
|
+
padding: 0;
|
|
173
|
+
margin: 0 0 12px;
|
|
174
|
+
width: auto;
|
|
175
|
+
font-weight: 500;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/* Back-to-machines: a real tap target (44px), not a hair-thin text link. */
|
|
179
|
+
#back,
|
|
180
|
+
#pair-back {
|
|
181
|
+
display: block;
|
|
182
|
+
min-height: 44px;
|
|
183
|
+
padding: 0 16px;
|
|
184
|
+
margin: 4px 0 12px;
|
|
185
|
+
width: auto;
|
|
186
|
+
border: 1px solid var(--line);
|
|
187
|
+
border-radius: var(--radius);
|
|
188
|
+
background: var(--surface);
|
|
189
|
+
color: var(--accent);
|
|
190
|
+
font-weight: 600;
|
|
191
|
+
text-align: left;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.list {
|
|
195
|
+
list-style: none;
|
|
196
|
+
margin: 0;
|
|
197
|
+
padding: 0;
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
gap: 8px;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.row {
|
|
204
|
+
display: block;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.rowbtn {
|
|
208
|
+
display: flex;
|
|
209
|
+
flex-direction: column;
|
|
210
|
+
align-items: flex-start;
|
|
211
|
+
gap: 3px;
|
|
212
|
+
width: 100%;
|
|
213
|
+
text-align: left;
|
|
214
|
+
background: var(--surface);
|
|
215
|
+
border: 1px solid var(--line);
|
|
216
|
+
color: var(--fg);
|
|
217
|
+
font-weight: 500;
|
|
218
|
+
margin: 0;
|
|
219
|
+
padding: 14px;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.rowbtn .name {
|
|
223
|
+
font-size: 15px;
|
|
224
|
+
}
|
|
225
|
+
.rowbtn .meta {
|
|
226
|
+
font-size: 12.5px;
|
|
227
|
+
color: var(--muted);
|
|
228
|
+
font-weight: 400;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.grid {
|
|
232
|
+
display: grid;
|
|
233
|
+
grid-template-columns: max-content 1fr;
|
|
234
|
+
gap: 6px 16px;
|
|
235
|
+
margin: 4px 0 16px;
|
|
236
|
+
}
|
|
237
|
+
.grid dt {
|
|
238
|
+
color: var(--muted);
|
|
239
|
+
font-size: 13px;
|
|
240
|
+
}
|
|
241
|
+
.grid dd {
|
|
242
|
+
margin: 0;
|
|
243
|
+
font-variant-numeric: tabular-nums;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.chips {
|
|
247
|
+
list-style: none;
|
|
248
|
+
display: flex;
|
|
249
|
+
flex-wrap: wrap;
|
|
250
|
+
gap: 6px;
|
|
251
|
+
padding: 0;
|
|
252
|
+
margin: 0 0 14px;
|
|
253
|
+
}
|
|
254
|
+
.chips li {
|
|
255
|
+
font-size: 12.5px;
|
|
256
|
+
padding: 4px 9px;
|
|
257
|
+
border-radius: 999px;
|
|
258
|
+
background: var(--surface);
|
|
259
|
+
border: 1px solid var(--line);
|
|
260
|
+
color: var(--muted);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
dialog {
|
|
264
|
+
border: 1px solid var(--line);
|
|
265
|
+
border-radius: 14px;
|
|
266
|
+
background: var(--surface);
|
|
267
|
+
color: var(--fg);
|
|
268
|
+
padding: 18px;
|
|
269
|
+
width: min(92vw, 420px);
|
|
270
|
+
}
|
|
271
|
+
dialog::backdrop {
|
|
272
|
+
background: rgb(0 0 0 / 0.5);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.row {
|
|
276
|
+
display: flex;
|
|
277
|
+
gap: 10px;
|
|
278
|
+
}
|
|
279
|
+
.row button {
|
|
280
|
+
flex: 1;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/* The SSH hint: command + key reveal, comfortable to tap on a phone. */
|
|
284
|
+
#view details.ssh {
|
|
285
|
+
margin-top: 14px;
|
|
286
|
+
border: 1px solid var(--line);
|
|
287
|
+
border-radius: var(--radius);
|
|
288
|
+
padding: 10px 12px;
|
|
289
|
+
}
|
|
290
|
+
#view details.ssh summary {
|
|
291
|
+
cursor: pointer;
|
|
292
|
+
font-weight: 500;
|
|
293
|
+
}
|
|
294
|
+
#view details.ssh pre {
|
|
295
|
+
margin: 10px 0 8px;
|
|
296
|
+
white-space: pre-wrap;
|
|
297
|
+
word-break: break-all;
|
|
298
|
+
}
|
|
299
|
+
#view details.ssh .keyrow button.link {
|
|
300
|
+
font-size: 0.95em;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/* SSH public-key management inside the device's SSH section */
|
|
304
|
+
.sshkeys .pubkey-input {
|
|
305
|
+
flex: 1;
|
|
306
|
+
min-width: 0;
|
|
307
|
+
font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
308
|
+
padding: 8px;
|
|
309
|
+
border: 1px solid var(--border, #ccc);
|
|
310
|
+
border-radius: 6px;
|
|
311
|
+
}
|
|
312
|
+
.sshkeys .keyrow { margin-top: 8px; }
|