@fedify/relay 2.3.0-dev.1190 → 2.3.0-dev.1213
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/litepub.test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-
|
|
4
|
+
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-CMAF8MjM.js";
|
|
5
5
|
import { MemoryKvStore, signRequest } from "@fedify/fedify";
|
|
6
6
|
import { createRelay } from "@fedify/relay";
|
|
7
7
|
import { Accept, Announce, Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
|
package/dist/mastodon.test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-
|
|
4
|
+
import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-CMAF8MjM.js";
|
|
5
5
|
import { MemoryKvStore, signRequest } from "@fedify/fedify";
|
|
6
6
|
import { createRelay } from "@fedify/relay";
|
|
7
7
|
import { Create, Delete, Follow, Move, Note, Person, Undo, Update } from "@fedify/vocab";
|
|
@@ -25931,7 +25931,7 @@ const preloadedContexts = {
|
|
|
25931
25931
|
} }
|
|
25932
25932
|
};
|
|
25933
25933
|
var name = "@fedify/vocab-runtime";
|
|
25934
|
-
var version = "2.3.0-dev.
|
|
25934
|
+
var version = "2.3.0-dev.1213+8ffffeb8";
|
|
25935
25935
|
const parametersNeedLowerCase = ["rel", "type"];
|
|
25936
25936
|
const regexpLinkWhitespace = /[\n\r\s\t]/;
|
|
25937
25937
|
function validateURI(uri) {
|
|
@@ -26219,29 +26219,137 @@ function validatePublicIpAddress(address, family) {
|
|
|
26219
26219
|
throw new UrlError(`Invalid or private address: ${address}`);
|
|
26220
26220
|
}
|
|
26221
26221
|
function isValidPublicIPv4Address(address) {
|
|
26222
|
-
const parts = address
|
|
26223
|
-
|
|
26224
|
-
|
|
26225
|
-
|
|
26226
|
-
if (first === 169 && second === 254) return false;
|
|
26227
|
-
if (first === 172 && second >= 16 && second <= 31) return false;
|
|
26228
|
-
if (first === 192 && second === 168) return false;
|
|
26229
|
-
return true;
|
|
26222
|
+
const parts = parseIPv4Address(address);
|
|
26223
|
+
if (parts == null) return false;
|
|
26224
|
+
const value = ipv4PartsToNumber(parts);
|
|
26225
|
+
return !nonPublicIPv4Prefixes.some(({ base, prefix }) => matchesIPv4Prefix(value, base, prefix));
|
|
26230
26226
|
}
|
|
26231
26227
|
function isValidPublicIPv6Address(address) {
|
|
26232
|
-
|
|
26233
|
-
if (
|
|
26234
|
-
|
|
26235
|
-
|
|
26228
|
+
const words = parseIPv6Address(address);
|
|
26229
|
+
if (words == null) return false;
|
|
26230
|
+
if (nonPublicIPv6Prefixes.some(({ words: prefixWords, prefix }) => matchesIPv6Prefix(words, prefixWords, prefix))) return false;
|
|
26231
|
+
for (const { extractIPv4, prefix, words: prefixWords } of ipv6WithIPv4Prefixes) {
|
|
26232
|
+
if (!matchesIPv6Prefix(words, prefixWords, prefix)) continue;
|
|
26233
|
+
const ipv4Address = extractIPv4(words);
|
|
26234
|
+
if (ipv4Address != null && !isValidPublicIPv4Address(ipv4Address)) return false;
|
|
26235
|
+
}
|
|
26236
|
+
return true;
|
|
26236
26237
|
}
|
|
26237
26238
|
function expandIPv6Address(address) {
|
|
26238
26239
|
address = address.toLowerCase();
|
|
26240
|
+
const ipv4Delimiter = address.lastIndexOf(":");
|
|
26241
|
+
if (address.includes(".") && ipv4Delimiter >= 0) {
|
|
26242
|
+
const ipv4Parts = parseIPv4Address(address.substring(ipv4Delimiter + 1));
|
|
26243
|
+
if (ipv4Parts == null) return address;
|
|
26244
|
+
const high = (ipv4Parts[0] << 8) + ipv4Parts[1];
|
|
26245
|
+
const low = (ipv4Parts[2] << 8) + ipv4Parts[3];
|
|
26246
|
+
address = address.substring(0, ipv4Delimiter + 1) + high.toString(16) + ":" + low.toString(16);
|
|
26247
|
+
}
|
|
26239
26248
|
if (address === "::") return "0000:0000:0000:0000:0000:0000:0000:0000";
|
|
26240
26249
|
if (address.startsWith("::")) address = "0000" + address;
|
|
26241
26250
|
if (address.endsWith("::")) address = address + "0000";
|
|
26242
26251
|
address = address.replace("::", ":0000".repeat(8 - (address.match(/:/g) || []).length) + ":");
|
|
26243
26252
|
return address.split(":").map((part) => part.padStart(4, "0")).join(":");
|
|
26244
26253
|
}
|
|
26254
|
+
const nonPublicIPv4Prefixes = [
|
|
26255
|
+
ipv4Prefix("0.0.0.0/8", "RFC 6890"),
|
|
26256
|
+
ipv4Prefix("10.0.0.0/8", "RFC 1918"),
|
|
26257
|
+
ipv4Prefix("100.64.0.0/10", "RFC 6598"),
|
|
26258
|
+
ipv4Prefix("127.0.0.0/8", "RFC 1122"),
|
|
26259
|
+
ipv4Prefix("169.254.0.0/16", "RFC 3927"),
|
|
26260
|
+
ipv4Prefix("172.16.0.0/12", "RFC 1918"),
|
|
26261
|
+
ipv4Prefix("192.0.0.0/24", "RFC 6890"),
|
|
26262
|
+
ipv4Prefix("192.0.2.0/24", "RFC 5737"),
|
|
26263
|
+
ipv4Prefix("192.88.99.0/24", "RFC 7526"),
|
|
26264
|
+
ipv4Prefix("192.168.0.0/16", "RFC 1918"),
|
|
26265
|
+
ipv4Prefix("198.18.0.0/15", "RFC 2544"),
|
|
26266
|
+
ipv4Prefix("198.51.100.0/24", "RFC 5737"),
|
|
26267
|
+
ipv4Prefix("203.0.113.0/24", "RFC 5737"),
|
|
26268
|
+
ipv4Prefix("224.0.0.0/4", "RFC 5771"),
|
|
26269
|
+
ipv4Prefix("240.0.0.0/4", "RFC 1112")
|
|
26270
|
+
];
|
|
26271
|
+
const nonPublicIPv6Prefixes = [
|
|
26272
|
+
ipv6Prefix("::/16", "RFC 4291"),
|
|
26273
|
+
ipv6Prefix("2001::/32", "RFC 4380"),
|
|
26274
|
+
ipv6Prefix("2002::/16", "RFC 3056"),
|
|
26275
|
+
ipv6Prefix("64:ff9b:1::/48", "RFC 8215"),
|
|
26276
|
+
ipv6Prefix("fc00::/7", "RFC 4193"),
|
|
26277
|
+
ipv6Prefix("fe80::/10", "RFC 4291"),
|
|
26278
|
+
ipv6Prefix("ff00::/8", "RFC 4291")
|
|
26279
|
+
];
|
|
26280
|
+
const ipv6WithIPv4Prefixes = [{
|
|
26281
|
+
...ipv6Prefix("64:ff9b::/96", "RFC 6052"),
|
|
26282
|
+
extractIPv4: (words) => ipv4FromWords(words[6], words[7])
|
|
26283
|
+
}];
|
|
26284
|
+
function ipv4Prefix(cidr, rfc) {
|
|
26285
|
+
const [address, prefixText] = cidr.split("/");
|
|
26286
|
+
const prefix = parseInt(prefixText, 10);
|
|
26287
|
+
const parts = parseIPv4Address(address);
|
|
26288
|
+
if (parts == null || !Number.isInteger(prefix) || prefix < 0 || prefix > 32) throw new Error(`Invalid IPv4 prefix: ${cidr}`);
|
|
26289
|
+
return {
|
|
26290
|
+
cidr,
|
|
26291
|
+
base: ipv4PartsToNumber(parts),
|
|
26292
|
+
prefix,
|
|
26293
|
+
rfc
|
|
26294
|
+
};
|
|
26295
|
+
}
|
|
26296
|
+
function ipv6Prefix(cidr, rfc) {
|
|
26297
|
+
const [address, prefixText] = cidr.split("/");
|
|
26298
|
+
const prefix = parseInt(prefixText, 10);
|
|
26299
|
+
const words = parseIPv6Address(address);
|
|
26300
|
+
if (words == null || !Number.isInteger(prefix) || prefix < 0 || prefix > 128) throw new Error(`Invalid IPv6 prefix: ${cidr}`);
|
|
26301
|
+
return {
|
|
26302
|
+
cidr,
|
|
26303
|
+
words,
|
|
26304
|
+
prefix,
|
|
26305
|
+
rfc
|
|
26306
|
+
};
|
|
26307
|
+
}
|
|
26308
|
+
function parseIPv4Address(address) {
|
|
26309
|
+
const parts = address.split(".").map((part) => {
|
|
26310
|
+
if (!/^\d+$/.test(part)) return NaN;
|
|
26311
|
+
return parseInt(part, 10);
|
|
26312
|
+
});
|
|
26313
|
+
if (parts.length !== 4 || parts.some((part) => !Number.isInteger(part) || part < 0 || part > 255)) return null;
|
|
26314
|
+
return parts;
|
|
26315
|
+
}
|
|
26316
|
+
function parseIPv6Address(address) {
|
|
26317
|
+
const parts = expandIPv6Address(address).split(":");
|
|
26318
|
+
if (parts.length !== 8) return null;
|
|
26319
|
+
const words = parts.map((part) => {
|
|
26320
|
+
if (!/^[0-9a-f]{1,4}$/i.test(part)) return NaN;
|
|
26321
|
+
return parseInt(part, 16);
|
|
26322
|
+
});
|
|
26323
|
+
if (words.some((word) => !Number.isInteger(word) || word < 0 || word > 65535)) return null;
|
|
26324
|
+
return words;
|
|
26325
|
+
}
|
|
26326
|
+
function ipv4PartsToNumber(parts) {
|
|
26327
|
+
return parts[0] * 2 ** 24 + parts[1] * 2 ** 16 + parts[2] * 2 ** 8 + parts[3];
|
|
26328
|
+
}
|
|
26329
|
+
function ipv4FromWords(highWord, lowWord) {
|
|
26330
|
+
return [
|
|
26331
|
+
highWord >> 8,
|
|
26332
|
+
highWord & 255,
|
|
26333
|
+
lowWord >> 8,
|
|
26334
|
+
lowWord & 255
|
|
26335
|
+
].join(".");
|
|
26336
|
+
}
|
|
26337
|
+
function matchesIPv4Prefix(address, prefixBase, prefixLength) {
|
|
26338
|
+
const blockSize = 2 ** (32 - prefixLength);
|
|
26339
|
+
return Math.floor(address / blockSize) === Math.floor(prefixBase / blockSize);
|
|
26340
|
+
}
|
|
26341
|
+
function matchesIPv6Prefix(address, prefixWords, prefixLength) {
|
|
26342
|
+
let remaining = prefixLength;
|
|
26343
|
+
for (let i = 0; i < 8 && remaining > 0; i++) if (remaining >= 16) {
|
|
26344
|
+
if (address[i] !== prefixWords[i]) return false;
|
|
26345
|
+
remaining -= 16;
|
|
26346
|
+
} else {
|
|
26347
|
+
const mask = 65535 << 16 - remaining & 65535;
|
|
26348
|
+
if ((address[i] & mask) !== (prefixWords[i] & mask)) return false;
|
|
26349
|
+
remaining = 0;
|
|
26350
|
+
}
|
|
26351
|
+
return true;
|
|
26352
|
+
}
|
|
26245
26353
|
const logger = getLogger([
|
|
26246
26354
|
"fedify",
|
|
26247
26355
|
"runtime",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/relay",
|
|
3
|
-
"version": "2.3.0-dev.
|
|
3
|
+
"version": "2.3.0-dev.1213+8ffffeb8",
|
|
4
4
|
"description": "ActivityPub relay support for Fedify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Fedify",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"dependencies": {
|
|
51
51
|
"@js-temporal/polyfill": "^0.5.1",
|
|
52
52
|
"@logtape/logtape": "^2.1.0",
|
|
53
|
-
"@fedify/
|
|
54
|
-
"@fedify/
|
|
53
|
+
"@fedify/fedify": "^2.3.0-dev.1213+8ffffeb8",
|
|
54
|
+
"@fedify/vocab": "2.3.0-dev.1213+8ffffeb8"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"tsdown": "^0.22.0",
|
|
58
58
|
"typescript": "^6.0.0",
|
|
59
59
|
"urlpattern-polyfill": "^10.1.0",
|
|
60
|
-
"@fedify/vocab-runtime": "^2.3.0-dev.
|
|
60
|
+
"@fedify/vocab-runtime": "^2.3.0-dev.1213+8ffffeb8"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"build:self": "tsdown",
|