@fedify/relay 2.0.15-dev.968 → 2.0.16

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.
@@ -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-BKN3G0Tb.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-Cs1iQQgS.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";
@@ -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-BKN3G0Tb.js";
4
+ import { n as exportSpki, r as getDocumentLoader, t as isRelayFollowerData } from "./types-Cs1iQQgS.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";
@@ -25514,7 +25514,7 @@ const preloadedContexts = {
25514
25514
  } }
25515
25515
  };
25516
25516
  var name = "@fedify/vocab-runtime";
25517
- var version = "2.0.15-dev.968+1cb9a6b2";
25517
+ var version = "2.0.16";
25518
25518
  const parametersNeedLowerCase = ["rel", "type"];
25519
25519
  const regexpLinkWhitespace = /[\n\r\s\t]/;
25520
25520
  function validateURI(uri) {
@@ -25769,8 +25769,13 @@ async function validatePublicUrl(url) {
25769
25769
  const parsed = new URL(url);
25770
25770
  if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new UrlError(`Unsupported protocol: ${parsed.protocol}`);
25771
25771
  let hostname = parsed.hostname;
25772
- if (hostname.startsWith("[") && hostname.endsWith("]")) hostname = hostname.substring(1, hostname.length - 2);
25772
+ if (hostname.startsWith("[") && hostname.endsWith("]")) hostname = hostname.slice(1, -1);
25773
25773
  if (hostname === "localhost") throw new UrlError("Localhost is not allowed");
25774
+ const hostnameFamily = isIP(hostname);
25775
+ if (hostnameFamily !== 0) {
25776
+ validatePublicIpAddress(hostname, hostnameFamily);
25777
+ return;
25778
+ }
25774
25779
  if ("Deno" in globalThis && !isIP(hostname)) {
25775
25780
  if ((await Deno.permissions.query({ name: "net" })).state !== "granted") return;
25776
25781
  }
@@ -25784,7 +25789,11 @@ async function validatePublicUrl(url) {
25784
25789
  } catch {
25785
25790
  addresses = [];
25786
25791
  }
25787
- for (const { address, family } of addresses) if (family === 4 && !isValidPublicIPv4Address(address) || family === 6 && !isValidPublicIPv6Address(address) || family < 4 || family === 5 || family > 6) throw new UrlError(`Invalid or private address: ${address}`);
25792
+ for (const { address, family } of addresses) validatePublicIpAddress(address, family);
25793
+ }
25794
+ function validatePublicIpAddress(address, family) {
25795
+ if (family === 4 && isValidPublicIPv4Address(address) || family === 6 && isValidPublicIPv6Address(address)) return;
25796
+ throw new UrlError(`Invalid or private address: ${address}`);
25788
25797
  }
25789
25798
  function isValidPublicIPv4Address(address) {
25790
25799
  const parts = address.split(".");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/relay",
3
- "version": "2.0.15-dev.968+1cb9a6b2",
3
+ "version": "2.0.16",
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.0.0",
53
- "@fedify/fedify": "^2.0.15-dev.968+1cb9a6b2",
54
- "@fedify/vocab": "2.0.15-dev.968+1cb9a6b2"
53
+ "@fedify/vocab": "2.0.16",
54
+ "@fedify/fedify": "^2.0.16"
55
55
  },
56
56
  "devDependencies": {
57
57
  "tsdown": "^0.21.6",
58
58
  "typescript": "^5.9.2",
59
59
  "urlpattern-polyfill": "^10.1.0",
60
- "@fedify/vocab-runtime": "^2.0.15-dev.968+1cb9a6b2"
60
+ "@fedify/vocab-runtime": "^2.0.16"
61
61
  },
62
62
  "scripts": {
63
63
  "build:self": "tsdown",