@bysir/herdr-web 0.4.0 → 0.5.1

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.
Files changed (2) hide show
  1. package/README.md +25 -21
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -80,7 +80,7 @@ The ⚙ at the right end of the top bar is the **settings panel**; its "Devices"
80
80
 
81
81
  **Out of codes? Go back to the machine and run `herdr-web pair`.** That is not laziness either — see below.
82
82
 
83
- The old never-expiring `~/.herdr-web/token` is demoted to **bootstrap only**: an old bookmark exchanges it for a device credential on first open and scrubs the token out of the URL, after which you should `rm ~/.herdr-web/token`. Details and reasoning in [SECURITY.md](SECURITY.md) (Chinese).
83
+ The old never-expiring `~/.herdr-web/token` is demoted to **bootstrap only**: an old bookmark exchanges it for a device credential on first open and scrubs the token out of the URL, after which you should `rm ~/.herdr-web/token`. Details and reasoning in [SECURITY.md](docs/dev/SECURITY.md) (Chinese).
84
84
 
85
85
  Once connected it **types `herdr` for you**. To type something else, or nothing: `HERDR_WEB_ONCONNECT` (set it to an empty string to stay in the shell). Adding a path segment to the URL (`/work`) gives you **a different herdr session** — see [First run](#first-run). The old "run herdr" button in the top bar is gone: with autotyping it earns its place less than once a day, and the soft key bar ships a preset for it if you want one.
86
86
 
@@ -150,7 +150,7 @@ the page** (an image in the clipboard is uploaded directly). Where the path land
150
150
  the outbox is open — appended to your draft, or typed straight into the terminal.
151
151
 
152
152
  → Why a separate box at all, how images actually work, the two-way caveats, measured polling
153
- latency: [OUTBOX.md](OUTBOX.md)
153
+ latency: [OUTBOX.md](docs/dev/OUTBOX.md)
154
154
 
155
155
  ### Soft key bar
156
156
 
@@ -166,7 +166,7 @@ Settings → Soft keys.
166
166
  the combination.
167
167
  - `act:` actions run in the browser and send no bytes: `act:kbd` (system keyboard), `act:img`
168
168
  (upload), `act:panes` (pane list), `act:files` (file browsing), `act:clip` / `act:paste`
169
- ([copy and paste on a phone](MOBILE.md#手机上怎么复制--粘贴)).
169
+ ([copy and paste on a phone](docs/dev/MOBILE.md#手机上怎么复制--粘贴)).
170
170
  - Every key has a **"double-tap"** checkbox; close pane / close tab / `/clear` ship with it on —
171
171
  keys sit close together and a misfire cannot be undone.
172
172
  - "Load presets" pours sixty-odd keys into "My keys", after which every one of them is yours to edit.
@@ -189,8 +189,8 @@ It is an index, not a second interface: after the tap you are looking at the sam
189
189
  every keyboard habit is unchanged.
190
190
 
191
191
  → Sort order, the "3 minutes ago" column, when a notice fires, how the badge counts, system
192
- notifications: [MOBILE.md](MOBILE.md)
193
-  How that text is scraped off the screen: [COMPOSER.md](COMPOSER.md)
192
+ notifications: [MOBILE.md](docs/dev/MOBILE.md)
193
+  How that text is scraped off the screen: [COMPOSER.md](docs/dev/COMPOSER.md)
194
194
 
195
195
  ### File browsing
196
196
 
@@ -208,7 +208,7 @@ allowlist would not stop them and would only get in the way daily. If you want o
208
208
  `HERDR_WEB_FILE_ROOTS` (that is a real jail); to remove the feature, `HERDR_WEB_FILES=0`.
209
209
 
210
210
  → The short-lived link route and the four hard rules on it (never `text/html`, why SVG is safe to
211
- render): [SECURITY.md](SECURITY.md)
211
+ render): [SECURITY.md](docs/dev/SECURITY.md)
212
212
 
213
213
  ### Phones and tablets
214
214
 
@@ -234,7 +234,7 @@ row of keys. **Landscape and portrait keep separate sets**, swapped on rotation.
234
234
  arranged on a phone do not follow you to the desktop, while the definitions stay shared.
235
235
 
236
236
  → Why the gestures are split this way, how the keyboard is handled, copy and paste on a phone, the
237
- details of the dock and the top bar: [MOBILE.md](MOBILE.md)
237
+ details of the dock and the top bar: [MOBILE.md](docs/dev/MOBILE.md)
238
238
 
239
239
  ### Settings panel
240
240
 
@@ -255,7 +255,7 @@ Keys the browser keeps for itself: on macOS `⌘W` `⌘T` `⌘N` `Ctrl+Tab`; on
255
255
 
256
256
  Copy `⌘C` (or `Ctrl+Shift+C`) · paste `⌘V` · clear `⌘K` · `Option` is Meta by default. Copy and
257
257
  paste on a phone is a different story — herdr copies to the clipboard of **the machine running
258
- herdr** — see [MOBILE.md](MOBILE.md#手机上怎么复制--粘贴).
258
+ herdr** — see [MOBILE.md](docs/dev/MOBILE.md#手机上怎么复制--粘贴).
259
259
 
260
260
  ## Configuration
261
261
 
@@ -289,7 +289,7 @@ Changes take effect on restart — configuration is read once at startup. To con
289
289
 
290
290
  | Variable | Default | Meaning |
291
291
  |---|---|---|
292
- | `HERDR_WEB_PORT` | `7788` | Port |
292
+ | `HERDR_WEB_PORT` | `7788` | The main port. **It only serves the local network**: a connection whose peer is not loopback / private / link-local / CGNAT gets 403 and nothing else. Public access is a separate, explicit port — see `HERDR_WEB_PUBLIC_PORT` |
293
293
  | `HERDR_WEB_HOST` | `127.0.0.1` | Listen address; `0.0.0.0` opens it to the LAN |
294
294
  | `HERDR_WEB_TOKEN` | reads `~/.herdr-web/token` | **Legacy**; only good for bootstrapping once (exchanged for a device credential). Not generated on new installs |
295
295
  | `HERDR_WEB_SHELL` | `$SHELL` | The shell run inside the PTY |
@@ -311,11 +311,12 @@ Changes take effect on restart — configuration is read once at startup. To con
311
311
 
312
312
  ### Exposure / TLS / credentials
313
313
 
314
- Details in [SECURITY.md](SECURITY.md) (Chinese).
314
+ Details in [SECURITY.md](docs/dev/SECURITY.md) (Chinese).
315
315
 
316
316
  | Variable | Default | Meaning |
317
317
  |---|---|---|
318
- | `HERDR_WEB_EXPOSED` | off | `=1` **declares that this port is reachable from the internet** (frp / port forwarding / tunnels). Behind frp the process usually listens on 127.0.0.1 and every request also comes from 127.0.0.1, so "is the listen address local" tells you nothing; it cannot be detected, only declared. Once declared: TLS is mandatory and loopback-without-pairing is turned off |
318
+ | `HERDR_WEB_PUBLIC_PORT` | off | **The port to expose.** Opens a second listener on `0.0.0.0:<port>` sharing the same handler, and that is where a tunnel / port forward / reverse proxy should point — never at the main port, which serves the local network only. Requests arriving here are treated as public: loopback-without-pairing and the legacy token's `loopback` tier do not apply (the source address of a tunnelled request is 127.0.0.1 too, so the only trustworthy signal is *which listener it landed on*), the rate limiter's "never block localhost" exemption is off, and TLS becomes mandatory. Why a separate port instead of a switch on the main port: a switch is a *declaration*, and declarations get forgotten — the person (or agent) writing code on this machine sees `127.0.0.1:7788` and has no way to know a tunnel is forwarding it, so every decision made under "only my machine can reach this" becomes a hole. With a separate port, forgetting to configure it means the tunnel gets connection refused |
319
+ | `HERDR_WEB_EXPOSED` | off | **Legacy; prefer `HERDR_WEB_PUBLIC_PORT`.** `=1` declares that *the main port itself* is reachable from the internet (frp / port forwarding / tunnels) — it cannot be detected, only declared. Once declared: TLS is mandatory, loopback-without-pairing is turned off, and the main port's "local network only" gate is lifted (you said it is public). Kept for machines already configured this way |
319
320
  | `HERDR_WEB_TLS_CERT` / `_KEY` | empty | Use the certificate you supply. If you own a domain and got a real certificate via DNS-01, take this route — zero browser warnings, no profiles to install, least friction |
320
321
  | `HERDR_WEB_ACME_DNS` | empty | Let herdr-web **get its own certificate**; the value is the DNS provider: `cloudflare` / `alidns` / `tencentcloud` / `route53` / `digitalocean` / `huaweicloud`. It uses DNS-01, so nothing has to reach you from outside — behind NAT, or with the domain pointed at a LAN address, it still works. **Where to get each provider's token and what scope it needs: [DNS.md](DNS.md)** (Chinese) |
321
322
  | `HERDR_WEB_ACME_EMAIL` | empty | ACME account email. Can be empty, but then you get no expiry reminders either |
@@ -355,10 +356,11 @@ Details in [SECURITY.md](SECURITY.md) (Chinese).
355
356
  # 2. Phone / tablet on the LAN: self-signed TLS, pair by scanning the banner QR
356
357
  HERDR_WEB_HOST=0.0.0.0 ./herdr-web
357
358
 
358
- # 3. Exposed through frp / a tunnel: EXPOSED must be declared (the process only
359
- # listens on 127.0.0.1 and cannot tell whether anyone outside can reach it),
360
- # PUBLIC_URL decides which address the QR code encodes
361
- HERDR_WEB_EXPOSED=1 HERDR_WEB_TLS=proxy \
359
+ # 3. Exposed through frp / a tunnel: point the tunnel at PUBLIC_PORT, never at the
360
+ # main port the main port only serves the local network, and every default on
361
+ # it assumes the internet cannot reach it. PUBLIC_URL decides which address the
362
+ # QR code encodes
363
+ HERDR_WEB_PUBLIC_PORT=17788 HERDR_WEB_TLS=proxy \
362
364
  HERDR_WEB_PUBLIC_URL=https://herdr.example.com \
363
365
  HERDR_WEB_HOSTNAME=herdr.example.com ./herdr-web
364
366
 
@@ -469,20 +471,22 @@ without a PTY), so the door is designed on that premise. What is implemented:
469
471
  moving to a new device does not require going back to the machine, and session credential lifetime
470
472
  can drop from three months to one day.
471
473
 
472
- → Threat model, the reasoning behind each choice, what is not built yet: [SECURITY.md](SECURITY.md)
474
+ → Threat model, the reasoning behind each choice, what is not built yet: [SECURITY.md](docs/dev/SECURITY.md)
473
475
   Reaching it from the internet (frp / tunnels) and the four TLS tiers: [DEPLOY.md](DEPLOY.md)
474
476
 
475
477
  ## Documents
476
478
 
477
479
  Everything below is in Chinese — that is where the "why" lives.
478
480
 
481
+ **This file, plus DEPLOY / DNS, is the user documentation.** The first five below live in [`docs/dev/`](docs/dev/README.md) — that layer is *why it is built this way*: design rationale, hand-verified semantics, and the traps that fail silently.
482
+
479
483
  | What you want | Where |
480
484
  |---|---|
481
- | Outbox: why a separate box, how images work, measured polling latency | [OUTBOX.md](OUTBOX.md) |
482
- | Reading the screen: scraping the input line, scraping what the agent said | [COMPOSER.md](COMPOSER.md) |
483
- | herdr socket API semantics, verified by hand | [HERDR-API.md](HERDR-API.md) |
484
- | The whole phone / tablet layer (gestures, keyboard, dock, top bar, notices, clipboard) | [MOBILE.md](MOBILE.md) |
485
- | Security design and threat model; the rules on the file-serving route | [SECURITY.md](SECURITY.md) |
485
+ | Outbox: why a separate box, how images work, measured polling latency | [OUTBOX.md](docs/dev/OUTBOX.md) |
486
+ | Reading the screen: scraping the input line, scraping what the agent said | [COMPOSER.md](docs/dev/COMPOSER.md) |
487
+ | herdr socket API semantics, verified by hand | [HERDR-API.md](docs/dev/HERDR-API.md) |
488
+ | The whole phone / tablet layer (gestures, keyboard, dock, top bar, notices, clipboard) | [MOBILE.md](docs/dev/MOBILE.md) |
489
+ | Security design and threat model; the rules on the file-serving route | [SECURITY.md](docs/dev/SECURITY.md) |
486
490
  | Where to run it, public access, TLS tiers | [DEPLOY.md](DEPLOY.md) |
487
491
  | Getting a DNS token from each provider and the scope it needs | [DNS.md](DNS.md) |
488
492
  | Read before changing code (layout, releasing, colours, the silent traps) | [CLAUDE.md](CLAUDE.md) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bysir/herdr-web",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "浏览器里的 herdr 终端 + 语音投稿。一个 Go 二进制,前端嵌在里面。",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/zbysir/herdr-web#readme",
@@ -29,9 +29,9 @@
29
29
  "node": ">=18"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@bysir/herdr-web-darwin-arm64": "0.4.0",
33
- "@bysir/herdr-web-darwin-x64": "0.4.0",
34
- "@bysir/herdr-web-linux-arm64": "0.4.0",
35
- "@bysir/herdr-web-linux-x64": "0.4.0"
32
+ "@bysir/herdr-web-darwin-arm64": "0.5.1",
33
+ "@bysir/herdr-web-darwin-x64": "0.5.1",
34
+ "@bysir/herdr-web-linux-arm64": "0.5.1",
35
+ "@bysir/herdr-web-linux-x64": "0.5.1"
36
36
  }
37
37
  }