@fedify/fedify 2.2.17 → 2.2.18
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/{assert_rejects-B-qJtC9Z.mjs → assert_rejects-WyYSTDDX.mjs} +2 -20
- package/dist/{assert_throws-4NwKEy2q.mjs → assert_throws-D4DNWrux.mjs} +19 -1
- package/dist/{builder-a-kl29PE.mjs → builder-DAbQyxmb.mjs} +2 -2
- package/dist/compat/public-audience.test.mjs +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{deno-Cya0rbEr.mjs → deno-JUTr6LYC.mjs} +1 -1
- package/dist/{docloader-Dz0Z1Y07.mjs → docloader-BGjq1F5U.mjs} +4 -2
- package/dist/federation/builder.test.mjs +3 -3
- package/dist/federation/collection.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +261 -8
- package/dist/federation/idempotency.test.mjs +3 -3
- package/dist/federation/inbox.test.mjs +25 -1
- package/dist/federation/kv.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +128 -10
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/mq.test.mjs +2 -2
- package/dist/federation/negotiation.test.mjs +3 -3
- package/dist/federation/retry.test.mjs +2 -2
- package/dist/federation/router.test.mjs +2 -3
- package/dist/federation/send.test.mjs +7 -6
- package/dist/federation/temporal.test.mjs +3 -3
- package/dist/federation/webfinger.test.mjs +2 -2
- package/dist/{http-C_aA2Zx1.cjs → http-DEH_eppX.cjs} +1 -1
- package/dist/{http-DkzPSl5o.js → http-OSYYhKM8.js} +1 -1
- package/dist/{http-dobCLGG2.mjs → http-lCmKCZBI.mjs} +2 -2
- package/dist/inbox-DMATfdEI.mjs +162 -0
- package/dist/{key-BMHNd0gP.mjs → key-D0ahOVjf.mjs} +1 -1
- package/dist/{kv-cache-DVhfMtqE.js → kv-cache-B7X4p1y7.js} +3 -1
- package/dist/{kv-cache-Btp4kC_U.cjs → kv-cache-CPEV_4nZ.cjs} +3 -1
- package/dist/{ld-B_m0qw8j.mjs → ld-CJOXIehz.mjs} +2 -2
- package/dist/{middleware-BYxKsDHj.mjs → middleware-BgGJEcdp.mjs} +1 -1
- package/dist/{middleware-5qLdPLro.mjs → middleware-CHoUjmJm.mjs} +84 -167
- package/dist/{middleware-ZKHfZ7zj.cjs → middleware-D3hx1aiI.cjs} +1 -1
- package/dist/{middleware-C7mI18WE.cjs → middleware-QcuVRA-q.cjs} +96 -26
- package/dist/{middleware-BchkzbpG.js → middleware-aNUajYPY.js} +95 -25
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/client.test.mjs +1 -1
- package/dist/nodeinfo/handler.test.mjs +2 -2
- package/dist/nodeinfo/types.test.mjs +2 -2
- package/dist/otel/exporter.test.mjs +1 -1
- package/dist/{owner-Dk85kXZz.mjs → owner-BUTMEkbn.mjs} +2 -2
- package/dist/{proof-ClpE9zhD.cjs → proof-BeY7TsiS.cjs} +1 -1
- package/dist/{proof-Bz6IdT2p.js → proof-Bm3xyn3D.js} +1 -1
- package/dist/{proof-DrGrnZVE.mjs → proof-DS1Zl6BX.mjs} +2 -2
- package/dist/{send-Co-E7yJn.mjs → send-fnPrh9Zm.mjs} +2 -2
- package/dist/sig/http.test.mjs +5 -5
- package/dist/sig/key.test.mjs +5 -5
- package/dist/sig/ld.test.mjs +4 -4
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +3 -3
- package/dist/sig/proof.test.mjs +4 -3
- package/dist/{std__assert-BVFj8-_V.mjs → std__assert-DNZ4Liil.mjs} +2 -2
- package/dist/{temporal-Bnwa_2NC.mjs → temporal-Biz6zK6e.mjs} +1 -1
- package/dist/utils/docloader.test.mjs +114 -39
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +5 -5
- /package/dist/{assert_not_equals--wG9hV7u.mjs → assert_not_equals-BkxW5QJI.mjs} +0 -0
- /package/dist/{negotiation-BHtZN6Y1.mjs → negotiation-SQvQgUqe.mjs} +0 -0
- /package/dist/{retry-bMXBL97A.mjs → retry-v_sGLH1d.mjs} +0 -0
package/dist/federation/mod.cjs
CHANGED
|
@@ -2,7 +2,7 @@ const { Temporal } = require("@js-temporal/polyfill");
|
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
require("../chunk-DDcVe30Y.cjs");
|
|
5
|
-
const require_middleware = require("../middleware-
|
|
5
|
+
const require_middleware = require("../middleware-QcuVRA-q.cjs");
|
|
6
6
|
let es_toolkit = require("es-toolkit");
|
|
7
7
|
//#region src/federation/kv.ts
|
|
8
8
|
/**
|
package/dist/federation/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-
|
|
3
|
+
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-aNUajYPY.js";
|
|
4
4
|
import { isEqual } from "es-toolkit";
|
|
5
5
|
//#region src/federation/kv.ts
|
|
6
6
|
/**
|
|
@@ -2,8 +2,8 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
-
import { n as assertGreaterOrEqual } from "../std__assert-
|
|
6
|
-
import {
|
|
5
|
+
import { n as assertGreaterOrEqual } from "../std__assert-DNZ4Liil.mjs";
|
|
6
|
+
import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
|
|
7
7
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
import { delay } from "es-toolkit";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import "../std__assert-
|
|
5
|
-
import {
|
|
4
|
+
import "../std__assert-DNZ4Liil.mjs";
|
|
5
|
+
import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
|
|
6
6
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
7
|
-
import { t as acceptsJsonLd } from "../negotiation-
|
|
7
|
+
import { t as acceptsJsonLd } from "../negotiation-SQvQgUqe.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/federation/negotiation.test.ts
|
|
10
10
|
test("acceptsJsonLd()", () => {
|
|
@@ -2,8 +2,8 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { l as AssertionError, t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
-
import { t as assertNotEquals } from "../assert_not_equals
|
|
6
|
-
import { t as createExponentialBackoffPolicy } from "../retry-
|
|
5
|
+
import { t as assertNotEquals } from "../assert_not_equals-BkxW5QJI.mjs";
|
|
6
|
+
import { t as createExponentialBackoffPolicy } from "../retry-v_sGLH1d.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
//#region src/federation/retry.test.ts
|
|
9
9
|
test("createExponentialBackoffPolicy()", () => {
|
|
@@ -3,10 +3,9 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as RouterError, t as Router } from "../router-CrMLXoOr.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
|
-
import "../std__assert-
|
|
7
|
-
import {
|
|
6
|
+
import "../std__assert-DNZ4Liil.mjs";
|
|
7
|
+
import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
|
|
8
8
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
9
|
-
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
10
9
|
import { test } from "@fedify/fixture";
|
|
11
10
|
//#region src/federation/router.test.ts
|
|
12
11
|
function setUp(options = {}) {
|
|
@@ -3,14 +3,15 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as esm_default } from "../esm-DVILvP5e.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
|
-
import "../std__assert-
|
|
7
|
-
import {
|
|
6
|
+
import "../std__assert-DNZ4Liil.mjs";
|
|
7
|
+
import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
|
|
8
8
|
import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
|
|
9
|
-
import { t as assertNotEquals } from "../assert_not_equals
|
|
10
|
-
import {
|
|
9
|
+
import { t as assertNotEquals } from "../assert_not_equals-BkxW5QJI.mjs";
|
|
10
|
+
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
11
|
+
import { l as verifyRequest } from "../http-lCmKCZBI.mjs";
|
|
11
12
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
12
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
13
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-
|
|
13
|
+
import { t as doesActorOwnKey } from "../owner-BUTMEkbn.mjs";
|
|
14
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-fnPrh9Zm.mjs";
|
|
14
15
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
15
16
|
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
16
17
|
import { FetchError, UrlError } from "@fedify/vocab-runtime";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import "../std__assert-
|
|
5
|
-
import {
|
|
4
|
+
import "../std__assert-DNZ4Liil.mjs";
|
|
5
|
+
import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
|
|
6
6
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
7
|
-
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-
|
|
7
|
+
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-Biz6zK6e.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/federation/temporal.test.ts
|
|
10
10
|
test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
|
|
@@ -3,9 +3,9 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { r as createRequestContext } from "../context-Dk_tacqz.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
|
-
import "../std__assert-
|
|
6
|
+
import "../std__assert-DNZ4Liil.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
|
|
8
|
-
import { o as createFederation, s as handleWebFinger } from "../middleware-
|
|
8
|
+
import { o as createFederation, s as handleWebFinger } from "../middleware-CHoUjmJm.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
import { Image, Link, Person, Tombstone } from "@fedify/vocab";
|
|
11
11
|
//#region src/federation/webfinger.test.ts
|
|
@@ -11,7 +11,7 @@ let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conve
|
|
|
11
11
|
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
12
12
|
//#region deno.json
|
|
13
13
|
var name = "@fedify/fedify";
|
|
14
|
-
var version = "2.2.
|
|
14
|
+
var version = "2.2.18";
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/sig/accept.ts
|
|
17
17
|
/**
|
|
@@ -10,7 +10,7 @@ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } fro
|
|
|
10
10
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
11
11
|
//#region deno.json
|
|
12
12
|
var name = "@fedify/fedify";
|
|
13
|
-
var version = "2.2.
|
|
13
|
+
var version = "2.2.18";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/sig/accept.ts
|
|
16
16
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Temporal } from "@js-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-JUTr6LYC.mjs";
|
|
5
5
|
import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-Dd__NiUL.mjs";
|
|
6
|
-
import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-
|
|
6
|
+
import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-D0ahOVjf.mjs";
|
|
7
7
|
import { CryptographicKey } from "@fedify/vocab";
|
|
8
8
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { n as version, t as name } from "./deno-JUTr6LYC.mjs";
|
|
5
|
+
import { getTypeId } from "@fedify/vocab";
|
|
6
|
+
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
7
|
+
import { getLogger } from "@logtape/logtape";
|
|
8
|
+
//#region src/federation/inbox.ts
|
|
9
|
+
/**
|
|
10
|
+
* Checks whether an activity's ID and all of its actor IDs have the same
|
|
11
|
+
* non-opaque origin. Activities without an ID have no origin to authenticate.
|
|
12
|
+
*
|
|
13
|
+
* The caller is responsible for rejecting a missing primary actor ID before
|
|
14
|
+
* relying on this check.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
function actorsHaveSameOrigin(activity) {
|
|
18
|
+
if (activity.id == null) return true;
|
|
19
|
+
const origin = activity.id.origin;
|
|
20
|
+
return origin !== "null" && activity.actorIds.every((actor) => actor.origin === origin);
|
|
21
|
+
}
|
|
22
|
+
async function routeActivity({ context: ctx, json, originalJson, normalizedActivity, ldSignatureVerified, activity, recipient, inboxListeners, inboxContextFactory, listenerInboxContextFactory, inboxErrorHandler, kv, kvPrefixes, queue, span, tracerProvider, idempotencyStrategy }) {
|
|
23
|
+
const logger = getLogger([
|
|
24
|
+
"fedify",
|
|
25
|
+
"federation",
|
|
26
|
+
"inbox"
|
|
27
|
+
]);
|
|
28
|
+
if (activity.actorId == null) {
|
|
29
|
+
logger.error("Missing actor.", { activity: json });
|
|
30
|
+
span.setStatus({
|
|
31
|
+
code: SpanStatusCode.ERROR,
|
|
32
|
+
message: "Missing actor."
|
|
33
|
+
});
|
|
34
|
+
return "missingActor";
|
|
35
|
+
}
|
|
36
|
+
let cacheKey = null;
|
|
37
|
+
if (activity.id != null) {
|
|
38
|
+
const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, getTypeId(activity).href);
|
|
39
|
+
const strategy = idempotencyStrategy ?? "per-inbox";
|
|
40
|
+
let keyString;
|
|
41
|
+
if (typeof strategy === "function") keyString = await strategy(inboxContext, activity);
|
|
42
|
+
else switch (strategy) {
|
|
43
|
+
case "global":
|
|
44
|
+
keyString = activity.id.href;
|
|
45
|
+
break;
|
|
46
|
+
case "per-origin":
|
|
47
|
+
keyString = `${ctx.origin}\n${activity.id.href}`;
|
|
48
|
+
break;
|
|
49
|
+
case "per-inbox":
|
|
50
|
+
keyString = `${ctx.origin}\n${activity.id.href}\n${recipient == null ? "sharedInbox" : `inbox\n${recipient}`}`;
|
|
51
|
+
break;
|
|
52
|
+
default: keyString = `${ctx.origin}\n${activity.id.href}`;
|
|
53
|
+
}
|
|
54
|
+
if (keyString != null) cacheKey = [...kvPrefixes.activityIdempotence, keyString];
|
|
55
|
+
}
|
|
56
|
+
if (cacheKey != null) {
|
|
57
|
+
if (await kv.get(cacheKey) === true) {
|
|
58
|
+
logger.debug("Activity {activityId} has already been processed.", {
|
|
59
|
+
activityId: activity.id?.href,
|
|
60
|
+
activity: json,
|
|
61
|
+
recipient
|
|
62
|
+
});
|
|
63
|
+
span.setStatus({
|
|
64
|
+
code: SpanStatusCode.UNSET,
|
|
65
|
+
message: `Activity ${activity.id?.href} has already been processed.`
|
|
66
|
+
});
|
|
67
|
+
return "alreadyProcessed";
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
span.setAttribute("activitypub.actor.id", activity.actorId.href);
|
|
71
|
+
if (queue != null) {
|
|
72
|
+
const carrier = {};
|
|
73
|
+
propagation.inject(context.active(), carrier);
|
|
74
|
+
try {
|
|
75
|
+
await queue.enqueue({
|
|
76
|
+
type: "inbox",
|
|
77
|
+
id: crypto.randomUUID(),
|
|
78
|
+
baseUrl: ctx.origin,
|
|
79
|
+
activity: originalJson ?? json,
|
|
80
|
+
...normalizedActivity == null ? {} : { normalizedActivity },
|
|
81
|
+
...ldSignatureVerified == null ? {} : { ldSignatureVerified },
|
|
82
|
+
identifier: recipient,
|
|
83
|
+
attempt: 0,
|
|
84
|
+
started: (/* @__PURE__ */ new Date()).toISOString(),
|
|
85
|
+
traceContext: carrier
|
|
86
|
+
});
|
|
87
|
+
} catch (error) {
|
|
88
|
+
logger.error("Failed to enqueue the incoming activity {activityId}:\n{error}", {
|
|
89
|
+
error,
|
|
90
|
+
activityId: activity.id?.href,
|
|
91
|
+
activity: json,
|
|
92
|
+
recipient
|
|
93
|
+
});
|
|
94
|
+
span.setStatus({
|
|
95
|
+
code: SpanStatusCode.ERROR,
|
|
96
|
+
message: `Failed to enqueue the incoming activity ${activity.id?.href}.`
|
|
97
|
+
});
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
logger.info("Activity {activityId} is enqueued.", {
|
|
101
|
+
activityId: activity.id?.href,
|
|
102
|
+
activity: json,
|
|
103
|
+
recipient
|
|
104
|
+
});
|
|
105
|
+
return "enqueued";
|
|
106
|
+
}
|
|
107
|
+
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
108
|
+
return await tracerProvider.getTracer(name, version).startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span) => {
|
|
109
|
+
const dispatched = inboxListeners?.dispatchWithClass(activity);
|
|
110
|
+
if (dispatched == null) {
|
|
111
|
+
logger.error("Unsupported activity type:\n{activity}", {
|
|
112
|
+
activity: json,
|
|
113
|
+
recipient
|
|
114
|
+
});
|
|
115
|
+
span.setStatus({
|
|
116
|
+
code: SpanStatusCode.UNSET,
|
|
117
|
+
message: `Unsupported activity type: ${getTypeId(activity).href}`
|
|
118
|
+
});
|
|
119
|
+
span.end();
|
|
120
|
+
return "unsupportedActivity";
|
|
121
|
+
}
|
|
122
|
+
const { class: cls, listener } = dispatched;
|
|
123
|
+
span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
124
|
+
try {
|
|
125
|
+
const contextFactory = listenerInboxContextFactory ?? inboxContextFactory;
|
|
126
|
+
await listener(contextFactory(recipient, contextFactory === inboxContextFactory ? json : originalJson ?? json, activity?.id?.href, getTypeId(activity).href), activity);
|
|
127
|
+
} catch (error) {
|
|
128
|
+
try {
|
|
129
|
+
await inboxErrorHandler?.(ctx, error);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
|
|
132
|
+
error,
|
|
133
|
+
activityId: activity.id?.href,
|
|
134
|
+
activity: json,
|
|
135
|
+
recipient
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
logger.error("Failed to process the incoming activity {activityId}:\n{error}", {
|
|
139
|
+
error,
|
|
140
|
+
activityId: activity.id?.href,
|
|
141
|
+
activity: json,
|
|
142
|
+
recipient
|
|
143
|
+
});
|
|
144
|
+
span.setStatus({
|
|
145
|
+
code: SpanStatusCode.ERROR,
|
|
146
|
+
message: String(error)
|
|
147
|
+
});
|
|
148
|
+
span.end();
|
|
149
|
+
return "error";
|
|
150
|
+
}
|
|
151
|
+
if (cacheKey != null) await kv.set(cacheKey, true, { ttl: Temporal.Duration.from({ days: 1 }) });
|
|
152
|
+
logger.info("Activity {activityId} has been processed.", {
|
|
153
|
+
activityId: activity.id?.href,
|
|
154
|
+
activity: json,
|
|
155
|
+
recipient
|
|
156
|
+
});
|
|
157
|
+
span.end();
|
|
158
|
+
return "success";
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
export { routeActivity as n, actorsHaveSameOrigin as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-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-JUTr6LYC.mjs";
|
|
5
5
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
7
7
|
import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { f as validateCryptoKey, t as doubleKnock } from "./http-
|
|
3
|
+
import { f as validateCryptoKey, t as doubleKnock } from "./http-OSYYhKM8.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { curry } from "es-toolkit";
|
|
6
6
|
import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -57,6 +57,8 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, maxRedi
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
async function validateUrl(url) {
|
|
60
|
+
const protocol = new URL(url).protocol;
|
|
61
|
+
if (protocol !== "http:" && protocol !== "https:") throw new UrlError(`Unsupported protocol: ${protocol}`);
|
|
60
62
|
if (!allowPrivateAddress) try {
|
|
61
63
|
await validatePublicUrl(url);
|
|
62
64
|
} catch (error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
require("./chunk-DDcVe30Y.cjs");
|
|
4
|
-
const require_http = require("./http-
|
|
4
|
+
const require_http = require("./http-DEH_eppX.cjs");
|
|
5
5
|
let _logtape_logtape = require("@logtape/logtape");
|
|
6
6
|
let es_toolkit = require("es-toolkit");
|
|
7
7
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
@@ -58,6 +58,8 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, maxRedi
|
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
60
|
async function validateUrl(url) {
|
|
61
|
+
const protocol = new URL(url).protocol;
|
|
62
|
+
if (protocol !== "http:" && protocol !== "https:") throw new _fedify_vocab_runtime.UrlError(`Unsupported protocol: ${protocol}`);
|
|
61
63
|
if (!allowPrivateAddress) try {
|
|
62
64
|
await (0, _fedify_vocab_runtime.validatePublicUrl)(url);
|
|
63
65
|
} catch (error) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { r as fetchKey, s as validateCryptoKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-JUTr6LYC.mjs";
|
|
5
|
+
import { r as fetchKey, s as validateCryptoKey } from "./key-D0ahOVjf.mjs";
|
|
6
6
|
import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
|
|
7
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|