From b0c944c244bf35be78bc5de5bc953a001b076ea0 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Sun, 4 Jan 2026 14:41:53 +0100 Subject: [PATCH] fix: Handle undefined options in WidgetRenderer constructor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix TypeError when WidgetRenderer is instantiated with undefined options parameter by adding defensive check at start of __init__ method. Error: TypeError: can't access property "containerId", options is undefined Fix: options = options || {}; This ensures the constructor works even if called without parameters, preventing the TypeError when accessing options.containerId. Incremented PKG_RELEASE: 3 → 4 --- package/secubox/luci-app-secubox-admin/Makefile | 2 +- .../luci-static/resources/secubox-admin/widget-renderer.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/package/secubox/luci-app-secubox-admin/Makefile b/package/secubox/luci-app-secubox-admin/Makefile index 09cfb384..216b3c43 100644 --- a/package/secubox/luci-app-secubox-admin/Makefile +++ b/package/secubox/luci-app-secubox-admin/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-secubox-admin PKG_VERSION:=1.0.0 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_LICENSE:=MIT PKG_MAINTAINER:=CyberMind diff --git a/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/secubox-admin/widget-renderer.js b/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/secubox-admin/widget-renderer.js index 7b96851f..10073ae9 100644 --- a/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/secubox-admin/widget-renderer.js +++ b/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/secubox-admin/widget-renderer.js @@ -20,6 +20,9 @@ var WidgetRenderer = baseclass.extend({ * @param {string} options.gridMode - Grid layout mode: 'auto', 'fixed-2', 'fixed-3', 'fixed-4' (default: 'auto') */ __init__: function(options) { + // Ensure options is an object + options = options || {}; + this.containerId = options.containerId || 'widget-container'; this.apps = options.apps || []; this.defaultRefreshInterval = options.defaultRefreshInterval || 30;