@fedify/relay 2.1.31 → 2.1.32
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/dist/litepub.test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-
|
|
4
|
+
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-DGBoEpdS.js";
|
|
5
5
|
import { MemoryKvStore, signRequest } from "@fedify/fedify";
|
|
6
6
|
import { createRelay } from "@fedify/relay";
|
|
7
7
|
import { Accept, Announce, Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
|
package/dist/mastodon.test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-
|
|
4
|
+
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-DGBoEpdS.js";
|
|
5
5
|
import { MemoryKvStore, signRequest } from "@fedify/fedify";
|
|
6
6
|
import { createRelay } from "@fedify/relay";
|
|
7
7
|
import { Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
|
|
@@ -6,7 +6,7 @@ import { getLogger } from "@logtape/logtape";
|
|
|
6
6
|
import dns from "node:dns/promises";
|
|
7
7
|
import { isIP } from "node:net";
|
|
8
8
|
import process$1 from "node:process";
|
|
9
|
-
//#region ../vocab-runtime/dist/
|
|
9
|
+
//#region ../vocab-runtime/dist/crypto-key-BR2FO0pB.js
|
|
10
10
|
const grants = /* @__PURE__ */ new WeakMap();
|
|
11
11
|
/**
|
|
12
12
|
* Issues a grant for the given URL's origin and addresses. This does not
|
|
@@ -80,6 +80,81 @@ function lookupAllAddresses(hostname) {
|
|
|
80
80
|
return dns.lookup(hostname, { all: true });
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
|
+
* Limits concurrent lookups started by the returned function. A pending
|
|
84
|
+
* caller can abort before its lookup starts. Once `dns.lookup()` has started,
|
|
85
|
+
* it cannot be cancelled, so its slot remains occupied until the underlying
|
|
86
|
+
* lookup settles, even if its caller aborts. This bounds the number of
|
|
87
|
+
* outstanding getaddrinfo calls made by users of this function.
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
function createBoundedLookup(lookup, maxConcurrent = 1) {
|
|
91
|
+
if (!Number.isInteger(maxConcurrent) || maxConcurrent < 1) throw new RangeError("maxConcurrent must be a positive integer");
|
|
92
|
+
let active = 0;
|
|
93
|
+
const waiting = /* @__PURE__ */ new Set();
|
|
94
|
+
function release() {
|
|
95
|
+
active--;
|
|
96
|
+
while (waiting.size > 0) {
|
|
97
|
+
const next = waiting.values().next().value;
|
|
98
|
+
waiting.delete(next);
|
|
99
|
+
next.signal?.removeEventListener("abort", next.onAbort);
|
|
100
|
+
if (next.signal?.aborted) {
|
|
101
|
+
next.reject(next.signal.reason);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
active++;
|
|
105
|
+
next.resolve();
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function acquire(signal) {
|
|
110
|
+
signal?.throwIfAborted();
|
|
111
|
+
if (active < maxConcurrent) {
|
|
112
|
+
active++;
|
|
113
|
+
return Promise.resolve();
|
|
114
|
+
}
|
|
115
|
+
return new Promise((resolve, reject) => {
|
|
116
|
+
const entry = {
|
|
117
|
+
signal,
|
|
118
|
+
resolve,
|
|
119
|
+
reject,
|
|
120
|
+
onAbort() {
|
|
121
|
+
if (!waiting.delete(entry)) return;
|
|
122
|
+
signal?.removeEventListener("abort", entry.onAbort);
|
|
123
|
+
reject(signal?.reason);
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
waiting.add(entry);
|
|
127
|
+
signal?.addEventListener("abort", entry.onAbort, { once: true });
|
|
128
|
+
if (signal?.aborted) entry.onAbort();
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return async (hostname, signal) => {
|
|
132
|
+
await acquire(signal);
|
|
133
|
+
let started = false;
|
|
134
|
+
try {
|
|
135
|
+
signal?.throwIfAborted();
|
|
136
|
+
const pending = lookup(hostname);
|
|
137
|
+
started = true;
|
|
138
|
+
pending.then(release, release);
|
|
139
|
+
if (signal == null) return await pending;
|
|
140
|
+
let onAbort;
|
|
141
|
+
const aborted = new Promise((_, reject) => {
|
|
142
|
+
onAbort = () => reject(signal.reason);
|
|
143
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
144
|
+
if (signal.aborted) onAbort();
|
|
145
|
+
});
|
|
146
|
+
try {
|
|
147
|
+
return await Promise.race([pending, aborted]);
|
|
148
|
+
} finally {
|
|
149
|
+
if (onAbort != null) signal.removeEventListener("abort", onAbort);
|
|
150
|
+
}
|
|
151
|
+
} finally {
|
|
152
|
+
if (!started) release();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
createBoundedLookup(lookupAllAddresses, 2);
|
|
157
|
+
/**
|
|
83
158
|
* Checks the parts of a URL that can be validated without resolving it:
|
|
84
159
|
* the protocol, the `localhost` hostname, and IP literal hostnames.
|
|
85
160
|
* @throws {UrlError} If the URL is not allowed.
|
|
@@ -731,6 +806,17 @@ function logUnpinned(url) {
|
|
|
731
806
|
protocol: url.protocol
|
|
732
807
|
});
|
|
733
808
|
}
|
|
809
|
+
/**
|
|
810
|
+
* Narrows a {@link CryptoKeyLike} to the ambient `CryptoKey` type, for passing
|
|
811
|
+
* it to `crypto.subtle` or to APIs that still declare the ambient type.
|
|
812
|
+
*
|
|
813
|
+
* This is internal to Fedify and is not exported from the package entry point.
|
|
814
|
+
* @param key The key to narrow.
|
|
815
|
+
* @returns The same key, typed as the ambient `CryptoKey`.
|
|
816
|
+
*/
|
|
817
|
+
function asCryptoKey(key) {
|
|
818
|
+
return key;
|
|
819
|
+
}
|
|
734
820
|
//#endregion
|
|
735
821
|
//#region ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js
|
|
736
822
|
/** only globals that common to node and browsers are allowed */
|
|
@@ -26477,7 +26563,7 @@ const preloadedContexts = {
|
|
|
26477
26563
|
"https://purl.archive.org/miscellany": miscellany_default
|
|
26478
26564
|
};
|
|
26479
26565
|
var name = "@fedify/vocab-runtime";
|
|
26480
|
-
var version = "2.1.
|
|
26566
|
+
var version = "2.1.32";
|
|
26481
26567
|
/**
|
|
26482
26568
|
* Error thrown when fetching a JSON-LD document failed.
|
|
26483
26569
|
*/
|
|
@@ -27302,7 +27388,7 @@ constants.reduce((prev, tupple) => {
|
|
|
27302
27388
|
*/
|
|
27303
27389
|
async function exportSpki(key) {
|
|
27304
27390
|
validateCryptoKey(key);
|
|
27305
|
-
let pem = a(await crypto.subtle.exportKey("spki", key));
|
|
27391
|
+
let pem = a(await crypto.subtle.exportKey("spki", asCryptoKey(key)));
|
|
27306
27392
|
pem = (pem.match(/.{1,64}/g) || []).join("\n");
|
|
27307
27393
|
return `-----BEGIN PUBLIC KEY-----\n${pem}\n-----END PUBLIC KEY-----\n`;
|
|
27308
27394
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/relay",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.32",
|
|
4
4
|
"description": "ActivityPub relay support for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Fedify",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@js-temporal/polyfill": "^0.5.1",
|
|
52
52
|
"@logtape/logtape": "^2.0.5",
|
|
53
|
-
"@fedify/vocab": "2.1.
|
|
54
|
-
"@fedify/fedify": "^2.1.
|
|
53
|
+
"@fedify/vocab": "2.1.32",
|
|
54
|
+
"@fedify/fedify": "^2.1.32"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"tsdown": "^0.21.6",
|
|
58
58
|
"typescript": "^6.0.0",
|
|
59
59
|
"urlpattern-polyfill": "^10.1.0",
|
|
60
|
-
"@fedify/vocab-runtime": "^2.1.
|
|
60
|
+
"@fedify/vocab-runtime": "^2.1.32"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build:self": "tsdown",
|