impreza-mcp 0.40.0 → 0.42.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/README.md CHANGED
@@ -230,7 +230,10 @@ you opening a browser:
230
230
  rather than per account.
231
231
  - **Tor is a deployment target, not an add-on.** `impreza_add_onion` gives a
232
232
  deployment a `.onion` address in one call, so an agent can publish a hidden
233
- service the same way it publishes a normal site.
233
+ service the same way it publishes a normal site. `impreza_onion_auth_*`
234
+ manage Tor v3 restricted discovery (client authorization): private keys
235
+ never leave the customer's Tor client unless they ask the server to
236
+ generate a keypair — and then the private key is shown once, never stored.
234
237
  - **No API key in your config.** The hosted connector authenticates over OAuth.
235
238
 
236
239
  If none of that matters for your project, a mainstream provider is a perfectly
@@ -431,6 +434,13 @@ and `impreza_api_search` finds anything not named here.
431
434
  | `impreza_restart_deployment` | `POST .../restart` |
432
435
  | `impreza_redeploy_deployment` | `POST .../custom/{id}/redeploy` (in-place rebuild, same domain) |
433
436
  | `impreza_add_onion` | `POST .../onion/add` |
437
+ | `impreza_set_onion_profile` | `POST .../onion/profile` (`standard` / `hardened` / `max` hardening tiers) |
438
+ | `impreza_export_onion_key` | `POST .../onion/export` (sealed to your X25519 key; plaintext never transits) |
439
+ | `impreza_fetch_onion_key_export` | `GET .../onion/export/{command_id}` (read-once — the blob is burned) |
440
+ | `impreza_rotate_onion_key` | `POST .../onion/rotate` (new .onion; the old address dies) |
441
+ | `impreza_onion_auth_list` | `GET .../onion/clients` |
442
+ | `impreza_onion_auth_add` | `POST .../onion/clients` (`pubkey`, or `generate:true` → `private_key` shown once) |
443
+ | `impreza_onion_auth_revoke` | `DELETE .../onion/clients/{name}` |
434
444
  | `impreza_change_domain` | `POST .../domain` |
435
445
  | `impreza_git_webhook_status` | `GET .../custom/{id}/git-webhook` |
436
446
  | `impreza_git_webhook_connect` | `POST .../custom/{id}/git-webhook/connect` |
@@ -583,6 +593,42 @@ The IP of the machine running this MCP server (almost always your
583
593
  laptop) must be on the API key's whitelist. Manage the whitelist in
584
594
  your Impreza clientarea.
585
595
 
596
+ ## Using over Tor
597
+
598
+ The MCP server can route every API call through a local Tor daemon, so
599
+ API requests use the configured proxy. Your network provider can still observe
600
+ your connection to Tor; this option does not hide that you are using Tor.
601
+
602
+ 1. Install and start Tor (the `tor` daemon, or Tor Browser — both
603
+ commonly expose a SOCKS5 listener on `127.0.0.1:9050` for the daemon
604
+ or `127.0.0.1:9150` for Tor Browser; check your local configuration).
605
+ 2. Add `IMPREZA_PROXY` to the MCP config env:
606
+
607
+ ```json
608
+ "env": {
609
+ "IMPREZA_API_KEY": "imp_...",
610
+ "IMPREZA_API_SECRET": "...",
611
+ "IMPREZA_PROXY": "socks5://127.0.0.1:9050"
612
+ }
613
+ ```
614
+
615
+ Every API request then exits through Tor, and the API hostname is
616
+ resolved by Tor itself (remote DNS) — nothing is resolved locally, so
617
+ no DNS leak. The transport fails closed: if the proxy is unreachable
618
+ or refuses the connection, the request fails — it never silently falls
619
+ back to a direct clearnet connection.
620
+
621
+ Optionally point `IMPREZA_BASE_URL` at the API's `.onion` mirror —
622
+ `http://` is accepted only for v3 `.onion` hosts, since Tor authenticates and
623
+ encrypts onion connections. Clearnet hosts require `https://`. An onion URL
624
+ also requires an explicit `IMPREZA_PROXY`; the client refuses direct DNS and
625
+ connections even when the onion URL uses HTTPS. Proxy requests refuse redirects,
626
+ use a bounded request deadline and accept response bodies up to 16 MiB.
627
+
628
+ One account-side adjustment: Tor exit IPs rotate constantly, so a
629
+ fixed-IP whitelist on the API key cannot work. Set the key's IP factor
630
+ to `tofu` or `keyonly` in the clientarea.
631
+
586
632
  ## PHP deployments
