@fedify/fedify 1.7.5 → 1.8.0-dev.1003
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/LICENSE +20 -0
- package/README.md +33 -0
- package/dist/{actor-CPpvuBKU.d.ts → actor-B4TBtqRP.d.ts} +2 -2
- package/dist/{actor-CKXuhyRT.js → actor-CESvGo9c.js} +179 -179
- package/dist/{actor-D-zfQLAH.js → actor-CqSuisvH.js} +3 -3
- package/dist/{assert-0DSnLFa8.js → assert-DwEa6glZ.js} +2 -2
- package/dist/{assert_equals-XhPMqqO2.js → assert_equals-C5gKCm6A.js} +10 -22
- package/dist/{assert_instance_of-v5adm_-K.js → assert_instance_of-C9QtN-X9.js} +2 -2
- package/dist/{assert_is_error-Drwb_yQp.js → assert_is_error-DQdKoRgb.js} +2 -2
- package/dist/{assert_not_equals-BRPdeJ9D.js → assert_not_equals-7pyUM3Ib.js} +2 -2
- package/dist/{assert_rejects-D_nYI1gs.js → assert_rejects-DceVjUlD.js} +4 -4
- package/dist/{assert_throws-DNuPhPNp.js → assert_throws-DTDC_gwN.js} +3 -3
- package/dist/{authdocloader-CFk80WJv.js → authdocloader-QSRLyapW.js} +3 -3
- package/dist/{authdocloader-81r40Meg.js → authdocloader-rYXZAJDf.js} +3 -3
- package/dist/{builder-Cmn0cpiZ.js → builder-rGWE83Jn.js} +4 -4
- package/dist/{client-CuYHcL1K.js → client-B3xo9NFO.js} +1 -1
- package/dist/{client-DvtwXO7t.d.ts → client-BQ4AQGKo.d.ts} +1 -1
- package/dist/compat/mod.d.ts +11 -11
- package/dist/compat/transformers.test.js +22 -22
- package/dist/{context-DPggmpB4.d.ts → context-CrSyJrIa.d.ts} +9 -9
- package/dist/{context-CFiKyaR_.js → context-T6ATmy_o.js} +3 -3
- package/dist/{denokv-CvROlGYX.js → denokv-QWKsIqML.js} +2 -0
- package/dist/{docloader-Q42SMRIB.d.ts → docloader-BeCtcTOJ.d.ts} +1 -1
- package/dist/{docloader-BLY7GyoJ.js → docloader-Coh6BBtD.js} +5 -13
- package/dist/{docloader-Ck2GBnC3.js → docloader-DP2c5RKR.js} +5 -13
- package/dist/{esm-CASHO3OR.js → esm-d-9EVGaP.js} +14 -14
- package/dist/federation/builder.test.js +14 -14
- package/dist/federation/collection.test.js +8 -8
- package/dist/federation/handler.test.js +29 -29
- package/dist/federation/inbox.test.js +6 -6
- package/dist/federation/keycache.test.js +7 -7
- package/dist/federation/kv.test.js +21 -9
- package/dist/federation/middleware.test.js +644 -630
- package/dist/federation/mod.d.ts +10 -10
- package/dist/federation/mod.js +11 -11
- package/dist/federation/mq.test.js +11 -11
- package/dist/federation/retry.test.js +2 -2
- package/dist/federation/router.test.js +9 -9
- package/dist/federation/send.test.js +18 -18
- package/dist/{federation-BRIQn-GV.js → federation-C44ekWNP.js} +28 -6
- package/dist/{http-B8EiSgi2.d.ts → http-CP2ZUALI.d.ts} +2 -2
- package/dist/{http-Cmpdwx_X.js → http-CkfVl7ql.js} +3 -3
- package/dist/{http-B6yJ2mAf.js → http-lmPPO2Eo.js} +3 -3
- package/dist/{inbox-CcAueP-r.js → inbox-CF21yedu.js} +2 -2
- package/dist/{key-BAckFVRH.js → key-BLqpPTN_.js} +3 -3
- package/dist/{key-D1uKqeD5.js → key-BjUOfK1Q.js} +2 -2
- package/dist/{key-Cj0F3jFv.js → key-CSLD2uRf.js} +4 -4
- package/dist/{key-rZ_Yr0Yr.js → key-NY6yQihW.js} +5 -5
- package/dist/{keycache-Ce9ou6p4.js → keycache-yqwT_M3m.js} +1 -1
- package/dist/{keys-DcrALCdq.js → keys-D9Gc5bvV.js} +1 -1
- package/dist/{kv-BMY6Qf_A.js → kv-D7Yt6pnB.js} +22 -0
- package/dist/{kv-DRaeSXco.d.ts → kv-DDdb1hMa.d.ts} +14 -0
- package/dist/{ld-S8bkC8Cg.js → ld-zsHn8nfn.js} +3 -3
- package/dist/{lookup-CQ5H1v6m.js → lookup-BYgWjDk7.js} +4 -3
- package/dist/{lookup-DW0leLqq.js → lookup-BlRxqykX.js} +62 -10
- package/dist/{lookup-DNZf9_oN.js → lookup-DU2MRGYe.js} +4 -3
- package/dist/{lookup-Bf-K85bV.d.ts → lookup-J_m4YZg0.d.ts} +7 -1
- package/dist/{middleware-Ba2-qvzk.js → middleware-BmxgK7wV.js} +11 -11
- package/dist/middleware-CILojq-d.js +17 -0
- package/dist/{middleware-CrCDov2d.js → middleware-CkV-ui-y.js} +16 -16
- package/dist/middleware-NVGAT7X_.js +33 -0
- package/dist/{mod-CDzlVCUF.d.ts → mod-BFwgZ7_K.d.ts} +77 -3
- package/dist/{mod-C2drFqH8.d.ts → mod-CytXBx8A.d.ts} +2 -2
- package/dist/{mod-sEI6_uZ2.d.ts → mod-D2uPZuP-.d.ts} +3 -3
- package/dist/{mod-CbjCOiVh.d.ts → mod-DpE8T10I.d.ts} +2 -2
- package/dist/mod.d.ts +14 -14
- package/dist/mod.js +12 -12
- package/dist/nodeinfo/client.test.js +11 -11
- package/dist/nodeinfo/handler.test.js +28 -28
- package/dist/nodeinfo/mod.d.ts +3 -3
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +8 -8
- package/dist/nodeinfo/types.test.js +8 -8
- package/dist/{owner-D0cOz8R5.d.ts → owner-CEv_PfyK.d.ts} +3 -3
- package/dist/{owner-B5IFvDCy.js → owner-yriwUrxg.js} +3 -3
- package/dist/{proof-C6nF-oYD.js → proof-B0keqm8m.js} +3 -3
- package/dist/{proof-CnQWIl9G.js → proof-CTzg7mvj.js} +3 -3
- package/dist/{router-D_aVZZUc.js → router-D3UybECj.js} +1 -1
- package/dist/runtime/authdocloader.test.js +17 -17
- package/dist/runtime/docloader.test.js +11 -11
- package/dist/runtime/key.test.js +13 -13
- package/dist/runtime/langstr.test.js +8 -8
- package/dist/runtime/mod.d.ts +5 -5
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +8 -8
- package/dist/runtime/url.test.js +4 -4
- package/dist/{send-IlYZ_CVt.js → send-CdU_Vjiy.js} +2 -2
- package/dist/sig/http.test.js +16 -16
- package/dist/sig/key.test.js +14 -14
- package/dist/sig/ld.test.js +12 -12
- package/dist/sig/mod.d.ts +7 -7
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +16 -16
- package/dist/sig/proof.test.js +15 -15
- package/dist/{std__assert-CmyZxqPw.js → std__assert-B3iAixc-.js} +6 -6
- package/dist/testing/docloader.test.js +8 -8
- package/dist/{types-BAIE7lzA.js → types-D9EP9eEB.js} +1 -1
- package/dist/vocab/actor.test.js +197 -190
- package/dist/vocab/lookup.test.js +13 -13
- package/dist/vocab/mod.d.ts +6 -6
- package/dist/vocab/mod.js +5 -5
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +128 -110
- package/dist/{vocab-BdvvrpJb.js → vocab-BFfwVBw7.js} +84 -11
- package/dist/{vocab-CzEfWQk2.d.ts → vocab-By6mpzr-.d.ts} +1 -1
- package/dist/{vocab-Cs1Xg69m.js → vocab-Df91ohvp.js} +178 -178
- package/dist/webfinger/handler.test.js +28 -28
- package/dist/webfinger/lookup.test.js +30 -12
- package/dist/webfinger/mod.d.ts +3 -3
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.d.ts +6 -1
- package/dist/x/cfworkers.js +5 -0
- package/dist/x/cfworkers.test.js +14 -9
- package/dist/x/hono.d.ts +10 -10
- package/dist/x/sveltekit.d.ts +10 -10
- package/package.json +7 -6
- package/dist/middleware-BBLmcWi8.js +0 -33
- package/dist/middleware-OQqgTYLn.js +0 -17
package/dist/federation/mod.d.ts
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore } from "../kv-
|
4
|
-
import "../docloader-
|
5
|
-
import "../client-
|
6
|
-
import "../vocab-
|
7
|
-
import "../actor-
|
8
|
-
import "../http-
|
9
|
-
import "../owner-
|
10
|
-
import "../mod-
|
11
|
-
import "../lookup-
|
12
|
-
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-
|
3
|
+
import { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore } from "../kv-DDdb1hMa.js";
|
4
|
+
import "../docloader-BeCtcTOJ.js";
|
5
|
+
import "../client-BQ4AQGKo.js";
|
6
|
+
import "../vocab-By6mpzr-.js";
|
7
|
+
import "../actor-B4TBtqRP.js";
|
8
|
+
import "../http-CP2ZUALI.js";
|
9
|
+
import "../owner-CEv_PfyK.js";
|
10
|
+
import "../mod-BFwgZ7_K.js";
|
11
|
+
import "../lookup-J_m4YZg0.js";
|
12
|
+
import { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, Message, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../context-CrSyJrIa.js";
|
13
13
|
import { InProcessMessageQueue, InProcessMessageQueueOptions, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, ParallelMessageQueue } from "../mq-DYKDDJmp.js";
|
14
14
|
import "../mod-g0xFzAP9.js";
|
15
15
|
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, Context, CreateExponentialBackoffPolicyOptions, CreateFederationOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, InProcessMessageQueue, InProcessMessageQueueOptions, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.js
CHANGED
@@ -3,16 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import "../transformers-ghwJuzGY.js";
|
6
|
-
import "../docloader-
|
7
|
-
import "../actor-
|
8
|
-
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-
|
9
|
-
import "../lookup-
|
10
|
-
import "../key-
|
11
|
-
import "../http-
|
12
|
-
import "../proof-
|
13
|
-
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-
|
14
|
-
import "../types-
|
15
|
-
import "../authdocloader-
|
16
|
-
import "../vocab-
|
6
|
+
import "../docloader-DP2c5RKR.js";
|
7
|
+
import "../actor-CESvGo9c.js";
|
8
|
+
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "../middleware-BmxgK7wV.js";
|
9
|
+
import "../lookup-BYgWjDk7.js";
|
10
|
+
import "../key-BjUOfK1Q.js";
|
11
|
+
import "../http-lmPPO2Eo.js";
|
12
|
+
import "../proof-B0keqm8m.js";
|
13
|
+
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "../federation-C44ekWNP.js";
|
14
|
+
import "../types-D9EP9eEB.js";
|
15
|
+
import "../authdocloader-QSRLyapW.js";
|
16
|
+
import "../vocab-BFfwVBw7.js";
|
17
17
|
|
18
18
|
export { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable };
|
@@ -3,16 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import { assert } from "../assert-
|
8
|
-
import "../assert_instance_of-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import { assert } from "../assert-DwEa6glZ.js";
|
8
|
+
import "../assert_instance_of-C9QtN-X9.js";
|
9
9
|
import { test } from "../testing-BZ0dJ4qn.js";
|
10
|
-
import { assertGreater, assertGreaterOrEqual } from "../std__assert-
|
11
|
-
import { assertFalse } from "../assert_rejects-
|
12
|
-
import "../assert_is_error-
|
13
|
-
import "../assert_not_equals-
|
14
|
-
import "../assert_throws-
|
15
|
-
import { delay } from "
|
10
|
+
import { assertGreater, assertGreaterOrEqual } from "../std__assert-B3iAixc-.js";
|
11
|
+
import { assertFalse } from "../assert_rejects-DceVjUlD.js";
|
12
|
+
import "../assert_is_error-DQdKoRgb.js";
|
13
|
+
import "../assert_not_equals-7pyUM3Ib.js";
|
14
|
+
import "../assert_throws-DTDC_gwN.js";
|
15
|
+
import { delay } from "es-toolkit";
|
16
16
|
|
17
17
|
//#region federation/mq.ts
|
18
18
|
/**
|
@@ -225,7 +225,7 @@ test("InProcessMessageQueue", async (t) => {
|
|
225
225
|
});
|
226
226
|
test("MessageQueue.nativeRetrial", async (t) => {
|
227
227
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") await t.step("DenoKvMessageQueue", async () => {
|
228
|
-
const { DenoKvMessageQueue } = await import("../denokv-
|
228
|
+
const { DenoKvMessageQueue } = await import("../denokv-QWKsIqML.js");
|
229
229
|
const mq = new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
230
230
|
assert(mq.nativeRetrial);
|
231
231
|
if (Symbol.dispose in mq) {
|
@@ -264,7 +264,7 @@ test("MessageQueue.nativeRetrial", async (t) => {
|
|
264
264
|
});
|
265
265
|
const queues = { InProcessMessageQueue: () => Promise.resolve(new InProcessMessageQueue()) };
|
266
266
|
if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") {
|
267
|
-
const { DenoKvMessageQueue } = await import("../denokv-
|
267
|
+
const { DenoKvMessageQueue } = await import("../denokv-QWKsIqML.js");
|
268
268
|
queues.DenoKvMessageQueue = async () => new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
269
269
|
}
|
270
270
|
for (const mqName in queues) test({
|
@@ -3,10 +3,10 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { AssertionError, assertEquals } from "../assert_equals-
|
6
|
+
import { AssertionError, assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
7
|
import { createExponentialBackoffPolicy } from "../retry-BiIhZWgD.js";
|
8
8
|
import { test } from "../testing-BZ0dJ4qn.js";
|
9
|
-
import { assertNotEquals } from "../assert_not_equals-
|
9
|
+
import { assertNotEquals } from "../assert_not_equals-7pyUM3Ib.js";
|
10
10
|
|
11
11
|
//#region federation/retry.test.ts
|
12
12
|
test("createExponentialBackoffPolicy()", () => {
|
@@ -3,16 +3,16 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import { assert } from "../assert-
|
8
|
-
import "../assert_instance_of-
|
9
|
-
import { Router, RouterError } from "../router-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import { assert } from "../assert-DwEa6glZ.js";
|
8
|
+
import "../assert_instance_of-C9QtN-X9.js";
|
9
|
+
import { Router, RouterError } from "../router-D3UybECj.js";
|
10
10
|
import { test } from "../testing-BZ0dJ4qn.js";
|
11
|
-
import "../std__assert-
|
12
|
-
import { assertFalse } from "../assert_rejects-
|
13
|
-
import "../assert_is_error-
|
14
|
-
import "../assert_not_equals-
|
15
|
-
import { assertThrows } from "../assert_throws-
|
11
|
+
import "../std__assert-B3iAixc-.js";
|
12
|
+
import { assertFalse } from "../assert_rejects-DceVjUlD.js";
|
13
|
+
import "../assert_is_error-DQdKoRgb.js";
|
14
|
+
import "../assert_not_equals-7pyUM3Ib.js";
|
15
|
+
import { assertThrows } from "../assert_throws-DTDC_gwN.js";
|
16
16
|
|
17
17
|
//#region federation/router.test.ts
|
18
18
|
function setUp(options = {}) {
|
@@ -3,30 +3,30 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
7
|
-
import { assert } from "../assert-
|
8
|
-
import "../assert_instance_of-
|
9
|
-
import "../docloader-
|
6
|
+
import { assertEquals } from "../assert_equals-C5gKCm6A.js";
|
7
|
+
import { assert } from "../assert-DwEa6glZ.js";
|
8
|
+
import "../assert_instance_of-C9QtN-X9.js";
|
9
|
+
import "../docloader-Coh6BBtD.js";
|
10
10
|
import "../url-kTAI6_KP.js";
|
11
11
|
import "../multibase-DeCHcK8L.js";
|
12
|
-
import { Activity, Application, Endpoints, Group, Person, Service } from "../vocab-
|
12
|
+
import { Activity, Application, Endpoints, Group, Person, Service } from "../vocab-Df91ohvp.js";
|
13
13
|
import "../langstr-DbWheeIS.js";
|
14
|
-
import "../lookup-
|
14
|
+
import "../lookup-DU2MRGYe.js";
|
15
15
|
import "../type-D2s5lmbZ.js";
|
16
|
-
import "../actor-
|
17
|
-
import "../key-
|
18
|
-
import { verifyRequest } from "../http-
|
19
|
-
import { doesActorOwnKey } from "../owner-
|
20
|
-
import { extractInboxes, sendActivity } from "../send-
|
16
|
+
import "../actor-CqSuisvH.js";
|
17
|
+
import "../key-BLqpPTN_.js";
|
18
|
+
import { verifyRequest } from "../http-CkfVl7ql.js";
|
19
|
+
import { doesActorOwnKey } from "../owner-yriwUrxg.js";
|
20
|
+
import { extractInboxes, sendActivity } from "../send-CdU_Vjiy.js";
|
21
21
|
import { test } from "../testing-BZ0dJ4qn.js";
|
22
|
-
import "../std__assert-
|
23
|
-
import { assertFalse, assertRejects } from "../assert_rejects-
|
24
|
-
import "../assert_is_error-
|
25
|
-
import { assertNotEquals } from "../assert_not_equals-
|
26
|
-
import "../assert_throws-
|
22
|
+
import "../std__assert-B3iAixc-.js";
|
23
|
+
import { assertFalse, assertRejects } from "../assert_rejects-DceVjUlD.js";
|
24
|
+
import "../assert_is_error-DQdKoRgb.js";
|
25
|
+
import { assertNotEquals } from "../assert_not_equals-7pyUM3Ib.js";
|
26
|
+
import "../assert_throws-DTDC_gwN.js";
|
27
27
|
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
28
|
-
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-
|
29
|
-
import { esm_default } from "../esm-
|
28
|
+
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-D9Gc5bvV.js";
|
29
|
+
import { esm_default } from "../esm-d-9EVGaP.js";
|
30
30
|
|
31
31
|
//#region federation/send.test.ts
|
32
32
|
test("extractInboxes()", () => {
|
@@ -2,6 +2,8 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
+
import { isEqual } from "es-toolkit";
|
6
|
+
|
5
7
|
//#region federation/kv.ts
|
6
8
|
/**
|
7
9
|
* A key–value store that stores values in memory.
|
@@ -45,6 +47,26 @@ var MemoryKvStore = class {
|
|
45
47
|
delete this.#values[encodedKey];
|
46
48
|
return Promise.resolve();
|
47
49
|
}
|
50
|
+
/**
|
51
|
+
* {@inheritDoc KvStore.cas}
|
52
|
+
*/
|
53
|
+
cas(key, expectedValue, newValue, options) {
|
54
|
+
const encodedKey = this.#encodeKey(key);
|
55
|
+
const entry = this.#values[encodedKey];
|
56
|
+
let currentValue;
|
57
|
+
if (entry == null) currentValue = void 0;
|
58
|
+
else {
|
59
|
+
const [value, expiration$1] = entry;
|
60
|
+
if (expiration$1 != null && Temporal.Now.instant().until(expiration$1).sign < 0) {
|
61
|
+
delete this.#values[encodedKey];
|
62
|
+
currentValue = void 0;
|
63
|
+
} else currentValue = value;
|
64
|
+
}
|
65
|
+
if (!isEqual(currentValue, expectedValue)) return Promise.resolve(false);
|
66
|
+
const expiration = options?.ttl == null ? null : Temporal.Now.instant().add(options.ttl.round({ largestUnit: "hour" }));
|
67
|
+
this.#values[encodedKey] = [newValue, expiration];
|
68
|
+
return Promise.resolve(true);
|
69
|
+
}
|
48
70
|
};
|
49
71
|
|
50
72
|
//#endregion
|
@@ -75,12 +97,12 @@ var InProcessMessageQueue = class {
|
|
75
97
|
this.#pollIntervalMs = Temporal.Duration.from(options.pollInterval ?? { seconds: 5 }).total("millisecond");
|
76
98
|
}
|
77
99
|
enqueue(message, options) {
|
78
|
-
const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
79
|
-
if (delay > 0) {
|
100
|
+
const delay$1 = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
101
|
+
if (delay$1 > 0) {
|
80
102
|
setTimeout(() => this.enqueue(message, {
|
81
103
|
...options,
|
82
104
|
delay: void 0
|
83
|
-
}), delay);
|
105
|
+
}), delay$1);
|
84
106
|
return Promise.resolve();
|
85
107
|
}
|
86
108
|
this.#messages.push(message);
|
@@ -89,12 +111,12 @@ var InProcessMessageQueue = class {
|
|
89
111
|
}
|
90
112
|
enqueueMany(messages, options) {
|
91
113
|
if (messages.length === 0) return Promise.resolve();
|
92
|
-
const delay = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
93
|
-
if (delay > 0) {
|
114
|
+
const delay$1 = options?.delay == null ? 0 : Math.max(options.delay.total("millisecond"), 0);
|
115
|
+
if (delay$1 > 0) {
|
94
116
|
setTimeout(() => this.enqueueMany(messages, {
|
95
117
|
...options,
|
96
118
|
delay: void 0
|
97
|
-
}), delay);
|
119
|
+
}), delay$1);
|
98
120
|
return Promise.resolve();
|
99
121
|
}
|
100
122
|
this.#messages.push(...messages);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import { DocumentLoader } from "./docloader-
|
4
|
-
import { CryptographicKey, Multikey } from "./vocab-
|
3
|
+
import { DocumentLoader } from "./docloader-BeCtcTOJ.js";
|
4
|
+
import { CryptographicKey, Multikey } from "./vocab-By6mpzr-.js";
|
5
5
|
import { TracerProvider } from "@opentelemetry/api";
|
6
6
|
|
7
7
|
//#region sig/key.d.ts
|
@@ -3,9 +3,9 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { deno_default } from "./docloader-
|
7
|
-
import { CryptographicKey } from "./vocab-
|
8
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
6
|
+
import { deno_default } from "./docloader-Coh6BBtD.js";
|
7
|
+
import { CryptographicKey } from "./vocab-Df91ohvp.js";
|
8
|
+
import { fetchKey, validateCryptoKey } from "./key-BLqpPTN_.js";
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
10
10
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
11
11
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
@@ -2,9 +2,9 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { deno_default } from "./docloader-
|
6
|
-
import { CryptographicKey } from "./actor-
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
5
|
+
import { deno_default } from "./docloader-DP2c5RKR.js";
|
6
|
+
import { CryptographicKey } from "./actor-CESvGo9c.js";
|
7
|
+
import { fetchKey, validateCryptoKey } from "./key-BjUOfK1Q.js";
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
10
10
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
@@ -3,8 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { deno_default } from "./docloader-
|
7
|
-
import { Activity } from "./vocab-
|
6
|
+
import { deno_default } from "./docloader-Coh6BBtD.js";
|
7
|
+
import { Activity } from "./vocab-Df91ohvp.js";
|
8
8
|
import { getTypeId } from "./type-D2s5lmbZ.js";
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
10
10
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
@@ -3,9 +3,9 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { deno_default, getDocumentLoader } from "./docloader-
|
7
|
-
import { CryptographicKey, Object as Object$1 } from "./vocab-
|
8
|
-
import { isActor } from "./actor-
|
6
|
+
import { deno_default, getDocumentLoader } from "./docloader-Coh6BBtD.js";
|
7
|
+
import { CryptographicKey, Object as Object$1 } from "./vocab-Df91ohvp.js";
|
8
|
+
import { isActor } from "./actor-CqSuisvH.js";
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
10
10
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
11
11
|
|
@@ -2,8 +2,8 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { deno_default, getDocumentLoader } from "./docloader-
|
6
|
-
import { CryptographicKey, Object as Object$1, isActor } from "./actor-
|
5
|
+
import { deno_default, getDocumentLoader } from "./docloader-DP2c5RKR.js";
|
6
|
+
import { CryptographicKey, Object as Object$1, isActor } from "./actor-CESvGo9c.js";
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
9
9
|
|
@@ -2,9 +2,9 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import "./docloader-
|
6
|
-
import "./actor-
|
7
|
-
import "./lookup-
|
8
|
-
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey } from "./key-
|
5
|
+
import "./docloader-DP2c5RKR.js";
|
6
|
+
import "./actor-CESvGo9c.js";
|
7
|
+
import "./lookup-BYgWjDk7.js";
|
8
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey } from "./key-BjUOfK1Q.js";
|
9
9
|
|
10
10
|
export { validateCryptoKey };
|
@@ -3,14 +3,14 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import "./docloader-
|
6
|
+
import "./docloader-Coh6BBtD.js";
|
7
7
|
import "./url-kTAI6_KP.js";
|
8
8
|
import "./multibase-DeCHcK8L.js";
|
9
|
-
import "./vocab-
|
9
|
+
import "./vocab-Df91ohvp.js";
|
10
10
|
import "./langstr-DbWheeIS.js";
|
11
|
-
import "./lookup-
|
11
|
+
import "./lookup-DU2MRGYe.js";
|
12
12
|
import "./type-D2s5lmbZ.js";
|
13
|
-
import "./actor-
|
14
|
-
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey } from "./key-
|
13
|
+
import "./actor-CqSuisvH.js";
|
14
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey } from "./key-BLqpPTN_.js";
|
15
15
|
|
16
16
|
export { validateCryptoKey };
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { CryptographicKey, Multikey } from "./vocab-
|
6
|
+
import { CryptographicKey, Multikey } from "./vocab-Df91ohvp.js";
|
7
7
|
|
8
8
|
//#region federation/keycache.ts
|
9
9
|
var KvKeyCache = class {
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { CryptographicKey, Multikey, importSpki } from "./vocab-
|
6
|
+
import { CryptographicKey, Multikey, importSpki } from "./vocab-Df91ohvp.js";
|
7
7
|
|
8
8
|
//#region testing/keys.ts
|
9
9
|
const rsaPublicKey1 = new CryptographicKey({
|
@@ -3,6 +3,8 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
+
import { isEqual } from "es-toolkit";
|
7
|
+
|
6
8
|
//#region federation/kv.ts
|
7
9
|
/**
|
8
10
|
* A key–value store that stores values in memory.
|
@@ -46,6 +48,26 @@ var MemoryKvStore = class {
|
|
46
48
|
delete this.#values[encodedKey];
|
47
49
|
return Promise.resolve();
|
48
50
|
}
|
51
|
+
/**
|
52
|
+
* {@inheritDoc KvStore.cas}
|
53
|
+
*/
|
54
|
+
cas(key, expectedValue, newValue, options) {
|
55
|
+
const encodedKey = this.#encodeKey(key);
|
56
|
+
const entry = this.#values[encodedKey];
|
57
|
+
let currentValue;
|
58
|
+
if (entry == null) currentValue = void 0;
|
59
|
+
else {
|
60
|
+
const [value, expiration$1] = entry;
|
61
|
+
if (expiration$1 != null && Temporal.Now.instant().until(expiration$1).sign < 0) {
|
62
|
+
delete this.#values[encodedKey];
|
63
|
+
currentValue = void 0;
|
64
|
+
} else currentValue = value;
|
65
|
+
}
|
66
|
+
if (!isEqual(currentValue, expectedValue)) return Promise.resolve(false);
|
67
|
+
const expiration = options?.ttl == null ? null : Temporal.Now.instant().add(options.ttl.round({ largestUnit: "hour" }));
|
68
|
+
this.#values[encodedKey] = [newValue, expiration];
|
69
|
+
return Promise.resolve(true);
|
70
|
+
}
|
49
71
|
};
|
50
72
|
|
51
73
|
//#endregion
|
@@ -44,6 +44,16 @@ interface KvStore {
|
|
44
44
|
* @param key The key to delete.
|
45
45
|
*/
|
46
46
|
delete(key: KvKey): Promise<void>;
|
47
|
+
/**
|
48
|
+
* Compare-and-swap (CAS) operation for the key–value store.
|
49
|
+
* @param key The key to perform the CAS operation on.
|
50
|
+
* @param expectedValue The expected value for the key.
|
51
|
+
* @param newValue The new value to set if the expected value matches.
|
52
|
+
* @param options Additional options for setting the value.
|
53
|
+
* @return `true` if the CAS operation was successful, `false` otherwise.
|
54
|
+
* @since 1.8.0
|
55
|
+
*/
|
56
|
+
cas?: (key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions) => Promise<boolean>;
|
47
57
|
}
|
48
58
|
/**
|
49
59
|
* A key–value store that stores values in memory.
|
@@ -65,6 +75,10 @@ declare class MemoryKvStore implements KvStore {
|
|
65
75
|
* {@inheritDoc KvStore.delete}
|
66
76
|
*/
|
67
77
|
delete(key: KvKey): Promise<void>;
|
78
|
+
/**
|
79
|
+
* {@inheritDoc KvStore.cas}
|
80
|
+
*/
|
81
|
+
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
68
82
|
}
|
69
83
|
//#endregion
|
70
84
|
export { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore };
|
@@ -3,10 +3,10 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { deno_default, getDocumentLoader } from "./docloader-
|
7
|
-
import { Activity, CryptographicKey, Object as Object$1 } from "./vocab-
|
6
|
+
import { deno_default, getDocumentLoader } from "./docloader-Coh6BBtD.js";
|
7
|
+
import { Activity, CryptographicKey, Object as Object$1 } from "./vocab-Df91ohvp.js";
|
8
8
|
import { getTypeId } from "./type-D2s5lmbZ.js";
|
9
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
9
|
+
import { fetchKey, validateCryptoKey } from "./key-BLqpPTN_.js";
|
10
10
|
import { getLogger } from "@logtape/logtape";
|
11
11
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
12
12
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
@@ -2,7 +2,7 @@
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
|
-
import { UrlError, deno_default, getUserAgent, validatePublicUrl } from "./docloader-
|
5
|
+
import { UrlError, deno_default, getUserAgent, validatePublicUrl } from "./docloader-DP2c5RKR.js";
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
7
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
8
8
|
|
@@ -12,7 +12,7 @@ const logger = getLogger([
|
|
12
12
|
"webfinger",
|
13
13
|
"lookup"
|
14
14
|
]);
|
15
|
-
const
|
15
|
+
const DEFAULT_MAX_REDIRECTION = 5;
|
16
16
|
/**
|
17
17
|
* Looks up a WebFinger resource.
|
18
18
|
* @param resource The resource URL to look up.
|
@@ -90,7 +90,8 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
90
90
|
}
|
91
91
|
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
92
92
|
redirected++;
|
93
|
-
|
93
|
+
const maxRedirection = options.maxRedirection ?? DEFAULT_MAX_REDIRECTION;
|
94
|
+
if (redirected >= maxRedirection) {
|
94
95
|
logger.error("Too many redirections ({redirections}) while fetching WebFinger resource descriptor.", { redirections: redirected });
|
95
96
|
return null;
|
96
97
|
}
|
@@ -3,21 +3,77 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { deno_default, getDocumentLoader } from "./docloader-
|
7
|
-
import { Object as Object$1 } from "./vocab-
|
8
|
-
import { lookupWebFinger } from "./lookup-
|
6
|
+
import { deno_default, getDocumentLoader } from "./docloader-Coh6BBtD.js";
|
7
|
+
import { Object as Object$1 } from "./vocab-Df91ohvp.js";
|
8
|
+
import { lookupWebFinger } from "./lookup-DU2MRGYe.js";
|
9
9
|
import { getTypeId } from "./type-D2s5lmbZ.js";
|
10
|
+
import { delay } from "es-toolkit";
|
10
11
|
import { getLogger } from "@logtape/logtape";
|
11
12
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
12
|
-
import { delay } from "@es-toolkit/es-toolkit";
|
13
13
|
|
14
|
+
//#region vocab/handle.ts
|
15
|
+
/**
|
16
|
+
* Regular expression to match a fediverse handle in the format `@user@server`
|
17
|
+
* or `user@server`. The `user` part can contain alphanumeric characters and
|
18
|
+
* some special characters except `@`. The `server` part is all characters
|
19
|
+
* after the `@` symbol in the middle.
|
20
|
+
*/
|
21
|
+
const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]+)$/;
|
22
|
+
/**
|
23
|
+
* Parses a fediverse handle in the format `@user@server` or `user@server`.
|
24
|
+
* The `user` part can contain alphanumeric characters and some special
|
25
|
+
* characters except `@`. The `server` part is all characters after the `@`
|
26
|
+
* symbol in the middle.
|
27
|
+
*
|
28
|
+
* @example
|
29
|
+
* ```typescript
|
30
|
+
* const handle = parseFediverseHandle("@username@example.com");
|
31
|
+
* console.log(handle?.username); // "username"
|
32
|
+
* console.log(handle?.host); // "example.com"
|
33
|
+
* ```
|
34
|
+
*
|
35
|
+
* @param handle - The fediverse handle string to parse.
|
36
|
+
* @returns A {@link FediverseHandle} object with `username` and `host`
|
37
|
+
* if the input is valid; otherwise `null`.
|
38
|
+
* @since 1.8.0
|
39
|
+
*/
|
40
|
+
function parseFediverseHandle(handle) {
|
41
|
+
const match = handleRegexp.exec(handle);
|
42
|
+
if (match) return {
|
43
|
+
username: match[1],
|
44
|
+
host: match[2]
|
45
|
+
};
|
46
|
+
return null;
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* Converts a fediverse handle in the format `@user@server` or `user@server`
|
50
|
+
* to an `acct:` URI, which is a URL-like identifier for ActivityPub actors.
|
51
|
+
*
|
52
|
+
* @example
|
53
|
+
* ```typescript
|
54
|
+
* const identifier = toAcctUrl("@username@example.com");
|
55
|
+
* console.log(identifier?.href); // "acct:username@example.com"
|
56
|
+
* ```
|
57
|
+
*
|
58
|
+
* @param handle - The fediverse handle string to convert.
|
59
|
+
* @returns A `URL` object representing the `acct:` URI if conversion succeeds;
|
60
|
+
* otherwise `null`.
|
61
|
+
* @since 1.8.0
|
62
|
+
*/
|
63
|
+
function toAcctUrl(handle) {
|
64
|
+
const parsed = parseFediverseHandle(handle);
|
65
|
+
if (!parsed) return null;
|
66
|
+
const identifier = new URL(`acct:${parsed.username}@${parsed.host}`);
|
67
|
+
return identifier;
|
68
|
+
}
|
69
|
+
|
70
|
+
//#endregion
|
14
71
|
//#region vocab/lookup.ts
|
15
72
|
const logger = getLogger([
|
16
73
|
"fedify",
|
17
74
|
"vocab",
|
18
75
|
"lookup"
|
19
76
|
]);
|
20
|
-
const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]+)$/;
|
21
77
|
/**
|
22
78
|
* Looks up an ActivityStreams object by its URI (including `acct:` URIs)
|
23
79
|
* or a fediverse handle (e.g., `@user@server` or `user@server`).
|
@@ -76,11 +132,7 @@ async function lookupObject(identifier, options = {}) {
|
|
76
132
|
}
|
77
133
|
async function lookupObjectInternal(identifier, options = {}) {
|
78
134
|
const documentLoader = options.documentLoader ?? getDocumentLoader({ userAgent: options.userAgent });
|
79
|
-
if (typeof identifier === "string")
|
80
|
-
const match = handleRegexp.exec(identifier);
|
81
|
-
if (match) identifier = `acct:${match[1]}@${match[2]}`;
|
82
|
-
identifier = new URL(identifier);
|
83
|
-
}
|
135
|
+
if (typeof identifier === "string") identifier = toAcctUrl(identifier) ?? new URL(identifier);
|
84
136
|
let document = null;
|
85
137
|
if (identifier.protocol === "http:" || identifier.protocol === "https:") try {
|
86
138
|
const remoteDoc = await documentLoader(identifier.href);
|
@@ -3,7 +3,7 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
globalThis.addEventListener = () => {};
|
5
5
|
|
6
|
-
import { deno_default, getUserAgent } from "./docloader-
|
6
|
+
import { deno_default, getUserAgent } from "./docloader-Coh6BBtD.js";
|
7
7
|
import { UrlError, validatePublicUrl } from "./url-kTAI6_KP.js";
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
9
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
@@ -14,7 +14,7 @@ const logger = getLogger([
|
|
14
14
|
"webfinger",
|
15
15
|
"lookup"
|
16
16
|
]);
|
17
|
-
const
|
17
|
+
const DEFAULT_MAX_REDIRECTION = 5;
|
18
18
|
/**
|
19
19
|
* Looks up a WebFinger resource.
|
20
20
|
* @param resource The resource URL to look up.
|
@@ -92,7 +92,8 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
92
92
|
}
|
93
93
|
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
94
94
|
redirected++;
|
95
|
-
|
95
|
+
const maxRedirection = options.maxRedirection ?? DEFAULT_MAX_REDIRECTION;
|
96
|
+
if (redirected >= maxRedirection) {
|
96
97
|
logger.error("Too many redirections ({redirections}) while fetching WebFinger resource descriptor.", { redirections: redirected });
|
97
98
|
return null;
|
98
99
|
}
|