mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-10-05 14:55:08 +00:00
fix: web UI and src.common bugs (wifi wrong-password, plugin icon, starlark toggle, API caching, scroll/logo/font helpers) (#646)
- wifi: keep the "wrong_password:" prefix through the restore/AP fallback so the UI's incorrect-password prompt fires again. - /plugins/installed returns the manifest's icon (string only). - /starlark/apps/<id>/toggle coerces `enabled` and delegates to _toggle_starlark_app (disk before memory, no KeyError, "false" is false). - /api/v3/ JSON GETs are sent Cache-Control: no-store; non-JSON keeps 5s. - ScrollHelper.set_scrolling_image converts non-RGB input (alpha onto black); create/set_scrolling_image reset last_update_time like reset_scroll. - LogoHelper backs off a failed download per path for MISSING_LOGO_RECHECK_SECONDS; cleared on invalidate/clear_cache. - refresh_placeholder_timestamp saves atomically. - FontManager.clear_cache / _clear_plugin_font_cache bump cache_generation. - Odds manager: per-game logs to DEBUG; JSON decode error caught before RequestException (same cooldown). - element_style mangled continuations; startup validator skips null plugin blocks and reuses the controller's discovery. - src/common/README lists frame_timing, json_body, render_gate. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+14
-5
@@ -1317,6 +1317,15 @@ class WiFiManager:
|
||||
|
||||
if self.has_nmcli:
|
||||
success, message = self._connect_nmcli(ssid, password)
|
||||
# Keep the "wrong_password:" prefix on whatever failure message
|
||||
# the recovery below returns: the web UI keys its "incorrect
|
||||
# password" prompt off it, and the restore/AP messages would
|
||||
# otherwise erase it.
|
||||
wrong_password = (not success and isinstance(message, str)
|
||||
and message.startswith("wrong_password:"))
|
||||
|
||||
def _fail(msg):
|
||||
return False, (f"wrong_password: {msg}" if wrong_password else msg)
|
||||
|
||||
# If connection failed, try to restore original connection
|
||||
if not success and original_connection and original_ssid:
|
||||
@@ -1327,18 +1336,18 @@ class WiFiManager:
|
||||
if restore_success:
|
||||
logger.info(f"Successfully restored original connection: {original_ssid}")
|
||||
self._show_led_message("Restored!", duration=3)
|
||||
return False, f"Failed to connect to {ssid}, restored {original_ssid}"
|
||||
return _fail(f"Failed to connect to {ssid}, restored {original_ssid}")
|
||||
else:
|
||||
logger.error(f"Failed to restore original connection: {original_ssid}")
|
||||
return self._failsafe_ap(
|
||||
return _fail(self._failsafe_ap(
|
||||
"Connection failed and restoration failed. AP mode enabled.",
|
||||
"Connection failed, restoration failed, and AP mode failed")
|
||||
"Connection failed, restoration failed, and AP mode failed")[1])
|
||||
|
||||
# If connection failed and no original connection to restore, enable AP mode
|
||||
elif not success:
|
||||
logger.warning(f"Connection to {ssid} failed and no original connection to restore")
|
||||
return self._failsafe_ap("Connection failed. AP mode enabled.",
|
||||
"Connection failed and AP mode failed")
|
||||
return _fail(self._failsafe_ap("Connection failed. AP mode enabled.",
|
||||
"Connection failed and AP mode failed")[1])
|
||||
|
||||
return success, message
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user