@fedify/fedify 2.4.0-dev.2155 → 2.4.0-dev.2159
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/{builder-CxHALSwA.mjs → builder-D89oOfHC.mjs} +2 -2
- package/dist/{client-DpnpgjyX.mjs → client-CEnNz8O7.mjs} +7 -3
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-nhrXTRQO.mjs → compound-proof-B02Os8h2.mjs} +2 -2
- package/dist/{context-OrnjnuMq.mjs → context-B2rlkkyJ.mjs} +1 -1
- package/dist/{context-BMggDR-l.d.cts → context-DpsaHkk1.d.cts} +119 -2
- package/dist/{context-exYu7gDU.d.ts → context-JDNkUtnu.d.ts} +119 -2
- package/dist/{deno-YLLbRq06.mjs → deno-CE_s0yQb.mjs} +1 -1
- package/dist/{dist-BQvArojP.mjs → dist-DJQM4u7i.mjs} +2 -1
- package/dist/docloader-C5p26tpa.mjs +79 -0
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +4 -4
- package/dist/federation/handler.test.mjs +6 -6
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +187 -10
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -1
- package/dist/federation/mq.test.mjs +98 -69
- package/dist/federation/outgoing-proof.test.mjs +5 -5
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-gateway-keys.test.mjs +4 -4
- package/dist/federation/portable-inbox.test.mjs +4 -4
- package/dist/federation/portable-parse-uri.test.d.mts +2 -0
- package/dist/federation/portable-parse-uri.test.mjs +348 -0
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +84 -3
- package/dist/federation/tasks/enqueue.test.mjs +3 -3
- package/dist/federation/tasks/tasks.test.mjs +4 -4
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +2 -2
- package/dist/{federation-D9TufmIO.cjs → federation-dBOqmJcA.cjs} +74 -10
- package/dist/{http-CXnNbRe_.mjs → http-DV_yW4dv.mjs} +9 -5
- package/dist/{http-Dk4O3WM0.js → http-nTZuTacw.js} +7 -3
- package/dist/{http-eqYXHRkz.cjs → http-wdsia0-O.cjs} +7 -3
- package/dist/{key-BZ-Z4uez.mjs → key-C6jnekFI.mjs} +2 -2
- package/dist/{kv-cache-DzClEalR.cjs → kv-cache-BHNtQi9e.cjs} +34 -8
- package/dist/{kv-cache-DZr8HTel.mjs → kv-cache-Bxm0a0Ww.mjs} +1 -1
- package/dist/{kv-cache-3uKc0G76.js → kv-cache-DhIl9YlV.js} +35 -9
- package/dist/{ld-Djxsq6JR.mjs → ld-ya2C1Xip.mjs} +4 -4
- package/dist/{metrics-CBHhbHgG.mjs → metrics-ByOQOHHS.mjs} +1 -1
- package/dist/{middleware-DDa8pCUa.mjs → middleware-Bdwd_Gg8.mjs} +70 -20
- package/dist/{middleware-BahNnLfD.mjs → middleware-DoVWq8mE.mjs} +1 -1
- package/dist/{middleware-BDUR99k3.js → middleware-WiaN4RS3.js} +74 -10
- package/dist/{mod-Decmur1U.d.cts → mod-DSKkTwH2.d.cts} +1 -1
- package/dist/{mod-CZetqT5h.d.ts → mod-DaiBrWDW.d.ts} +2 -0
- package/dist/{mod-D4g9ffEn.d.cts → mod-Mt4aO3DX.d.cts} +2 -0
- package/dist/{mod-CnGtADvO.d.ts → mod-_4K05HZF.d.ts} +1 -1
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/client.test.mjs +49 -1
- package/dist/nodeinfo/handler.test.mjs +2 -2
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.js +1 -1
- package/dist/{owner-OdWSE8am.mjs → owner-C6Nv5yyw.mjs} +3 -3
- package/dist/{portable-collection-BCy06GiS.js → portable-collection-B-mU1F1-.js} +1 -1
- package/dist/{portable-collection-wBWbuHOH.cjs → portable-collection-C65SwL2l.cjs} +1 -1
- package/dist/{portable-collection-DAV7Ho3m.mjs → portable-collection-uWj3hfzv.mjs} +2 -2
- package/dist/{portable-key-BL6K88p2.mjs → portable-key-BXsVLSMa.mjs} +1 -1
- package/dist/{proof-vZ04IAjq.mjs → proof-BdO3BbLh.mjs} +4 -4
- package/dist/{send-ylV8KCLx.mjs → send-BwANxryy.mjs} +18 -4
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +42 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +5 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +2 -2
- package/dist/sig/portable-key.test.mjs +6 -6
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/{tasks-dbCShlCb.mjs → tasks-IG3pHfvZ.mjs} +1 -1
- package/dist/{temporal-BTD4f_mZ.mjs → temporal-CbPfRGZq.mjs} +1 -1
- package/dist/testing/context.test.mjs +1 -1
- package/dist/testing/kv.test.mjs +3 -3
- package/dist/testing/mod.d.mts +118 -1
- package/dist/testing/mod.mjs +4 -4
- package/dist/{testing-CKaJhcA0.mjs → testing-C1itIjqW.mjs} +3 -3
- package/dist/{types-C_cNlNVK.js → types-_S2_MeLF.js} +7 -3
- package/dist/{types-Be2zbyeG.cjs → types-poIao40f.cjs} +7 -3
- package/dist/utils/docloader.test.mjs +297 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/dist/vocab/cjs.test.mjs +1 -1
- package/package.json +7 -7
- package/dist/docloader-vc-pSu9-.mjs +0 -53
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
4
|
+
import { n as version, t as name } from "./deno-CE_s0yQb.mjs";
|
|
5
5
|
import { c as isPortableId, r as getPortableDid, t as getCanonicalPortableId } from "./portable-key-id-Bg259c4Z.mjs";
|
|
6
6
|
import { t as ActivityListenerSet } from "./activity-listener-C-BSbKI7.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -89,7 +89,7 @@ var FederationBuilderImpl = class {
|
|
|
89
89
|
* specified.
|
|
90
90
|
*/
|
|
91
91
|
async build(options) {
|
|
92
|
-
const { FederationImpl } = await import("./middleware-
|
|
92
|
+
const { FederationImpl } = await import("./middleware-DoVWq8mE.mjs");
|
|
93
93
|
const f = new FederationImpl(options);
|
|
94
94
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
95
95
|
f.router = this.router.clone();
|
|
@@ -93,8 +93,8 @@ const DEFAULT_MAX_REDIRECTION = 5;
|
|
|
93
93
|
* bounce the request to an internal address.
|
|
94
94
|
* @param url The URL to fetch.
|
|
95
95
|
* @param headers The request headers.
|
|
96
|
-
* @returns The final response, or `null` if the URL is disallowed
|
|
97
|
-
* are too many redirects.
|
|
96
|
+
* @returns The final response, or `null` if the URL is disallowed, its
|
|
97
|
+
* hostname cannot be resolved, or there are too many redirects.
|
|
98
98
|
*/
|
|
99
99
|
async function fetchPublicUrl(url, headers) {
|
|
100
100
|
let current = url instanceof URL ? url : new URL(url);
|
|
@@ -104,7 +104,11 @@ async function fetchPublicUrl(url, headers) {
|
|
|
104
104
|
await validatePublicUrl(current.href);
|
|
105
105
|
} catch (e) {
|
|
106
106
|
if (e instanceof UrlError) {
|
|
107
|
-
logger.error("
|
|
107
|
+
if (e.reason === "dns") logger.error("DNS lookup failed for {url}: {error}", {
|
|
108
|
+
url: current.href,
|
|
109
|
+
error: e
|
|
110
|
+
});
|
|
111
|
+
else logger.error("Refused to fetch a private or invalid URL {url}: {error}", {
|
|
108
112
|
url: current.href,
|
|
109
113
|
error: e
|
|
110
114
|
});
|
package/dist/compat/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import {
|
|
2
|
+
import { $t as ActivityTransformer, n as Context } from "../context-DpsaHkk1.cjs";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
package/dist/compat/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import {
|
|
2
|
+
import { $t as ActivityTransformer, n as Context } from "../context-JDNkUtnu.js";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
|
@@ -5,7 +5,7 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
6
6
|
import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
|
|
7
7
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
8
|
-
import { E as autoIdAssigner, T as actorDehydrator, n as FederationImpl } from "../middleware-
|
|
8
|
+
import { E as autoIdAssigner, T as actorDehydrator, n as FederationImpl } from "../middleware-Bdwd_Gg8.mjs";
|
|
9
9
|
import { Follow, Person } from "@fedify/vocab";
|
|
10
10
|
import { test } from "@fedify/fixture";
|
|
11
11
|
//#region src/compat/transformers.test.ts
|
|
@@ -3,8 +3,8 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { c as isPortableId, i as getRawCanonicalPortableId, t as getCanonicalPortableId } from "./portable-key-id-Bg259c4Z.mjs";
|
|
5
5
|
import { n as preloadedOnlyDocumentLoader } from "./public-audience--klBIOk1.mjs";
|
|
6
|
-
import { c as getNormalizationContextLoader } from "./ld-
|
|
7
|
-
import { l as verifyPortableObjectProofPolicy, n as classifyFep2277CoreType, o as verifyMapLocalProof } from "./proof-
|
|
6
|
+
import { c as getNormalizationContextLoader } from "./ld-ya2C1Xip.mjs";
|
|
7
|
+
import { l as verifyPortableObjectProofPolicy, n as classifyFep2277CoreType, o as verifyMapLocalProof } from "./proof-BdO3BbLh.mjs";
|
|
8
8
|
import { parseIri, preloadedContexts } from "@fedify/vocab-runtime";
|
|
9
9
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
10
10
|
//#region src/sig/compound-proof.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as mockDocumentLoader } from "./dist-
|
|
4
|
+
import { t as mockDocumentLoader } from "./dist-DJQM4u7i.mjs";
|
|
5
5
|
import { RouterError } from "@fedify/uri-template";
|
|
6
6
|
import { lookupObject, traverseCollection } from "@fedify/vocab";
|
|
7
7
|
import { lookupWebFinger } from "@fedify/webfinger";
|
|
@@ -3348,12 +3348,38 @@ interface Context<TContextData> {
|
|
|
3348
3348
|
getPortableFeaturedTagsUri(identifier: string, authority: string): URL;
|
|
3349
3349
|
/**
|
|
3350
3350
|
* Determines the type of the URI and extracts the associated data.
|
|
3351
|
+
*
|
|
3352
|
+
* By default, only URIs on this server's origin are recognized. With
|
|
3353
|
+
* the `portable` option, [FEP-ef61] portable IDs, e.g.,
|
|
3354
|
+
* `ap+ef61://did:key:z6Mk.../users/alice`, and their compatible
|
|
3355
|
+
* identifiers on any gateway, e.g.,
|
|
3356
|
+
* `https://example.com/.well-known/apgateway/did:key:z6Mk.../users/alice`,
|
|
3357
|
+
* are also recognized by the same paths that the gateway endpoint routes
|
|
3358
|
+
* to the dispatchers, and the result has the DID in its `authority`
|
|
3359
|
+
* property.
|
|
3360
|
+
*
|
|
3361
|
+
* The DID of a portable ID is anyone's to choose, so recognizing it does
|
|
3362
|
+
* not mean that this server hosts anything for the DID. Check that
|
|
3363
|
+
* `authority` is the DID that the application stores for the actor or
|
|
3364
|
+
* object before acting on it:
|
|
3365
|
+
*
|
|
3366
|
+
* ~~~~ typescript
|
|
3367
|
+
* const parsed = ctx.parseUri(follow.objectId, { portable: true });
|
|
3368
|
+
* if (parsed?.type !== "actor") return;
|
|
3369
|
+
* const user = await getUser(parsed.identifier);
|
|
3370
|
+
* if (user == null) return;
|
|
3371
|
+
* if (parsed.authority != null && parsed.authority !== user.did) return;
|
|
3372
|
+
* ~~~~
|
|
3373
|
+
*
|
|
3374
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3375
|
+
*
|
|
3351
3376
|
* @param uri The URI to parse.
|
|
3377
|
+
* @param options Options for parsing the URI. Since 2.4.0.
|
|
3352
3378
|
* @returns The result of parsing the URI. If `null` is given or
|
|
3353
3379
|
* the URI is not recognized, `null` is returned.
|
|
3354
3380
|
* @since 0.9.0
|
|
3355
3381
|
*/
|
|
3356
|
-
parseUri(uri: URL | null): ParseUriResult | null;
|
|
3382
|
+
parseUri(uri: URL | null, options?: ParseUriOptions): ParseUriResult | null;
|
|
3357
3383
|
/**
|
|
3358
3384
|
* Gets the key pairs for an actor.
|
|
3359
3385
|
* @param identifier The actor's identifier.
|
|
@@ -4252,52 +4278,143 @@ interface OutboxContext<TContextData> extends Context<TContextData> {
|
|
|
4252
4278
|
clone(data: TContextData): OutboxContext<TContextData>;
|
|
4253
4279
|
}
|
|
4254
4280
|
/**
|
|
4281
|
+
* Options for {@link Context.parseUri}.
|
|
4282
|
+
* @since 2.4.0
|
|
4283
|
+
*/
|
|
4284
|
+
interface ParseUriOptions {
|
|
4285
|
+
/**
|
|
4286
|
+
* Whether to also recognize [FEP-ef61] portable IDs, i.e., `ap:` and
|
|
4287
|
+
* `ap+ef61:` URIs, and their compatible identifiers on any gateway.
|
|
4288
|
+
* The result of a portable ID has its DID, without percent-encoding, in
|
|
4289
|
+
* the `authority` property, which the caller has to compare with the DID
|
|
4290
|
+
* that it stores for the actor or object, since anyone can make a portable
|
|
4291
|
+
* ID with the same path under another DID.
|
|
4292
|
+
*
|
|
4293
|
+
* Like URIs on this server's origin, a portable ID is recognized by its
|
|
4294
|
+
* path, and its query, e.g., location hints, and fragment are ignored.
|
|
4295
|
+
* A shared inbox is never recognized in a portable ID, and a portable ID
|
|
4296
|
+
* with a malformed DID, or with a `did:key` DID that is not encoded in
|
|
4297
|
+
* base58-btc, is not recognized either.
|
|
4298
|
+
*
|
|
4299
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4300
|
+
* @default `false`
|
|
4301
|
+
*/
|
|
4302
|
+
readonly portable?: boolean;
|
|
4303
|
+
}
|
|
4304
|
+
/**
|
|
4255
4305
|
* A result of parsing an URI.
|
|
4256
4306
|
*/
|
|
4257
4307
|
type ParseUriResult = {
|
|
4258
4308
|
readonly type: "actor";
|
|
4259
4309
|
readonly identifier: string;
|
|
4310
|
+
/**
|
|
4311
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4312
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4313
|
+
* @since 2.4.0
|
|
4314
|
+
*/
|
|
4315
|
+
readonly authority?: string;
|
|
4260
4316
|
} | {
|
|
4261
4317
|
readonly type: "object";
|
|
4262
4318
|
readonly class: ConstructorWithTypeId<Object$1>;
|
|
4263
4319
|
readonly typeId: URL;
|
|
4264
4320
|
readonly values: Record<string, string>;
|
|
4321
|
+
/**
|
|
4322
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4323
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4324
|
+
* @since 2.4.0
|
|
4325
|
+
*/
|
|
4326
|
+
readonly authority?: string;
|
|
4265
4327
|
} | {
|
|
4266
4328
|
readonly type: "inbox";
|
|
4267
4329
|
readonly identifier: undefined;
|
|
4330
|
+
readonly authority?: undefined;
|
|
4268
4331
|
} | {
|
|
4269
4332
|
readonly type: "inbox";
|
|
4270
4333
|
readonly identifier: string;
|
|
4334
|
+
/**
|
|
4335
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4336
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4337
|
+
* @since 2.4.0
|
|
4338
|
+
*/
|
|
4339
|
+
readonly authority?: string;
|
|
4271
4340
|
} | {
|
|
4272
4341
|
readonly type: "outbox";
|
|
4273
4342
|
readonly identifier: string;
|
|
4343
|
+
/**
|
|
4344
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4345
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4346
|
+
* @since 2.4.0
|
|
4347
|
+
*/
|
|
4348
|
+
readonly authority?: string;
|
|
4274
4349
|
} | {
|
|
4275
4350
|
readonly type: "following";
|
|
4276
4351
|
readonly identifier: string;
|
|
4352
|
+
/**
|
|
4353
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4354
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4355
|
+
* @since 2.4.0
|
|
4356
|
+
*/
|
|
4357
|
+
readonly authority?: string;
|
|
4277
4358
|
} | {
|
|
4278
4359
|
readonly type: "followers";
|
|
4279
4360
|
readonly identifier: string;
|
|
4361
|
+
/**
|
|
4362
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4363
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4364
|
+
* @since 2.4.0
|
|
4365
|
+
*/
|
|
4366
|
+
readonly authority?: string;
|
|
4280
4367
|
} | {
|
|
4281
4368
|
readonly type: "liked";
|
|
4282
4369
|
readonly identifier: string;
|
|
4370
|
+
/**
|
|
4371
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4372
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4373
|
+
* @since 2.4.0
|
|
4374
|
+
*/
|
|
4375
|
+
readonly authority?: string;
|
|
4283
4376
|
} | {
|
|
4284
4377
|
readonly type: "featured";
|
|
4285
4378
|
readonly identifier: string;
|
|
4379
|
+
/**
|
|
4380
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4381
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4382
|
+
* @since 2.4.0
|
|
4383
|
+
*/
|
|
4384
|
+
readonly authority?: string;
|
|
4286
4385
|
} | {
|
|
4287
4386
|
readonly type: "featuredTags";
|
|
4288
4387
|
readonly identifier: string;
|
|
4388
|
+
/**
|
|
4389
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4390
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4391
|
+
* @since 2.4.0
|
|
4392
|
+
*/
|
|
4393
|
+
readonly authority?: string;
|
|
4289
4394
|
} | {
|
|
4290
4395
|
readonly type: "collection";
|
|
4291
4396
|
readonly name: string | symbol;
|
|
4292
4397
|
readonly class: ConstructorWithTypeId<Object$1>;
|
|
4293
4398
|
readonly typeId: URL;
|
|
4294
4399
|
readonly values: Record<string, string>;
|
|
4400
|
+
/**
|
|
4401
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4402
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4403
|
+
* @since 2.4.0
|
|
4404
|
+
*/
|
|
4405
|
+
readonly authority?: string;
|
|
4295
4406
|
} | {
|
|
4296
4407
|
readonly type: "orderedCollection";
|
|
4297
4408
|
readonly name: string | symbol;
|
|
4298
4409
|
readonly class: ConstructorWithTypeId<Object$1>;
|
|
4299
4410
|
readonly typeId: URL;
|
|
4300
4411
|
readonly values: Record<string, string>;
|
|
4412
|
+
/**
|
|
4413
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4414
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4415
|
+
* @since 2.4.0
|
|
4416
|
+
*/
|
|
4417
|
+
readonly authority?: string;
|
|
4301
4418
|
};
|
|
4302
4419
|
/**
|
|
4303
4420
|
* Options for {@link Context.sendActivity} method.
|
|
@@ -4464,4 +4581,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
4464
4581
|
readonly multikey: Multikey;
|
|
4465
4582
|
}
|
|
4466
4583
|
//#endregion
|
|
4467
|
-
export {
|
|
4584
|
+
export { respondWithObjectIfAcceptable as $, ActivityTransformer as $t, InboxListenerSetters as A, HashlinkMediaDispatcher as At, Message as B, OutboxListenerErrorHandler as Bt, FederationBuilder as C, AuthorizePredicate as Ct, IdempotencyKeyCallback as D, CustomCollectionCounter as Dt, FederationStartQueueOptions as E, CollectionDispatcher as Et, Rfc6570Expression as F, NodeInfoDispatcher as Ft, TaskHandler as G, UnverifiedActivityHandler as Gt, TaskDefinition as H, PortableActorIdMapper as Ht, FederationKvPrefixes as I, ObjectAuthorizePredicate as It, RetryContext as J, SendActivityError as Jt, TaskRegistry as K, UnverifiedActivityReason as Kt, FederationOrigin as L, ObjectDispatcher as Lt, ObjectCallbackSetters as M, InboxErrorHandler as Mt, OutboxListenerSetters as N, InboxListener as Nt, IdempotencyStrategy as O, CustomCollectionCursor as Ot, PortableInboxForwardingOptions as P, MediaUploaderCallback as Pt, respondWithObject as Q, digest as Qt, FederationQueueOptions as R, OutboxErrorHandler as Rt, FederationBenchmarkOptions as S, ActorKeyPairsDispatcher as St, FederationOptions as T, CollectionCursor as Tt, TaskDefinitionOptions as U, PortableCollectionOwnerMapper as Ut, createFederationBuilder as V, OutboxPermanentFailureHandler as Vt, TaskEnqueueOptions as W, SharedInboxKeyDispatcher as Wt, createExponentialBackoffPolicy as X, PageItems as Xt, RetryPolicy as Y, SenderKeyPair as Yt, RespondWithObjectOptions as Z, buildCollectionSynchronizationHeader as Zt, CollectionCallbackSetters as _, normalizeCircuitBreakerOptions as _t, GetObjectOptions as a, MessageQueueListenOptions as at, Federatable as b, ActorDispatcher as bt, OutboxContext as c, CircuitBreakerActivityDrop as ct, PortableRequest as d, CircuitBreakerFailurePolicy as dt, InProcessMessageQueue as et, RequestContext as f, CircuitBreakerKvState as ft, ActorCallbackSetters as g, NormalizedCircuitBreakerOptions as gt, SendActivityOptionsForCollection as h, CircuitBreakerStateChange as ht, GetActorOptions as i, MessageQueueEnqueueOptions as it, MediaUploaderSetters as j, HashlinkMediaRequest as jt, InboxChallengePolicy as k, CustomCollectionDispatcher as kt, ParseUriOptions as l, CircuitBreakerBeforeSendDecision as lt, SendActivityOptions as m, CircuitBreakerState as mt, Context as n, MessageQueue as nt, GetSignedKeyOptions as o, ParallelMessageQueue as ot, RouteActivityOptions as p, CircuitBreakerOptions as pt, CreateExponentialBackoffPolicyOptions as q, WebFingerLinksDispatcher as qt, ForwardActivityOptions as r, MessageQueueDepth as rt, InboxContext as s, CircuitBreaker as st, ActorKeyPair as t, InProcessMessageQueueOptions as tt, ParseUriResult as u, CircuitBreakerCreateOptions as ut, ConstructorWithTypeId as v, parseCircuitBreakerKvState as vt, FederationFetchOptions as w, CollectionCounter as wt, Federation as x, ActorHandleMapper as xt, CustomCollectionCallbackSetters as y, ActorAliasMapper as yt, createFederation as z, OutboxListener as zt };
|
|
@@ -3350,12 +3350,38 @@ interface Context<TContextData> {
|
|
|
3350
3350
|
getPortableFeaturedTagsUri(identifier: string, authority: string): URL;
|
|
3351
3351
|
/**
|
|
3352
3352
|
* Determines the type of the URI and extracts the associated data.
|
|
3353
|
+
*
|
|
3354
|
+
* By default, only URIs on this server's origin are recognized. With
|
|
3355
|
+
* the `portable` option, [FEP-ef61] portable IDs, e.g.,
|
|
3356
|
+
* `ap+ef61://did:key:z6Mk.../users/alice`, and their compatible
|
|
3357
|
+
* identifiers on any gateway, e.g.,
|
|
3358
|
+
* `https://example.com/.well-known/apgateway/did:key:z6Mk.../users/alice`,
|
|
3359
|
+
* are also recognized by the same paths that the gateway endpoint routes
|
|
3360
|
+
* to the dispatchers, and the result has the DID in its `authority`
|
|
3361
|
+
* property.
|
|
3362
|
+
*
|
|
3363
|
+
* The DID of a portable ID is anyone's to choose, so recognizing it does
|
|
3364
|
+
* not mean that this server hosts anything for the DID. Check that
|
|
3365
|
+
* `authority` is the DID that the application stores for the actor or
|
|
3366
|
+
* object before acting on it:
|
|
3367
|
+
*
|
|
3368
|
+
* ~~~~ typescript
|
|
3369
|
+
* const parsed = ctx.parseUri(follow.objectId, { portable: true });
|
|
3370
|
+
* if (parsed?.type !== "actor") return;
|
|
3371
|
+
* const user = await getUser(parsed.identifier);
|
|
3372
|
+
* if (user == null) return;
|
|
3373
|
+
* if (parsed.authority != null && parsed.authority !== user.did) return;
|
|
3374
|
+
* ~~~~
|
|
3375
|
+
*
|
|
3376
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
3377
|
+
*
|
|
3353
3378
|
* @param uri The URI to parse.
|
|
3379
|
+
* @param options Options for parsing the URI. Since 2.4.0.
|
|
3354
3380
|
* @returns The result of parsing the URI. If `null` is given or
|
|
3355
3381
|
* the URI is not recognized, `null` is returned.
|
|
3356
3382
|
* @since 0.9.0
|
|
3357
3383
|
*/
|
|
3358
|
-
parseUri(uri: URL | null): ParseUriResult | null;
|
|
3384
|
+
parseUri(uri: URL | null, options?: ParseUriOptions): ParseUriResult | null;
|
|
3359
3385
|
/**
|
|
3360
3386
|
* Gets the key pairs for an actor.
|
|
3361
3387
|
* @param identifier The actor's identifier.
|
|
@@ -4254,52 +4280,143 @@ interface OutboxContext<TContextData> extends Context<TContextData> {
|
|
|
4254
4280
|
clone(data: TContextData): OutboxContext<TContextData>;
|
|
4255
4281
|
}
|
|
4256
4282
|
/**
|
|
4283
|
+
* Options for {@link Context.parseUri}.
|
|
4284
|
+
* @since 2.4.0
|
|
4285
|
+
*/
|
|
4286
|
+
interface ParseUriOptions {
|
|
4287
|
+
/**
|
|
4288
|
+
* Whether to also recognize [FEP-ef61] portable IDs, i.e., `ap:` and
|
|
4289
|
+
* `ap+ef61:` URIs, and their compatible identifiers on any gateway.
|
|
4290
|
+
* The result of a portable ID has its DID, without percent-encoding, in
|
|
4291
|
+
* the `authority` property, which the caller has to compare with the DID
|
|
4292
|
+
* that it stores for the actor or object, since anyone can make a portable
|
|
4293
|
+
* ID with the same path under another DID.
|
|
4294
|
+
*
|
|
4295
|
+
* Like URIs on this server's origin, a portable ID is recognized by its
|
|
4296
|
+
* path, and its query, e.g., location hints, and fragment are ignored.
|
|
4297
|
+
* A shared inbox is never recognized in a portable ID, and a portable ID
|
|
4298
|
+
* with a malformed DID, or with a `did:key` DID that is not encoded in
|
|
4299
|
+
* base58-btc, is not recognized either.
|
|
4300
|
+
*
|
|
4301
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
4302
|
+
* @default `false`
|
|
4303
|
+
*/
|
|
4304
|
+
readonly portable?: boolean;
|
|
4305
|
+
}
|
|
4306
|
+
/**
|
|
4257
4307
|
* A result of parsing an URI.
|
|
4258
4308
|
*/
|
|
4259
4309
|
type ParseUriResult = {
|
|
4260
4310
|
readonly type: "actor";
|
|
4261
4311
|
readonly identifier: string;
|
|
4312
|
+
/**
|
|
4313
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4314
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4315
|
+
* @since 2.4.0
|
|
4316
|
+
*/
|
|
4317
|
+
readonly authority?: string;
|
|
4262
4318
|
} | {
|
|
4263
4319
|
readonly type: "object";
|
|
4264
4320
|
readonly class: ConstructorWithTypeId<Object$1>;
|
|
4265
4321
|
readonly typeId: URL;
|
|
4266
4322
|
readonly values: Record<string, string>;
|
|
4323
|
+
/**
|
|
4324
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4325
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4326
|
+
* @since 2.4.0
|
|
4327
|
+
*/
|
|
4328
|
+
readonly authority?: string;
|
|
4267
4329
|
} | {
|
|
4268
4330
|
readonly type: "inbox";
|
|
4269
4331
|
readonly identifier: undefined;
|
|
4332
|
+
readonly authority?: undefined;
|
|
4270
4333
|
} | {
|
|
4271
4334
|
readonly type: "inbox";
|
|
4272
4335
|
readonly identifier: string;
|
|
4336
|
+
/**
|
|
4337
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4338
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4339
|
+
* @since 2.4.0
|
|
4340
|
+
*/
|
|
4341
|
+
readonly authority?: string;
|
|
4273
4342
|
} | {
|
|
4274
4343
|
readonly type: "outbox";
|
|
4275
4344
|
readonly identifier: string;
|
|
4345
|
+
/**
|
|
4346
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4347
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4348
|
+
* @since 2.4.0
|
|
4349
|
+
*/
|
|
4350
|
+
readonly authority?: string;
|
|
4276
4351
|
} | {
|
|
4277
4352
|
readonly type: "following";
|
|
4278
4353
|
readonly identifier: string;
|
|
4354
|
+
/**
|
|
4355
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4356
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4357
|
+
* @since 2.4.0
|
|
4358
|
+
*/
|
|
4359
|
+
readonly authority?: string;
|
|
4279
4360
|
} | {
|
|
4280
4361
|
readonly type: "followers";
|
|
4281
4362
|
readonly identifier: string;
|
|
4363
|
+
/**
|
|
4364
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4365
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4366
|
+
* @since 2.4.0
|
|
4367
|
+
*/
|
|
4368
|
+
readonly authority?: string;
|
|
4282
4369
|
} | {
|
|
4283
4370
|
readonly type: "liked";
|
|
4284
4371
|
readonly identifier: string;
|
|
4372
|
+
/**
|
|
4373
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4374
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4375
|
+
* @since 2.4.0
|
|
4376
|
+
*/
|
|
4377
|
+
readonly authority?: string;
|
|
4285
4378
|
} | {
|
|
4286
4379
|
readonly type: "featured";
|
|
4287
4380
|
readonly identifier: string;
|
|
4381
|
+
/**
|
|
4382
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4383
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4384
|
+
* @since 2.4.0
|
|
4385
|
+
*/
|
|
4386
|
+
readonly authority?: string;
|
|
4288
4387
|
} | {
|
|
4289
4388
|
readonly type: "featuredTags";
|
|
4290
4389
|
readonly identifier: string;
|
|
4390
|
+
/**
|
|
4391
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4392
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4393
|
+
* @since 2.4.0
|
|
4394
|
+
*/
|
|
4395
|
+
readonly authority?: string;
|
|
4291
4396
|
} | {
|
|
4292
4397
|
readonly type: "collection";
|
|
4293
4398
|
readonly name: string | symbol;
|
|
4294
4399
|
readonly class: ConstructorWithTypeId<Object$1>;
|
|
4295
4400
|
readonly typeId: URL;
|
|
4296
4401
|
readonly values: Record<string, string>;
|
|
4402
|
+
/**
|
|
4403
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4404
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4405
|
+
* @since 2.4.0
|
|
4406
|
+
*/
|
|
4407
|
+
readonly authority?: string;
|
|
4297
4408
|
} | {
|
|
4298
4409
|
readonly type: "orderedCollection";
|
|
4299
4410
|
readonly name: string | symbol;
|
|
4300
4411
|
readonly class: ConstructorWithTypeId<Object$1>;
|
|
4301
4412
|
readonly typeId: URL;
|
|
4302
4413
|
readonly values: Record<string, string>;
|
|
4414
|
+
/**
|
|
4415
|
+
* The DID of the portable ID, e.g., `did:key:z6Mk...`, or `undefined`
|
|
4416
|
+
* for a URI on this server's origin. See {@link ParseUriOptions.portable}.
|
|
4417
|
+
* @since 2.4.0
|
|
4418
|
+
*/
|
|
4419
|
+
readonly authority?: string;
|
|
4303
4420
|
};
|
|
4304
4421
|
/**
|
|
4305
4422
|
* Options for {@link Context.sendActivity} method.
|
|
@@ -4466,4 +4583,4 @@ interface ActorKeyPair extends CryptoKeyPair {
|
|
|
4466
4583
|
readonly multikey: Multikey;
|
|
4467
4584
|
}
|
|
4468
4585
|
//#endregion
|
|
4469
|
-
export {
|
|
4586
|
+
export { respondWithObjectIfAcceptable as $, ActivityTransformer as $t, InboxListenerSetters as A, HashlinkMediaDispatcher as At, Message as B, OutboxListenerErrorHandler as Bt, FederationBuilder as C, AuthorizePredicate as Ct, IdempotencyKeyCallback as D, CustomCollectionCounter as Dt, FederationStartQueueOptions as E, CollectionDispatcher as Et, Rfc6570Expression as F, NodeInfoDispatcher as Ft, TaskHandler as G, UnverifiedActivityHandler as Gt, TaskDefinition as H, PortableActorIdMapper as Ht, FederationKvPrefixes as I, ObjectAuthorizePredicate as It, RetryContext as J, SendActivityError as Jt, TaskRegistry as K, UnverifiedActivityReason as Kt, FederationOrigin as L, ObjectDispatcher as Lt, ObjectCallbackSetters as M, InboxErrorHandler as Mt, OutboxListenerSetters as N, InboxListener as Nt, IdempotencyStrategy as O, CustomCollectionCursor as Ot, PortableInboxForwardingOptions as P, MediaUploaderCallback as Pt, respondWithObject as Q, digest as Qt, FederationQueueOptions as R, OutboxErrorHandler as Rt, FederationBenchmarkOptions as S, ActorKeyPairsDispatcher as St, FederationOptions as T, CollectionCursor as Tt, TaskDefinitionOptions as U, PortableCollectionOwnerMapper as Ut, createFederationBuilder as V, OutboxPermanentFailureHandler as Vt, TaskEnqueueOptions as W, SharedInboxKeyDispatcher as Wt, createExponentialBackoffPolicy as X, PageItems as Xt, RetryPolicy as Y, SenderKeyPair as Yt, RespondWithObjectOptions as Z, buildCollectionSynchronizationHeader as Zt, CollectionCallbackSetters as _, normalizeCircuitBreakerOptions as _t, GetObjectOptions as a, MessageQueueListenOptions as at, Federatable as b, ActorDispatcher as bt, OutboxContext as c, CircuitBreakerActivityDrop as ct, PortableRequest as d, CircuitBreakerFailurePolicy as dt, InProcessMessageQueue as et, RequestContext as f, CircuitBreakerKvState as ft, ActorCallbackSetters as g, NormalizedCircuitBreakerOptions as gt, SendActivityOptionsForCollection as h, CircuitBreakerStateChange as ht, GetActorOptions as i, MessageQueueEnqueueOptions as it, MediaUploaderSetters as j, HashlinkMediaRequest as jt, InboxChallengePolicy as k, CustomCollectionDispatcher as kt, ParseUriOptions as l, CircuitBreakerBeforeSendDecision as lt, SendActivityOptions as m, CircuitBreakerState as mt, Context as n, MessageQueue as nt, GetSignedKeyOptions as o, ParallelMessageQueue as ot, RouteActivityOptions as p, CircuitBreakerOptions as pt, CreateExponentialBackoffPolicyOptions as q, WebFingerLinksDispatcher as qt, ForwardActivityOptions as r, MessageQueueDepth as rt, InboxContext as s, CircuitBreaker as st, ActorKeyPair as t, InProcessMessageQueueOptions as tt, ParseUriResult as u, CircuitBreakerCreateOptions as ut, ConstructorWithTypeId as v, parseCircuitBreakerKvState as vt, FederationFetchOptions as w, CollectionCounter as wt, Federation as x, ActorHandleMapper as xt, CustomCollectionCallbackSetters as y, ActorAliasMapper as yt, createFederation as z, OutboxListener as zt };
|
|
@@ -6,6 +6,7 @@ import { configure, getConsoleSink, getLogger, reset } from "@logtape/logtape";
|
|
|
6
6
|
import "@opentelemetry/sdk-trace-base";
|
|
7
7
|
import "@opentelemetry/core";
|
|
8
8
|
//#region ../fixture/dist/mod.js
|
|
9
|
+
const fixtureFetch = globalThis.fetch.bind(globalThis);
|
|
9
10
|
const logger = getLogger(["fixture", "docloader"]);
|
|
10
11
|
/**
|
|
11
12
|
* A mock of the document loader. This does not make any actual HTTP requests
|
|
@@ -20,7 +21,7 @@ async function mockDocumentLoader(resource, _options) {
|
|
|
20
21
|
if ("navigator" in globalThis && navigator.userAgent === "Cloudflare-Workers") {
|
|
21
22
|
const testUrl = new URL(url);
|
|
22
23
|
testUrl.hostname += ".test";
|
|
23
|
-
const resp = await
|
|
24
|
+
const resp = await fixtureFetch(testUrl);
|
|
24
25
|
if (resp.ok) {
|
|
25
26
|
const document = await resp.json();
|
|
26
27
|
logger.debug("Successfully fetched fixture {resource}: {status} {statusText}\n{body}", {
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import "temporal-polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { c as validateCryptoKey } from "./key-C6jnekFI.mjs";
|
|
5
|
+
import { n as doubleKnock } from "./http-DV_yW4dv.mjs";
|
|
6
|
+
import { getLogger } from "@logtape/logtape";
|
|
7
|
+
import { curry } from "es-toolkit";
|
|
8
|
+
import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
9
|
+
//#region src/utils/docloader.ts
|
|
10
|
+
const logger = getLogger([
|
|
11
|
+
"fedify",
|
|
12
|
+
"utils",
|
|
13
|
+
"docloader"
|
|
14
|
+
]);
|
|
15
|
+
const DEFAULT_MAX_REDIRECTION = 20;
|
|
16
|
+
/**
|
|
17
|
+
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
|
18
|
+
* Note that an authenticated document loader intentionally does not cache
|
|
19
|
+
* the fetched documents.
|
|
20
|
+
* At most 20 HTTP redirects and alternate document links are followed in total
|
|
21
|
+
* per call. Revisiting a URL within that chain throws a {@link FetchError}.
|
|
22
|
+
* @param identity The identity to get the document loader for.
|
|
23
|
+
* The actor's key pair.
|
|
24
|
+
* @param options The options for the document loader.
|
|
25
|
+
* @returns The authenticated document loader.
|
|
26
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
27
|
+
* @since 0.4.0
|
|
28
|
+
*/
|
|
29
|
+
function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, maxRedirection, userAgent, specDeterminer, tracerProvider } = {}) {
|
|
30
|
+
validateCryptoKey(identity.privateKey);
|
|
31
|
+
async function load(url, options, redirected = 0, visited = /* @__PURE__ */ new Set()) {
|
|
32
|
+
options?.signal?.throwIfAborted();
|
|
33
|
+
let currentUrl = new URL(url).href;
|
|
34
|
+
await validateUrl(currentUrl, options);
|
|
35
|
+
visited.add(currentUrl);
|
|
36
|
+
const originalRequest = createActivityPubRequest(currentUrl, { userAgent });
|
|
37
|
+
function follow(nextUrl) {
|
|
38
|
+
options?.signal?.throwIfAborted();
|
|
39
|
+
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(currentUrl, `Too many redirections (${redirected + 1})`);
|
|
40
|
+
if (visited.has(nextUrl)) throw new FetchError(currentUrl, `Redirect loop detected: ${nextUrl}`);
|
|
41
|
+
redirected++;
|
|
42
|
+
}
|
|
43
|
+
const response = await doubleKnock(originalRequest, identity, {
|
|
44
|
+
maxRedirection,
|
|
45
|
+
specDeterminer,
|
|
46
|
+
log: curry(logRequest)(logger),
|
|
47
|
+
tracerProvider,
|
|
48
|
+
signal: options?.signal,
|
|
49
|
+
validateRedirect: async (nextUrl) => {
|
|
50
|
+
follow(nextUrl);
|
|
51
|
+
await validateUrl(nextUrl, options);
|
|
52
|
+
visited.add(nextUrl);
|
|
53
|
+
currentUrl = nextUrl;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
return getRemoteDocument(currentUrl, response, (alternateUrl) => {
|
|
57
|
+
follow(alternateUrl);
|
|
58
|
+
return load(alternateUrl, options, redirected, visited);
|
|
59
|
+
}, options);
|
|
60
|
+
}
|
|
61
|
+
async function validateUrl(url, options) {
|
|
62
|
+
if (!allowPrivateAddress) try {
|
|
63
|
+
await validatePublicUrl(url);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
if (error instanceof UrlError) if (error.reason === "dns") logger.debug("DNS lookup failed for {url}", {
|
|
66
|
+
url,
|
|
67
|
+
error
|
|
68
|
+
});
|
|
69
|
+
else logger[options?.suppressError ? "warn" : "error"]("Disallowed private URL: {url}", {
|
|
70
|
+
url,
|
|
71
|
+
error
|
|
72
|
+
});
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return (url, options) => load(url, options);
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
export { getAuthenticatedDocumentLoader as t };
|
|
@@ -6,7 +6,7 @@ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
|
6
6
|
import { t as assertExists } from "../assert_exists-cffSpJ7X.mjs";
|
|
7
7
|
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
8
8
|
import "../std__assert-DvMDRPes.mjs";
|
|
9
|
-
import { r as createFederationBuilder } from "../builder-
|
|
9
|
+
import { r as createFederationBuilder } from "../builder-D89oOfHC.mjs";
|
|
10
10
|
import { DisallowedOperatorError, DisallowedVarSpecModifierError, DuplicateRouteVariableError, RouteTemplateOptionsNotMatchedError, RouterError } from "@fedify/uri-template";
|
|
11
11
|
import { Activity, Note, Person } from "@fedify/vocab";
|
|
12
12
|
import { test } from "@fedify/fixture";
|
|
@@ -6,11 +6,11 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
6
6
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
7
7
|
import "../std__assert-DvMDRPes.mjs";
|
|
8
8
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
9
|
-
import { n as exportJwk } from "../key-
|
|
9
|
+
import { n as exportJwk } from "../key-C6jnekFI.mjs";
|
|
10
10
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
|
|
11
|
-
import { a as signObject, d as verifyProof } from "../proof-
|
|
11
|
+
import { a as signObject, d as verifyProof } from "../proof-BdO3BbLh.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
13
|
-
import { n as FederationImpl } from "../middleware-
|
|
13
|
+
import { n as FederationImpl } from "../middleware-Bdwd_Gg8.mjs";
|
|
14
14
|
import { Create, DataIntegrityProof, Note } from "@fedify/vocab";
|
|
15
15
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
16
16
|
import { exportDidKey, parseIri } from "@fedify/vocab-runtime";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { r as createRequestContext, t as createInboxContext } from "../context-
|
|
4
|
+
import { r as createRequestContext, t as createInboxContext } from "../context-B2rlkkyJ.mjs";
|
|
5
5
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
6
6
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
7
7
|
import "../std__assert-DvMDRPes.mjs";
|
|
8
|
-
import { a as compactJsonLd, m as verifyCompactJsonLd, p as signJsonLd } from "../ld-
|
|
9
|
-
import { l as signRequest } from "../http-
|
|
8
|
+
import { a as compactJsonLd, m as verifyCompactJsonLd, p as signJsonLd } from "../ld-ya2C1Xip.mjs";
|
|
9
|
+
import { l as signRequest } from "../http-DV_yW4dv.mjs";
|
|
10
10
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
11
|
-
import { f as handleInbox, o as createFederation } from "../middleware-
|
|
11
|
+
import { f as handleInbox, o as createFederation } from "../middleware-Bdwd_Gg8.mjs";
|
|
12
12
|
import { t as ActivityListenerSet } from "../activity-listener-C-BSbKI7.mjs";
|
|
13
13
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
14
14
|
import { Create, CryptographicKey, Multikey, Person, Update } from "@fedify/vocab";
|