@fedify/vocab 2.4.0-dev.1508 → 2.4.0-dev.1531
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/deno.json +1 -1
- package/dist/mod.cjs +3731 -2360
- package/dist/mod.js +3732 -2361
- package/dist-tests/{actor-DuYbpVhy.mjs → actor-BNGWfRD2.mjs} +2 -2
- package/dist-tests/actor.test.mjs +2 -2
- package/dist-tests/lookup.test.mjs +7 -5
- package/dist-tests/type.test.mjs +1 -1
- package/dist-tests/{vocab-XnSGFOqq.mjs → vocab-CQX0Zq_l.mjs} +3727 -2358
- package/dist-tests/vocab.test.mjs +788 -1
- package/package.json +4 -4
- package/src/lookup.ts +6 -2
- package/src/vocab.test.ts +1132 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/vocab",
|
|
3
|
-
"version": "2.4.0-dev.
|
|
3
|
+
"version": "2.4.0-dev.1531+0896bc51",
|
|
4
4
|
"homepage": "https://fedify.dev/",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"es-toolkit": "1.46.1",
|
|
44
44
|
"jsonld": "^9.0.0",
|
|
45
45
|
"pkijs": "^3.3.3",
|
|
46
|
-
"@fedify/
|
|
47
|
-
"@fedify/
|
|
48
|
-
"@fedify/vocab-
|
|
46
|
+
"@fedify/vocab-tools": "2.4.0-dev.1531+0896bc51",
|
|
47
|
+
"@fedify/webfinger": "2.4.0-dev.1531+0896bc51",
|
|
48
|
+
"@fedify/vocab-runtime": "2.4.0-dev.1531+0896bc51"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.17.0",
|
package/src/lookup.ts
CHANGED
|
@@ -2,6 +2,8 @@ import type { GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
|
2
2
|
import {
|
|
3
3
|
type DocumentLoader,
|
|
4
4
|
getDocumentLoader,
|
|
5
|
+
haveSameIriOrigin,
|
|
6
|
+
parseIri,
|
|
5
7
|
type RemoteDocument,
|
|
6
8
|
} from "@fedify/vocab-runtime";
|
|
7
9
|
import { lookupWebFinger } from "@fedify/webfinger";
|
|
@@ -312,12 +314,14 @@ async function lookupObjectInternal(
|
|
|
312
314
|
}
|
|
313
315
|
if (remoteDoc == null) return null;
|
|
314
316
|
let object: Object;
|
|
317
|
+
let documentUrl: URL;
|
|
315
318
|
try {
|
|
319
|
+
documentUrl = parseIri(remoteDoc.documentUrl);
|
|
316
320
|
object = await Object.fromJsonLd(remoteDoc.document, {
|
|
317
321
|
documentLoader,
|
|
318
322
|
contextLoader: options.contextLoader,
|
|
319
323
|
tracerProvider: options.tracerProvider,
|
|
320
|
-
baseUrl:
|
|
324
|
+
baseUrl: documentUrl,
|
|
321
325
|
});
|
|
322
326
|
} catch (error) {
|
|
323
327
|
if (error instanceof TypeError) {
|
|
@@ -331,7 +335,7 @@ async function lookupObjectInternal(
|
|
|
331
335
|
}
|
|
332
336
|
if (
|
|
333
337
|
options.crossOrigin !== "trust" && object.id != null &&
|
|
334
|
-
object.id
|
|
338
|
+
!haveSameIriOrigin(object.id, documentUrl)
|
|
335
339
|
) {
|
|
336
340
|
if (options.crossOrigin === "throw") {
|
|
337
341
|
throw new Error(
|