587
633
 
588
634
  Use `impreza_prepare_project` with `composer_json` and optionally `php_document_root` to review a PHP app. Deploy with `impreza_deploy_custom`, `mode: "dockerfile"` and `build_strategy: "php_composer"`, using Git, a local directory or a retained upload. The PHP 8.4/Apache recipe installs production dependencies from `composer.json` and a matching `composer.lock`, without Composer scripts or plugins, and checks actual platform requirements. Choose `project_dir` for the application and `php_document_root` for its public subfolder containing `index.php` (default `public`). Apache runs as a non-root user on `target_port` (default 8080, minimum 1024); it serves public files and sends missing paths to `index.php`.
@@ -670,3 +716,32 @@ The custom deploy and preparation tools also support `static_files` and
670
716
  `go_build`. Metrics and MariaDB bindings require agent 0.6.17 or newer.
671
717
  See [configuration, metrics and recovery](https://docs.imprezahost.com/customer-workflows.html)
672
718
  for permissions, examples and limits. No automatic server update occurs.
719
+
720
+ ### Isolated runtime through Tor (0.42.0)
721
+
722
+ Custom image and source deployments can opt in with `tor_egress: true` through
723
+ `impreza_deploy_custom` and saved deployment preparation. This option needs an
724
+ agent advertising `tor-egress-v1`, Docker Engine 28+, and a SOCKS5h-capable
725
+ application. The runtime has no direct outbound fallback. Source downloads,
726
+ image pulls and builds retain the server's normal network connection. Catalog
727
+ installs, imported manifests and external service bindings are unsupported.
728
+ See the [Tor runtime guide](https://docs.imprezahost.com/onion-services.html#runtime-egress)
729
+ for availability and verification. This option is separate from using Tor to
730
+ connect the MCP client itself and from publishing an inbound onion address.
731
+
732
+ ## Private onion previews and retained identities (0.42.0)
733
+
734
+ Preview creation supports `private: true`; optionally supply one or more `onion_clients`.
735
+ Supplied reviewers use a name and X25519 public key. Without supplied clients, a reviewer keypair is generated and the private key is shown once. This mode requires agent
736
+ 0.6.20 with `onion-private-preview-v1`; reviewer authorization is installed
737
+ before the first onion publication. Repeated deploys preserve later revocations.
738
+ Do not combine this option with password-protected HTTPS previews.
739
+
740
+ `impreza_purge_onion_key` requires the exact old onion address and explicit
741
+ confirmation. Queued work is not proof of deletion: inspect its completed
742
+ result. Active addresses are refused. Purge removes retained copies on that
743
+ server; exports and backups elsewhere remain. Releasing a reservation for an
744
+ uninstalled application does not delete key material.
745
+
746
+ See the [onion guide](https://docs.imprezahost.com/onion-services.html)
747
+ for permissions, customer update steps and supported limitations.
package/dist/client.d.ts CHANGED
@@ -4,12 +4,19 @@ export interface ImprezaConfig {
4
4
  apiSecret: string;
5
5
  /** Wall-clock budget per HTTP call. Default 60s. */
6
6
  timeoutMs?: number;
7
+ /**
8
+ * Optional `socks5://host:port` proxy (typically a local Tor daemon) that
9
+ * EVERY API call is routed through. Fail-closed: when set and the proxy is
10
+ * unreachable, requests fail — there is no silent fallback to clearnet.
11
+ */
12
+ proxy?: string;
7
13
  }
8
14
  export declare class ImprezaClient {
9
15
  private readonly baseURL;
10
16
  private readonly apiKey;
11
17
  private readonly apiSecret;
12
18
  private readonly timeoutMs;
19
+ private readonly proxy;
13
20
  constructor(cfg: ImprezaConfig);
14
21
  /**
15
22
  * Authenticated GET. Decodes the standard envelope ({success, data,
@@ -47,6 +54,15 @@ export declare class ImprezaClient {
47
54
  */
48
55
  postRaw<T>(path: string, contentType: string, bytes: Uint8Array): Promise<T>;
49
56
  private fetch;
57
+ /**
58
+ * fetch() equivalent routed through the configured SOCKS5 proxy. The proxy
59
+ * resolves the target hostname (remote DNS — no local lookup, no leak) and
60
+ * TLS, when the URL is https, is layered on top of the proxied socket. Uses
61
+ * node:http with a per-request `createConnection` (the one form Node honors
62
+ * — an Agent-constructor option is silently ignored), so no dependency is
63
+ * needed. Any proxy/handshake failure throws: fail closed, never direct.
64
+ */
65
+ private proxiedFetch;
50
66
  private parseEnvelope;
51
67
  }
52
68
  import { VERSION } from './version.js';
package/dist/client.js CHANGED
@@ -2,25 +2,38 @@
2
2
  // OpenAPI surface in impreza-platform/specs/openapi-platform.yaml.
3
3
  //
4
4
  // Auth: standard X-API-Key + X-API-Secret headers, sourced from env.
5
- // Network: native fetch (Node ≥ 20 has it). No retry / circuit-breaker
6
- // in v1 — the AI client retries the tool call if it cares.
5
+ // Network: native fetch (Node ≥ 20 has it), or a hand-rolled no-auth SOCKS5
6
+ // transport over node:net/node:http when `proxy` is configured (Tor usage —
7
+ // see socks5.ts). No retry / circuit-breaker in v1 — the AI client retries
8
+ // the tool call if it cares.
7
9
  import { createHash } from 'node:crypto';
10
+ import { once } from 'node:events';
8
11
  import { readFile, stat } from 'node:fs/promises';
12
+ import http from 'node:http';
9
13
  import { tmpdir } from 'node:os';
10
14
  import { join } from 'node:path';
11
15
  import { createWriteStream } from 'node:fs';
16
+ import tls from 'node:tls';
12
17
  import { unlink } from 'node:fs/promises';
13
18
  import * as tar from 'tar';
19
+ import { parseSocksProxy, socks5Connect } from './socks5.js';
20
+ import { isOnionHost } from './env.js';
14
21
  export class ImprezaClient {
15
22
  baseURL;
16
23
  apiKey;
17
24
  apiSecret;
18
25
  timeoutMs;
26
+ proxy;
19
27
  constructor(cfg) {
20
28
  this.baseURL = cfg.baseURL.replace(/\/+$/, '');
21
29
  this.apiKey = cfg.apiKey;
22
30
  this.apiSecret = cfg.apiSecret;
23
31
  this.timeoutMs = cfg.timeoutMs ?? 60_000;
32
+ this.proxy = cfg.proxy ? parseSocksProxy(cfg.proxy) : undefined;
33
+ const host = new URL(this.baseURL).hostname;
34
+ if (host.endsWith('.onion') && (!isOnionHost(host) || !this.proxy)) {
35
+ throw new Error('An onion API requires a valid v3 hostname and an explicit SOCKS5 proxy; no direct connection is allowed.');
36
+ }
24
37
  }
25
38
  /**
26
39
  * Authenticated GET. Decodes the standard envelope ({success, data,
@@ -106,25 +119,26 @@ export class ImprezaClient {
106
119
  async fetch(url, init) {
107
120
  const ctrl = new AbortController();
108
121
  const timer = setTimeout(() => ctrl.abort(), this.timeoutMs);
122
+ const headers = {
123
+ Accept: 'application/json',
124
+ 'X-API-Key': this.apiKey,
125
+ 'X-API-Secret': this.apiSecret,
126
+ 'User-Agent': `impreza-mcp/${VERSION}`,
127
+ // All callers pass plain objects — cast keeps HeadersInit's array/Headers
128
+ // variants from poisoning the merged shape.
129
+ ...(init.headers ?? {}),
130
+ };
109
131
  try {
110
- const res = await fetch(url, {
111
- ...init,
112
- headers: {
113
- Accept: 'application/json',
114
- 'X-API-Key': this.apiKey,
115
- 'X-API-Secret': this.apiSecret,
116
- 'User-Agent': `impreza-mcp/${VERSION}`,
117
- ...(init.headers ?? {}),
118
- },
119
- // The credentials above are CUSTOM headers. Fetch strips Authorization,
120
- // Cookie and Proxy-Authorization when a redirect crosses to another
121
- // origin — it has no idea ours are credentials, so it would carry the
122
- // customer's key and secret to whatever host a 3xx names. The API
123
- // answers JSON on every endpoint and never redirects, so we take the
124
- // redirect ourselves and refuse it.
125
- redirect: 'manual',
126
- signal: ctrl.signal,
127
- });
132
+ // The credentials above are CUSTOM headers. Fetch strips Authorization,
133
+ // Cookie and Proxy-Authorization when a redirect crosses to another
134
+ // origin — it has no idea ours are credentials, so it would carry the
135
+ // customer's key and secret to whatever host a 3xx names. The API
136
+ // answers JSON on every endpoint and never redirects, so we take the
137
+ // redirect ourselves and refuse it. (node:http never follows redirects
138
+ // at all, so the proxied path is equally strict by construction.)
139
+ const res = this.proxy
140
+ ? await this.proxiedFetch(url, init, headers, ctrl.signal)
141
+ : await fetch(url, { ...init, headers, redirect: 'manual', signal: ctrl.signal });
128
142
  if (res.status >= 300 && res.status < 400) {
129
143
  throw new Error(`UNEXPECTED_REDIRECT: the API answered HTTP ${res.status} for ${url.pathname}. ` +
130
144
  'Refusing to resend your API credentials to the redirect target. ' +
@@ -136,6 +150,91 @@ export class ImprezaClient {
136
150
  clearTimeout(timer);
137
151
  }
138
152
  }
153
+ /**
154
+ * fetch() equivalent routed through the configured SOCKS5 proxy. The proxy
155
+ * resolves the target hostname (remote DNS — no local lookup, no leak) and
156
+ * TLS, when the URL is https, is layered on top of the proxied socket. Uses
157
+ * node:http with a per-request `createConnection` (the one form Node honors
158
+ * — an Agent-constructor option is silently ignored), so no dependency is
159
+ * needed. Any proxy/handshake failure throws: fail closed, never direct.
160
+ */
161
+ async proxiedFetch(url, init, headers, signal) {
162
+ if (!this.proxy)
163
+ throw new Error('proxiedFetch without a configured proxy');
164
+ const isTls = url.protocol === 'https:';
165
+ const port = url.port ? Number(url.port) : isTls ? 443 : 80;
166
+ let socket;
167
+ const onAbort = () => socket?.destroy(new Error('Proxied request aborted'));
168
+ signal.addEventListener('abort', onAbort);
169
+ try {
170
+ signal.throwIfAborted();
171
+ socket = await socks5Connect(this.proxy, url.hostname, port, this.timeoutMs, signal);
172
+ signal.throwIfAborted();
173
+ if (isTls) {
174
+ const tlsSocket = tls.connect({ socket, servername: url.hostname });
175
+ // Abort removes once() listeners before destroy(error) emits. Keep a
176
+ // sink for that late event; the awaited handshake/request still rejects.
177
+ tlsSocket.on('error', () => { });
178
+ socket = tlsSocket;
179
+ await once(tlsSocket, 'secureConnect', { signal });
180
+ }
181
+ const established = socket;
182
+ const body = init.body;
183
+ const reqHeaders = { ...headers };
184
+ if (body !== undefined) {
185
+ reqHeaders['Content-Length'] = String(typeof body === 'string' ? Buffer.byteLength(body) : body.byteLength);
186
+ }
187
+ return await new Promise((resolve, reject) => {
188
+ const req = http.request({
189
+ method: init.method ?? 'GET',
190
+ host: url.hostname,
191
+ port,
192
+ path: url.pathname + url.search,
193
+ headers: reqHeaders,
194
+ createConnection: () => established,
195
+ }, (res) => {
196
+ const chunks = [];
197
+ let bytes = 0;
198
+ res.on('data', (c) => {
199
+ bytes += c.length;
200
+ if (bytes > 16 * 1024 * 1024) {
201
+ req.destroy(new Error('Proxied response exceeds 16 MiB'));
202
+ return;
203
+ }
204
+ chunks.push(c);
205
+ });
206
+ res.on('end', () => {
207
+ try {
208
+ const resHeaders = new Headers();
209
+ for (let i = 0; i + 1 < res.rawHeaders.length; i += 2) {
210
+ resHeaders.append(res.rawHeaders[i], res.rawHeaders[i + 1]);
211
+ }
212
+ resolve(new Response([204, 205, 304].includes(res.statusCode ?? 0) ? null : Buffer.concat(chunks), {
213
+ status: res.statusCode ?? 502,
214
+ statusText: res.statusMessage ?? '',
215
+ headers: resHeaders,
216
+ }));
217
+ }
218
+ catch (err) {
219
+ reject(err);
220
+ }
221
+ });
222
+ res.on('error', reject);
223
+ res.on('aborted', () => reject(new Error('Proxied response was truncated')));
224
+ });
225
+ req.setTimeout(this.timeoutMs, () => req.destroy(new Error(`proxied request timed out after ${this.timeoutMs}ms`)));
226
+ req.on('error', reject);
227
+ if (body !== undefined)
228
+ req.write(body);
229
+ req.end();
230
+ established.resume();
231
+ });
232
+ }
233
+ finally {
234
+ signal.removeEventListener('abort', onAbort);
235
+ socket?.destroy();
236
+ }
237
+ }
139
238
  async parseEnvelope(res) {
140
239
  const text = await res.text();
141
240
  let env;
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,mEAAmE;AACnE,EAAE;AACF,qEAAqE;AACrE,uEAAuE;AACvE,2DAA2D;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAU3B,MAAM,OAAO,aAAa;IACP,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,SAAS,CAAS;IAClB,SAAS,CAAS;IAEnC,YAAY,GAAkB;QAC5B,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,IAAI,MAAM,CAAC;IAC3C,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,GAAG,CAAI,IAAY,EAAE,KAA8B;QACvD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI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package/dist/env.d.ts ADDED
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ export declare const isOnionHost: (host: string) => boolean;
3
+ export declare const IMPREZA_BASE_URL_SCHEMA: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
4
+ export declare const IMPREZA_PROXY_SCHEMA: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
5
+ export declare const envSchema: z.ZodEffects<z.ZodObject<{
6
+ IMPREZA_API_KEY: z.ZodString;
7
+ IMPREZA_API_SECRET: z.ZodString;
8
+ IMPREZA_BASE_URL: z.ZodDefault<z.ZodEffects<z.ZodString, string, string>>;
9
+ IMPREZA_PROXY: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ IMPREZA_API_KEY: string;
12
+ IMPREZA_API_SECRET: string;
13
+ IMPREZA_BASE_URL: string;
14
+ IMPREZA_PROXY?: string | undefined;
15
+ }, {
16
+ IMPREZA_API_KEY: string;
17
+ IMPREZA_API_SECRET: string;
18
+ IMPREZA_BASE_URL?: string | undefined;
19
+ IMPREZA_PROXY?: string | undefined;
20
+ }>, {
21
+ IMPREZA_API_KEY: string;
22
+ IMPREZA_API_SECRET: string;
23
+ IMPREZA_BASE_URL: string;
24
+ IMPREZA_PROXY?: string | undefined;
25
+ }, {
26
+ IMPREZA_API_KEY: string;
27
+ IMPREZA_API_SECRET: string;
28
+ IMPREZA_BASE_URL?: string | undefined;
29
+ IMPREZA_PROXY?: string | undefined;
30
+ }>;
package/dist/env.js ADDED
@@ -0,0 +1,67 @@
1
+ // Env validation for the MCP server, extracted from server.ts so the rules
2
+ // can be unit-tested without booting the server itself.
3
+ import { z } from 'zod';
4
+ import { parseSocksProxy } from './socks5.js';
5
+ // IMPREZA_BASE_URL must be https:// — the API key + secret travel in request
6
+ // headers on every call, so an http:// (or otherwise downgraded) base URL
7
+ // would expose them in cleartext. Refusing non-https here prevents an
8
+ // attacker who can influence the environment from pointing the client at a
9
+ // malicious or plaintext endpoint to harvest credentials.
10
+ //
11
+ // The single exception is a .onion host: onion circuits are end-to-end
12
+ // encrypted by Tor itself, so http:// to a .onion never crosses the network
13
+ // in cleartext. A proxy is mandatory for either scheme on an onion host.
14
+ export const isOnionHost = (host) => /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)*[a-z2-7]{56}\.onion$/i.test(host);
15
+ export const IMPREZA_BASE_URL_SCHEMA = z
16
+ .string()
17
+ .url()
18
+ .refine((u) => {
19
+ let url;
20
+ try {
21
+ url = new URL(u);
22
+ }
23
+ catch {
24
+ return false;
25
+ }
26
+ if (url.username || url.password || url.search || url.hash)
27
+ return false;
28
+ if (url.hostname.endsWith('.onion') && !isOnionHost(url.hostname))
29
+ return false;
30
+ if (url.protocol === 'https:')
31
+ return true;
32
+ return url.protocol === 'http:' && isOnionHost(url.hostname);
33
+ }, 'IMPREZA_BASE_URL must be an https:// URL — http:// is accepted only for .onion hosts')
34
+ .default('https://api.imprezahost.com');
35
+ // IMPREZA_PROXY routes every API call through a local SOCKS5 proxy (typically
36
+ // the Tor daemon). Format checked with the same parser the client uses, so a
37
+ // value that validates here cannot fail at request time.
38
+ export const IMPREZA_PROXY_SCHEMA = z
39
+ .string()
40
+ .refine((v) => {
41
+ try {
42
+ parseSocksProxy(v);
43
+ return true;
44
+ }
45
+ catch {
46
+ return false;
47
+ }
48
+ }, 'IMPREZA_PROXY must be a socks5://host:port URL (e.g. socks5://127.0.0.1:9050)')
49
+ .optional();
50
+ export const envSchema = z.object({
51
+ IMPREZA_API_KEY: z.string().min(8, 'IMPREZA_API_KEY must be set (starts with imp_)'),
52
+ IMPREZA_API_SECRET: z.string().min(16, 'IMPREZA_API_SECRET must be set'),
53
+ IMPREZA_BASE_URL: IMPREZA_BASE_URL_SCHEMA,
54
+ IMPREZA_PROXY: IMPREZA_PROXY_SCHEMA,
55
+ }).superRefine((cfg, ctx) => {
56
+ let host;
57
+ try {
58
+ host = new URL(cfg.IMPREZA_BASE_URL).hostname;
59
+ }
60
+ catch {
61
+ return;
62
+ }
63
+ if (host.endsWith('.onion') && !cfg.IMPREZA_PROXY) {
64
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ['IMPREZA_PROXY'], message: 'An onion API requires IMPREZA_PROXY; direct DNS and connections are refused.' });
65
+ }
66
+ });
67
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,wDAAwD;AAExD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,6EAA6E;AAC7E,0EAA0E;AAC1E,sEAAsE;AACtE,2EAA2E;AAC3E,0DAA0D;AAC1D,EAAE;AACF,uEAAuE;AACvE,4EAA4E;AAC5E,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAW,EAAE,CAAC,mEAAmE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrI,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC;KACrC,MAAM,EAAE;KACR,GAAG,EAAE;KACL,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;IACZ,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;IACnB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACzE,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAChF,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