@fedify/vocab 2.4.0-dev.1873 → 2.4.0-dev.1889
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 +1 -1
- package/dist/mod.js +1 -1
- package/dist-tests/{actor-CjCW6kRX.mjs → actor-DPT4RP43.mjs} +1 -1
- package/dist-tests/actor.test.mjs +40 -40
- package/dist-tests/lookup.test.mjs +1 -1
- package/package.json +4 -4
- package/src/__snapshots__/vocab.test.ts.snap +6 -6
- package/src/actor.test.ts +40 -40
package/deno.json
CHANGED
package/dist/mod.cjs
CHANGED
|
@@ -34,7 +34,7 @@ let _fedify_vocab_runtime_temporal = require("@fedify/vocab-runtime/temporal");
|
|
|
34
34
|
let es_toolkit = require("es-toolkit");
|
|
35
35
|
//#region deno.json
|
|
36
36
|
var name = "@fedify/vocab";
|
|
37
|
-
var version = "2.4.0-dev.
|
|
37
|
+
var version = "2.4.0-dev.1889+70cfc7ff";
|
|
38
38
|
//#endregion
|
|
39
39
|
//#region src/type.ts
|
|
40
40
|
function getTypeId(object) {
|
package/dist/mod.js
CHANGED
|
@@ -10,7 +10,7 @@ import { isTemporalDuration, isTemporalInstant } from "@fedify/vocab-runtime/tem
|
|
|
10
10
|
import { delay } from "es-toolkit";
|
|
11
11
|
//#region deno.json
|
|
12
12
|
var name = "@fedify/vocab";
|
|
13
|
-
var version = "2.4.0-dev.
|
|
13
|
+
var version = "2.4.0-dev.1889+70cfc7ff";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/type.ts
|
|
16
16
|
function getTypeId(object) {
|
|
@@ -1213,7 +1213,7 @@ var esm_default = new class FetchMock {
|
|
|
1213
1213
|
//#endregion
|
|
1214
1214
|
//#region deno.json
|
|
1215
1215
|
var name = "@fedify/vocab";
|
|
1216
|
-
var version = "2.4.0-dev.
|
|
1216
|
+
var version = "2.4.0-dev.1889+70cfc7ff";
|
|
1217
1217
|
//#endregion
|
|
1218
1218
|
//#region src/actor.ts
|
|
1219
1219
|
const ACTOR_DISCOVERY_HISTOGRAM_BUCKETS = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
3
|
import { B as Service, M as Person, a as Application, j as Organization, q as __exportAll, v as Group } from "./vocab-CNiWKo57.mjs";
|
|
4
|
-
import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-
|
|
4
|
+
import { a as normalizeActorHandle, c as esm_default, i as isActor, n as getActorHandle, r as getActorTypeName, t as getActorClassByTypeName } from "./actor-DPT4RP43.mjs";
|
|
5
5
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|
|
6
6
|
import { deepStrictEqual, ok, rejects, strictEqual, throws } from "node:assert/strict";
|
|
7
7
|
//#region ../../node_modules/.pnpm/fast-check@3.23.2/node_modules/fast-check/lib/esm/check/precondition/PreconditionFailure.js
|
|
@@ -5648,50 +5648,50 @@ test({
|
|
|
5648
5648
|
},
|
|
5649
5649
|
async fn(t) {
|
|
5650
5650
|
esm_default.spyGlobal();
|
|
5651
|
-
esm_default.get("begin:https://
|
|
5652
|
-
body: { subject: "acct:johndoe@
|
|
5651
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5652
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
5653
5653
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5654
5654
|
});
|
|
5655
|
-
const actorId = new URL("https://
|
|
5655
|
+
const actorId = new URL("https://1.1.1.1/@john");
|
|
5656
5656
|
const actor = new Person({
|
|
5657
5657
|
id: actorId,
|
|
5658
5658
|
preferredUsername: "john"
|
|
5659
5659
|
});
|
|
5660
5660
|
await t.step("WebFinger subject", async () => {
|
|
5661
|
-
deepStrictEqual(await getActorHandle(actor), "@johndoe@
|
|
5662
|
-
deepStrictEqual(await getActorHandle(actor, { trimLeadingAt: true }), "johndoe@
|
|
5663
|
-
deepStrictEqual(await getActorHandle(actorId), "@johndoe@
|
|
5664
|
-
deepStrictEqual(await getActorHandle(actorId, { trimLeadingAt: true }), "johndoe@
|
|
5661
|
+
deepStrictEqual(await getActorHandle(actor), "@johndoe@1.1.1.1");
|
|
5662
|
+
deepStrictEqual(await getActorHandle(actor, { trimLeadingAt: true }), "johndoe@1.1.1.1");
|
|
5663
|
+
deepStrictEqual(await getActorHandle(actorId), "@johndoe@1.1.1.1");
|
|
5664
|
+
deepStrictEqual(await getActorHandle(actorId, { trimLeadingAt: true }), "johndoe@1.1.1.1");
|
|
5665
5665
|
});
|
|
5666
5666
|
esm_default.removeRoutes();
|
|
5667
|
-
esm_default.get("begin:https://
|
|
5667
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5668
5668
|
body: {
|
|
5669
|
-
subject: "https://
|
|
5670
|
-
aliases: ["acct:john@
|
|
5669
|
+
subject: "https://1.1.1.1/@john",
|
|
5670
|
+
aliases: ["acct:john@8.8.8.8", "acct:johndoe@1.1.1.1"]
|
|
5671
5671
|
},
|
|
5672
5672
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5673
5673
|
});
|
|
5674
5674
|
await t.step("WebFinger aliases", async () => {
|
|
5675
|
-
deepStrictEqual(await getActorHandle(actor), "@johndoe@
|
|
5676
|
-
deepStrictEqual(await getActorHandle(actor, { trimLeadingAt: true }), "johndoe@
|
|
5677
|
-
deepStrictEqual(await getActorHandle(actorId), "@johndoe@
|
|
5678
|
-
deepStrictEqual(await getActorHandle(actorId, { trimLeadingAt: true }), "johndoe@
|
|
5675
|
+
deepStrictEqual(await getActorHandle(actor), "@johndoe@1.1.1.1");
|
|
5676
|
+
deepStrictEqual(await getActorHandle(actor, { trimLeadingAt: true }), "johndoe@1.1.1.1");
|
|
5677
|
+
deepStrictEqual(await getActorHandle(actorId), "@johndoe@1.1.1.1");
|
|
5678
|
+
deepStrictEqual(await getActorHandle(actorId, { trimLeadingAt: true }), "johndoe@1.1.1.1");
|
|
5679
5679
|
});
|
|
5680
|
-
esm_default.get("begin:https://
|
|
5680
|
+
esm_default.get("begin:https://8.8.8.8/.well-known/webfinger?", {
|
|
5681
5681
|
body: {
|
|
5682
|
-
subject: "acct:john@
|
|
5683
|
-
aliases: ["https://
|
|
5682
|
+
subject: "acct:john@8.8.8.8",
|
|
5683
|
+
aliases: ["https://1.1.1.1/@john"]
|
|
5684
5684
|
},
|
|
5685
5685
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5686
5686
|
});
|
|
5687
5687
|
await t.step("cross-origin WebFinger resources", async () => {
|
|
5688
|
-
deepStrictEqual(await getActorHandle(actor), "@john@
|
|
5688
|
+
deepStrictEqual(await getActorHandle(actor), "@john@8.8.8.8");
|
|
5689
5689
|
});
|
|
5690
5690
|
esm_default.removeRoutes();
|
|
5691
|
-
esm_default.get("begin:https://
|
|
5691
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", { status: 404 });
|
|
5692
5692
|
await t.step("no WebFinger", async () => {
|
|
5693
|
-
deepStrictEqual(await getActorHandle(actor), "@john@
|
|
5694
|
-
rejects(() => getActorHandle(actorId), TypeError);
|
|
5693
|
+
deepStrictEqual(await getActorHandle(actor), "@john@1.1.1.1");
|
|
5694
|
+
await rejects(() => getActorHandle(actorId), TypeError);
|
|
5695
5695
|
});
|
|
5696
5696
|
esm_default.hardReset();
|
|
5697
5697
|
}
|
|
@@ -5702,25 +5702,25 @@ test("getActorHandle() records activitypub.actor.discovery counter", { permissio
|
|
|
5702
5702
|
} }, async (t) => {
|
|
5703
5703
|
esm_default.spyGlobal();
|
|
5704
5704
|
try {
|
|
5705
|
-
const actorId = new URL("https://
|
|
5705
|
+
const actorId = new URL("https://1.1.1.1/@john");
|
|
5706
5706
|
const actor = new Person({
|
|
5707
5707
|
id: actorId,
|
|
5708
5708
|
preferredUsername: "john"
|
|
5709
5709
|
});
|
|
5710
5710
|
await t.step("records result=resolved on a successful lookup", async () => {
|
|
5711
5711
|
esm_default.removeRoutes();
|
|
5712
|
-
esm_default.get("begin:https://
|
|
5713
|
-
body: { subject: "acct:johndoe@
|
|
5712
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5713
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
5714
5714
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5715
5715
|
});
|
|
5716
5716
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
5717
|
-
deepStrictEqual(await getActorHandle(actor, { meterProvider }), "@johndoe@
|
|
5717
|
+
deepStrictEqual(await getActorHandle(actor, { meterProvider }), "@johndoe@1.1.1.1");
|
|
5718
5718
|
const counters = recorder.getMeasurements("activitypub.actor.discovery");
|
|
5719
5719
|
deepStrictEqual(counters.length, 1);
|
|
5720
5720
|
deepStrictEqual(counters[0].type, "counter");
|
|
5721
5721
|
deepStrictEqual(counters[0].value, 1);
|
|
5722
5722
|
deepStrictEqual(counters[0].attributes["activitypub.actor.discovery.result"], "resolved");
|
|
5723
|
-
deepStrictEqual(counters[0].attributes["activitypub.remote.host"], "
|
|
5723
|
+
deepStrictEqual(counters[0].attributes["activitypub.remote.host"], "1.1.1.1");
|
|
5724
5724
|
const durations = recorder.getMeasurements("activitypub.actor.discovery.duration");
|
|
5725
5725
|
deepStrictEqual(durations.length, 1);
|
|
5726
5726
|
deepStrictEqual(durations[0].type, "histogram");
|
|
@@ -5729,40 +5729,40 @@ test("getActorHandle() records activitypub.actor.discovery counter", { permissio
|
|
|
5729
5729
|
});
|
|
5730
5730
|
await t.step("records result=resolved when WebFinger is missing but preferredUsername fallback succeeds", async () => {
|
|
5731
5731
|
esm_default.removeRoutes();
|
|
5732
|
-
esm_default.get("begin:https://
|
|
5732
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", { status: 404 });
|
|
5733
5733
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
5734
|
-
deepStrictEqual(await getActorHandle(actor, { meterProvider }), "@john@
|
|
5734
|
+
deepStrictEqual(await getActorHandle(actor, { meterProvider }), "@john@1.1.1.1");
|
|
5735
5735
|
const counter = recorder.getMeasurement("activitypub.actor.discovery");
|
|
5736
5736
|
ok(counter != null);
|
|
5737
5737
|
deepStrictEqual(counter.attributes["activitypub.actor.discovery.result"], "resolved");
|
|
5738
5738
|
});
|
|
5739
5739
|
await t.step("records result=not_found when neither WebFinger nor preferredUsername yields a handle", async () => {
|
|
5740
5740
|
esm_default.removeRoutes();
|
|
5741
|
-
esm_default.get("begin:https://
|
|
5741
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", { status: 404 });
|
|
5742
5742
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
5743
5743
|
await rejects(() => getActorHandle(actorId, { meterProvider }), TypeError);
|
|
5744
5744
|
const counter = recorder.getMeasurement("activitypub.actor.discovery");
|
|
5745
5745
|
ok(counter != null);
|
|
5746
5746
|
deepStrictEqual(counter.attributes["activitypub.actor.discovery.result"], "not_found");
|
|
5747
|
-
deepStrictEqual(counter.attributes["activitypub.remote.host"], "
|
|
5747
|
+
deepStrictEqual(counter.attributes["activitypub.remote.host"], "1.1.1.1");
|
|
5748
5748
|
const duration = recorder.getMeasurement("activitypub.actor.discovery.duration");
|
|
5749
5749
|
ok(duration != null);
|
|
5750
5750
|
deepStrictEqual(duration.attributes["activitypub.actor.discovery.result"], "not_found");
|
|
5751
5751
|
});
|
|
5752
5752
|
await t.step("records non-default ports for actor IDs", async () => {
|
|
5753
5753
|
esm_default.removeRoutes();
|
|
5754
|
-
esm_default.get("begin:https://
|
|
5754
|
+
esm_default.get("begin:https://1.1.1.1:8443/.well-known/webfinger?", { status: 404 });
|
|
5755
5755
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
5756
|
-
await rejects(() => getActorHandle(new URL("https://
|
|
5756
|
+
await rejects(() => getActorHandle(new URL("https://1.1.1.1:8443/@john"), { meterProvider }), TypeError);
|
|
5757
5757
|
const counter = recorder.getMeasurement("activitypub.actor.discovery");
|
|
5758
5758
|
ok(counter != null);
|
|
5759
|
-
deepStrictEqual(counter.attributes["activitypub.remote.host"], "
|
|
5759
|
+
deepStrictEqual(counter.attributes["activitypub.remote.host"], "1.1.1.1:8443");
|
|
5760
5760
|
});
|
|
5761
5761
|
await t.step("records result=error when a malformed WebFinger alias throws TypeError", async () => {
|
|
5762
5762
|
esm_default.removeRoutes();
|
|
5763
|
-
esm_default.get("begin:https://
|
|
5763
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5764
5764
|
body: {
|
|
5765
|
-
subject: "https://
|
|
5765
|
+
subject: "https://1.1.1.1/@john",
|
|
5766
5766
|
aliases: ["acct:john@["]
|
|
5767
5767
|
},
|
|
5768
5768
|
headers: { "Content-Type": "application/jrd+json" }
|
|
@@ -5775,8 +5775,8 @@ test("getActorHandle() records activitypub.actor.discovery counter", { permissio
|
|
|
5775
5775
|
});
|
|
5776
5776
|
await t.step("propagates meterProvider into the nested webfinger.lookup", async () => {
|
|
5777
5777
|
esm_default.removeRoutes();
|
|
5778
|
-
esm_default.get("begin:https://
|
|
5779
|
-
body: { subject: "acct:johndoe@
|
|
5778
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5779
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
5780
5780
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5781
5781
|
});
|
|
5782
5782
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
@@ -5787,8 +5787,8 @@ test("getActorHandle() records activitypub.actor.discovery counter", { permissio
|
|
|
5787
5787
|
});
|
|
5788
5788
|
await t.step("omits measurements when no meterProvider is provided", async () => {
|
|
5789
5789
|
esm_default.removeRoutes();
|
|
5790
|
-
esm_default.get("begin:https://
|
|
5791
|
-
body: { subject: "acct:johndoe@
|
|
5790
|
+
esm_default.get("begin:https://1.1.1.1/.well-known/webfinger?", {
|
|
5791
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
5792
5792
|
headers: { "Content-Type": "application/jrd+json" }
|
|
5793
5793
|
});
|
|
5794
5794
|
const [_unused, recorder] = createTestMeterProvider();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
globalThis.addEventListener = () => {};
|
|
3
3
|
import { D as Note, M as Person, O as Object$1, o as Collection } from "./vocab-CNiWKo57.mjs";
|
|
4
|
-
import { c as esm_default, i as isActor, o as name, s as version } from "./actor-
|
|
4
|
+
import { c as esm_default, i as isActor, o as name, s as version } from "./actor-DPT4RP43.mjs";
|
|
5
5
|
import { t as getTypeId } from "./type-BMdjm4Eg.mjs";
|
|
6
6
|
import { t as assertInstanceOf } from "./utils-Df2odC27.mjs";
|
|
7
7
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
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.1889+70cfc7ff",
|
|
4
4
|
"homepage": "https://fedify.dev/",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"jsonld": "^9.0.0",
|
|
44
44
|
"pkijs": "^3.3.3",
|
|
45
45
|
"temporal-polyfill": "^1.0.1",
|
|
46
|
-
"@fedify/vocab-tools": "2.4.0-dev.
|
|
47
|
-
"@fedify/vocab-runtime": "2.4.0-dev.
|
|
48
|
-
"@fedify/webfinger": "2.4.0-dev.
|
|
46
|
+
"@fedify/vocab-tools": "2.4.0-dev.1889+70cfc7ff",
|
|
47
|
+
"@fedify/vocab-runtime": "2.4.0-dev.1889+70cfc7ff",
|
|
48
|
+
"@fedify/webfinger": "2.4.0-dev.1889+70cfc7ff"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.17.0",
|
|
@@ -2305,8 +2305,8 @@ snapshot[`Deno.inspect(CryptographicKey) [auto] 1`] = `
|
|
|
2305
2305
|
algorithm: {
|
|
2306
2306
|
name: "RSASSA-PKCS1-v1_5",
|
|
2307
2307
|
modulusLength: 2048,
|
|
2308
|
-
|
|
2309
|
-
|
|
2308
|
+
hash: { name: "SHA-256" },
|
|
2309
|
+
publicExponent: Uint8Array(3) [ 1, 0, 1 ]
|
|
2310
2310
|
},
|
|
2311
2311
|
usages: [ "verify" ]
|
|
2312
2312
|
}
|
|
@@ -2323,8 +2323,8 @@ snapshot[`Deno.inspect(CryptographicKey) [auto] 2`] = `
|
|
|
2323
2323
|
algorithm: {
|
|
2324
2324
|
name: "RSASSA-PKCS1-v1_5",
|
|
2325
2325
|
modulusLength: 2048,
|
|
2326
|
-
|
|
2327
|
-
|
|
2326
|
+
hash: { name: "SHA-256" },
|
|
2327
|
+
publicExponent: Uint8Array(3) [ 1, 0, 1 ]
|
|
2328
2328
|
},
|
|
2329
2329
|
usages: [ "verify" ]
|
|
2330
2330
|
}
|
|
@@ -2341,8 +2341,8 @@ snapshot[`Deno.inspect(CryptographicKey) [auto] 3`] = `
|
|
|
2341
2341
|
algorithm: {
|
|
2342
2342
|
name: "RSASSA-PKCS1-v1_5",
|
|
2343
2343
|
modulusLength: 2048,
|
|
2344
|
-
|
|
2345
|
-
|
|
2344
|
+
hash: { name: "SHA-256" },
|
|
2345
|
+
publicExponent: Uint8Array(3) [ 1, 0, 1 ]
|
|
2346
2346
|
},
|
|
2347
2347
|
usages: [ "verify" ]
|
|
2348
2348
|
}
|
package/src/actor.test.ts
CHANGED
|
@@ -100,44 +100,44 @@ test({
|
|
|
100
100
|
fetchMock.spyGlobal();
|
|
101
101
|
|
|
102
102
|
fetchMock.get(
|
|
103
|
-
"begin:https://
|
|
103
|
+
"begin:https://1.1.1.1/.well-known/webfinger?",
|
|
104
104
|
{
|
|
105
|
-
body: { subject: "acct:johndoe@
|
|
105
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
106
106
|
headers: { "Content-Type": "application/jrd+json" },
|
|
107
107
|
},
|
|
108
108
|
);
|
|
109
109
|
|
|
110
|
-
const actorId = new URL("https://
|
|
110
|
+
const actorId = new URL("https://1.1.1.1/@john");
|
|
111
111
|
const actor = new Person({
|
|
112
112
|
id: actorId,
|
|
113
113
|
preferredUsername: "john",
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
await t.step("WebFinger subject", async () => {
|
|
117
|
-
deepStrictEqual(await getActorHandle(actor), "@johndoe@
|
|
117
|
+
deepStrictEqual(await getActorHandle(actor), "@johndoe@1.1.1.1");
|
|
118
118
|
deepStrictEqual(
|
|
119
119
|
await getActorHandle(actor, { trimLeadingAt: true }),
|
|
120
|
-
"johndoe@
|
|
120
|
+
"johndoe@1.1.1.1",
|
|
121
121
|
);
|
|
122
122
|
deepStrictEqual(
|
|
123
123
|
await getActorHandle(actorId),
|
|
124
|
-
"@johndoe@
|
|
124
|
+
"@johndoe@1.1.1.1",
|
|
125
125
|
);
|
|
126
126
|
deepStrictEqual(
|
|
127
127
|
await getActorHandle(actorId, { trimLeadingAt: true }),
|
|
128
|
-
"johndoe@
|
|
128
|
+
"johndoe@1.1.1.1",
|
|
129
129
|
);
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
fetchMock.removeRoutes();
|
|
133
133
|
fetchMock.get(
|
|
134
|
-
"begin:https://
|
|
134
|
+
"begin:https://1.1.1.1/.well-known/webfinger?",
|
|
135
135
|
{
|
|
136
136
|
body: {
|
|
137
|
-
subject: "https://
|
|
137
|
+
subject: "https://1.1.1.1/@john",
|
|
138
138
|
aliases: [
|
|
139
|
-
"acct:john@
|
|
140
|
-
"acct:johndoe@
|
|
139
|
+
"acct:john@8.8.8.8",
|
|
140
|
+
"acct:johndoe@1.1.1.1",
|
|
141
141
|
],
|
|
142
142
|
},
|
|
143
143
|
headers: { "Content-Type": "application/jrd+json" },
|
|
@@ -145,28 +145,28 @@ test({
|
|
|
145
145
|
);
|
|
146
146
|
|
|
147
147
|
await t.step("WebFinger aliases", async () => {
|
|
148
|
-
deepStrictEqual(await getActorHandle(actor), "@johndoe@
|
|
148
|
+
deepStrictEqual(await getActorHandle(actor), "@johndoe@1.1.1.1");
|
|
149
149
|
deepStrictEqual(
|
|
150
150
|
await getActorHandle(actor, { trimLeadingAt: true }),
|
|
151
|
-
"johndoe@
|
|
151
|
+
"johndoe@1.1.1.1",
|
|
152
152
|
);
|
|
153
153
|
deepStrictEqual(
|
|
154
154
|
await getActorHandle(actorId),
|
|
155
|
-
"@johndoe@
|
|
155
|
+
"@johndoe@1.1.1.1",
|
|
156
156
|
);
|
|
157
157
|
deepStrictEqual(
|
|
158
158
|
await getActorHandle(actorId, { trimLeadingAt: true }),
|
|
159
|
-
"johndoe@
|
|
159
|
+
"johndoe@1.1.1.1",
|
|
160
160
|
);
|
|
161
161
|
});
|
|
162
162
|
|
|
163
163
|
fetchMock.get(
|
|
164
|
-
"begin:https://
|
|
164
|
+
"begin:https://8.8.8.8/.well-known/webfinger?",
|
|
165
165
|
{
|
|
166
166
|
body: {
|
|
167
|
-
subject: "acct:john@
|
|
167
|
+
subject: "acct:john@8.8.8.8",
|
|
168
168
|
aliases: [
|
|
169
|
-
"https://
|
|
169
|
+
"https://1.1.1.1/@john",
|
|
170
170
|
],
|
|
171
171
|
},
|
|
172
172
|
headers: { "Content-Type": "application/jrd+json" },
|
|
@@ -174,18 +174,18 @@ test({
|
|
|
174
174
|
);
|
|
175
175
|
|
|
176
176
|
await t.step("cross-origin WebFinger resources", async () => {
|
|
177
|
-
deepStrictEqual(await getActorHandle(actor), "@john@
|
|
177
|
+
deepStrictEqual(await getActorHandle(actor), "@john@8.8.8.8");
|
|
178
178
|
});
|
|
179
179
|
|
|
180
180
|
fetchMock.removeRoutes();
|
|
181
181
|
fetchMock.get(
|
|
182
|
-
"begin:https://
|
|
182
|
+
"begin:https://1.1.1.1/.well-known/webfinger?",
|
|
183
183
|
{ status: 404 },
|
|
184
184
|
);
|
|
185
185
|
|
|
186
186
|
await t.step("no WebFinger", async () => {
|
|
187
|
-
deepStrictEqual(await getActorHandle(actor), "@john@
|
|
188
|
-
rejects(() => getActorHandle(actorId), TypeError);
|
|
187
|
+
deepStrictEqual(await getActorHandle(actor), "@john@1.1.1.1");
|
|
188
|
+
await rejects(() => getActorHandle(actorId), TypeError);
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
fetchMock.hardReset();
|
|
@@ -197,7 +197,7 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
197
197
|
}, async (t) => {
|
|
198
198
|
fetchMock.spyGlobal();
|
|
199
199
|
try {
|
|
200
|
-
const actorId = new URL("https://
|
|
200
|
+
const actorId = new URL("https://1.1.1.1/@john");
|
|
201
201
|
const actor = new Person({
|
|
202
202
|
id: actorId,
|
|
203
203
|
preferredUsername: "john",
|
|
@@ -206,15 +206,15 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
206
206
|
await t.step("records result=resolved on a successful lookup", async () => {
|
|
207
207
|
fetchMock.removeRoutes();
|
|
208
208
|
fetchMock.get(
|
|
209
|
-
"begin:https://
|
|
209
|
+
"begin:https://1.1.1.1/.well-known/webfinger?",
|
|
210
210
|
{
|
|
211
|
-
body: { subject: "acct:johndoe@
|
|
211
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
212
212
|
headers: { "Content-Type": "application/jrd+json" },
|
|
213
213
|
},
|
|
214
214
|
);
|
|
215
215
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
216
216
|
const handle = await getActorHandle(actor, { meterProvider });
|
|
217
|
-
deepStrictEqual(handle, "@johndoe@
|
|
217
|
+
deepStrictEqual(handle, "@johndoe@1.1.1.1");
|
|
218
218
|
|
|
219
219
|
const counters = recorder.getMeasurements(
|
|
220
220
|
"activitypub.actor.discovery",
|
|
@@ -228,7 +228,7 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
228
228
|
);
|
|
229
229
|
deepStrictEqual(
|
|
230
230
|
counters[0].attributes["activitypub.remote.host"],
|
|
231
|
-
"
|
|
231
|
+
"1.1.1.1",
|
|
232
232
|
);
|
|
233
233
|
|
|
234
234
|
const durations = recorder.getMeasurements(
|
|
@@ -248,12 +248,12 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
248
248
|
async () => {
|
|
249
249
|
fetchMock.removeRoutes();
|
|
250
250
|
fetchMock.get(
|
|
251
|
-
"begin:https://
|
|
251
|
+
"begin:https://1.1.1.1/.well-known/webfinger?",
|
|
252
252
|
{ status: 404 },
|
|
253
253
|
);
|
|
254
254
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
255
255
|
const handle = await getActorHandle(actor, { meterProvider });
|
|
256
|
-
deepStrictEqual(handle, "@john@
|
|
256
|
+
deepStrictEqual(handle, "@john@1.1.1.1");
|
|
257
257
|
const counter = recorder.getMeasurement("activitypub.actor.discovery");
|
|
258
258
|
ok(counter != null);
|
|
259
259
|
deepStrictEqual(
|
|
@@ -268,7 +268,7 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
268
268
|
async () => {
|
|
269
269
|
fetchMock.removeRoutes();
|
|
270
270
|
fetchMock.get(
|
|
271
|
-
"begin:https://
|
|
271
|
+
"begin:https://1.1.1.1/.well-known/webfinger?",
|
|
272
272
|
{ status: 404 },
|
|
273
273
|
);
|
|
274
274
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
@@ -284,7 +284,7 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
284
284
|
);
|
|
285
285
|
deepStrictEqual(
|
|
286
286
|
counter.attributes["activitypub.remote.host"],
|
|
287
|
-
"
|
|
287
|
+
"1.1.1.1",
|
|
288
288
|
);
|
|
289
289
|
const duration = recorder.getMeasurement(
|
|
290
290
|
"activitypub.actor.discovery.duration",
|
|
@@ -302,13 +302,13 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
302
302
|
async () => {
|
|
303
303
|
fetchMock.removeRoutes();
|
|
304
304
|
fetchMock.get(
|
|
305
|
-
"begin:https://
|
|
305
|
+
"begin:https://1.1.1.1:8443/.well-known/webfinger?",
|
|
306
306
|
{ status: 404 },
|
|
307
307
|
);
|
|
308
308
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
309
309
|
await rejects(
|
|
310
310
|
() =>
|
|
311
|
-
getActorHandle(new URL("https://
|
|
311
|
+
getActorHandle(new URL("https://1.1.1.1:8443/@john"), {
|
|
312
312
|
meterProvider,
|
|
313
313
|
}),
|
|
314
314
|
TypeError,
|
|
@@ -317,7 +317,7 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
317
317
|
ok(counter != null);
|
|
318
318
|
deepStrictEqual(
|
|
319
319
|
counter.attributes["activitypub.remote.host"],
|
|
320
|
-
"
|
|
320
|
+
"1.1.1.1:8443",
|
|
321
321
|
);
|
|
322
322
|
},
|
|
323
323
|
);
|
|
@@ -332,10 +332,10 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
332
332
|
// `error` rather than `not_found`.
|
|
333
333
|
fetchMock.removeRoutes();
|
|
334
334
|
fetchMock.get(
|
|
335
|
-
"begin:https://
|
|
335
|
+
"begin:https://1.1.1.1/.well-known/webfinger?",
|
|
336
336
|
{
|
|
337
337
|
body: {
|
|
338
|
-
subject: "https://
|
|
338
|
+
subject: "https://1.1.1.1/@john",
|
|
339
339
|
aliases: ["acct:john@["],
|
|
340
340
|
},
|
|
341
341
|
headers: { "Content-Type": "application/jrd+json" },
|
|
@@ -362,9 +362,9 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
362
362
|
async () => {
|
|
363
363
|
fetchMock.removeRoutes();
|
|
364
364
|
fetchMock.get(
|
|
365
|
-
"begin:https://
|
|
365
|
+
"begin:https://1.1.1.1/.well-known/webfinger?",
|
|
366
366
|
{
|
|
367
|
-
body: { subject: "acct:johndoe@
|
|
367
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
368
368
|
headers: { "Content-Type": "application/jrd+json" },
|
|
369
369
|
},
|
|
370
370
|
);
|
|
@@ -384,9 +384,9 @@ test("getActorHandle() records activitypub.actor.discovery counter", {
|
|
|
384
384
|
async () => {
|
|
385
385
|
fetchMock.removeRoutes();
|
|
386
386
|
fetchMock.get(
|
|
387
|
-
"begin:https://
|
|
387
|
+
"begin:https://1.1.1.1/.well-known/webfinger?",
|
|
388
388
|
{
|
|
389
|
-
body: { subject: "acct:johndoe@
|
|
389
|
+
body: { subject: "acct:johndoe@1.1.1.1" },
|
|
390
390
|
headers: { "Content-Type": "application/jrd+json" },
|
|
391
391
|
},
|
|
392
392
|
);
|