@hocuspocus/extension-throttle 4.0.0-rc.6 → 4.0.0

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.
Files changed (2) hide show
  1. package/README.md +39 -5
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -4,11 +4,45 @@
4
4
  [![License](https://img.shields.io/npm/l/@hocuspocus/extension-throttle.svg)](https://www.npmjs.com/package/@hocuspocus/extension-throttle)
5
5
  [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
6
6
 
7
- ## Introduction
8
- Rate-limit and throttle connections to a [Hocuspocus](https://github.com/ueberdosis/hocuspocus) server by IP. Helps protect your collaboration backend from abuse, accidental reconnect loops, and misbehaving clients.
7
+ Rate-limit and throttle connections to a [Hocuspocus](https://github.com/ueberdosis/hocuspocus) server by IP. Protects your collaboration backend from abuse, accidental reconnect loops, and misbehaving clients.
9
8
 
10
- ## Official Documentation
11
- Documentation can be found in the [GitHub repository](https://github.com/ueberdosis/hocuspocus).
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @hocuspocus/extension-throttle
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ With default thresholds (15 connection attempts per 60 seconds, 5 minute ban):
18
+
19
+ ```js
20
+ import { Server } from "@hocuspocus/server"
21
+ import { Throttle } from "@hocuspocus/extension-throttle"
22
+
23
+ const server = new Server({
24
+ extensions: [new Throttle()],
25
+ })
26
+
27
+ server.listen()
28
+ ```
29
+
30
+ ### Tune the limits
31
+
32
+ ```js
33
+ new Throttle({
34
+ throttle: 30, // allowed connection attempts per window
35
+ consideredSeconds: 60, // window length in seconds
36
+ banTime: 5, // ban duration in minutes
37
+ })
38
+ ```
39
+
40
+ Pass `throttle: false` (or `null`) to effectively disable the limiter without removing the extension.
41
+
42
+ ## Documentation
43
+
44
+ Full options reference: [tiptap.dev/docs/hocuspocus/server/extensions/throttle](https://tiptap.dev/docs/hocuspocus/server/extensions/throttle).
12
45
 
13
46
  ## License
14
- Hocuspocus is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/hocuspocus/blob/main/LICENSE.md).
47
+
48
+ MIT — see [LICENSE.md](https://github.com/ueberdosis/hocuspocus/blob/main/LICENSE.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hocuspocus/extension-throttle",
3
- "version": "4.0.0-rc.6",
3
+ "version": "4.0.0",
4
4
  "description": "hocuspocus throttle extension",
5
5
  "homepage": "https://hocuspocus.dev",
6
6
  "keywords": [
@@ -28,9 +28,9 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@hocuspocus/server": "^4.0.0-rc.6"
31
+ "@hocuspocus/server": "^4.0.0"
32
32
  },
33
- "gitHead": "f8b039aea9d9c7f5b80b2cbb82381e2153ef8dc0",
33
+ "gitHead": "1c1b34800f702a06e1ce236e8a175c82876bff42",
34
34
  "repository": {
35
35
  "url": "https://github.com/ueberdosis/hocuspocus"
36
36
  },