herdr-remote-relay 0.3.25 → 0.3.27
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 +3 -1
- package/README.zh-CN.md +3 -1
- package/dist/protocol/index.d.ts +1 -0
- package/dist/protocol/index.js +1 -0
- package/dist/protocol/release.d.ts +8 -0
- package/dist/protocol/release.js +17 -0
- package/dist/relay-server.d.ts +3 -0
- package/dist/relay-server.js +3 -1
- package/dist/server/http-api.d.ts +1 -0
- package/dist/server/http-api.js +12 -7
- package/dist/server/types.d.ts +2 -0
- package/package.json +1 -1
- package/web/dist/assets/index-DkFcSEuU.js +61 -0
- package/web/dist/assets/index-DznFLD5G.css +32 -0
- package/web/dist/fonts/maple-mono/OFL.txt +93 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-0-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-0-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-1-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-1-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-10-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-10-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-11-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-11-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-12-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-12-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-13-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-13-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-14-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-14-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-15-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-15-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-16-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-16-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-17-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-17-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-18-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-18-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-19-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-19-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-2-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-2-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-3-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-3-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-4-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-4-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-5-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-5-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-6-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-6-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-7-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-7-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-8-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-8-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-9-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-9-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-0-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-0-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-1-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-1-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-10-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-10-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-11-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-11-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-12-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-12-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-13-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-13-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-14-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-14-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-2-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-2-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-3-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-3-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-4-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-4-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-5-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-5-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-6-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-6-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-7-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-7-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-8-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-8-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-9-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-cjk-rare-9-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-0-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-1-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-10-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-11-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-12-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-13-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-14-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-15-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-16-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-17-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-2-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-3-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-4-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-5-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-6-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-7-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-8-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-icons-9-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-latin-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-latin-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-symbols-400.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono-symbols-700.woff2 +0 -0
- package/web/dist/fonts/maple-mono/maple-mono.css +992 -0
- package/web/dist/index.html +5 -2
- package/web/dist/assets/index-XYYRsgSb.css +0 -32
- package/web/dist/assets/index-k4NH1O2l.js +0 -61
package/README.md
CHANGED
|
@@ -11,10 +11,12 @@ Brokers WebSocket connections between browsers and workstation host connectors.
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install -g herdr-remote-relay
|
|
14
|
+
npm install -g https://github.com/dibin666/herdr-remote/releases/latest/download/herdr-remote-relay.tgz
|
|
15
15
|
herdr-remote-relay --public-url https://herdr.example.com --password <password>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
From npm instead: `npm install -g herdr-remote-relay` (it can lag a new release by a while).
|
|
19
|
+
|
|
18
20
|
Requirements: Node.js 22+, TLS reverse proxy (nginx, Caddy, Cloudflare Tunnel).
|
|
19
21
|
|
|
20
22
|
## Docker
|
package/README.zh-CN.md
CHANGED
|
@@ -11,10 +11,12 @@
|
|
|
11
11
|
## 安装
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
npm install -g herdr-remote-relay
|
|
14
|
+
npm install -g https://github.com/dibin666/herdr-remote/releases/latest/download/herdr-remote-relay.tgz
|
|
15
15
|
herdr-remote-relay --public-url https://herdr.example.com --password <密码>
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
也可从 npm 安装:`npm install -g herdr-remote-relay`(新版本上线后 npm 可能要过一段时间才同步)。
|
|
19
|
+
|
|
18
20
|
前置要求:Node.js 22+、TLS 反向代理(nginx、Caddy、Cloudflare Tunnel 等)。
|
|
19
21
|
|
|
20
22
|
## Docker 运行
|
package/dist/protocol/index.d.ts
CHANGED
package/dist/protocol/index.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Also the name an update check reports as its source. */
|
|
2
|
+
export declare const GITHUB_RELEASES_URL = "https://github.com/dibin666/herdr-remote/releases";
|
|
3
|
+
/** `{ schema, version, tag, relayVersion, tarball }`, attached to every release. */
|
|
4
|
+
export declare const LATEST_RELEASE_MANIFEST_URL = "https://github.com/dibin666/herdr-remote/releases/latest/download/latest.json";
|
|
5
|
+
/** The newest self-contained CLI tarball, for a workstation that cannot say which it needs. */
|
|
6
|
+
export declare const LATEST_CLI_TARBALL_URL = "https://github.com/dibin666/herdr-remote/releases/latest/download/herdr-remote.tgz";
|
|
7
|
+
/** One CLI release's self-contained tarball; it bundles the relay it was released with. */
|
|
8
|
+
export declare function cliTarballUrl(version: string): string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Where herdr-remote is released. The CLI updates from here and the browser
|
|
2
|
+
// shows the same addresses in its manual steps, so there is one definition.
|
|
3
|
+
//
|
|
4
|
+
// GitHub Releases is the primary channel: a release is downloadable the moment
|
|
5
|
+
// it is created, whereas npm can take many minutes after `npm publish` before
|
|
6
|
+
// a new version installs. npm carries the same tarballs as a fallback.
|
|
7
|
+
const RELEASE_REPOSITORY = 'dibin666/herdr-remote';
|
|
8
|
+
/** Also the name an update check reports as its source. */
|
|
9
|
+
export const GITHUB_RELEASES_URL = `https://github.com/${RELEASE_REPOSITORY}/releases`;
|
|
10
|
+
/** `{ schema, version, tag, relayVersion, tarball }`, attached to every release. */
|
|
11
|
+
export const LATEST_RELEASE_MANIFEST_URL = `${GITHUB_RELEASES_URL}/latest/download/latest.json`;
|
|
12
|
+
/** The newest self-contained CLI tarball, for a workstation that cannot say which it needs. */
|
|
13
|
+
export const LATEST_CLI_TARBALL_URL = `${GITHUB_RELEASES_URL}/latest/download/herdr-remote.tgz`;
|
|
14
|
+
/** One CLI release's self-contained tarball; it bundles the relay it was released with. */
|
|
15
|
+
export function cliTarballUrl(version) {
|
|
16
|
+
return `${GITHUB_RELEASES_URL}/download/herdr-remote-v${version}/herdr-remote-${version}.tgz`;
|
|
17
|
+
}
|
package/dist/relay-server.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export interface RelayServerOptions {
|
|
|
21
21
|
devLatencyMs?: number | string;
|
|
22
22
|
metrics?: RelayMetrics;
|
|
23
23
|
auth?: AuthStore;
|
|
24
|
+
/** The built web client to serve; defaults to the package's `web/dist`. */
|
|
25
|
+
publicDir?: string;
|
|
24
26
|
}
|
|
25
27
|
export type RelayAddress = {
|
|
26
28
|
host: string;
|
|
@@ -47,6 +49,7 @@ declare class RelayServer implements RelayContext {
|
|
|
47
49
|
trustProxy: boolean;
|
|
48
50
|
devLatencyMs: number;
|
|
49
51
|
devDelayMs: number;
|
|
52
|
+
publicDir: string;
|
|
50
53
|
sendQueues: WeakMap<RelaySocket, SendQueue>;
|
|
51
54
|
activeDelayTimers: Set<NodeJS.Timeout>;
|
|
52
55
|
auth: AuthStore;
|
package/dist/relay-server.js
CHANGED
|
@@ -10,7 +10,7 @@ import { PROTOCOL_VERSION, WS_CLIENT_PATH, WS_HOST_PATH } from './protocol/index
|
|
|
10
10
|
import { DEFAULTS, defaultStateDir, loadRelayConfig } from './relay-config.js';
|
|
11
11
|
import { handleClientConnection } from './server/client-channel.js';
|
|
12
12
|
import { handleHostConnection } from './server/host-channel.js';
|
|
13
|
-
import { handleHttp } from './server/http-api.js';
|
|
13
|
+
import { handleHttp, PUBLIC_DIR } from './server/http-api.js';
|
|
14
14
|
import { heartbeat, sweep } from './server/maintenance.js';
|
|
15
15
|
import { isAllowedOrigin } from './server/requests.js';
|
|
16
16
|
import { detachClient, detachHost } from './server/sessions.js';
|
|
@@ -35,6 +35,7 @@ class RelayServer {
|
|
|
35
35
|
trustProxy;
|
|
36
36
|
devLatencyMs;
|
|
37
37
|
devDelayMs;
|
|
38
|
+
publicDir;
|
|
38
39
|
sendQueues = new WeakMap();
|
|
39
40
|
activeDelayTimers = new Set();
|
|
40
41
|
auth;
|
|
@@ -57,6 +58,7 @@ class RelayServer {
|
|
|
57
58
|
this.password = options.password ?? auth.password ?? null;
|
|
58
59
|
this.adminToken = options.adminToken ?? auth.adminToken ?? null;
|
|
59
60
|
this.trustProxy = Boolean(options.trustProxy ?? relay.trustProxy);
|
|
61
|
+
this.publicDir = path.resolve(options.publicDir ?? PUBLIC_DIR);
|
|
60
62
|
// Development-only artificial latency switch for local responsiveness profiling.
|
|
61
63
|
// When unset or 0, this incurs zero overhead and avoids entering the delayed path.
|
|
62
64
|
// RELAY_DEV_LATENCY_MS specifies round-trip delay, so each one-way leg
|
package/dist/server/http-api.js
CHANGED
|
@@ -10,7 +10,8 @@ import { detachDeviceSessions } from './sessions.js';
|
|
|
10
10
|
import { isOpen } from './sockets.js';
|
|
11
11
|
import { statusSnapshot } from './status.js';
|
|
12
12
|
import { VERSION } from './version.js';
|
|
13
|
-
const PUBLIC_DIR = path.join(PACKAGE_ROOT, 'web', 'dist');
|
|
13
|
+
export const PUBLIC_DIR = path.join(PACKAGE_ROOT, 'web', 'dist');
|
|
14
|
+
const FONT_CACHE_SECONDS = 7 * 24 * 60 * 60;
|
|
14
15
|
const MIME_TYPES = {
|
|
15
16
|
'.html': 'text/html; charset=utf-8',
|
|
16
17
|
'.js': 'text/javascript; charset=utf-8',
|
|
@@ -179,21 +180,21 @@ export function handleHttp(relay, req, res) {
|
|
|
179
180
|
sendError(res, 404, 'not_found', 'API route not found');
|
|
180
181
|
return;
|
|
181
182
|
}
|
|
182
|
-
serveStatic(pathname, res);
|
|
183
|
+
serveStatic(relay.publicDir, pathname, res);
|
|
183
184
|
}
|
|
184
|
-
function serveStatic(requestPath, res) {
|
|
185
|
+
function serveStatic(publicDir, requestPath, res) {
|
|
185
186
|
const relative = requestPath === '/' || requestPath === '/admin'
|
|
186
187
|
? 'index.html'
|
|
187
188
|
: requestPath.replace(/^\/+/, '');
|
|
188
|
-
const candidate = path.resolve(
|
|
189
|
-
if (!candidate.startsWith(`${
|
|
190
|
-
candidate !== path.join(
|
|
189
|
+
const candidate = path.resolve(publicDir, relative);
|
|
190
|
+
if (!candidate.startsWith(`${publicDir}${path.sep}`) &&
|
|
191
|
+
candidate !== path.join(publicDir, 'index.html')) {
|
|
191
192
|
sendError(res, 403, 'forbidden', 'path is not allowed');
|
|
192
193
|
return;
|
|
193
194
|
}
|
|
194
195
|
fs.readFile(candidate, (error, data) => {
|
|
195
196
|
if (error && !path.extname(relative)) {
|
|
196
|
-
fs.readFile(path.join(
|
|
197
|
+
fs.readFile(path.join(publicDir, 'index.html'), (fallbackError, fallbackData) => {
|
|
197
198
|
if (fallbackError) {
|
|
198
199
|
sendError(res, 503, 'web_not_built', 'frontend has not been built');
|
|
199
200
|
return;
|
|
@@ -209,6 +210,10 @@ function serveStatic(requestPath, res) {
|
|
|
209
210
|
}
|
|
210
211
|
const extension = path.extname(candidate).toLowerCase();
|
|
211
212
|
setResponseHeaders(res, MIME_TYPES[extension] || 'application/octet-stream');
|
|
213
|
+
// The bundled fonts run to megabytes and only change with a release; a
|
|
214
|
+
// week is short enough that a font upgrade still arrives.
|
|
215
|
+
if (relative.startsWith('fonts/'))
|
|
216
|
+
res.setHeader('Cache-Control', `public, max-age=${FONT_CACHE_SECONDS}`);
|
|
212
217
|
res.end(data);
|
|
213
218
|
});
|
|
214
219
|
}
|
package/dist/server/types.d.ts
CHANGED
|
@@ -118,6 +118,8 @@ export interface RelayContext {
|
|
|
118
118
|
trustProxy: boolean;
|
|
119
119
|
devLatencyMs: number;
|
|
120
120
|
devDelayMs: number;
|
|
121
|
+
/** Where the built web client is served from. */
|
|
122
|
+
publicDir: string;
|
|
121
123
|
sendQueues: WeakMap<RelaySocket, SendQueue>;
|
|
122
124
|
activeDelayTimers: Set<NodeJS.Timeout>;
|
|
123
125
|
finishHandshake(ws: RelaySocket): void;
|