@ik-firewall/core 2.3.6 → 2.3.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.
- package/dist/index.cjs +11 -2
- package/dist/index.js +11 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1528,8 +1528,14 @@ var UsageTracker = class {
|
|
|
1528
1528
|
try {
|
|
1529
1529
|
await this.sendBatch(payload);
|
|
1530
1530
|
} catch (error) {
|
|
1531
|
-
console.error("[IK_TRACKER] Batch send failed
|
|
1532
|
-
|
|
1531
|
+
console.error("[IK_TRACKER] Batch send failed:", error.message);
|
|
1532
|
+
const isAuthError = error.message?.includes("401");
|
|
1533
|
+
if (!isAuthError) {
|
|
1534
|
+
console.log("[IK_TRACKER] Queuing for retry...");
|
|
1535
|
+
this.handleFailure(payload);
|
|
1536
|
+
} else {
|
|
1537
|
+
console.warn("[IK_TRACKER] Unauthorized: Please check your IK_FIREWALL_SECRET and License Key. Discarding batch.");
|
|
1538
|
+
}
|
|
1533
1539
|
} finally {
|
|
1534
1540
|
this.flushInProgress = false;
|
|
1535
1541
|
}
|
|
@@ -1538,6 +1544,9 @@ var UsageTracker = class {
|
|
|
1538
1544
|
const baseUrl = this.config.get("centralReportEndpoint") || "https://ik-firewall.vercel.app";
|
|
1539
1545
|
const endpoint = `${baseUrl.replace(/\/$/, "")}/api/v1/report`;
|
|
1540
1546
|
const hmacSecret = this.config.get("hmacSecret") || process.env.IK_FIREWALL_SECRET;
|
|
1547
|
+
if (process.env.IK_FIREWALL_DISABLED === "true" || process.env.NEXT_PUBLIC_IK_FIREWALL_DISABLED === "true") {
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1541
1550
|
if (hmacSecret) {
|
|
1542
1551
|
try {
|
|
1543
1552
|
const crypto = typeof window === "undefined" ? (await import("crypto")).default : null;
|
package/dist/index.js
CHANGED
|
@@ -1486,8 +1486,14 @@ var UsageTracker = class {
|
|
|
1486
1486
|
try {
|
|
1487
1487
|
await this.sendBatch(payload);
|
|
1488
1488
|
} catch (error) {
|
|
1489
|
-
console.error("[IK_TRACKER] Batch send failed
|
|
1490
|
-
|
|
1489
|
+
console.error("[IK_TRACKER] Batch send failed:", error.message);
|
|
1490
|
+
const isAuthError = error.message?.includes("401");
|
|
1491
|
+
if (!isAuthError) {
|
|
1492
|
+
console.log("[IK_TRACKER] Queuing for retry...");
|
|
1493
|
+
this.handleFailure(payload);
|
|
1494
|
+
} else {
|
|
1495
|
+
console.warn("[IK_TRACKER] Unauthorized: Please check your IK_FIREWALL_SECRET and License Key. Discarding batch.");
|
|
1496
|
+
}
|
|
1491
1497
|
} finally {
|
|
1492
1498
|
this.flushInProgress = false;
|
|
1493
1499
|
}
|
|
@@ -1496,6 +1502,9 @@ var UsageTracker = class {
|
|
|
1496
1502
|
const baseUrl = this.config.get("centralReportEndpoint") || "https://ik-firewall.vercel.app";
|
|
1497
1503
|
const endpoint = `${baseUrl.replace(/\/$/, "")}/api/v1/report`;
|
|
1498
1504
|
const hmacSecret = this.config.get("hmacSecret") || process.env.IK_FIREWALL_SECRET;
|
|
1505
|
+
if (process.env.IK_FIREWALL_DISABLED === "true" || process.env.NEXT_PUBLIC_IK_FIREWALL_DISABLED === "true") {
|
|
1506
|
+
return;
|
|
1507
|
+
}
|
|
1499
1508
|
if (hmacSecret) {
|
|
1500
1509
|
try {
|
|
1501
1510
|
const crypto = typeof window === "undefined" ? (await import("crypto")).default : null;
|