Conversation
- plugin.py: day_selected and target_date were only assigned inside conditional branches but referenced unconditionally afterward, causing NameError/UnboundLocalError crashes when the API returns fewer days than expected or the hourly forecast is empty. - foreca_svg_map_viewer.py: removed an import of REGION_CENTERS and get_background_for_layer from foreca_map_viewer, which never defined them (ImportError on opening any wind-symbol SVG map). Defined both locally, mapped to background PNGs that actually exist under thumb/. - foreca_map_menu.py: a debug-loop leftover variable was compared instead of the current layer's id when filtering layer 3 from the map menu, so filtering behaved inconsistently depending on API response ordering. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UPpumFb2PP21ATpDwJBYBB
- foreca_map_api.py: replaced hardcoded, real-looking Foreca API credentials (used as a fallback default and written into the generated .example config) with the same placeholder values already used elsewhere in the file. - plugin.py: the saved API credentials file is now chmod 600 (previously inherited the process umask, typically world-readable); dropped the needless execute bit on other saved plain-data files (favorites/color/alpha configs), tightening 0o655 to 0o644. - rain_maps.py: validate the tile-server host returned by api.rainviewer.com's JSON response before using it to build subsequent outbound tile-fetch URLs, instead of trusting it unconditionally. - city_panel.py: URL-encode the user-entered city search term before interpolating it into the request URL, matching the existing correct pattern already used in foreca_weather_api.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UPpumFb2PP21ATpDwJBYBB
- plugin.py: _update_station_label ran in a background Thread but
called self["station_name"].setText(...) directly from that
thread instead of marshaling back to the UI thread, risking GUI
corruption if the screen closes/rebuilds mid-fetch. Now wrapped
in reactor.callFromThread, matching the pattern already used
elsewhere in the file (_moon_api_callback).
- meteogram.py: fetch_data ran its network request and HTML/JSON
parsing synchronously from onLayoutFinish, freezing the whole
Enigma2 UI while it waited. Split into a background-thread worker
that fetches/parses data and a UI-thread method that only
populates widgets, connected via reactor.callFromThread.
- moon_calendar.py: load_calendar performed ~365 trig-heavy lunar
position calculations synchronously from onLayoutFinish. Same
treatment: computation moved to a background Thread, only the
final widget population runs via reactor.callFromThread.
- CONTROL/preinst: the opkg (.ipk) install path never installed
Pillow even though several plugin modules import it for map
rendering, unlike installer.sh which already installs it
correctly. Added the missing ${PY}-pillow install.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UPpumFb2PP21ATpDwJBYBB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A full audit of the plugin (33 Python files, ~16k lines) plus the install/packaging layer surfaced several critical and high-severity issues. This PR fixes the ones that could be verified and validated by reading code alone (no Enigma2 hardware available in this environment to run the plugin live).
plugin.pyhadday_selected/target_datereferenced outside the conditional branches that assign them, causingNameError/UnboundLocalErrorwhen the API returns incomplete data.foreca_svg_map_viewer.pyimportedREGION_CENTERS/get_background_for_layerfrom a module that never defined them, causing an immediateImportErroron any wind-symbol SVG map.foreca_map_menu.pyhad a debug-loop leftover variable compared instead of the current layer's id, making the map layer filter behave inconsistently.foreca_map_api.py(used as a fallback default and written into the generated.exampleconfig); tightened the saved credentials file to0600and dropped the needless execute bit on other saved config files; added host validation before trusting a third-party API response (rain_maps.py) to build subsequent outbound URLs; URL-encoded user search input incity_panel.py.meteogram.pyandmoon_calendar.pyran blocking network/CPU-heavy work synchronously fromonLayoutFinish, freezing the whole Enigma2 UI on screen open — both now background the work and marshal only widget updates back viareactor.callFromThread, matching the pattern already used elsewhere in the plugin. Fixed a thread-unsafe widget update inplugin.py. Added the missing Pillow dependency toCONTROL/preinst(the opkg/.ipk install path never installed it despite several modules importing PIL for map rendering).Test plan
python3 -m py_compilepasses on all changed Python filessh -npasses onCONTROL/preinstNot included (flagged as follow-up, not done here)
plugin.py's_load_favorite(core weather-refresh path, higher risk, needs hardware testing)slideshow.pyHTTP→HTTPS switch (not verified whether the source host supports TLS)