@fedify/fedify 0.6.0-dev.113 → 0.6.1

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
@@ -3,10 +3,19 @@
3
3
  Fedify changelog
4
4
  ================
5
5
 
6
+ Version 0.6.1
7
+ -------------
8
+
9
+ Released on April 17, 2024.
10
+
11
+ - Fixed a bug of `new Federation()` constructor that if it is once called
12
+ the process will never exit. [[#39]]
13
+
14
+
6
15
  Version 0.6.0
7
16
  -------------
8
17
 
9
- To be released.
18
+ Released on April 9, 2024.
10
19
 
11
20
  - `DocumentLoader` is now propagated to the loaded remote objects from
12
21
  Activity Vocabulary objects. [[#27]]
@@ -47,6 +56,17 @@ To be released.
47
56
  [#27]: https://github.com/dahlia/fedify/issues/27
48
57
 
49
58
 
59
+ Version 0.5.2
60
+ -------------
61
+
62
+ Released on April 17, 2024.
63
+
64
+ - Fixed a bug of `new Federation()` constructor that if it is once called
65
+ the process will never exit. [[#39]]
66
+
67
+ [#39]: https://github.com/dahlia/fedify/issues/39
68
+
69
+
50
70
  Version 0.5.1
51
71
  -------------
52
72
 
package/README.md CHANGED
@@ -51,7 +51,7 @@ join our [Matrix chat space][Matrix] or [GitHub Discussions].
51
51
  [Mastodon], [Lemmy], [Pixelfed], [PeerTube], and so on.
52
52
 
53
53
  [JSR]: https://jsr.io/@fedify/fedify
54
- [JSR badge]: https://jsr.io/badges/@fedify/fedify?_v=0.5.1
54
+ [JSR badge]: https://jsr.io/badges/@fedify/fedify?v=0.6.0
55
55
  [npm]: https://www.npmjs.com/package/@fedify/fedify
56
56
  [npm badge]: https://img.shields.io/npm/v/@fedify/fedify?logo=npm
57
57
  [GitHub Actions]: https://github.com/dahlia/fedify/actions/workflows/build.yaml
@@ -19,6 +19,7 @@ export class Federation {
19
19
  #kv;
20
20
  #kvPrefixes;
21
21
  #queue;
22
+ #queueStarted;
22
23
  #router;
23
24
  #nodeInfoDispatcher;
24
25
  #actorCallbacks;
@@ -46,6 +47,7 @@ export class Federation {
46
47
  ...(kvPrefixes ?? {}),
47
48
  };
48
49
  this.#queue = queue;
50
+ this.#queueStarted = false;
49
51
  this.#router = new Router();
50
52
  this.#router.add("/.well-known/webfinger", "webfinger");
51
53
  this.#router.add("/.well-known/nodeinfo", "nodeInfoJrd");
@@ -67,7 +69,12 @@ export class Federation {
67
69
  15 * 60000,
68
70
  60 * 60000,
69
71
  ].map((ms) => Temporal.Duration.from({ milliseconds: ms }));
70
- queue?.listen(this.#listenQueue.bind(this));
72
+ }
73
+ #startQueue() {
74
+ if (this.#queue != null && !this.#queueStarted) {
75
+ this.#queue?.listen(this.#listenQueue.bind(this));
76
+ this.#queueStarted = true;
77
+ }
71
78
  }
72
79
  async #listenQueue(message) {
73
80
  let activity = null;
@@ -492,6 +499,7 @@ export class Federation {
492
499
  if (activity.actorId == null) {
493
500
  throw new TypeError("The activity to send must have at least one actor property.");
494
501
  }
502
+ this.#startQueue();
495
503
  if (activity.id == null) {
496
504
  activity = activity.clone({
497
505
  id: new URL(`urn:uuid:${dntShim.crypto.randomUUID()}`),
@@ -559,6 +567,7 @@ export class Federation {
559
567
  * @since 0.6.0
560
568
  */
561
569
  async fetch(request, { onNotFound, onNotAcceptable, contextData, }) {
570
+ this.#startQueue();
562
571
  onNotFound ??= notFound;
563
572
  onNotAcceptable ??= notAcceptable;
564
573
  const url = new URL(request.url);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "0.6.0-dev.113+4573e798",
3
+ "version": "0.6.1",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -1 +1 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,EAC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