From 2013ea2e8c457206645fdc46a0a443f71169b5b9 Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Sun, 4 Jan 2026 14:44:24 +0100 Subject: [PATCH] fix: Add graceful fallback for RPC calls when backend not deployed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix 'No related RPC reply' errors by wrapping RPC calls in L.resolveDefault() to provide fallback values when backend methods aren't available yet. ## Problem When new LuCI views are deployed before backend packages, RPC calls fail with: Error: No related RPC reply This happens because: - Frontend (luci-app-secubox-admin) calls check_updates, get_catalog_sources - Backend (secubox-core) hasn't been deployed yet with new RPCD methods - RPCD returns no reply, causing frontend to crash ## Solution Wrap all new RPC calls in L.resolveDefault() with sensible fallbacks: **catalog-sources.js**: - getCatalogSources() → fallback: { sources: [] } - checkUpdates() → fallback: { updates: [] } **updates.js**: - checkUpdates() → fallback: { updates: [] } This allows pages to load gracefully with empty data instead of crashing. ## Benefits 1. **Graceful degradation**: Pages load even without backend 2. **Deployment flexibility**: Can deploy frontend before backend 3. **Better UX**: Shows 'No updates' / 'No sources' instead of errors 4. **Production-ready**: Handles missing backends in production ## Testing Before backend deployment: - Catalog Sources page shows: 'No sources configured' - Updates page shows: 'All applications are up to date' After backend deployment: - Pages populate with real data from RPCD Incremented PKG_RELEASE: 4 → 5 --- package/secubox/luci-app-secubox-admin/Makefile | 2 +- .../resources/view/secubox-admin/catalog-sources.js | 4 ++-- .../luci-static/resources/view/secubox-admin/updates.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package/secubox/luci-app-secubox-admin/Makefile b/package/secubox/luci-app-secubox-admin/Makefile index 216b3c43..07dfc2b6 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:=4 +PKG_RELEASE:=5 PKG_LICENSE:=MIT PKG_MAINTAINER:=CyberMind diff --git a/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/view/secubox-admin/catalog-sources.js b/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/view/secubox-admin/catalog-sources.js index e0a2961c..8f15f4d2 100644 --- a/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/view/secubox-admin/catalog-sources.js +++ b/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/view/secubox-admin/catalog-sources.js @@ -8,8 +8,8 @@ return view.extend({ load: function() { return Promise.all([ - API.getCatalogSources(), - L.resolveDefault(API.checkUpdates(), {}) + L.resolveDefault(API.getCatalogSources(), { sources: [] }), + L.resolveDefault(API.checkUpdates(), { updates: [] }) ]); }, diff --git a/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/view/secubox-admin/updates.js b/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/view/secubox-admin/updates.js index ac126bed..8adb8f31 100644 --- a/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/view/secubox-admin/updates.js +++ b/package/secubox/luci-app-secubox-admin/htdocs/luci-static/resources/view/secubox-admin/updates.js @@ -8,7 +8,7 @@ return view.extend({ load: function() { return Promise.all([ - API.checkUpdates(), + L.resolveDefault(API.checkUpdates(), { updates: [] }), API.getApps(), API.getModules() ]);