From fffe96999c06c3cb5bce336120d409e7323361e6 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Tue, 6 Jan 2026 15:56:33 +0100 Subject: [PATCH] fix(luci-app-crowdsec-dashboard): Fix API instantiation error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed 'new api()' to 'api' in all dashboard views since the API module exports an object, not a constructor class. Fixed files: - overview.js - decisions.js - alerts.js - metrics.js - waf.js This resolves the 'TypeError: api is not a constructor' error. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .../luci-static/resources/view/crowdsec-dashboard/alerts.js | 2 +- .../luci-static/resources/view/crowdsec-dashboard/decisions.js | 2 +- .../luci-static/resources/view/crowdsec-dashboard/metrics.js | 2 +- .../luci-static/resources/view/crowdsec-dashboard/overview.js | 2 +- .../htdocs/luci-static/resources/view/crowdsec-dashboard/waf.js | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/alerts.js b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/alerts.js index e491ec1b..754f3ace 100644 --- a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/alerts.js +++ b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/alerts.js @@ -27,7 +27,7 @@ return view.extend({ cssLink.href = L.resource('crowdsec-dashboard/dashboard.css'); document.head.appendChild(cssLink); - this.csApi = new api(); + this.csApi = api; return this.csApi.getAlerts(this.limit); }, diff --git a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/decisions.js b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/decisions.js index 239af369..4c37bca1 100644 --- a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/decisions.js +++ b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/decisions.js @@ -28,7 +28,7 @@ return view.extend({ cssLink.href = L.resource('crowdsec-dashboard/dashboard.css'); document.head.appendChild(cssLink); - this.csApi = new api(); + this.csApi = api; return this.csApi.getDecisions(); }, diff --git a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/metrics.js b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/metrics.js index 2970af95..eb041a6e 100644 --- a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/metrics.js +++ b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/metrics.js @@ -27,7 +27,7 @@ return view.extend({ cssLink.href = L.resource('crowdsec-dashboard/dashboard.css'); document.head.appendChild(cssLink); - this.csApi = new api(); + this.csApi = api; return Promise.all([ this.csApi.getMetrics(), diff --git a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/overview.js b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/overview.js index 9ca9f221..25b13a77 100644 --- a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/overview.js +++ b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/overview.js @@ -27,7 +27,7 @@ return view.extend({ document.head.appendChild(cssLink); // Load API - this.csApi = new api(); + this.csApi = api; return Promise.all([ this.csApi.getDashboardData(), diff --git a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/waf.js b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/waf.js index a3f0f5eb..d3d2e6cc 100644 --- a/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/waf.js +++ b/package/secubox/luci-app-crowdsec-dashboard/htdocs/luci-static/resources/view/crowdsec-dashboard/waf.js @@ -24,7 +24,7 @@ return view.extend({ cssLink.href = L.resource('crowdsec-dashboard/dashboard.css'); document.head.appendChild(cssLink); - this.csApi = new api(); + this.csApi = api; return this.csApi.getWAFStatus().then(function(result) { return {