@fedify/fedify 0.15.0-dev.377 → 0.15.0-dev.381

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGES.md CHANGED
@@ -29,6 +29,16 @@ To be released.
29
29
  object.
30
30
 
31
31
 
32
+ Version 0.14.4
33
+ --------------
34
+
35
+ Released on September 6, 2024.
36
+
37
+ - Fixed a bug of `Object.fromJsonLd()` method where it had thrown
38
+ a `TypeError` when the given JSON-LD object had an `@id` property
39
+ with an empty string.
40
+
41
+
32
42
  Version 0.14.3
33
43
  --------------
34
44
 
@@ -154,6 +164,16 @@ Released on August 27, 2024.
154
164
  [#115]: https://github.com/dahlia/fedify/issues/115
155
165
 
156
166
 
167
+ Version 0.13.5
168
+ --------------
169
+
170
+ Released on September 6, 2024.
171
+
172
+ - Fixed a bug of `Object.fromJsonLd()` method where it had thrown
173
+ a `TypeError` when the given JSON-LD object had an `@id` property
174
+ with an empty string.
175
+
176
+
157
177
  Version 0.13.4
158
178
  --------------
159
179
 
@@ -43,6 +43,7 @@ function logRequest(request) {
43
43
  }
44
44
  async function getRemoteDocument(url, response, fetch) {
45
45
  const documentUrl = response.url === "" ? url : response.url;
46
+ const docUrl = new URL(documentUrl);
46
47
  if (!response.ok) {
47
48
  logger.error("Failed to fetch document: {status} {url} {headers}", {
48
49
  status: response.status,
@@ -54,6 +55,7 @@ async function getRemoteDocument(url, response, fetch) {
54
55
  const contentType = response.headers.get("Content-Type");
55
56
  const jsonLd = contentType == null ||
56
57
  contentType === "application/activity+json" ||
58
+ contentType.startsWith("application/activity+json;") ||
57
59
  contentType === "application/ld+json" ||
58
60
  contentType.startsWith("application/ld+json;");
59
61
  const linkHeader = response.headers.get("Link");
@@ -75,7 +77,8 @@ async function getRemoteDocument(url, response, fetch) {
75
77
  if ("type" in params &&
76
78
  (params.type === "application/activity+json" ||
77
79
  params.type === "application/ld+json" ||
78
- params.type.startsWith("application/ld+json;"))) {
80
+ params.type.startsWith("application/ld+json;")) &&
81
+ new URL(uri).href !== docUrl.href) {
79
82
  logger.debug("Found alternate document: {alternateUrl} from {url}", { alternateUrl: uri, url: documentUrl });
80
83
  return await fetch(uri);
81
84
  }
@@ -103,9 +106,10 @@ async function getRemoteDocument(url, response, fetch) {
103
106
  }
104
107
  if (attribs.rel === "alternate" && "type" in attribs && (attribs.type === "application/activity+json" ||
105
108
  attribs.type === "application/ld+json" ||
106
- attribs.type.startsWith("application/ld+json;")) && "href" in attribs) {
109
+ attribs.type.startsWith("application/ld+json;")) && "href" in attribs &&
110
+ new URL(attribs.href, docUrl).href !== docUrl.href) {
107
111
  logger.debug("Found alternate document: {alternateUrl} from {url}", { alternateUrl: attribs.href, url: documentUrl });
108
- return await fetch(attribs.href);
112
+ return await fetch(new URL(attribs.href, docUrl).href);
109
113
  }
110
114
  }
111
115
  }
@@ -4695,7 +4695,8 @@ export class Object {
4695
4695
  if (v == null)
4696
4696
  continue;
4697
4697
  const decoded = typeof v === "object" && "@id" in v &&
4698
- typeof v["@id"] === "string"
4698
+ typeof v["@id"] === "string" &&
4699
+ v["@id"] !== "" && v["@id"] !== "/"
4699
4700
  ? new URL(v["@id"])
4700
4701
  : typeof v === "object" && "@type" in v &&
4701
4702
  Array.isArray(v["@type"]) &&
@@ -28989,7 +28990,8 @@ export class Place extends Object {
28989
28990
  v["@value"] == "m" || v["@value"] == "miles")
28990
28991
  ? v["@value"]
28991
28992
  : typeof v === "object" && "@id" in v &&
28992
- typeof v["@id"] === "string"
28993
+ typeof v["@id"] === "string" &&
28994
+ v["@id"] !== "" && v["@id"] !== "/"
28993
28995
  ? new URL(v["@id"])
28994
28996
  : undefined;
28995
28997
  if (typeof decoded === "undefined")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "0.15.0-dev.377+2711ed19",
3
+ "version": "0.15.0-dev.381+af99094c",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -1 +1 @@
1
- {"version":3,"file":"docloader.d.ts","sourceRoot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