mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-04 14:25:08 +00:00
fix(web): plugin dir resolver in routes, nmcli AP detection, daemon config reload, upload safety, BDF preview (#655)
* fix(web): plugin dir resolver in routes, nmcli AP detection, daemon config reload, upload safety - Route plugin lookups (installed list, update, recorded version, config form, web UI pages) through the plugin manager's resolver so plugins in ledmatrix-<id> directories work. - Captive-portal detection also sees the nmcli fallback AP (cached). - WiFi monitor daemon re-reads wifi_config.json when its mtime changes. - Drop the AP check in disconnect_from_network that could never fire. - LED status file per WiFiManager; config path falls back to this checkout. - BDF font preview via src.common.bdf_font. - Asset uploads validate every file before saving; metadata and calendar credentials written atomically; no absolute path in the response; asset delete answers 400 for a missing body. - Coerce string booleans in plugin toggle, on-demand start and AP force. - SSE broadcaster clears its thread handle before exiting. - start.py log filter handles every exc_info form. - Cleanups: unused plugins/fonts partial work, duplicate backup catch-alls, raw-config error helper, update-route tidy, redundant imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): request BDF font previews now that the server renders them The Fonts tab skipped the preview request for .bdf files because the server used to refuse them; /fonts/preview now draws BDF with the shared loader. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): take the update route's plugin directory from a directory listing CodeQL flagged the path built from the request's plugin_id (the id was already validated with safe_path_component, which CodeQL doesn't model; the same flow on main is alerts 738/739). The directory is now the entry of plugins_dir matched by name, so nothing built from user input reaches the filesystem; an id with nothing installed goes to the store manager, which reports it not found as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(web): read the blueprint's plugin_manager defensively in _plugin_directory _get_plugin_version now goes through _plugin_directory, which read api_v3.plugin_manager directly; the attribute exists only once the app sets it, so test_path_traversal_guards::test_a_real_manifest_is_read failed when run on its own (order-dependent in the full suite). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+16
-1
@@ -17,6 +17,21 @@ logger = logging.getLogger('web_interface.start')
|
||||
_CLIENT_DISCONNECT_ERRNOS = (113, 32, 104)
|
||||
|
||||
|
||||
def _exc_info_value(exc_info):
|
||||
"""The exception a logging call's ``exc_info`` argument refers to.
|
||||
|
||||
logging accepts a (type, value, traceback) tuple, an exception instance,
|
||||
or True for the exception being handled. The werkzeug filter below used
|
||||
to unpack it as a tuple, so True or an instance raised TypeError from
|
||||
inside the logging call itself.
|
||||
"""
|
||||
if isinstance(exc_info, BaseException):
|
||||
return exc_info
|
||||
if isinstance(exc_info, tuple):
|
||||
return exc_info[1] if len(exc_info) > 1 else None
|
||||
return sys.exc_info()[1]
|
||||
|
||||
|
||||
def get_local_ips():
|
||||
"""Get list of local IP addresses the service will be accessible on."""
|
||||
ips = []
|
||||
@@ -94,7 +109,7 @@ def main():
|
||||
return
|
||||
# For exceptions, check if it's a socket error
|
||||
if 'exc_info' in kwargs and kwargs['exc_info']:
|
||||
exc_type, exc_value, exc_tb = kwargs['exc_info']
|
||||
exc_value = _exc_info_value(kwargs['exc_info'])
|
||||
if isinstance(exc_value, OSError):
|
||||
if exc_value.errno in _CLIENT_DISCONNECT_ERRNOS:
|
||||
werkzeug_logger.debug(message, *args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user