mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-04 06:15:09 +00:00
fix(web): update-all skips Starlark apps and no longer misses plugins (#587)
* fix(web): update-all skips Starlark apps and no longer misses plugins Check & Update All posted every entry from /plugins/installed to POST /plugins/update, including the virtual starlark:<app_id> entries that list installed Starlark apps. The store manager cannot find those, so each answered 500 "plugin not found". Update-all now sends only plugin ids (install_manager.js, and the older app-shell.js copy), and the route answers a starlark: id with a 400 saying it is a Starlark app. A request that got no HTTP answer was recorded as failed and never sent again. On a device, a web-service restart mid-run killed the in-flight request and refused the next one, stock-news, which was left on 2.6.2 with 2.8.0 available. Such requests are now re-sent with backoff (about 30s) before being reported as failed. HTTP error answers are not retried. Tests: test/js/unit/test_update_all.js (run from pytest via test/web_interface/test_update_all_plugins.py so CI covers it) and the route contract for starlark: ids. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * refactor(web): walk update-all retry delays without indexed lookup Codacy's ESLint security/detect-object-injection rule flagged retryDelays[attempt] as a High issue. The index was a bounded loop counter over a fixed array, but shifting a per-plugin copy of the schedule gives the same backoff without the pattern. No behaviour change: test/js/unit/test_update_all.js (21) and test/web_interface/test_update_all_plugins.py (7) pass unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -943,6 +943,19 @@ def update_plugin():
|
||||
)
|
||||
data = {'plugin_id': plugin_id}
|
||||
|
||||
# /plugins/installed lists installed Starlark apps as virtual
|
||||
# 'starlark:<app_id>' entries. They are not plugin directories, so the
|
||||
# store manager can only fail to find them -- which used to surface as
|
||||
# a 500 "plugin not found" for an app that is installed and working.
|
||||
raw_id = data.get('plugin_id')
|
||||
if isinstance(raw_id, str) and raw_id.startswith('starlark:'):
|
||||
return error_response(
|
||||
ErrorCode.INVALID_INPUT,
|
||||
f'{raw_id} is a Starlark app, not a plugin; Starlark apps are '
|
||||
'not updated through the plugin updater',
|
||||
status_code=400
|
||||
)
|
||||
|
||||
if not api_v3.plugin_store_manager:
|
||||
return error_response(
|
||||
ErrorCode.SYSTEM_ERROR,
|
||||
|
||||
Reference in New Issue
Block a user