@aloth/olcli 0.15.3 → 0.16.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.
- package/README.md +140 -437
- package/dist/browser-auth.d.ts +144 -0
- package/dist/browser-auth.d.ts.map +1 -0
- package/dist/browser-auth.js +442 -0
- package/dist/browser-auth.js.map +1 -0
- package/dist/cli.js +429 -174
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +20 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +103 -37
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +25 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +40 -7
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +50 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +115 -0
- package/dist/errors.js.map +1 -0
- package/dist/fast-export.d.ts +2 -0
- package/dist/fast-export.d.ts.map +1 -1
- package/dist/fast-export.js +5 -1
- package/dist/fast-export.js.map +1 -1
- package/dist/mcp-server.d.ts.map +1 -1
- package/dist/mcp-server.js +4 -1
- package/dist/mcp-server.js.map +1 -1
- package/dist/mcp.js +1 -1
- package/dist/mcp.js.map +1 -1
- package/dist/paths.d.ts +18 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +45 -0
- package/dist/paths.js.map +1 -1
- package/dist/project-match.d.ts +37 -0
- package/dist/project-match.d.ts.map +1 -0
- package/dist/project-match.js +97 -0
- package/dist/project-match.js.map +1 -0
- package/dist/proxy.d.ts +52 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/proxy.js +189 -0
- package/dist/proxy.js.map +1 -0
- package/dist/remote-helper.d.ts +3 -2
- package/dist/remote-helper.d.ts.map +1 -1
- package/dist/remote-helper.js +130 -37
- package/dist/remote-helper.js.map +1 -1
- package/dist/term.d.ts +25 -0
- package/dist/term.d.ts.map +1 -0
- package/dist/term.js +42 -0
- package/dist/term.js.map +1 -0
- package/package.json +9 -4
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Find a project by what the user typed.
|
|
3
|
+
*
|
|
4
|
+
* Order, first hit wins:
|
|
5
|
+
* 1. exact name (case-sensitive), so two projects that differ only in case
|
|
6
|
+
* can still be told apart
|
|
7
|
+
* 2. exact name, case-insensitive
|
|
8
|
+
* 3. a unique case-insensitive prefix
|
|
9
|
+
*
|
|
10
|
+
* Several projects sharing the name or the prefix is an error that lists
|
|
11
|
+
* them; nothing matching is an error that suggests the closest names. Both
|
|
12
|
+
* are typed so callers can exit non-zero without parsing the message.
|
|
13
|
+
*/
|
|
14
|
+
export class ProjectNotFoundError extends Error {
|
|
15
|
+
query;
|
|
16
|
+
suggestions;
|
|
17
|
+
constructor(query, suggestions) {
|
|
18
|
+
const hint = suggestions.length > 0
|
|
19
|
+
? `\nDid you mean: ${suggestions.map((s) => `"${s}"`).join(', ')}?`
|
|
20
|
+
: '\nList your projects with: olcli list';
|
|
21
|
+
super(`Project not found: ${query}${hint}`);
|
|
22
|
+
this.name = 'ProjectNotFoundError';
|
|
23
|
+
this.query = query;
|
|
24
|
+
this.suggestions = suggestions;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export class AmbiguousProjectError extends Error {
|
|
28
|
+
query;
|
|
29
|
+
candidates;
|
|
30
|
+
constructor(query, candidates) {
|
|
31
|
+
const shown = candidates.slice(0, 10).map((p) => ` ${p.name} (${p.id})`);
|
|
32
|
+
if (candidates.length > 10)
|
|
33
|
+
shown.push(` ... and ${candidates.length - 10} more`);
|
|
34
|
+
super(`"${query}" matches ${candidates.length} projects:\n${shown.join('\n')}\nUse the full name or the project ID.`);
|
|
35
|
+
this.name = 'AmbiguousProjectError';
|
|
36
|
+
this.query = query;
|
|
37
|
+
this.candidates = candidates;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/** Levenshtein distance; names are short, so the quadratic table is fine. */
|
|
41
|
+
export function editDistance(a, b) {
|
|
42
|
+
const x = [...a];
|
|
43
|
+
const y = [...b];
|
|
44
|
+
let prev = Array.from({ length: y.length + 1 }, (_, j) => j);
|
|
45
|
+
for (let i = 1; i <= x.length; i++) {
|
|
46
|
+
const row = [i];
|
|
47
|
+
for (let j = 1; j <= y.length; j++) {
|
|
48
|
+
row[j] = Math.min(prev[j] + 1, row[j - 1] + 1, prev[j - 1] + (x[i - 1] === y[j - 1] ? 0 : 1));
|
|
49
|
+
}
|
|
50
|
+
prev = row;
|
|
51
|
+
}
|
|
52
|
+
return prev[y.length];
|
|
53
|
+
}
|
|
54
|
+
const fold = (s) => s.normalize('NFC').toLocaleLowerCase();
|
|
55
|
+
/**
|
|
56
|
+
* Up to `limit` project names closest to `query`: names containing it first,
|
|
57
|
+
* then by edit distance, dropping anything further than about half the query.
|
|
58
|
+
*/
|
|
59
|
+
export function suggestProjectNames(projects, query, limit = 3) {
|
|
60
|
+
const q = fold(query);
|
|
61
|
+
const maxDistance = Math.max(2, Math.ceil(q.length / 2));
|
|
62
|
+
const scored = projects.map((p) => {
|
|
63
|
+
const name = fold(p.name);
|
|
64
|
+
const contains = name.includes(q) || (name.length >= 3 && q.includes(name));
|
|
65
|
+
// Compare against the start of the name as well, so a short query for a
|
|
66
|
+
// long title is not dismissed for the length difference alone.
|
|
67
|
+
const distance = Math.min(editDistance(q, name), editDistance(q, name.slice(0, q.length)) + 1);
|
|
68
|
+
return { name: p.name, contains, distance };
|
|
69
|
+
});
|
|
70
|
+
return scored
|
|
71
|
+
.filter((s) => s.contains || s.distance <= maxDistance)
|
|
72
|
+
.sort((a, b) => Number(b.contains) - Number(a.contains) || a.distance - b.distance || a.name.localeCompare(b.name))
|
|
73
|
+
.map((s) => s.name)
|
|
74
|
+
.filter((name, index, all) => all.indexOf(name) === index)
|
|
75
|
+
.slice(0, limit);
|
|
76
|
+
}
|
|
77
|
+
/** Resolve `query` to one project or throw ProjectNotFoundError / AmbiguousProjectError. */
|
|
78
|
+
export function matchProject(projects, query) {
|
|
79
|
+
const exact = projects.filter((p) => p.name === query);
|
|
80
|
+
if (exact.length === 1)
|
|
81
|
+
return exact[0];
|
|
82
|
+
if (exact.length > 1)
|
|
83
|
+
throw new AmbiguousProjectError(query, exact);
|
|
84
|
+
const q = fold(query);
|
|
85
|
+
const insensitive = projects.filter((p) => fold(p.name) === q);
|
|
86
|
+
if (insensitive.length === 1)
|
|
87
|
+
return insensitive[0];
|
|
88
|
+
if (insensitive.length > 1)
|
|
89
|
+
throw new AmbiguousProjectError(query, insensitive);
|
|
90
|
+
const prefixed = q ? projects.filter((p) => fold(p.name).startsWith(q)) : [];
|
|
91
|
+
if (prefixed.length === 1)
|
|
92
|
+
return prefixed[0];
|
|
93
|
+
if (prefixed.length > 1)
|
|
94
|
+
throw new AmbiguousProjectError(query, prefixed);
|
|
95
|
+
throw new ProjectNotFoundError(query, suggestProjectNames(projects, query));
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=project-match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-match.js","sourceRoot":"","sources":["../src/project-match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,KAAK,CAAS;IACd,WAAW,CAAW;IAE/B,YAAY,KAAa,EAAE,WAAqB;QAC9C,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC;YACjC,CAAC,CAAC,mBAAmB,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YACnE,CAAC,CAAC,uCAAuC,CAAC;QAC5C,KAAK,CAAC,sBAAsB,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,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and the collaboration socket is Socket.IO
|
|
6
|
+
* xhr-polling over the same function, so routing that one function through
|
|
7
|
+
* the proxy covers all traffic. Node's own env-proxy support only exists in
|
|
8
|
+
* recent releases and has to be switched on with NODE_USE_ENV_PROXY, and
|
|
9
|
+
* undici's EnvHttpProxyAgent only serves fetch(), so this is done here with
|
|
10
|
+
* no dependency:
|
|
11
|
+
*
|
|
12
|
+
* - an https:// target goes through a CONNECT tunnel, then TLS end to end,
|
|
13
|
+
* so the proxy never sees the cookie;
|
|
14
|
+
* - an http:// target (self-hosted instances) is sent to the proxy with the
|
|
15
|
+
* absolute URL as the request target, as HTTP/1.1 proxies expect.
|
|
16
|
+
*
|
|
17
|
+
* Lower-case variable names win over upper-case ones, as in curl.
|
|
18
|
+
*/
|
|
19
|
+
import * as http from 'node:http';
|
|
20
|
+
import * as https from 'node:https';
|
|
21
|
+
/**
|
|
22
|
+
* True for localhost (and its subdomains), 127.0.0.0/8, ::1 and the
|
|
23
|
+
* IPv4-mapped ::ffff:127.x addresses. Brackets around IPv6 are accepted.
|
|
24
|
+
*/
|
|
25
|
+
export declare function isLoopbackHost(hostname: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* True when NO_PROXY exempts `target`. Entries are comma or space separated:
|
|
28
|
+
* `*` matches everything, `example.com` and `.example.com` match the host and
|
|
29
|
+
* its subdomains, `host:port` matches only that port, and an IP matches
|
|
30
|
+
* itself. Loopback (localhost, 127.0.0.0/8, ::1) is always reached
|
|
31
|
+
* directly, whatever NO_PROXY says: a proxy cannot reach this machine's
|
|
32
|
+
* loopback interface, and the browser sign-in talks to a local browser.
|
|
33
|
+
*/
|
|
34
|
+
export declare function bypassesProxy(target: URL, env?: NodeJS.ProcessEnv): boolean;
|
|
35
|
+
/** The proxy for `target`, or undefined when it should be reached directly. */
|
|
36
|
+
export declare function proxyForUrl(target: URL, env?: NodeJS.ProcessEnv): URL | undefined;
|
|
37
|
+
export interface ProxiedRequest {
|
|
38
|
+
/** What to pass to http(s).request as the URL. */
|
|
39
|
+
url: string;
|
|
40
|
+
/** Extra request options (agent, headers) for the proxy. */
|
|
41
|
+
options: http.RequestOptions;
|
|
42
|
+
/** The transport module to call request() on. */
|
|
43
|
+
transport: typeof http | typeof https;
|
|
44
|
+
/** The proxy in use, for --verbose; undefined for a direct request. */
|
|
45
|
+
proxy?: URL;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* How to send a request to `reqUrl`, honoring the proxy variables in `env`.
|
|
49
|
+
* The headers passed in are extended, never replaced.
|
|
50
|
+
*/
|
|
51
|
+
export declare function routeRequest(reqUrl: string, headers: Record<string, string>, env?: NodeJS.ProcessEnv): ProxiedRequest;
|
|
52
|
+
//# sourceMappingURL=proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAUpC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAaxD;AAMD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAwBxF;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,GAAG,GAAG,SAAS,CAU9F;AAgED,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,4DAA4D;IAC5D,OAAO,EAAE,IAAI,CAAC,cAAc,CAAC;IAC7B,iDAAiD;IACjD,SAAS,EAAE,OAAO,IAAI,GAAG,OAAO,KAAK,CAAC;IACtC,uEAAuE;IACvE,KAAK,CAAC,EAAE,GAAG,CAAC;CACb;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/B,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,cAAc,CA2BhB"}
|
package/dist/proxy.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTPS_PROXY, HTTP_PROXY and NO_PROXY for every request olcli makes.
|
|
3
|
+
*
|
|
4
|
+
* The client talks to Overleaf through node:http and node:https (see
|
|
5
|
+
* httpRequest in client.ts), and the collaboration socket is Socket.IO
|
|
6
|
+
* xhr-polling over the same function, so routing that one function through
|
|
7
|
+
* the proxy covers all traffic. Node's own env-proxy support only exists in
|
|
8
|
+
* recent releases and has to be switched on with NODE_USE_ENV_PROXY, and
|
|
9
|
+
* undici's EnvHttpProxyAgent only serves fetch(), so this is done here with
|
|
10
|
+
* no dependency:
|
|
11
|
+
*
|
|
12
|
+
* - an https:// target goes through a CONNECT tunnel, then TLS end to end,
|
|
13
|
+
* so the proxy never sees the cookie;
|
|
14
|
+
* - an http:// target (self-hosted instances) is sent to the proxy with the
|
|
15
|
+
* absolute URL as the request target, as HTTP/1.1 proxies expect.
|
|
16
|
+
*
|
|
17
|
+
* Lower-case variable names win over upper-case ones, as in curl.
|
|
18
|
+
*/
|
|
19
|
+
import * as http from 'node:http';
|
|
20
|
+
import * as https from 'node:https';
|
|
21
|
+
import * as tls from 'node:tls';
|
|
22
|
+
import { isIP } from 'node:net';
|
|
23
|
+
function envValue(env, name) {
|
|
24
|
+
const value = env[name.toLowerCase()] ?? env[name.toUpperCase()];
|
|
25
|
+
return value && value.trim() ? value.trim() : undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* True for localhost (and its subdomains), 127.0.0.0/8, ::1 and the
|
|
29
|
+
* IPv4-mapped ::ffff:127.x addresses. Brackets around IPv6 are accepted.
|
|
30
|
+
*/
|
|
31
|
+
export function isLoopbackHost(hostname) {
|
|
32
|
+
const host = hostname.replace(/^\[|\]$/g, '').replace(/\.$/, '').toLowerCase();
|
|
33
|
+
if (host === 'localhost' || host.endsWith('.localhost'))
|
|
34
|
+
return true;
|
|
35
|
+
if (isIP(host) === 4)
|
|
36
|
+
return host.split('.')[0] === '127';
|
|
37
|
+
if (isIP(host) === 6) {
|
|
38
|
+
if (host === '::1' || /^(0{1,4}:){7}0{0,3}1$/.test(host) || host === '0:0:0:0:0:0:0:1')
|
|
39
|
+
return true;
|
|
40
|
+
const mapped = host.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/);
|
|
41
|
+
if (mapped)
|
|
42
|
+
return mapped[1].split('.')[0] === '127';
|
|
43
|
+
// WHATWG URL normalizes ::ffff:127.0.0.1 to ::ffff:7f00:1.
|
|
44
|
+
const mappedHex = host.match(/^::ffff:([0-9a-f]{1,4}):[0-9a-f]{1,4}$/);
|
|
45
|
+
if (mappedHex)
|
|
46
|
+
return (parseInt(mappedHex[1], 16) >> 8) === 127;
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
function defaultPort(protocol) {
|
|
51
|
+
return protocol === 'https:' ? 443 : 80;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* True when NO_PROXY exempts `target`. Entries are comma or space separated:
|
|
55
|
+
* `*` matches everything, `example.com` and `.example.com` match the host and
|
|
56
|
+
* its subdomains, `host:port` matches only that port, and an IP matches
|
|
57
|
+
* itself. Loopback (localhost, 127.0.0.0/8, ::1) is always reached
|
|
58
|
+
* directly, whatever NO_PROXY says: a proxy cannot reach this machine's
|
|
59
|
+
* loopback interface, and the browser sign-in talks to a local browser.
|
|
60
|
+
*/
|
|
61
|
+
export function bypassesProxy(target, env = process.env) {
|
|
62
|
+
const host = target.hostname.replace(/^\[|\]$/g, '').toLowerCase();
|
|
63
|
+
if (isLoopbackHost(host))
|
|
64
|
+
return true;
|
|
65
|
+
const noProxy = envValue(env, 'no_proxy');
|
|
66
|
+
if (!noProxy)
|
|
67
|
+
return false;
|
|
68
|
+
const port = Number(target.port || defaultPort(target.protocol));
|
|
69
|
+
for (const raw of noProxy.split(/[\s,]+/)) {
|
|
70
|
+
let entry = raw.trim().toLowerCase();
|
|
71
|
+
if (!entry)
|
|
72
|
+
continue;
|
|
73
|
+
if (entry === '*')
|
|
74
|
+
return true;
|
|
75
|
+
let entryPort;
|
|
76
|
+
const portMatch = entry.match(/^(.*):(\d+)$/);
|
|
77
|
+
if (portMatch && !portMatch[1].includes(':')) {
|
|
78
|
+
entry = portMatch[1];
|
|
79
|
+
entryPort = Number(portMatch[2]);
|
|
80
|
+
}
|
|
81
|
+
entry = entry.replace(/^\[|\]$/g, '').replace(/^\*?\./, '');
|
|
82
|
+
if (entryPort !== undefined && entryPort !== port)
|
|
83
|
+
continue;
|
|
84
|
+
if (host === entry || host.endsWith(`.${entry}`))
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
/** The proxy for `target`, or undefined when it should be reached directly. */
|
|
90
|
+
export function proxyForUrl(target, env = process.env) {
|
|
91
|
+
const raw = target.protocol === 'https:'
|
|
92
|
+
? envValue(env, 'https_proxy') ?? envValue(env, 'all_proxy')
|
|
93
|
+
: envValue(env, 'http_proxy') ?? envValue(env, 'all_proxy');
|
|
94
|
+
if (!raw || bypassesProxy(target, env))
|
|
95
|
+
return undefined;
|
|
96
|
+
try {
|
|
97
|
+
return new URL(raw.includes('://') ? raw : `http://${raw}`);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
throw new Error(`Invalid proxy URL in the environment: ${raw}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function proxyAuthorization(proxy) {
|
|
104
|
+
if (!proxy.username && !proxy.password)
|
|
105
|
+
return undefined;
|
|
106
|
+
const credentials = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
|
|
107
|
+
return `Basic ${Buffer.from(credentials).toString('base64')}`;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* An https.Agent whose sockets are CONNECT tunnels through `proxy`. Node's
|
|
111
|
+
* Agent accepts an asynchronous createConnection that reports through the
|
|
112
|
+
* callback, which is what lets the tunnel be opened before TLS starts.
|
|
113
|
+
*/
|
|
114
|
+
class TunnelAgent extends https.Agent {
|
|
115
|
+
proxy;
|
|
116
|
+
constructor(proxy) {
|
|
117
|
+
super({ keepAlive: false });
|
|
118
|
+
this.proxy = proxy;
|
|
119
|
+
}
|
|
120
|
+
createConnection(options, callback) {
|
|
121
|
+
const host = String(options.host ?? options.hostname ?? 'localhost');
|
|
122
|
+
const port = Number(options.port ?? 443);
|
|
123
|
+
const authority = `${host.includes(':') ? `[${host}]` : host}:${port}`;
|
|
124
|
+
const transport = this.proxy.protocol === 'https:' ? https : http;
|
|
125
|
+
const headers = { Host: authority };
|
|
126
|
+
const auth = proxyAuthorization(this.proxy);
|
|
127
|
+
if (auth)
|
|
128
|
+
headers['Proxy-Authorization'] = auth;
|
|
129
|
+
const connect = transport.request({
|
|
130
|
+
host: this.proxy.hostname.replace(/^\[|\]$/g, ''),
|
|
131
|
+
port: Number(this.proxy.port || defaultPort(this.proxy.protocol)),
|
|
132
|
+
method: 'CONNECT',
|
|
133
|
+
path: authority,
|
|
134
|
+
headers,
|
|
135
|
+
agent: false,
|
|
136
|
+
});
|
|
137
|
+
connect.once('connect', (res, socket) => {
|
|
138
|
+
if (res.statusCode !== 200) {
|
|
139
|
+
socket.destroy();
|
|
140
|
+
callback(Object.assign(new Error(`Proxy ${this.proxy.host} refused CONNECT ${authority}: HTTP ${res.statusCode}`), { code: 'EPROXY' }));
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const secure = tls.connect({
|
|
144
|
+
socket,
|
|
145
|
+
servername: options.servername || (isIP(host) ? undefined : host),
|
|
146
|
+
rejectUnauthorized: options.rejectUnauthorized,
|
|
147
|
+
ca: options.ca,
|
|
148
|
+
});
|
|
149
|
+
secure.once('secureConnect', () => callback(null, secure));
|
|
150
|
+
secure.once('error', (error) => callback(error));
|
|
151
|
+
});
|
|
152
|
+
connect.once('error', (error) => callback(error));
|
|
153
|
+
connect.end();
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const tunnelAgents = new Map();
|
|
158
|
+
/**
|
|
159
|
+
* How to send a request to `reqUrl`, honoring the proxy variables in `env`.
|
|
160
|
+
* The headers passed in are extended, never replaced.
|
|
161
|
+
*/
|
|
162
|
+
export function routeRequest(reqUrl, headers, env = process.env) {
|
|
163
|
+
const target = new URL(reqUrl);
|
|
164
|
+
const direct = target.protocol === 'https:' ? https : http;
|
|
165
|
+
const proxy = proxyForUrl(target, env);
|
|
166
|
+
if (!proxy)
|
|
167
|
+
return { url: reqUrl, options: { headers }, transport: direct };
|
|
168
|
+
if (target.protocol === 'https:') {
|
|
169
|
+
let agent = tunnelAgents.get(proxy.href);
|
|
170
|
+
if (!agent) {
|
|
171
|
+
agent = new TunnelAgent(proxy);
|
|
172
|
+
tunnelAgents.set(proxy.href, agent);
|
|
173
|
+
}
|
|
174
|
+
return { url: reqUrl, options: { headers, agent }, transport: https, proxy };
|
|
175
|
+
}
|
|
176
|
+
// Plain HTTP: ask the proxy for the absolute URL.
|
|
177
|
+
const auth = proxyAuthorization(proxy);
|
|
178
|
+
return {
|
|
179
|
+
url: `${proxy.protocol}//${proxy.host}${proxy.pathname === '/' ? '' : proxy.pathname}`,
|
|
180
|
+
options: {
|
|
181
|
+
headers: { ...headers, Host: target.host, ...(auth ? { 'Proxy-Authorization': auth } : {}) },
|
|
182
|
+
path: target.href,
|
|
183
|
+
agent: false,
|
|
184
|
+
},
|
|
185
|
+
transport: proxy.protocol === 'https:' ? https : http,
|
|
186
|
+
proxy,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=proxy.js.map
|
|
@@ -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AC,CAAC;QACtC,CAAC;QACD,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC/E,CAAC;IAED,kDAAkD;IAClD,MAAM,IAAI,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO;QACL,GAAG,EAAE,GAAG,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE;QACtF,OAAO,EAAE;YACP,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;YAC5F,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,KAAK;SACb;QACD,SAAS,EAAE,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;QACrD,KAAK;KACN,CAAC;AACJ,CAAC"}
|
package/dist/remote-helper.d.ts
CHANGED
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
*
|
|
10
10
|
* Protocol reference: gitremote-helpers(7)
|
|
11
11
|
*
|
|
12
|
-
* Capabilities: import + export with refspec.
|
|
13
|
-
* State stored in .git/overleaf/ (manifest).
|
|
12
|
+
* Capabilities: import + export with refspec, option (for push --force).
|
|
13
|
+
* State stored in .git/overleaf/ (manifest, marks, sha256 of every remote file).
|
|
14
|
+
* A push is refused while Overleaf has changes the clone has not fetched.
|
|
14
15
|
*/
|
|
15
16
|
export {};
|
|
16
17
|
//# sourceMappingURL=remote-helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-helper.d.ts","sourceRoot":"","sources":["../src/remote-helper.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"remote-helper.d.ts","sourceRoot":"","sources":["../src/remote-helper.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG"}
|