@fedify/fedify 0.8.0-dev.156 → 0.8.0-dev.162

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of @fedify/fedify might be problematic. Click here for more details.

package/README.md CHANGED
@@ -35,13 +35,12 @@ If you want to know more about the project, please take a look at the following
35
35
  resources:
36
36
 
37
37
  - [Tutorial](https://fedify.dev/tutorial)
38
- - [Manual](https://fedify.dev/manual)
39
- ([Unstable](https://unstable.fedify.dev/manual))
40
38
  - [API reference][JSR]
41
39
  - [Examples](https://github.com/dahlia/fedify/tree/main/examples)
42
40
 
43
41
  If you have any questions, suggestions, or feedback, please feel free to
44
- join our [Matrix chat space][Matrix] or [GitHub Discussions].
42
+ join our [Matrix chat space][Matrix] or [GitHub Discussions]. Or tag
43
+ [#Fedify] in the fediverse!
45
44
 
46
45
  [^1]: You may already know some of the networks in the fediverse, such as
47
46
  [Mastodon], [Lemmy], [Pixelfed], [PeerTube], and so on.
@@ -64,6 +63,7 @@ join our [Matrix chat space][Matrix] or [GitHub Discussions].
64
63
  [HTTP Signatures]: https://tools.ietf.org/html/draft-cavage-http-signatures-12
65
64
  [NodeInfo]: https://nodeinfo.diaspora.software/
66
65
  [GitHub Discussions]: https://github.com/dahlia/fedify/discussions
66
+ [#Fedify]: https://elk.zone/mastodon.social/tags/fedify
67
67
  [Mastodon]: https://joinmastodon.org/
68
68
  [Lemmy]: https://join-lemmy.org/
69
69
  [Pixelfed]: https://pixelfed.org/
package/esm/mod.js CHANGED
@@ -25,8 +25,6 @@
25
25
  *
26
26
  * - [GitHub](https://github.com/dahlia/fedify)
27
27
  * - [Tutorial](https://fedify.dev/tutorial)
28
- * - [Manual](https://fedify.dev/manual)
29
- * ([Unstable](https://unstable.fedify.dev/manual))
30
28
  * - [Examples](https://github.com/dahlia/fedify/tree/main/examples)
31
29
  *
32
30
  * [ActivityPub]: https://www.w3.org/TR/activitypub/
@@ -28,7 +28,7 @@ function createRequest(url) {
28
28
  headers: {
29
29
  Accept: "application/activity+json, application/ld+json",
30
30
  },
31
- redirect: "follow",
31
+ redirect: "manual",
32
32
  });
33
33
  }
34
34
  function logRequest(request) {
@@ -68,6 +68,11 @@ export async function fetchDocumentLoader(url) {
68
68
  const request = createRequest(url);
69
69
  logRequest(request);
70
70
  const response = await fetch(request);
71
+ // Follow redirects manually to get the final URL:
72
+ if (response.status >= 300 && response.status < 400 &&
73
+ response.headers.has("Location")) {
74
+ return fetchDocumentLoader(response.headers.get("Location"));
75
+ }
71
76
  return getRemoteDocument(url, response);
72
77
  }
73
78
  /**
@@ -82,13 +87,19 @@ export async function fetchDocumentLoader(url) {
82
87
  */
83
88
  export function getAuthenticatedDocumentLoader(identity) {
84
89
  validateCryptoKey(identity.privateKey);
85
- return async (url) => {
90
+ async function load(url) {
86
91
  let request = createRequest(url);
87
92
  request = await sign(request, identity.privateKey, identity.keyId);
88
93
  logRequest(request);
89
94
  const response = await fetch(request);
95
+ // Follow redirects manually to get the final URL:
96
+ if (response.status >= 300 && response.status < 400 &&
97
+ response.headers.has("Location")) {
98
+ return load(response.headers.get("Location"));
99
+ }
90
100
  return getRemoteDocument(url, response);
91
- };
101
+ }
102
+ return load;
92
103
  }
93
104
  /**
94
105
  * Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "0.8.0-dev.156+1ac72062",
3
+ "version": "0.8.0-dev.162+2daab895",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
package/types/mod.d.ts CHANGED
@@ -25,8 +25,6 @@
25
25
  *
26
26
  * - [GitHub](https://github.com/dahlia/fedify)
27
27
  * - [Tutorial](https://fedify.dev/tutorial)
28
- * - [Manual](https://fedify.dev/manual)
29
- * ([Unstable](https://unstable.fedify.dev/manual))
30
28
  * - [Examples](https://github.com/dahlia/fedify/tree/main/examples)
31
29
  *
32
30
  * [ActivityPub]: https://www.w3.org/TR/activitypub/
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,eAAe,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"docloader.d.ts","sourceRoot":"","sources":["../../src/runtime/docloader.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAM1D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;AAEtE;;;;;;;;GAQG;AACH,MAAM,MAAM,kCAAkC,GAAG,CAC/C,QAAQ,EAAE;IAAE,KAAK,EAAE,GAAG,CAAC;IAA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