@fedify/fedify 2.0.0-pr.433.1601 → 2.0.0-pr.434.1659
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/actor-BODH8--e.cjs +37786 -0
- package/dist/{actor-BYk33gpL.js → actor-DJS2ne1f.js} +200 -200
- package/dist/actor-DMgu-ZjT.d.cts +128 -0
- package/dist/{actor-DhgsJz-4.js → actor-WgMDAZc5.js} +1 -1
- package/dist/{assert_rejects-7UF4R_Qs.js → assert_rejects-DiIiJbZn.js} +1 -1
- package/dist/{assert_throws-53_pKeP3.js → assert_throws-BOO88avQ.js} +1 -1
- package/dist/authdocloader-C8Eqv2Kg.cjs +58 -0
- package/dist/{authdocloader-Bnyhgo9N.js → authdocloader-FA-VNPvw.js} +3 -3
- package/dist/{authdocloader-Dcu0wNV2.js → authdocloader-SW1oQJ7q.js} +6 -6
- package/dist/{builder-QxLyGSq9.js → builder-Cp2PpvmH.js} +4 -4
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/client-CegPX0Rn.d.cts +222 -0
- package/dist/{client-apb-XuqD.js → client-D_BQdihX.js} +2 -7
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +13 -0
- package/dist/compat/mod.d.ts +2 -2
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +18 -17
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/{context-CDSZdQHD.d.ts → context-CQsAT7xk.d.ts} +0 -1
- package/dist/context-tVOQ76fi.d.cts +2254 -0
- package/dist/docloader-D-MrRyHl.d.cts +219 -0
- package/dist/{docloader-C5a95do5.js → docloader-DrPHprgh.js} +188 -8
- package/dist/docloader-dZO9fPIT.cjs +4861 -0
- package/dist/{esm-Bgz4xida.js → esm-CjcCcZ6s.js} +1 -1
- package/dist/federation/builder.test.js +10 -10
- package/dist/federation/collection.test.js +8 -8
- package/dist/federation/handler.test.js +26 -145
- package/dist/federation/inbox.test.js +6 -6
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +9 -8
- package/dist/federation/middleware.test.js +255 -38
- package/dist/federation/mod.cjs +29 -0
- package/dist/federation/mod.d.cts +13 -0
- package/dist/federation/mod.d.ts +1 -1
- package/dist/federation/mod.js +15 -15
- package/dist/federation/mq.test.js +10 -10
- package/dist/federation/negotiation.test.d.ts +3 -0
- package/dist/federation/negotiation.test.js +28 -0
- package/dist/federation/retry.test.js +5 -5
- package/dist/federation/router.test.js +8 -8
- package/dist/federation/send.test.js +15 -15
- package/dist/{federation-CMX7WzeL.js → federation-D1U8YY9t.js} +3 -3
- package/dist/federation-H2_En3j5.cjs +244 -0
- package/dist/{http-DNI66-5x.js → http-BPkuNd26.js} +2 -2
- package/dist/http-BS6766zs.d.cts +253 -0
- package/dist/{http-JY6wHpzI.js → http-BgQ07Ja_.js} +6 -6
- package/dist/http-CZJRJ0Pv.cjs +826 -0
- package/dist/{inbox-DQ8L0DJL.js → inbox-CCB1CbWJ.js} +1 -1
- package/dist/{key-5IrrMBg5.js → key-B_P3wH2F.js} +5 -5
- package/dist/{key-Be6l1ofa.js → key-BstbqwrH.js} +3 -3
- package/dist/{key-BPlyixfT.js → key-C0k2A_bI.js} +2 -2
- package/dist/key-C8TOf6mh.cjs +290 -0
- package/dist/key-CtA7xiw_.js +10 -0
- package/dist/key-hknDPZ-z.cjs +10 -0
- package/dist/{keycache-C4ahXsL4.js → keycache-DvDW8JPA.js} +1 -1
- package/dist/{keys-DJSYNKDA.js → keys-DzXrG_sX.js} +1 -1
- package/dist/kv-63Cil1MD.d.cts +81 -0
- package/dist/{ld-CWJxBIBV.js → ld-BcKcM_o9.js} +2 -2
- package/dist/{lookup-BnXYO054.js → lookup-C3BC8XO-.js} +4 -4
- package/dist/lookup-C3BGNQTz.cjs +137 -0
- package/dist/{lookup-C7LsgCJN.js → lookup-DbTBDJcT.js} +1 -1
- package/dist/{middleware-exe_8YIh.js → middleware-B3crRaK-.js} +50 -81
- package/dist/middleware-BWXHJSkY.cjs +17 -0
- package/dist/middleware-C4A4GTtX.cjs +4204 -0
- package/dist/middleware-CGlIdSyy.js +17 -0
- package/dist/middleware-CUWXMbGt.js +26 -0
- package/dist/{middleware-DfHez8_s.js → middleware-CXRqw8n4.js} +49 -144
- package/dist/{mod-RI3-KvUI.d.ts → mod-B26zRlH1.d.ts} +1 -1
- package/dist/mod-BClfg3ej.d.cts +266 -0
- package/dist/mod-C2tOeRkN.d.cts +1 -0
- package/dist/mod-DBQAI4v9.d.cts +80 -0
- package/dist/mod-Dc_-mf8s.d.cts +102 -0
- package/dist/mod-FZd39qVq.d.cts +1 -0
- package/dist/mod-evzlRVZq.d.cts +289 -0
- package/dist/mod-jQ4OODsl.d.cts +113 -0
- package/dist/mod.cjs +150 -0
- package/dist/mod.d.cts +17 -0
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +20 -20
- package/dist/mq-B7R1Q-M5.d.cts +140 -0
- package/dist/negotiation-5NPJL6zp.js +71 -0
- package/dist/nodeinfo/client.test.js +10 -10
- package/dist/nodeinfo/handler.test.js +23 -22
- package/dist/nodeinfo/mod.cjs +11 -0
- package/dist/nodeinfo/mod.d.cts +5 -0
- package/dist/nodeinfo/mod.js +6 -6
- package/dist/nodeinfo/types.test.js +8 -8
- package/dist/nodeinfo-Co9lJrWl.cjs +4 -0
- package/dist/nodeinfo-DfycQ8Wf.js +4 -0
- package/dist/owner-B-7Ptt_m.d.cts +67 -0
- package/dist/{owner-CM_3htrf.js → owner-BcEciLTD.js} +2 -2
- package/dist/{proof-WqatqDcH.js → proof-DAEfR6xA.js} +6 -6
- package/dist/proof-ZBmKo2zb.cjs +673 -0
- package/dist/{proof-B13S28BP.js → proof-vGquXXR6.js} +2 -2
- package/dist/runtime/authdocloader.test.js +14 -14
- package/dist/runtime/docloader.test.js +9 -9
- package/dist/runtime/key.test.js +10 -10
- package/dist/runtime/langstr.test.js +8 -8
- package/dist/runtime/link.test.d.ts +3 -0
- package/dist/runtime/link.test.js +61 -0
- package/dist/runtime/mod.cjs +25 -0
- package/dist/runtime/mod.d.cts +6 -0
- package/dist/runtime/mod.js +10 -10
- package/dist/runtime/multibase/multibase.test.js +8 -8
- package/dist/runtime/url.test.js +5 -5
- package/dist/runtime-C58AJWSv.cjs +4 -0
- package/dist/runtime-DPYEDf-o.js +4 -0
- package/dist/{send-BcaNFUhd.js → send-svmMjAUr.js} +2 -2
- package/dist/sig/http.test.js +13 -13
- package/dist/sig/key.test.js +11 -11
- package/dist/sig/ld.test.js +10 -10
- package/dist/sig/mod.cjs +30 -0
- package/dist/sig/mod.d.cts +8 -0
- package/dist/sig/mod.js +10 -10
- package/dist/sig/owner.test.js +12 -12
- package/dist/sig/proof.test.js +12 -12
- package/dist/sig-ByHXzqUi.cjs +4 -0
- package/dist/sig-Cj3tk-ig.js +4 -0
- package/dist/testing/docloader.test.js +8 -8
- package/dist/testing/mod.js +3 -3
- package/dist/{testing-CakwOL23.js → testing-y9ueu9Aj.js} +2 -2
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/{type-BKY_LVaq.js → type-9o78PXlX.js} +381 -201
- package/dist/{types-zVT9nODh.js → types-DTCqX5HE.js} +5 -10
- package/dist/types-K5btoOl6.cjs +315 -0
- package/dist/vocab/actor.test.js +10 -10
- package/dist/vocab/lookup.test.js +9 -9
- package/dist/vocab/mod.cjs +87 -0
- package/dist/vocab/mod.d.cts +6 -0
- package/dist/vocab/mod.js +7 -7
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +45 -10
- package/dist/vocab-CJ0jQMQV.cjs +282 -0
- package/dist/{vocab-ClXayeh5.js → vocab-C_Pm3NG3.js} +6 -6
- package/dist/vocab-DJTYMqyU.d.cts +14632 -0
- package/dist/webfinger/handler.test.js +23 -22
- package/dist/webfinger/lookup.test.js +9 -9
- package/dist/webfinger/mod.cjs +9 -0
- package/dist/webfinger/mod.d.cts +4 -0
- package/dist/webfinger/mod.js +6 -6
- package/dist/webfinger-BjOEdFPs.cjs +4 -0
- package/dist/webfinger-De_bU0iE.js +4 -0
- package/dist/x/cfworkers.cjs +100 -0
- package/dist/x/cfworkers.d.cts +59 -0
- package/dist/x/cfworkers.js +3 -3
- package/dist/x/cfworkers.test.js +8 -8
- package/dist/x/hono.cjs +61 -0
- package/dist/x/hono.d.cts +54 -0
- package/dist/x/hono.d.ts +1 -1
- package/dist/x/hono.js +3 -3
- package/dist/x/sveltekit.cjs +69 -0
- package/dist/x/sveltekit.d.cts +46 -0
- package/dist/x/sveltekit.d.ts +1 -1
- package/dist/x/sveltekit.js +3 -3
- package/package.json +68 -13
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/key-BLStGL0R.js +0 -10
- package/dist/middleware-D2diREI8.js +0 -17
- package/dist/middleware-D5PCuUVh.js +0 -25
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/webfinger-C3GIyXIg.js +0 -4
- /package/dist/{assert_is_error-B035L3om.js → assert_is_error-BPGph1Jx.js} +0 -0
- /package/dist/{assert_not_equals-C80BG-_5.js → assert_not_equals-f3m3epl3.js} +0 -0
- /package/dist/{denokv-jZ0Z2h0M.js → denokv-Bv33Xxea.js} +0 -0
- /package/dist/{retry-CfF8Gn4d.js → retry-D4GJ670a.js} +0 -0
- /package/dist/{std__assert-DWivtrGR.js → std__assert-X-_kMxKM.js} +0 -0
@@ -1,17 +1,17 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
import { getDefaultActivityTransformers } from "./transformers-
|
6
|
-
import { deno_default, getDocumentLoader, kvCache } from "./docloader-
|
7
|
-
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-
|
8
|
-
import { lookupWebFinger } from "./lookup-
|
9
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
10
|
-
import { doubleKnock, verifyRequest } from "./http-
|
11
|
-
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-
|
12
|
-
import { getNodeInfo, nodeInfoToJson } from "./types-
|
13
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
14
|
-
import { lookupObject, traverseCollection } from "./vocab-
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import { getDefaultActivityTransformers } from "./transformers-BFT6d7J5.js";
|
6
|
+
import { deno_default, getDocumentLoader, kvCache } from "./docloader-DrPHprgh.js";
|
7
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-DJS2ne1f.js";
|
8
|
+
import { lookupWebFinger } from "./lookup-C3BC8XO-.js";
|
9
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-B_P3wH2F.js";
|
10
|
+
import { doubleKnock, verifyRequest } from "./http-BgQ07Ja_.js";
|
11
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-DAEfR6xA.js";
|
12
|
+
import { getNodeInfo, nodeInfoToJson } from "./types-DTCqX5HE.js";
|
13
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-SW1oQJ7q.js";
|
14
|
+
import { lookupObject, traverseCollection } from "./vocab-C_Pm3NG3.js";
|
15
15
|
import { getLogger, withContext } from "@logtape/logtape";
|
16
16
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
17
17
|
import { encodeHex } from "byte-encodings/hex";
|
@@ -321,7 +321,7 @@ var FederationBuilderImpl = class {
|
|
321
321
|
this.collectionTypeIds = {};
|
322
322
|
}
|
323
323
|
async build(options) {
|
324
|
-
const { FederationImpl: FederationImpl$1 } = await import("./middleware-
|
324
|
+
const { FederationImpl: FederationImpl$1 } = await import("./middleware-CGlIdSyy.js");
|
325
325
|
const f = new FederationImpl$1(options);
|
326
326
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
327
327
|
f.router = this.router.clone();
|
@@ -979,9 +979,6 @@ function preferredMediaTypes(accept) {
|
|
979
979
|
const accepts = parseAccept(accept === void 0 ? "*/*" : accept ?? "");
|
980
980
|
return accepts.filter(isQuality).sort(compareSpecs).map(getFullType);
|
981
981
|
}
|
982
|
-
|
983
|
-
//#endregion
|
984
|
-
//#region src/federation/handler.ts
|
985
982
|
function acceptsJsonLd(request) {
|
986
983
|
const accept = request.headers.get("Accept");
|
987
984
|
const types = accept ? preferredMediaTypes(accept) : ["*/*"];
|
@@ -989,6 +986,9 @@ function acceptsJsonLd(request) {
|
|
989
986
|
if (types[0] === "text/html" || types[0] === "application/xhtml+xml") return false;
|
990
987
|
return types.includes("application/activity+json") || types.includes("application/ld+json") || types.includes("application/json");
|
991
988
|
}
|
989
|
+
|
990
|
+
//#endregion
|
991
|
+
//#region src/federation/handler.ts
|
992
992
|
/**
|
993
993
|
* Handles an actor request.
|
994
994
|
* @template TContextData The context data to pass to the context.
|
@@ -996,7 +996,7 @@ function acceptsJsonLd(request) {
|
|
996
996
|
* @param parameters The parameters for handling the actor.
|
997
997
|
* @returns A promise that resolves to an HTTP response.
|
998
998
|
*/
|
999
|
-
async function handleActor(request, { identifier, context: context$1, actorDispatcher, authorizePredicate, onNotFound,
|
999
|
+
async function handleActor(request, { identifier, context: context$1, actorDispatcher, authorizePredicate, onNotFound, onUnauthorized }) {
|
1000
1000
|
const logger$1 = getLogger([
|
1001
1001
|
"fedify",
|
1002
1002
|
"federation",
|
@@ -1011,7 +1011,6 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
|
|
1011
1011
|
logger$1.debug("Actor {identifier} not found.", { identifier });
|
1012
1012
|
return await onNotFound(request);
|
1013
1013
|
}
|
1014
|
-
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
|
1015
1014
|
if (authorizePredicate != null) {
|
1016
1015
|
let key = await context$1.getSignedKey();
|
1017
1016
|
key = key?.clone({}, { $warning: {
|
@@ -1046,11 +1045,10 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
|
|
1046
1045
|
* @param parameters The parameters for handling the object.
|
1047
1046
|
* @returns A promise that resolves to an HTTP response.
|
1048
1047
|
*/
|
1049
|
-
async function handleObject(request, { values, context: context$1, objectDispatcher, authorizePredicate, onNotFound,
|
1048
|
+
async function handleObject(request, { values, context: context$1, objectDispatcher, authorizePredicate, onNotFound, onUnauthorized }) {
|
1050
1049
|
if (objectDispatcher == null) return await onNotFound(request);
|
1051
1050
|
const object = await objectDispatcher(context$1, values);
|
1052
1051
|
if (object == null) return await onNotFound(request);
|
1053
|
-
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
|
1054
1052
|
if (authorizePredicate != null) {
|
1055
1053
|
let key = await context$1.getSignedKey();
|
1056
1054
|
key = key?.clone({}, { $warning: {
|
@@ -1088,7 +1086,7 @@ async function handleObject(request, { values, context: context$1, objectDispatc
|
|
1088
1086
|
* @param parameters The parameters for handling the collection.
|
1089
1087
|
* @returns A promise that resolves to an HTTP response.
|
1090
1088
|
*/
|
1091
|
-
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$1, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound
|
1089
|
+
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$1, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound }) {
|
1092
1090
|
const spanName = name.trim().replace(/\s+/g, "_");
|
1093
1091
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
1094
1092
|
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
@@ -1201,7 +1199,6 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
1201
1199
|
partOf
|
1202
1200
|
});
|
1203
1201
|
}
|
1204
|
-
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
|
1205
1202
|
if (collectionCallbacks.authorizePredicate != null) {
|
1206
1203
|
let key = await context$1.getSignedKey();
|
1207
1204
|
key = key?.clone({}, { $warning: {
|
@@ -1539,7 +1536,6 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
1539
1536
|
const handleCustomCollection = exceptWrapper(_handleCustomCollection);
|
1540
1537
|
async function _handleCustomCollection(request, { name, values, context: context$1, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
|
1541
1538
|
verifyDefined(callbacks);
|
1542
|
-
verifyJsonLdRequest(request);
|
1543
1539
|
await authIfNeeded(context$1, values, callbacks);
|
1544
1540
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
1545
1541
|
return await new CustomCollectionHandler(name, values, context$1, callbacks, tracerProvider, Collection, CollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
@@ -1558,7 +1554,6 @@ async function _handleCustomCollection(request, { name, values, context: context
|
|
1558
1554
|
const handleOrderedCollection = exceptWrapper(_handleOrderedCollection);
|
1559
1555
|
async function _handleOrderedCollection(request, { name, values, context: context$1, tracerProvider, collectionCallbacks: callbacks, filterPredicate }) {
|
1560
1556
|
verifyDefined(callbacks);
|
1561
|
-
verifyJsonLdRequest(request);
|
1562
1557
|
await authIfNeeded(context$1, values, callbacks);
|
1563
1558
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
1564
1559
|
return await new CustomCollectionHandler(name, values, context$1, callbacks, tracerProvider, OrderedCollection, OrderedCollectionPage, filterPredicate).fetchCollection(cursor).toJsonLd().then(respondAsActivity);
|
@@ -1836,10 +1831,9 @@ function exceptWrapper(handler) {
|
|
1836
1831
|
try {
|
1837
1832
|
return await handler(request, handlerParams);
|
1838
1833
|
} catch (error) {
|
1839
|
-
const { onNotFound,
|
1834
|
+
const { onNotFound, onUnauthorized } = handlerParams;
|
1840
1835
|
switch (error?.constructor) {
|
1841
1836
|
case ItemsNotFoundError: return await onNotFound(request);
|
1842
|
-
case NotAcceptableError: return await onNotAcceptable(request);
|
1843
1837
|
case UnauthorizedError: return await onUnauthorized(request);
|
1844
1838
|
default: throw error;
|
1845
1839
|
}
|
@@ -1857,15 +1851,6 @@ const verifyDefined = (callbacks) => {
|
|
1857
1851
|
if (callbacks === void 0) throw new ItemsNotFoundError();
|
1858
1852
|
};
|
1859
1853
|
/**
|
1860
|
-
* Verifies that a request accepts JSON-LD content type.
|
1861
|
-
* @param request The HTTP request to verify.
|
1862
|
-
* @throws {NotAcceptableError} If the request doesn't accept JSON-LD.
|
1863
|
-
* @since 1.8.0
|
1864
|
-
*/
|
1865
|
-
const verifyJsonLdRequest = (request) => {
|
1866
|
-
if (!acceptsJsonLd(request)) throw new NotAcceptableError();
|
1867
|
-
};
|
1868
|
-
/**
|
1869
1854
|
* Performs authorization if needed based on the authorization predicate.
|
1870
1855
|
* @template TContextData The context data type.
|
1871
1856
|
* @param {RequestContext<TContextData>} context The request context.
|
@@ -1949,15 +1934,6 @@ var ItemsNotFoundError = class extends HandlerError {
|
|
1949
1934
|
}
|
1950
1935
|
};
|
1951
1936
|
/**
|
1952
|
-
* Error thrown when the request is not acceptable (e.g., wrong content type).
|
1953
|
-
* @since 1.8.0
|
1954
|
-
*/
|
1955
|
-
var NotAcceptableError = class extends HandlerError {
|
1956
|
-
constructor() {
|
1957
|
-
super("The request is not acceptable.");
|
1958
|
-
}
|
1959
|
-
};
|
1960
|
-
/**
|
1961
1937
|
* Error thrown when access to a collection is unauthorized.
|
1962
1938
|
* @since 1.8.0
|
1963
1939
|
*/
|
@@ -2955,6 +2931,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2955
2931
|
span,
|
2956
2932
|
tracer
|
2957
2933
|
});
|
2934
|
+
if (acceptsJsonLd(request)) response.headers.set("Vary", "Accept");
|
2958
2935
|
} catch (error) {
|
2959
2936
|
span.setStatus({
|
2960
2937
|
code: SpanStatusCode.ERROR,
|
@@ -3018,6 +2995,9 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3018
2995
|
context: context$1,
|
3019
2996
|
nodeInfoDispatcher: this.nodeInfoDispatcher
|
3020
2997
|
});
|
2998
|
+
}
|
2999
|
+
if (!acceptsJsonLd(request)) return await onNotAcceptable(request);
|
3000
|
+
switch (routeName) {
|
3021
3001
|
case "actor":
|
3022
3002
|
context$1 = this.#createContext(request, contextData, { invokedFromActorDispatcher: { identifier: route.values.identifier ?? route.values.handle } });
|
3023
3003
|
return await handleActor(request, {
|
@@ -3026,8 +3006,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3026
3006
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
3027
3007
|
authorizePredicate: this.actorCallbacks?.authorizePredicate,
|
3028
3008
|
onUnauthorized,
|
3029
|
-
onNotFound
|
3030
|
-
onNotAcceptable
|
3009
|
+
onNotFound
|
3031
3010
|
});
|
3032
3011
|
case "object": {
|
3033
3012
|
const typeId = route.name.replace(/^object:/, "");
|
@@ -3043,8 +3022,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3043
3022
|
objectDispatcher: callbacks?.dispatcher,
|
3044
3023
|
authorizePredicate: callbacks?.authorizePredicate,
|
3045
3024
|
onUnauthorized,
|
3046
|
-
onNotFound
|
3047
|
-
onNotAcceptable
|
3025
|
+
onNotFound
|
3048
3026
|
});
|
3049
3027
|
}
|
3050
3028
|
case "outbox": return await handleCollection(request, {
|
@@ -3055,8 +3033,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3055
3033
|
collectionCallbacks: this.outboxCallbacks,
|
3056
3034
|
tracerProvider: this.tracerProvider,
|
3057
3035
|
onUnauthorized,
|
3058
|
-
onNotFound
|
3059
|
-
onNotAcceptable
|
3036
|
+
onNotFound
|
3060
3037
|
});
|
3061
3038
|
case "inbox":
|
3062
3039
|
if (request.method !== "POST") return await handleCollection(request, {
|
@@ -3067,8 +3044,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3067
3044
|
collectionCallbacks: this.inboxCallbacks,
|
3068
3045
|
tracerProvider: this.tracerProvider,
|
3069
3046
|
onUnauthorized,
|
3070
|
-
onNotFound
|
3071
|
-
onNotAcceptable
|
3047
|
+
onNotFound
|
3072
3048
|
});
|
3073
3049
|
context$1 = this.#createContext(request, contextData, { documentLoader: await context$1.getDocumentLoader({ identifier: route.values.identifier ?? route.values.handle }) });
|
3074
3050
|
case "sharedInbox":
|
@@ -3100,8 +3076,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3100
3076
|
collectionCallbacks: this.followingCallbacks,
|
3101
3077
|
tracerProvider: this.tracerProvider,
|
3102
3078
|
onUnauthorized,
|
3103
|
-
onNotFound
|
3104
|
-
onNotAcceptable
|
3079
|
+
onNotFound
|
3105
3080
|
});
|
3106
3081
|
case "followers": {
|
3107
3082
|
let baseUrl = url.searchParams.get("base-url");
|
@@ -3124,8 +3099,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3124
3099
|
collectionCallbacks: this.followersCallbacks,
|
3125
3100
|
tracerProvider: this.tracerProvider,
|
3126
3101
|
onUnauthorized,
|
3127
|
-
onNotFound
|
3128
|
-
onNotAcceptable
|
3102
|
+
onNotFound
|
3129
3103
|
});
|
3130
3104
|
}
|
3131
3105
|
case "liked": return await handleCollection(request, {
|
@@ -3136,8 +3110,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3136
3110
|
collectionCallbacks: this.likedCallbacks,
|
3137
3111
|
tracerProvider: this.tracerProvider,
|
3138
3112
|
onUnauthorized,
|
3139
|
-
onNotFound
|
3140
|
-
onNotAcceptable
|
3113
|
+
onNotFound
|
3141
3114
|
});
|
3142
3115
|
case "featured": return await handleCollection(request, {
|
3143
3116
|
name: "featured",
|
@@ -3147,8 +3120,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3147
3120
|
collectionCallbacks: this.featuredCallbacks,
|
3148
3121
|
tracerProvider: this.tracerProvider,
|
3149
3122
|
onUnauthorized,
|
3150
|
-
onNotFound
|
3151
|
-
onNotAcceptable
|
3123
|
+
onNotFound
|
3152
3124
|
});
|
3153
3125
|
case "featuredTags": return await handleCollection(request, {
|
3154
3126
|
name: "featured tags",
|
@@ -3158,8 +3130,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3158
3130
|
collectionCallbacks: this.featuredTagsCallbacks,
|
3159
3131
|
tracerProvider: this.tracerProvider,
|
3160
3132
|
onUnauthorized,
|
3161
|
-
onNotFound
|
3162
|
-
onNotAcceptable
|
3133
|
+
onNotFound
|
3163
3134
|
});
|
3164
3135
|
case "collection": {
|
3165
3136
|
const name = route.name.replace(/^collection:/, "");
|
@@ -3171,8 +3142,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3171
3142
|
collectionCallbacks: callbacks,
|
3172
3143
|
tracerProvider: this.tracerProvider,
|
3173
3144
|
onUnauthorized,
|
3174
|
-
onNotFound
|
3175
|
-
onNotAcceptable
|
3145
|
+
onNotFound
|
3176
3146
|
});
|
3177
3147
|
}
|
3178
3148
|
case "orderedCollection": {
|
@@ -3185,8 +3155,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
3185
3155
|
collectionCallbacks: callbacks,
|
3186
3156
|
tracerProvider: this.tracerProvider,
|
3187
3157
|
onUnauthorized,
|
3188
|
-
onNotFound
|
3189
|
-
onNotAcceptable
|
3158
|
+
onNotFound
|
3190
3159
|
});
|
3191
3160
|
}
|
3192
3161
|
default: {
|
@@ -3481,15 +3450,16 @@ var ContextImpl = class ContextImpl {
|
|
3481
3450
|
"actor"
|
3482
3451
|
]);
|
3483
3452
|
if (this.federation.actorCallbacks?.keyPairsDispatcher == null) throw new Error("No actor key pairs dispatcher registered.");
|
3484
|
-
|
3485
|
-
|
3486
|
-
|
3487
|
-
})
|
3488
|
-
|
3489
|
-
|
3490
|
-
|
3453
|
+
let actorUri;
|
3454
|
+
try {
|
3455
|
+
actorUri = this.getActorUri(identifier);
|
3456
|
+
} catch (error) {
|
3457
|
+
if (error instanceof RouterError) {
|
3458
|
+
logger$1.warn(error.message);
|
3459
|
+
return [];
|
3460
|
+
}
|
3461
|
+
throw error;
|
3491
3462
|
}
|
3492
|
-
const actorUri = new URL(path, this.canonicalOrigin);
|
3493
3463
|
const keyPairs = await this.federation.actorCallbacks?.keyPairsDispatcher(new ContextImpl({
|
3494
3464
|
...this,
|
3495
3465
|
invokedFromActorKeyPairsDispatcher: { identifier }
|
@@ -3650,12 +3620,11 @@ var ContextImpl = class ContextImpl {
|
|
3650
3620
|
if (identifier == null) throw new Error("If recipients is \"followers\", sender must be an actor identifier or username.");
|
3651
3621
|
expandedRecipients = [];
|
3652
3622
|
for await (const recipient of this.getFollowers(identifier)) expandedRecipients.push(recipient);
|
3653
|
-
if (options.syncCollection) {
|
3654
|
-
|
3655
|
-
|
3656
|
-
|
3657
|
-
|
3658
|
-
opts.collectionSync = collectionId == null ? void 0 : new URL(collectionId, this.canonicalOrigin).href;
|
3623
|
+
if (options.syncCollection) try {
|
3624
|
+
opts.collectionSync = this.getFollowersUri(identifier).href;
|
3625
|
+
} catch (error) {
|
3626
|
+
if (error instanceof RouterError) opts.collectionSync = void 0;
|
3627
|
+
else throw error;
|
3659
3628
|
}
|
3660
3629
|
} else expandedRecipients = [recipients];
|
3661
3630
|
span.setAttribute("activitypub.inboxes", expandedRecipients.length);
|
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
require('./transformers-CoBS-oFG.cjs');
|
6
|
+
require('./docloader-dZO9fPIT.cjs');
|
7
|
+
require('./actor-BODH8--e.cjs');
|
8
|
+
const require_middleware = require('./middleware-C4A4GTtX.cjs');
|
9
|
+
require('./lookup-C3BGNQTz.cjs');
|
10
|
+
require('./key-C8TOf6mh.cjs');
|
11
|
+
require('./http-CZJRJ0Pv.cjs');
|
12
|
+
require('./proof-ZBmKo2zb.cjs');
|
13
|
+
require('./types-K5btoOl6.cjs');
|
14
|
+
require('./authdocloader-C8Eqv2Kg.cjs');
|
15
|
+
require('./vocab-CJ0jQMQV.cjs');
|
16
|
+
|
17
|
+
exports.FederationImpl = require_middleware.FederationImpl;
|