@liberstudio/cloudflare-list 2.0.6 → 2.0.7
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.
|
@@ -6,5 +6,5 @@ export declare class AttacksService {
|
|
|
6
6
|
private readonly logger;
|
|
7
7
|
private readonly API_URL;
|
|
8
8
|
constructor(httpService: HttpService, options: CloudflareAttacksOptions);
|
|
9
|
-
updateIpList(ip: string): Promise<CloudflareResponse
|
|
9
|
+
updateIpList(ip: string): Promise<CloudflareResponse>;
|
|
10
10
|
}
|
package/dist/attacks.service.js
CHANGED
|
@@ -29,12 +29,10 @@ let AttacksService = class AttacksService {
|
|
|
29
29
|
this.API_URL = `https://api.cloudflare.com/client/v4/accounts`;
|
|
30
30
|
}
|
|
31
31
|
async updateIpList(ip) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
const { accountId, listId, apiToken, comment } = this.options;
|
|
32
|
+
const apiToken = this.options.apiToken.trim();
|
|
33
|
+
const accountId = this.options.accountId.trim();
|
|
34
|
+
const listId = this.options.listId.trim();
|
|
35
|
+
const comment = this.options.comment || "Auto-blocked";
|
|
38
36
|
const url = `${this.API_URL}/${accountId}/rules/lists/${listId}/items`;
|
|
39
37
|
this.logger.error(`Aggiungo IP ${ip} alla lista Cloudflare`);
|
|
40
38
|
const formattedIp = ip.includes("/") ? ip : `${ip}/32`;
|