@fedify/fedify 1.2.17 → 1.2.19
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 +86 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.8/_common16.js +45 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.8/_common64.js +98 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.8/_common_detach.js +13 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.8/base64.js +82 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.8/base64url.js +72 -0
- package/esm/deps/jsr.io/@std/encoding/1.0.8/hex.js +87 -0
- package/esm/federation/collection.js +3 -3
- package/esm/federation/handler.js +5 -2
- package/esm/federation/middleware.js +20 -3
- package/esm/runtime/key.js +3 -3
- package/esm/sig/http.js +1 -1
- package/esm/sig/ld.js +2 -2
- package/esm/vocab/lookup.js +1 -1
- package/esm/webfinger/handler.js +8 -1
- package/package.json +1 -1
- package/types/deps/jsr.io/@std/async/{1.0.11 → 1.0.12}/delay.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/encoding/1.0.8/_common16.d.ts +21 -0
- package/types/deps/jsr.io/@std/encoding/1.0.8/_common16.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/1.0.8/_common64.d.ts +21 -0
- package/types/deps/jsr.io/@std/encoding/1.0.8/_common64.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/1.0.8/_common_detach.d.ts +4 -0
- package/types/deps/jsr.io/@std/encoding/1.0.8/_common_detach.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.8}/_types.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/encoding/1.0.8/base64.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/1.0.8/base64url.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/encoding/1.0.8/hex.d.ts.map +1 -0
- package/types/federation/collection.d.ts +2 -2
- package/types/federation/handler.d.ts.map +1 -1
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/webfinger/handler.d.ts.map +1 -1
- package/esm/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.js +0 -26
- package/esm/deps/jsr.io/@std/encoding/1.0.7/base64.js +0 -163
- package/esm/deps/jsr.io/@std/encoding/1.0.7/base64url.js +0 -81
- package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.js +0 -109
- package/types/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.d.ts +0 -2
- package/types/deps/jsr.io/@std/encoding/1.0.7/_validate_binary_like.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/1.0.7/base64.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/1.0.7/base64url.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/async/{1.0.11 → 1.0.12}/delay.js +0 -0
- /package/esm/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.8}/_types.js +0 -0
- /package/types/deps/jsr.io/@std/async/{1.0.11 → 1.0.12}/delay.d.ts +0 -0
- /package/types/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.8}/_types.d.ts +0 -0
- /package/types/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.8}/base64.d.ts +0 -0
- /package/types/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.8}/base64url.d.ts +0 -0
- /package/types/deps/jsr.io/@std/encoding/{1.0.7 → 1.0.8}/hex.d.ts +0 -0
package/CHANGES.md
CHANGED
@@ -3,6 +3,33 @@
|
|
3
3
|
Fedify changelog
|
4
4
|
================
|
5
5
|
|
6
|
+
Version 1.2.19
|
7
|
+
--------------
|
8
|
+
|
9
|
+
Released on March 26, 2025.
|
10
|
+
|
11
|
+
- Fixed a bug where the `totalItems` property of `OrderedCollection`
|
12
|
+
objects returned by followers collection dispatcher had been an incorrect
|
13
|
+
value if a `base-url` parameter was provided.
|
14
|
+
|
15
|
+
- Fixed a bug where the `id` property of `OrderedCollection` and
|
16
|
+
`OrderedCollectionPage` objects returned by followers collection dispatcher
|
17
|
+
had been an incorrect value if a `base-url` parameter was provided.
|
18
|
+
|
19
|
+
|
20
|
+
Version 1.2.18
|
21
|
+
--------------
|
22
|
+
|
23
|
+
Released on March 20, 2025.
|
24
|
+
|
25
|
+
- Fixed a bug of WebFinger handler where it had failed to match
|
26
|
+
`acct:` URIs with a host having a port number.
|
27
|
+
[[#218], [#219] by Revath S Kumar]
|
28
|
+
|
29
|
+
- Fixed a server error thrown when an invalid URL was passed to the `base-url`
|
30
|
+
parameter of the followers collection. [[#217]]
|
31
|
+
|
32
|
+
|
6
33
|
Version 1.2.17
|
7
34
|
--------------
|
8
35
|
|
@@ -331,6 +358,33 @@ Released on October 31, 2024.
|
|
331
358
|
[#118]: https://github.com/dahlia/fedify/issues/118
|
332
359
|
|
333
360
|
|
361
|
+
Version 1.1.19
|
362
|
+
--------------
|
363
|
+
|
364
|
+
Released on March 26, 2025.
|
365
|
+
|
366
|
+
- Fixed a bug where the `totalItems` property of `OrderedCollection`
|
367
|
+
objects returned by followers collection dispatcher had been an incorrect
|
368
|
+
value if a `base-url` parameter was provided.
|
369
|
+
|
370
|
+
- Fixed a bug where the `id` property of `OrderedCollection` and
|
371
|
+
`OrderedCollectionPage` objects returned by followers collection dispatcher
|
372
|
+
had been an incorrect value if a `base-url` parameter was provided.
|
373
|
+
|
374
|
+
|
375
|
+
Version 1.1.18
|
376
|
+
--------------
|
377
|
+
|
378
|
+
Released on March 20, 2025.
|
379
|
+
|
380
|
+
- Fixed a bug of WebFinger handler where it had failed to match
|
381
|
+
`acct:` URIs with a host having a port number.
|
382
|
+
[[#218], [#219] by Revath S Kumar]
|
383
|
+
|
384
|
+
- Fixed a server error thrown when an invalid URL was passed to the `base-url`
|
385
|
+
parameter of the followers collection. [[#217]]
|
386
|
+
|
387
|
+
|
334
388
|
Version 1.1.17
|
335
389
|
--------------
|
336
390
|
|
@@ -700,6 +754,37 @@ Released on October 20, 2024.
|
|
700
754
|
[#150]: https://github.com/dahlia/fedify/issues/150
|
701
755
|
|
702
756
|
|
757
|
+
Version 1.0.22
|
758
|
+
--------------
|
759
|
+
|
760
|
+
Released on March 26, 2025.
|
761
|
+
|
762
|
+
- Fixed a bug where the `totalItems` property of `OrderedCollection`
|
763
|
+
objects returned by followers collection dispatcher had been an incorrect
|
764
|
+
value if a `base-url` parameter was provided.
|
765
|
+
|
766
|
+
- Fixed a bug where the `id` property of `OrderedCollection` and
|
767
|
+
`OrderedCollectionPage` objects returned by followers collection dispatcher
|
768
|
+
had been an incorrect value if a `base-url` parameter was provided.
|
769
|
+
|
770
|
+
|
771
|
+
Version 1.0.21
|
772
|
+
--------------
|
773
|
+
|
774
|
+
Released on March 20, 2025.
|
775
|
+
|
776
|
+
- Fixed a bug of WebFinger handler where it had failed to match
|
777
|
+
`acct:` URIs with a host having a port number.
|
778
|
+
[[#218], [#219] by Revath S Kumar]
|
779
|
+
|
780
|
+
- Fixed a server error thrown when an invalid URL was passed to the `base-url`
|
781
|
+
parameter of the followers collection. [[#217]]
|
782
|
+
|
783
|
+
[#217]: https://github.com/fedify-dev/fedify/issues/217
|
784
|
+
[#218]: https://github.com/fedify-dev/fedify/issues/218
|
785
|
+
[#219]: https://github.com/fedify-dev/fedify/pull/219
|
786
|
+
|
787
|
+
|
703
788
|
Version 1.0.20
|
704
789
|
--------------
|
705
790
|
|
@@ -2867,3 +2952,4 @@ Version 0.1.0
|
|
2867
2952
|
Initial release. Released on March 8, 2024.
|
2868
2953
|
|
2869
2954
|
<!-- cSpell: ignore Dogeon Fabien Wressell Emelia Fróði Karlsson -->
|
2955
|
+
<!-- cSpell: ignore Revath Kumar -->
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
2
|
+
/**
|
3
|
+
* Calculate the output size needed to encode a given input size for
|
4
|
+
* {@linkcode encodeRawHex}.
|
5
|
+
*
|
6
|
+
* @param originalSize The size of the input buffer.
|
7
|
+
* @returns The size of the output buffer.
|
8
|
+
*
|
9
|
+
* @example Basic Usage
|
10
|
+
* ```ts
|
11
|
+
* import { assertEquals } from "@std/assert";
|
12
|
+
* import { calcMax } from "@std/encoding/unstable-hex";
|
13
|
+
*
|
14
|
+
* assertEquals(calcMax(1), 2);
|
15
|
+
* ```
|
16
|
+
*/
|
17
|
+
export function calcMax(originalSize) {
|
18
|
+
return originalSize * 2;
|
19
|
+
}
|
20
|
+
export function encode(buffer, i, o, alphabet) {
|
21
|
+
for (; i < buffer.length; ++i) {
|
22
|
+
const x = buffer[i];
|
23
|
+
buffer[o++] = alphabet[x >> 4];
|
24
|
+
buffer[o++] = alphabet[x & 0xF];
|
25
|
+
}
|
26
|
+
return o;
|
27
|
+
}
|
28
|
+
export function decode(buffer, i, o, alphabet) {
|
29
|
+
if ((buffer.length - o) % 2 === 1) {
|
30
|
+
throw new RangeError(`Cannot decode input as hex: Length (${buffer.length - o}) must be divisible by 2`);
|
31
|
+
}
|
32
|
+
i += 1;
|
33
|
+
for (; i < buffer.length; i += 2) {
|
34
|
+
buffer[o++] = (getByte(buffer[i - 1], alphabet) << 4) |
|
35
|
+
getByte(buffer[i], alphabet);
|
36
|
+
}
|
37
|
+
return o;
|
38
|
+
}
|
39
|
+
function getByte(char, alphabet) {
|
40
|
+
const byte = alphabet[char] ?? 16;
|
41
|
+
if (byte === 16) { // alphabet.Hex.length
|
42
|
+
throw new TypeError(`Cannot decode input as hex: Invalid character (${String.fromCharCode(char)})`);
|
43
|
+
}
|
44
|
+
return byte;
|
45
|
+
}
|
@@ -0,0 +1,98 @@
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
2
|
+
/**
|
3
|
+
* Calculate the output size needed to encode a given input size for
|
4
|
+
* {@linkcode encodeRawBase64}.
|
5
|
+
*
|
6
|
+
* @param originalSize The size of the input buffer.
|
7
|
+
* @returns The size of the output buffer.
|
8
|
+
*
|
9
|
+
* @example Basic Usage
|
10
|
+
* ```ts
|
11
|
+
* import { assertEquals } from "@std/assert";
|
12
|
+
* import { calcMax } from "@std/encoding/unstable-base64";
|
13
|
+
*
|
14
|
+
* assertEquals(calcMax(1), 4);
|
15
|
+
* ```
|
16
|
+
*/
|
17
|
+
export function calcMax(originalSize) {
|
18
|
+
return ((originalSize + 2) / 3 | 0) * 4;
|
19
|
+
}
|
20
|
+
export function encode(buffer, i, o, alphabet, padding) {
|
21
|
+
i += 2;
|
22
|
+
for (; i < buffer.length; i += 3) {
|
23
|
+
const x = (buffer[i - 2] << 16) | (buffer[i - 1] << 8) | buffer[i];
|
24
|
+
buffer[o++] = alphabet[x >> 18];
|
25
|
+
buffer[o++] = alphabet[x >> 12 & 0x3F];
|
26
|
+
buffer[o++] = alphabet[x >> 6 & 0x3F];
|
27
|
+
buffer[o++] = alphabet[x & 0x3F];
|
28
|
+
}
|
29
|
+
switch (i) {
|
30
|
+
case buffer.length + 1: {
|
31
|
+
const x = buffer[i - 2] << 16;
|
32
|
+
buffer[o++] = alphabet[x >> 18];
|
33
|
+
buffer[o++] = alphabet[x >> 12 & 0x3F];
|
34
|
+
buffer[o++] = padding;
|
35
|
+
buffer[o++] = padding;
|
36
|
+
break;
|
37
|
+
}
|
38
|
+
case buffer.length: {
|
39
|
+
const x = (buffer[i - 2] << 16) | (buffer[i - 1] << 8);
|
40
|
+
buffer[o++] = alphabet[x >> 18];
|
41
|
+
buffer[o++] = alphabet[x >> 12 & 0x3F];
|
42
|
+
buffer[o++] = alphabet[x >> 6 & 0x3F];
|
43
|
+
buffer[o++] = padding;
|
44
|
+
break;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
return o;
|
48
|
+
}
|
49
|
+
export function decode(buffer, i, o, alphabet, padding) {
|
50
|
+
for (let x = buffer.length - 2; x < buffer.length; ++x) {
|
51
|
+
if (buffer[x] === padding) {
|
52
|
+
for (let y = x + 1; y < buffer.length; ++y) {
|
53
|
+
if (buffer[y] !== padding) {
|
54
|
+
throw new TypeError(`Cannot decode input as base64: Invalid character (${String.fromCharCode(buffer[y])})`);
|
55
|
+
}
|
56
|
+
}
|
57
|
+
buffer = buffer.subarray(0, x);
|
58
|
+
break;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
if ((buffer.length - o) % 4 === 1) {
|
62
|
+
throw new RangeError(`Cannot decode input as base64: Length (${buffer.length - o}), excluding padding, must not have a remainder of 1 when divided by 4`);
|
63
|
+
}
|
64
|
+
i += 3;
|
65
|
+
for (; i < buffer.length; i += 4) {
|
66
|
+
const x = (getByte(buffer[i - 3], alphabet) << 18) |
|
67
|
+
(getByte(buffer[i - 2], alphabet) << 12) |
|
68
|
+
(getByte(buffer[i - 1], alphabet) << 6) |
|
69
|
+
getByte(buffer[i], alphabet);
|
70
|
+
buffer[o++] = x >> 16;
|
71
|
+
buffer[o++] = x >> 8 & 0xFF;
|
72
|
+
buffer[o++] = x & 0xFF;
|
73
|
+
}
|
74
|
+
switch (i) {
|
75
|
+
case buffer.length + 1: {
|
76
|
+
const x = (getByte(buffer[i - 3], alphabet) << 18) |
|
77
|
+
(getByte(buffer[i - 2], alphabet) << 12);
|
78
|
+
buffer[o++] = x >> 16;
|
79
|
+
break;
|
80
|
+
}
|
81
|
+
case buffer.length: {
|
82
|
+
const x = (getByte(buffer[i - 3], alphabet) << 18) |
|
83
|
+
(getByte(buffer[i - 2], alphabet) << 12) |
|
84
|
+
(getByte(buffer[i - 1], alphabet) << 6);
|
85
|
+
buffer[o++] = x >> 16;
|
86
|
+
buffer[o++] = x >> 8 & 0xFF;
|
87
|
+
break;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
return o;
|
91
|
+
}
|
92
|
+
function getByte(char, alphabet) {
|
93
|
+
const byte = alphabet[char] ?? 64;
|
94
|
+
if (byte === 64) { // alphabet.Base64.length
|
95
|
+
throw new TypeError(`Cannot decode input as base64: Invalid character (${String.fromCharCode(char)})`);
|
96
|
+
}
|
97
|
+
return byte;
|
98
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
2
|
+
export function detach(buffer, maxSize) {
|
3
|
+
const originalSize = buffer.length;
|
4
|
+
if (buffer.byteOffset) {
|
5
|
+
const b = new Uint8Array(buffer.buffer);
|
6
|
+
b.set(buffer);
|
7
|
+
buffer = b.subarray(0, originalSize);
|
8
|
+
}
|
9
|
+
// deno-lint-ignore no-explicit-any
|
10
|
+
buffer = new Uint8Array(buffer.buffer.transfer(maxSize));
|
11
|
+
buffer.set(buffer.subarray(0, originalSize), maxSize - originalSize);
|
12
|
+
return [buffer, maxSize - originalSize];
|
13
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Utilities for
|
5
|
+
* {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-4 | base64}
|
6
|
+
* encoding and decoding.
|
7
|
+
*
|
8
|
+
* ```ts
|
9
|
+
* import {
|
10
|
+
* encodeBase64,
|
11
|
+
* decodeBase64,
|
12
|
+
* } from "@std/encoding/base64";
|
13
|
+
* import { assertEquals } from "@std/assert";
|
14
|
+
*
|
15
|
+
* const foobar = new TextEncoder().encode("foobar");
|
16
|
+
*
|
17
|
+
* assertEquals(encodeBase64(foobar), "Zm9vYmFy");
|
18
|
+
* assertEquals(decodeBase64("Zm9vYmFy"), foobar);
|
19
|
+
* ```
|
20
|
+
*
|
21
|
+
* @module
|
22
|
+
*/
|
23
|
+
import { calcMax, decode, encode } from "./_common64.js";
|
24
|
+
import { detach } from "./_common_detach.js";
|
25
|
+
const padding = "=".charCodeAt(0);
|
26
|
+
const alphabet = new TextEncoder()
|
27
|
+
.encode("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
|
28
|
+
const rAlphabet = new Uint8Array(128).fill(64); // alphabet.length
|
29
|
+
alphabet.forEach((byte, i) => rAlphabet[byte] = i);
|
30
|
+
/**
|
31
|
+
* Converts data into a base64-encoded string.
|
32
|
+
*
|
33
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-4}
|
34
|
+
*
|
35
|
+
* @param data The data to encode.
|
36
|
+
* @returns The base64-encoded string.
|
37
|
+
*
|
38
|
+
* @example Usage
|
39
|
+
* ```ts
|
40
|
+
* import { encodeBase64 } from "@std/encoding/base64";
|
41
|
+
* import { assertEquals } from "@std/assert";
|
42
|
+
*
|
43
|
+
* assertEquals(encodeBase64("foobar"), "Zm9vYmFy");
|
44
|
+
* ```
|
45
|
+
*/
|
46
|
+
export function encodeBase64(data) {
|
47
|
+
if (typeof data === "string") {
|
48
|
+
data = new TextEncoder().encode(data);
|
49
|
+
}
|
50
|
+
else if (data instanceof ArrayBuffer)
|
51
|
+
data = new Uint8Array(data).slice();
|
52
|
+
else
|
53
|
+
data = data.slice();
|
54
|
+
const [output, i] = detach(data, calcMax(data.length));
|
55
|
+
encode(output, i, 0, alphabet, padding);
|
56
|
+
return new TextDecoder().decode(output);
|
57
|
+
}
|
58
|
+
/**
|
59
|
+
* Decodes a base64-encoded string.
|
60
|
+
*
|
61
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-4}
|
62
|
+
*
|
63
|
+
* @param b64 The base64-encoded string to decode.
|
64
|
+
* @returns The decoded data.
|
65
|
+
*
|
66
|
+
* @example Usage
|
67
|
+
* ```ts
|
68
|
+
* import { decodeBase64 } from "@std/encoding/base64";
|
69
|
+
* import { assertEquals } from "@std/assert";
|
70
|
+
*
|
71
|
+
* assertEquals(
|
72
|
+
* decodeBase64("Zm9vYmFy"),
|
73
|
+
* new TextEncoder().encode("foobar")
|
74
|
+
* );
|
75
|
+
* ```
|
76
|
+
*/
|
77
|
+
export function decodeBase64(b64) {
|
78
|
+
const output = new TextEncoder().encode(b64);
|
79
|
+
// deno-lint-ignore no-explicit-any
|
80
|
+
return new Uint8Array(output.buffer
|
81
|
+
.transfer(decode(output, 0, 0, rAlphabet, padding)));
|
82
|
+
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
2
|
+
// This module is browser compatible.
|
3
|
+
/**
|
4
|
+
* Utilities for
|
5
|
+
* {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-5 | base64url}
|
6
|
+
* encoding and decoding.
|
7
|
+
*
|
8
|
+
* @module
|
9
|
+
*/
|
10
|
+
import { calcMax, decode, encode } from "./_common64.js";
|
11
|
+
import { detach } from "./_common_detach.js";
|
12
|
+
const padding = "=".charCodeAt(0);
|
13
|
+
const alphabet = new TextEncoder()
|
14
|
+
.encode("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_");
|
15
|
+
const rAlphabet = new Uint8Array(128).fill(64); // alphabet.length
|
16
|
+
alphabet.forEach((byte, i) => rAlphabet[byte] = i);
|
17
|
+
/**
|
18
|
+
* Convert data into a base64url-encoded string.
|
19
|
+
*
|
20
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-5}
|
21
|
+
*
|
22
|
+
* @param data The data to encode.
|
23
|
+
* @returns The base64url-encoded string.
|
24
|
+
*
|
25
|
+
* @example Usage
|
26
|
+
* ```ts
|
27
|
+
* import { encodeBase64Url } from "@std/encoding/base64url";
|
28
|
+
* import { assertEquals } from "@std/assert";
|
29
|
+
*
|
30
|
+
* assertEquals(encodeBase64Url("foobar"), "Zm9vYmFy");
|
31
|
+
* ```
|
32
|
+
*/
|
33
|
+
export function encodeBase64Url(data) {
|
34
|
+
if (typeof data === "string") {
|
35
|
+
data = new TextEncoder().encode(data);
|
36
|
+
}
|
37
|
+
else if (data instanceof ArrayBuffer)
|
38
|
+
data = new Uint8Array(data).slice();
|
39
|
+
else
|
40
|
+
data = data.slice();
|
41
|
+
const [output, i] = detach(data, calcMax(data.length));
|
42
|
+
let o = encode(output, i, 0, alphabet, padding);
|
43
|
+
o = output.indexOf(padding, o - 2);
|
44
|
+
return new TextDecoder().decode(
|
45
|
+
// deno-lint-ignore no-explicit-any
|
46
|
+
o > 0 ? new Uint8Array(output.buffer.transfer(o)) : output);
|
47
|
+
}
|
48
|
+
/**
|
49
|
+
* Decodes a given base64url-encoded string.
|
50
|
+
*
|
51
|
+
* @see {@link https://www.rfc-editor.org/rfc/rfc4648.html#section-5}
|
52
|
+
*
|
53
|
+
* @param b64url The base64url-encoded string to decode.
|
54
|
+
* @returns The decoded data.
|
55
|
+
*
|
56
|
+
* @example Usage
|
57
|
+
* ```ts
|
58
|
+
* import { decodeBase64Url } from "@std/encoding/base64url";
|
59
|
+
* import { assertEquals } from "@std/assert";
|
60
|
+
*
|
61
|
+
* assertEquals(
|
62
|
+
* decodeBase64Url("Zm9vYmFy"),
|
63
|
+
* new TextEncoder().encode("foobar")
|
64
|
+
* );
|
65
|
+
* ```
|
66
|
+
*/
|
67
|
+
export function decodeBase64Url(b64url) {
|
68
|
+
const output = new TextEncoder().encode(b64url);
|
69
|
+
// deno-lint-ignore no-explicit-any
|
70
|
+
return new Uint8Array(output.buffer
|
71
|
+
.transfer(decode(output, 0, 0, rAlphabet, padding)));
|
72
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
// Copyright 2009 The Go Authors. All rights reserved.
|
2
|
+
// https://github.com/golang/go/blob/master/LICENSE
|
3
|
+
// Copyright 2018-2025 the Deno authors. MIT license.
|
4
|
+
// This module is browser compatible.
|
5
|
+
/**
|
6
|
+
* Port of the Go
|
7
|
+
* {@link https://github.com/golang/go/blob/go1.12.5/src/encoding/hex/hex.go | encoding/hex}
|
8
|
+
* library.
|
9
|
+
*
|
10
|
+
* ```ts
|
11
|
+
* import {
|
12
|
+
* decodeHex,
|
13
|
+
* encodeHex,
|
14
|
+
* } from "@std/encoding/hex";
|
15
|
+
* import { assertEquals } from "@std/assert";
|
16
|
+
*
|
17
|
+
* assertEquals(encodeHex("abc"), "616263");
|
18
|
+
*
|
19
|
+
* assertEquals(
|
20
|
+
* decodeHex("616263"),
|
21
|
+
* new TextEncoder().encode("abc"),
|
22
|
+
* );
|
23
|
+
* ```
|
24
|
+
*
|
25
|
+
* @module
|
26
|
+
*/
|
27
|
+
import { calcMax, decode, encode } from "./_common16.js";
|
28
|
+
import { detach } from "./_common_detach.js";
|
29
|
+
const alphabet = new TextEncoder()
|
30
|
+
.encode("0123456789abcdef");
|
31
|
+
const rAlphabet = new Uint8Array(128).fill(16); // alphabet.length
|
32
|
+
alphabet.forEach((byte, i) => rAlphabet[byte] = i);
|
33
|
+
new TextEncoder()
|
34
|
+
.encode("ABCDEF")
|
35
|
+
.forEach((byte, i) => rAlphabet[byte] = i + 10);
|
36
|
+
/**
|
37
|
+
* Converts data into a hex-encoded string.
|
38
|
+
*
|
39
|
+
* @param src The data to encode.
|
40
|
+
*
|
41
|
+
* @returns The hex-encoded string.
|
42
|
+
*
|
43
|
+
* @example Usage
|
44
|
+
* ```ts
|
45
|
+
* import { encodeHex } from "@std/encoding/hex";
|
46
|
+
* import { assertEquals } from "@std/assert";
|
47
|
+
*
|
48
|
+
* assertEquals(encodeHex("abc"), "616263");
|
49
|
+
* ```
|
50
|
+
*/
|
51
|
+
export function encodeHex(src) {
|
52
|
+
if (typeof src === "string") {
|
53
|
+
src = new TextEncoder().encode(src);
|
54
|
+
}
|
55
|
+
else if (src instanceof ArrayBuffer)
|
56
|
+
src = new Uint8Array(src).slice();
|
57
|
+
else
|
58
|
+
src = src.slice();
|
59
|
+
const [output, i] = detach(src, calcMax(src.length));
|
60
|
+
encode(output, i, 0, alphabet);
|
61
|
+
return new TextDecoder().decode(output);
|
62
|
+
}
|
63
|
+
/**
|
64
|
+
* Decodes the given hex-encoded string. If the input is malformed, an error is
|
65
|
+
* thrown.
|
66
|
+
*
|
67
|
+
* @param src The hex-encoded string to decode.
|
68
|
+
*
|
69
|
+
* @returns The decoded data.
|
70
|
+
*
|
71
|
+
* @example Usage
|
72
|
+
* ```ts
|
73
|
+
* import { decodeHex } from "@std/encoding/hex";
|
74
|
+
* import { assertEquals } from "@std/assert";
|
75
|
+
*
|
76
|
+
* assertEquals(
|
77
|
+
* decodeHex("616263"),
|
78
|
+
* new TextEncoder().encode("abc"),
|
79
|
+
* );
|
80
|
+
* ```
|
81
|
+
*/
|
82
|
+
export function decodeHex(src) {
|
83
|
+
const output = new TextEncoder().encode(src);
|
84
|
+
// deno-lint-ignore no-explicit-any
|
85
|
+
return new Uint8Array(output.buffer
|
86
|
+
.transfer(decode(output, 0, 0, rAlphabet)));
|
87
|
+
}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
|
-
import { encodeHex } from "../deps/jsr.io/@std/encoding/1.0.
|
2
|
+
import { encodeHex } from "../deps/jsr.io/@std/encoding/1.0.8/hex.js";
|
3
3
|
/**
|
4
4
|
* Calculates the [partial follower collection digest][1].
|
5
5
|
*
|
6
|
-
* [1]: https://
|
6
|
+
* [1]: https://w3id.org/fep/8fcf#partial-follower-collection-digest
|
7
7
|
* @param uris The URIs to calculate the digest. Duplicate URIs are ignored.
|
8
8
|
* @returns The digest.
|
9
9
|
*/
|
@@ -27,7 +27,7 @@ export async function digest(uris) {
|
|
27
27
|
/**
|
28
28
|
* Builds [`Collection-Synchronization`][1] header content.
|
29
29
|
*
|
30
|
-
* [1]: https://
|
30
|
+
* [1]: https://w3id.org/fep/8fcf#the-collection-synchronization-http-header
|
31
31
|
*
|
32
32
|
* @param collectionId The sender's followers collection URI.
|
33
33
|
* @param actorIds The actor URIs to digest.
|
@@ -77,7 +77,9 @@ export async function handleCollection(request, { name, identifier, uriGetter, f
|
|
77
77
|
const baseUri = uriGetter(identifier);
|
78
78
|
if (cursor == null) {
|
79
79
|
const firstCursor = await collectionCallbacks.firstCursor?.(context, identifier);
|
80
|
-
const totalItems =
|
80
|
+
const totalItems = filter == null
|
81
|
+
? await collectionCallbacks.counter?.(context, identifier)
|
82
|
+
: undefined;
|
81
83
|
if (firstCursor == null) {
|
82
84
|
const page = await collectionCallbacks.dispatcher(context, identifier, null, filter);
|
83
85
|
if (page == null)
|
@@ -166,7 +168,8 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
166
168
|
if (!logged) {
|
167
169
|
getLogger(["fedify", "federation", "collection"]).warn(`The ${collectionName} collection apparently does not implement ` +
|
168
170
|
"filtering. This may result in a large response payload. " +
|
169
|
-
"Please consider implementing filtering for the collection."
|
171
|
+
"Please consider implementing filtering for the collection. " +
|
172
|
+
"See also: https://fedify.dev/manual/collections#filtering-by-server");
|
170
173
|
logged = true;
|
171
174
|
}
|
172
175
|
continue;
|
@@ -1126,13 +1126,24 @@ export class FederationImpl {
|
|
1126
1126
|
case "followers": {
|
1127
1127
|
let baseUrl = url.searchParams.get("base-url");
|
1128
1128
|
if (baseUrl != null) {
|
1129
|
-
|
1130
|
-
|
1129
|
+
try {
|
1130
|
+
baseUrl = `${new URL(baseUrl).origin}/`;
|
1131
|
+
}
|
1132
|
+
catch {
|
1133
|
+
// If base-url is invalid, set to null to behave as if it wasn't provided
|
1134
|
+
baseUrl = null;
|
1135
|
+
}
|
1131
1136
|
}
|
1132
1137
|
return await handleCollection(request, {
|
1133
1138
|
name: "followers",
|
1134
1139
|
identifier: route.values.identifier ?? route.values.handle,
|
1135
|
-
uriGetter:
|
1140
|
+
uriGetter: baseUrl == null
|
1141
|
+
? context.getFollowersUri.bind(context)
|
1142
|
+
: (identifier) => {
|
1143
|
+
const uri = context.getFollowersUri(identifier);
|
1144
|
+
uri.searchParams.set("base-url", baseUrl);
|
1145
|
+
return uri;
|
1146
|
+
},
|
1136
1147
|
context,
|
1137
1148
|
filter: baseUrl != null ? new URL(baseUrl) : undefined,
|
1138
1149
|
filterPredicate: baseUrl != null
|
@@ -1646,6 +1657,12 @@ export class ContextImpl {
|
|
1646
1657
|
throw new Error("No first cursor dispatcher registered for followers collection.");
|
1647
1658
|
}
|
1648
1659
|
let cursor = await this.federation.followersCallbacks.firstCursor(this, identifier);
|
1660
|
+
if (cursor != null) {
|
1661
|
+
getLogger(["fedify", "federation", "outbox"]).warn("Since the followers collection dispatcher returned null for no " +
|
1662
|
+
"cursor (i.e., one-shot dispatcher), the pagination is used to fetch " +
|
1663
|
+
'"followers". However, it is recommended to implement the one-shot ' +
|
1664
|
+
"dispatcher for better performance.", { identifier });
|
1665
|
+
}
|
1649
1666
|
while (cursor != null) {
|
1650
1667
|
const result = await this.federation.followersCallbacks.dispatcher(this, identifier, cursor);
|
1651
1668
|
if (result == null)
|
package/esm/runtime/key.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
2
|
import { createPublicKey } from "node:crypto";
|
3
3
|
import { concat } from "../deps/jsr.io/@std/bytes/1.0.5/concat.js";
|
4
|
-
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/1.0.
|
5
|
-
import { decodeBase64Url } from "../deps/jsr.io/@std/encoding/1.0.
|
6
|
-
import { decodeHex } from "../deps/jsr.io/@std/encoding/1.0.
|
4
|
+
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/1.0.8/base64.js";
|
5
|
+
import { decodeBase64Url } from "../deps/jsr.io/@std/encoding/1.0.8/base64url.js";
|
6
|
+
import { decodeHex } from "../deps/jsr.io/@std/encoding/1.0.8/hex.js";
|
7
7
|
import { Integer, Sequence } from "asn1js";
|
8
8
|
import { decode, encode } from "multibase";
|
9
9
|
import { addPrefix, getCodeFromData, rmPrefix } from "multicodec";
|
package/esm/sig/http.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
2
|
import { getLogger } from "@logtape/logtape";
|
3
3
|
import { equals } from "../deps/jsr.io/@std/bytes/1.0.5/mod.js";
|
4
|
-
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/1.0.
|
4
|
+
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/1.0.8/base64.js";
|
5
5
|
import { CryptographicKey } from "../vocab/vocab.js";
|
6
6
|
import { fetchKey, validateCryptoKey } from "./key.js";
|
7
7
|
/**
|
package/esm/sig/ld.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
2
|
import { getLogger } from "@logtape/logtape";
|
3
|
-
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/1.0.
|
4
|
-
import { encodeHex } from "../deps/jsr.io/@std/encoding/1.0.
|
3
|
+
import { decodeBase64, encodeBase64 } from "../deps/jsr.io/@std/encoding/1.0.8/base64.js";
|
4
|
+
import { encodeHex } from "../deps/jsr.io/@std/encoding/1.0.8/hex.js";
|
5
5
|
// @ts-ignore TS7016
|
6
6
|
import jsonld from "jsonld";
|
7
7
|
import { fetchDocumentLoader, } from "../runtime/docloader.js";
|
package/esm/vocab/lookup.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
2
|
import { getLogger } from "@logtape/logtape";
|
3
|
-
import { delay } from "../deps/jsr.io/@std/async/1.0.
|
3
|
+
import { delay } from "../deps/jsr.io/@std/async/1.0.12/delay.js";
|
4
4
|
import { fetchDocumentLoader, } from "../runtime/docloader.js";
|
5
5
|
import { lookupWebFinger } from "../webfinger/lookup.js";
|
6
6
|
import { Object } from "./vocab.js";
|
package/esm/webfinger/handler.js
CHANGED
@@ -34,7 +34,14 @@ export async function handleWebFinger(request, { context, actorDispatcher, actor
|
|
34
34
|
const uriParsed = context.parseUri(resourceUrl);
|
35
35
|
if (uriParsed?.type != "actor") {
|
36
36
|
const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
|
37
|
-
if (match == null
|
37
|
+
if (match == null)
|
38
|
+
return await onNotFound(request);
|
39
|
+
const portMatch = /:\d+$/.exec(match[2]);
|
40
|
+
const normalizedHost = portMatch == null
|
41
|
+
? domainToASCII(match[2].toLowerCase())
|
42
|
+
: domainToASCII(match[2].substring(0, portMatch.index).toLowerCase()) +
|
43
|
+
portMatch[0];
|
44
|
+
if (normalizedHost != context.url.host) {
|
38
45
|
return await onNotFound(request);
|
39
46
|
}
|
40
47
|
const username = match[1];
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/async/1.0.
|
1
|
+
{"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/async/1.0.12/delay.ts"],"names":[],"mappings":";AAMA,MAAM,WAAW,YAAY;IAC3B,sCAAsC;IACtC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2B3E"}
|