@ik-firewall/core 2.3.0 → 2.3.1
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 +5 -3
- package/dist/index.js +5 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -255,7 +255,8 @@ var ConfigManager = class {
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
try {
|
|
258
|
-
const
|
|
258
|
+
const baseUrl = this.config.centralReportEndpoint || "https://ik-firewall.vercel.app";
|
|
259
|
+
const endpoint = `${baseUrl.replace(/\/$/, "")}/api/v1/sync`;
|
|
259
260
|
const instanceConfig2 = this.config.instanceConfigs?.[instanceId];
|
|
260
261
|
const registrationEmail = instanceConfig2?.ownerEmail || this.config.ownerEmail;
|
|
261
262
|
if ((!instanceConfig2?.licenseKey || instanceConfig2.licenseKey.startsWith("TRIAL-")) && registrationEmail) {
|
|
@@ -1528,7 +1529,8 @@ var UsageTracker = class {
|
|
|
1528
1529
|
async flush(aggregatedData) {
|
|
1529
1530
|
const usageToFlush = aggregatedData || this.buffer;
|
|
1530
1531
|
if (usageToFlush.length === 0) return;
|
|
1531
|
-
const
|
|
1532
|
+
const baseUrl = this.config.get("centralReportEndpoint") || "https://ik-firewall.vercel.app";
|
|
1533
|
+
const endpoint = `${baseUrl.replace(/\/$/, "")}/api/v1/report`;
|
|
1532
1534
|
const hmacSecret = this.config.get("hmacSecret");
|
|
1533
1535
|
try {
|
|
1534
1536
|
this.hooks?.onStatus?.(`\u{1F4E4} IK_TRACKER: Flushing ${usageToFlush.length} interactions to ${endpoint}...`);
|
|
@@ -1694,7 +1696,7 @@ var IKFirewallCore = class _IKFirewallCore {
|
|
|
1694
1696
|
providerMode: process.env.IK_FIREWALL_MODE || "hybrid",
|
|
1695
1697
|
runtimeStrategy: "internal",
|
|
1696
1698
|
localAuditEndpoint: process.env.IK_FIREWALL_LOCAL_ENDPOINT || "http://127.0.0.1:8085/v1/chat/completions",
|
|
1697
|
-
centralReportEndpoint: process.env.IK_FIREWALL_CENTRAL_ENDPOINT || "https://ik-firewall.vercel.app
|
|
1699
|
+
centralReportEndpoint: (process.env.IK_FIREWALL_CENTRAL_ENDPOINT || "https://ik-firewall.vercel.app").replace(/\/$/, ""),
|
|
1698
1700
|
ownerEmail: process.env.IK_FIREWALL_EMAIL,
|
|
1699
1701
|
hmacSecret: process.env.IK_FIREWALL_SECRET,
|
|
1700
1702
|
fallbackToCloudAudit: process.env.IK_FIREWALL_FALLBACK === "true" || false,
|
package/dist/index.js
CHANGED
|
@@ -213,7 +213,8 @@ var ConfigManager = class {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
try {
|
|
216
|
-
const
|
|
216
|
+
const baseUrl = this.config.centralReportEndpoint || "https://ik-firewall.vercel.app";
|
|
217
|
+
const endpoint = `${baseUrl.replace(/\/$/, "")}/api/v1/sync`;
|
|
217
218
|
const instanceConfig2 = this.config.instanceConfigs?.[instanceId];
|
|
218
219
|
const registrationEmail = instanceConfig2?.ownerEmail || this.config.ownerEmail;
|
|
219
220
|
if ((!instanceConfig2?.licenseKey || instanceConfig2.licenseKey.startsWith("TRIAL-")) && registrationEmail) {
|
|
@@ -1486,7 +1487,8 @@ var UsageTracker = class {
|
|
|
1486
1487
|
async flush(aggregatedData) {
|
|
1487
1488
|
const usageToFlush = aggregatedData || this.buffer;
|
|
1488
1489
|
if (usageToFlush.length === 0) return;
|
|
1489
|
-
const
|
|
1490
|
+
const baseUrl = this.config.get("centralReportEndpoint") || "https://ik-firewall.vercel.app";
|
|
1491
|
+
const endpoint = `${baseUrl.replace(/\/$/, "")}/api/v1/report`;
|
|
1490
1492
|
const hmacSecret = this.config.get("hmacSecret");
|
|
1491
1493
|
try {
|
|
1492
1494
|
this.hooks?.onStatus?.(`\u{1F4E4} IK_TRACKER: Flushing ${usageToFlush.length} interactions to ${endpoint}...`);
|
|
@@ -1652,7 +1654,7 @@ var IKFirewallCore = class _IKFirewallCore {
|
|
|
1652
1654
|
providerMode: process.env.IK_FIREWALL_MODE || "hybrid",
|
|
1653
1655
|
runtimeStrategy: "internal",
|
|
1654
1656
|
localAuditEndpoint: process.env.IK_FIREWALL_LOCAL_ENDPOINT || "http://127.0.0.1:8085/v1/chat/completions",
|
|
1655
|
-
centralReportEndpoint: process.env.IK_FIREWALL_CENTRAL_ENDPOINT || "https://ik-firewall.vercel.app
|
|
1657
|
+
centralReportEndpoint: (process.env.IK_FIREWALL_CENTRAL_ENDPOINT || "https://ik-firewall.vercel.app").replace(/\/$/, ""),
|
|
1656
1658
|
ownerEmail: process.env.IK_FIREWALL_EMAIL,
|
|
1657
1659
|
hmacSecret: process.env.IK_FIREWALL_SECRET,
|
|
1658
1660
|
fallbackToCloudAudit: process.env.IK_FIREWALL_FALLBACK === "true" || false,
|