@adminforth/rich-editor 1.5.1 → 1.5.3
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.
- package/dist/index.js +7 -2
- package/index.ts +7 -6
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -219,8 +219,13 @@ export default class RichEditorPlugin extends AdminForthPlugin {
|
|
|
219
219
|
const { record } = body;
|
|
220
220
|
if ((_b = this.options.completion.rateLimit) === null || _b === void 0 ? void 0 : _b.limit) {
|
|
221
221
|
// rate limit
|
|
222
|
-
const { error } = RateLimiter.checkRateLimit(
|
|
223
|
-
|
|
222
|
+
// const { error } = RateLimiter.checkRateLimit(
|
|
223
|
+
// this.pluginInstanceId,
|
|
224
|
+
// this.options.completion.rateLimit?.limit,
|
|
225
|
+
// this.adminforth.auth.getClientIp(headers),
|
|
226
|
+
// );
|
|
227
|
+
const rateLimiter = new RateLimiter((_c = this.options.completion.rateLimit) === null || _c === void 0 ? void 0 : _c.limit);
|
|
228
|
+
if (!rateLimiter.consume(`${this.pluginInstanceId}-${this.adminforth.auth.getClientIp(headers)}`)) {
|
|
224
229
|
return {
|
|
225
230
|
completion: [],
|
|
226
231
|
};
|
package/index.ts
CHANGED
|
@@ -273,12 +273,13 @@ export default class RichEditorPlugin extends AdminForthPlugin {
|
|
|
273
273
|
|
|
274
274
|
if (this.options.completion.rateLimit?.limit) {
|
|
275
275
|
// rate limit
|
|
276
|
-
const { error } = RateLimiter.checkRateLimit(
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
);
|
|
281
|
-
|
|
276
|
+
// const { error } = RateLimiter.checkRateLimit(
|
|
277
|
+
// this.pluginInstanceId,
|
|
278
|
+
// this.options.completion.rateLimit?.limit,
|
|
279
|
+
// this.adminforth.auth.getClientIp(headers),
|
|
280
|
+
// );
|
|
281
|
+
const rateLimiter = new RateLimiter(this.options.completion.rateLimit?.limit);
|
|
282
|
+
if (!rateLimiter.consume(`${this.pluginInstanceId}-${this.adminforth.auth.getClientIp(headers)}`)) {
|
|
282
283
|
return {
|
|
283
284
|
completion: [],
|
|
284
285
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/rich-editor",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "Rich editor plugin for adminforth",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"author": "devforth",
|
|
25
25
|
"license": "ISC",
|
|
26
26
|
"dependencies": {
|
|
27
|
+
"adminforth": "^2.4.0-next.238",
|
|
27
28
|
"cheerio": "^1.0.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|