@fedify/fedify 0.8.0-dev.154 → 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/CHANGES.md CHANGED
@@ -8,8 +8,9 @@ Version 0.8.0
8
8
 
9
9
  To be released.
10
10
 
11
- - The CLI toolchain is now available on JSR: [@fedify/cli]. You can install
12
- it with `deno install -A -n fedify jsr:@fedify/cli`.
11
+ - The CLI toolchain for testing and debugging is now available on JSR:
12
+ [@fedify/cli]. You can install it with
13
+ `deno install -A -n fedify jsr:@fedify/cli`.
13
14
 
14
15
  - Implemented [followers collection synchronization mechanism][FEP-8fcf].
15
16
 
package/README.md CHANGED
@@ -19,33 +19,28 @@ It aims to eliminate the complexity and redundant boilerplate code when
19
19
  building a federated server app, so that you can focus on your business logic
20
20
  and user experience.
21
21
 
22
- Currently, Fedify is moving fast and the API is not stable yet. We do not
23
- recommend using it in production yet, so please use it if you would like to
24
- experiment with it and help us improve it.
25
-
26
- The rough roadmap is to implement the following features out of the box:
22
+ Currently, Fedify provides the following features out of the box:
27
23
 
28
24
  - Type-safe objects for [Activity Vocabulary] (including some vendor-specific
29
25
  extensions)
30
26
  - [WebFinger] client and server
31
27
  - [HTTP Signatures]
32
28
  - Middlewares for handling webhooks
33
- - [ActivityPub] client
34
29
  - [NodeInfo] protocol
35
30
  - Special touch for interoperability with Mastodon and few other popular
36
31
  fediverse software
32
+ - CLI toolchain for testing and debugging
37
33
 
38
34
  If you want to know more about the project, please take a look at the following
39
35
  resources:
40
36
 
41
37
  - [Tutorial](https://fedify.dev/tutorial)
42
- - [Manual](https://fedify.dev/manual)
43
- ([Unstable](https://unstable.fedify.dev/manual))
44
38
  - [API reference][JSR]
45
39
  - [Examples](https://github.com/dahlia/fedify/tree/main/examples)
46
40
 
47
41
  If you have any questions, suggestions, or feedback, please feel free to
48
- 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!
49
44
 
50
45
  [^1]: You may already know some of the networks in the fediverse, such as
51
46
  [Mastodon], [Lemmy], [Pixelfed], [PeerTube], and so on.
@@ -68,6 +63,7 @@ join our [Matrix chat space][Matrix] or [GitHub Discussions].
68
63
  [HTTP Signatures]: https://tools.ietf.org/html/draft-cavage-http-signatures-12
69
64
  [NodeInfo]: https://nodeinfo.diaspora.software/
70
65
  [GitHub Discussions]: https://github.com/dahlia/fedify/discussions
66
+ [#Fedify]: https://elk.zone/mastodon.social/tags/fedify
71
67
  [Mastodon]: https://joinmastodon.org/
72
68
  [Lemmy]: https://join-lemmy.org/
73
69
  [Pixelfed]: https://pixelfed.org/
package/esm/mod.js CHANGED
@@ -8,29 +8,23 @@
8
8
  * building a federated server app, so that you can focus on your business
9
9
  * logic and user experience.
10
10
  *
11
- * Currently, Fedify is moving fast and the API is not stable yet. We do not
12
- * recommend using it in production yet, so please use it if you would like to
13
- * experiment with it and help us improve it.
14
- *
15
- * The rough roadmap is to implement the following features out of the box:
11
+ * Currently, Fedify provides the following features out of the box:
16
12
  *
17
13
  * - Type-safe objects for [Activity Vocabulary] (including some vendor-specific
18
14
  * extensions)
19
15
  * - [WebFinger] client and server
20
16
  * - [HTTP Signatures]
21
17
  * - Middlewares for handling webhooks
22
- * - [ActivityPub] client
23
18
  * - [NodeInfo] protocol
24
19
  * - Special touch for interoperability with Mastodon and few other popular
25
20
  * fediverse software
21
+ * - CLI toolchain for testing and debugging
26
22
  *
27
23
  * If you want to know more about the project, please take a look at the
28
24
  * following resources:
29
25
  *
30
26
  * - [GitHub](https://github.com/dahlia/fedify)
31
- * - [Tutorial](https://fedify.dev/tutorial)
32
- * - [Manual](https://fedify.dev/manual)
33
- * ([Unstable](https://unstable.fedify.dev/manual))
27
+ * - [Tutorial](https://fedify.dev/tutorial)
34
28
  * - [Examples](https://github.com/dahlia/fedify/tree/main/examples)
35
29
  *
36
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.154+c62294c6",
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
@@ -8,29 +8,23 @@
8
8
  * building a federated server app, so that you can focus on your business
9
9
  * logic and user experience.
10
10
  *
11
- * Currently, Fedify is moving fast and the API is not stable yet. We do not
12
- * recommend using it in production yet, so please use it if you would like to
13
- * experiment with it and help us improve it.
14
- *
15
- * The rough roadmap is to implement the following features out of the box:
11
+ * Currently, Fedify provides the following features out of the box:
16
12
  *
17
13
  * - Type-safe objects for [Activity Vocabulary] (including some vendor-specific
18
14
  * extensions)
19
15
  * - [WebFinger] client and server
20
16
  * - [HTTP Signatures]
21
17
  * - Middlewares for handling webhooks
22
- * - [ActivityPub] client
23
18
  * - [NodeInfo] protocol
24
19
  * - Special touch for interoperability with Mastodon and few other popular
25
20
  * fediverse software
21
+ * - CLI toolchain for testing and debugging
26
22
  *
27
23
  * If you want to know more about the project, please take a look at the
28
24
  * following resources:
29
25
  *
30
26
  * - [GitHub](https://github.com/dahlia/fedify)
31
- * - [Tutorial](https://fedify.dev/tutorial)
32
- * - [Manual](https://fedify.dev/manual)
33
- * ([Unstable](https://unstable.fedify.dev/manual))
27
+ * - [Tutorial](https://fedify.dev/tutorial)
34
28
  * - [Examples](https://github.com/dahlia/fedify/tree/main/examples)
35
29
  *
36
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;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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