@fedify/fedify 0.15.0-dev.372 → 0.15.0-dev.375
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/CHANGES.md +9 -0
- package/esm/federation/middleware.js +34 -2
- package/esm/vocab/vocab.js +0 -504
- package/package.json +1 -1
- package/types/federation/context.d.ts +39 -0
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/middleware.d.ts +13 -0
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/vocab/vocab.d.ts +0 -63
- package/types/vocab/vocab.d.ts.map +1 -1
package/CHANGES.md
CHANGED
@@ -8,6 +8,15 @@ Version 0.15.0
|
|
8
8
|
|
9
9
|
To be released.
|
10
10
|
|
11
|
+
- Removed `expand` option of `Object.toJsonLd()` method, which was deprecated
|
12
|
+
in version 0.14.0. Use `format: "expand"` option instead.
|
13
|
+
- Added `Context.lookupObject()` method.
|
14
|
+
- Added `allowPrivateAddress` option to `CreateFederationOptions` interface.
|
15
|
+
- Renamed the short option `-c` for `--compact` of `fedify lookup` command to
|
16
|
+
`-C` to avoid conflict with the short option `-c` for `--cache-dir`.
|
17
|
+
- Added `-r`/`--raw` option to `fedify lookup` command to output the raw JSON
|
18
|
+
object.
|
19
|
+
|
11
20
|
|
12
21
|
Version 0.14.3
|
13
22
|
--------------
|
@@ -5,6 +5,7 @@ import { fetchDocumentLoader, getAuthenticatedDocumentLoader, kvCache, } from ".
|
|
5
5
|
import { verifyRequest } from "../sig/http.js";
|
6
6
|
import { exportJwk, importJwk, validateCryptoKey } from "../sig/key.js";
|
7
7
|
import { getKeyOwner } from "../sig/owner.js";
|
8
|
+
import { lookupObject } from "../vocab/lookup.js";
|
8
9
|
import { Activity, CryptographicKey, Multikey, } from "../vocab/vocab.js";
|
9
10
|
import { handleWebFinger } from "../webfinger/handler.js";
|
10
11
|
import { buildCollectionSynchronizationHeader } from "./collection.js";
|
@@ -72,15 +73,31 @@ class FederationImpl {
|
|
72
73
|
this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
73
74
|
this.objectCallbacks = {};
|
74
75
|
this.objectTypeIds = {};
|
76
|
+
if (options.allowPrivateAddress) {
|
77
|
+
if (options.documentLoader != null) {
|
78
|
+
throw new TypeError("Cannot set documentLoader with allowPrivateAddress turned on.");
|
79
|
+
}
|
80
|
+
else if (options.contextLoader != null) {
|
81
|
+
throw new TypeError("Cannot set contextLoader with allowPrivateAddress turned on.");
|
82
|
+
}
|
83
|
+
else if (options.authenticatedDocumentLoaderFactory != null) {
|
84
|
+
throw new TypeError("Cannot set authenticatedDocumentLoaderFactory with " +
|
85
|
+
"allowPrivateAddress turned on.");
|
86
|
+
}
|
87
|
+
}
|
75
88
|
this.documentLoader = options.documentLoader ?? kvCache({
|
76
|
-
loader:
|
89
|
+
loader: options.allowPrivateAddress
|
90
|
+
? (url) => fetchDocumentLoader(url, true)
|
91
|
+
: fetchDocumentLoader,
|
77
92
|
kv: options.kv,
|
78
93
|
prefix: this.kvPrefixes.remoteDocument,
|
79
94
|
});
|
80
95
|
this.contextLoader = options.contextLoader ?? this.documentLoader;
|
81
96
|
this.authenticatedDocumentLoaderFactory =
|
82
97
|
options.authenticatedDocumentLoaderFactory ??
|
83
|
-
|
98
|
+
(options.allowPrivateAddress
|
99
|
+
? (identity) => getAuthenticatedDocumentLoader(identity, true)
|
100
|
+
: getAuthenticatedDocumentLoader);
|
84
101
|
this.onOutboxError = options.onOutboxError;
|
85
102
|
this.signatureTimeWindow = options.signatureTimeWindow ?? { minutes: 1 };
|
86
103
|
this.skipSignatureVerification = options.skipSignatureVerification ?? false;
|
@@ -323,6 +340,15 @@ class FederationImpl {
|
|
323
340
|
if (actor == null)
|
324
341
|
return null;
|
325
342
|
const logger = getLogger(["fedify", "federation", "actor"]);
|
343
|
+
if (actor.id == null) {
|
344
|
+
logger.warn("Actor dispatcher returned an actor without an id property. " +
|
345
|
+
"Set the property with Context.getActorUri(handle).");
|
346
|
+
}
|
347
|
+
else if (actor.id.href != context.getActorUri(handle).href) {
|
348
|
+
logger.warn("Actor dispatcher returned an actor with an id property that " +
|
349
|
+
"does not match the actor URI. Set the property with " +
|
350
|
+
"Context.getActorUri(handle).");
|
351
|
+
}
|
326
352
|
if (this.followingCallbacks != null &&
|
327
353
|
this.followingCallbacks.dispatcher != null) {
|
328
354
|
if (actor.followingId == null) {
|
@@ -1269,6 +1295,12 @@ class ContextImpl {
|
|
1269
1295
|
}
|
1270
1296
|
return this.federation.authenticatedDocumentLoaderFactory(identity);
|
1271
1297
|
}
|
1298
|
+
lookupObject(identifier, options = {}) {
|
1299
|
+
return lookupObject(identifier, {
|
1300
|
+
documentLoader: options.documentLoader ?? this.documentLoader,
|
1301
|
+
contextLoader: options.contextLoader ?? this.contextLoader,
|
1302
|
+
});
|
1303
|
+
}
|
1272
1304
|
async sendActivity(sender, recipients, activity, options = {}) {
|
1273
1305
|
let keys;
|
1274
1306
|
if ("handle" in sender) {
|