Add Open-Meteo provider and UI#227
Conversation
Introduce a selectable weather provider and implement Open-Meteo support. index.html: add a weather provider dropdown UI. privacy-policy.html: document new IP-based GeoJS endpoint, Open-Meteo, and Nominatim usage. scripts/weather.js: update header copyright, add provider selection persistence, implement Open-Meteo location search and forecast fetching (with geocoding/reverse-geocoding fallbacks), map Open-Meteo codes to a WeatherAPI-like response shape, and fall back to WeatherAPI when selected. Also reset cached parsed weather on provider change and wire up the provider select element.
📝 WalkthroughWalkthroughAdds a selectable weather provider dropdown (WeatherAPI or Open-Meteo) to the Settings UI. The ChangesWeather Provider Selection Feature
Documentation and Branding Updates
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@privacy-policy.html`:
- Around line 205-230: In the privacy policy's Weather Updates section, the
WeatherAPI subsection lists two endpoints (forecast.json and search.json) but is
missing the CDN endpoint used for weather icons. Add the missing WeatherAPI CDN
endpoint https://cdn.weatherapi.com/weather/128x128/ to the nested list under
the WeatherAPI link, documenting that it retrieves weather condition icons. This
endpoint should be added as a new list item alongside the existing forecast and
search endpoint documentation to ensure complete disclosure of all WeatherAPI
resources accessed by the application.
In `@scripts/weather.js`:
- Around line 399-403: The regex pattern that validates currentUserLocation on
line 399 has an optional group for the comma and second coordinate, which allows
single numeric values to pass validation. When a single number like "42"
matches, the subsequent split(",") operation on that line returns only one
element, leaving lon as undefined, which then gets passed to the reverse
geocoding API call. Fix this by removing the question mark that makes the comma
and second coordinate group optional in the regex pattern, ensuring both
latitude and longitude are mandatory for a valid location string.
- Around line 390-495: The Open-Meteo weather provider block (the if branch
checking weatherProvider === "openmeteo") and the WeatherAPI fallback (the else
branch) are part of a single if-else structure within a larger try-catch block.
When an error occurs in the Open-Meteo branch (such as geocoding or API
failures), it is caught by the outer catch block which logs the error,
preventing the WeatherAPI fallback from executing. Wrap the entire Open-Meteo
conditional block in its own try-catch statement, so that any errors thrown
during Open-Meteo processing are caught locally and allow execution to fall
through to the else clause where WeatherAPI can be used as a fallback. Ensure
the inner catch block re-throws or continues in a way that permits the else
branch to execute.
- Around line 409-411: The searchTerm variable is being assigned only the first
part of currentUserLocation by splitting on comma and taking the first element,
which removes important geographic context like region and country information.
This causes ambiguous city names to resolve to incorrect locations. Instead of
splitting currentUserLocation and taking only the first part, pass the full
currentUserLocation string directly as the search term to the Open-Meteo
geocoding API, since it supports comma-separated location strings (e.g.,
"Springfield, Illinois, United States") for proper disambiguation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5d8ce42a-241a-409f-806e-a8380d653fa7
📒 Files selected for processing (3)
index.htmlprivacy-policy.htmlscripts/weather.js
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Line 23: The badge images in the README.md file are missing descriptive alt
text, which violates accessibility standards and markdown linting rules. For
each badge link on line 23 (marked by `[](link)` patterns), add
descriptive alt text between the `![` and `]` brackets to identify what each
badge represents, such as version numbers, ratings, or user counts for Chrome
Web Store, Firefox, and Edge. This ensures screen readers can properly convey
the badge purpose to users and complies with MD045 markdown linting rules.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
|  | ||
|
|
||
| [](https://chrome.google.com/webstore/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chrome.google.com/webstore/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chrome.google.com/webstore/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) ▪️ [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) ▪️ [](https://microsoftedge.microsoft.com/addons/detail/mynt-material-you-new-ta/lcgdmfjofmcblocogcabdpfidfbkblcd) | ||
| [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) ▪️ [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) ▪️ [](https://microsoftedge.microsoft.com/addons/detail/mynt-material-you-new-ta/lcgdmfjofmcblocogcabdpfidfbkblcd) |
There was a problem hiding this comment.
Add descriptive alt text to badge images for accessibility.
The badge images on this line are missing alt text. Each  should include descriptive text between ![ and ] to comply with the MD045 markdown linting rule and to ensure screen readers can identify the badge purpose.
Example: [](url)
🔧 Proposed fix for badge alt text
-[](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) ▪️ [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) ▪️ [](https://microsoftedge.microsoft.com/addons/detail/mynt-material-you-new-ta/lcgdmfjofmcblocogcabdpfidfbkblcd)
+[](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) ▪️ [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) ▪️ [](https://microsoftedge.microsoft.com/addons/detail/mynt-material-you-new-ta/lcgdmfjofmcblocogcabdpfidfbkblcd)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) ▪️ [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) ▪️ [](https://microsoftedge.microsoft.com/addons/detail/mynt-material-you-new-ta/lcgdmfjofmcblocogcabdpfidfbkblcd) | |
| [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) [](https://chromewebstore.google.com/detail/mynt-material-you-new-tab/jjpokbgpiljgndebfoljdeihhkpcpfgl) ▪️ [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) [](https://addons.mozilla.org/en-US/firefox/addon/mynt/) ▪️ [](https://microsoftedge.microsoft.com/addons/detail/mynt-material-you-new-ta/lcgdmfjofmcblocogcabdpfidfbkblcd) |
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 23-23: Images should have alternate text (alt text)
(MD045, no-alt-text)
[warning] 23-23: Images should have alternate text (alt text)
(MD045, no-alt-text)
[warning] 23-23: Images should have alternate text (alt text)
(MD045, no-alt-text)
[warning] 23-23: Images should have alternate text (alt text)
(MD045, no-alt-text)
[warning] 23-23: Images should have alternate text (alt text)
(MD045, no-alt-text)
[warning] 23-23: Images should have alternate text (alt text)
(MD045, no-alt-text)
[warning] 23-23: Images should have alternate text (alt text)
(MD045, no-alt-text)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.md` at line 23, The badge images in the README.md file are missing
descriptive alt text, which violates accessibility standards and markdown
linting rules. For each badge link on line 23 (marked by
`[](link)` patterns), add descriptive alt text between the `![`
and `]` brackets to identify what each badge represents, such as version
numbers, ratings, or user counts for Chrome Web Store, Firefox, and Edge. This
ensures screen readers can properly convey the badge purpose to users and
complies with MD045 markdown linting rules.
Source: Linters/SAST tools
Add Open-Meteo handling in scripts/weather.js: validate/resolve coordinates and names, fetch Open-Meteo forecast, map Open-Meteo weather codes to WeatherAPI-style condition text and icon URLs, and build a WeatherAPI-compatible filteredData object. Wrap Open-Meteo flow in try/catch and fall back to WeatherAPI on errors. Also tighten coordinate regex and improve reverse-geocoding handling. Documentation updates: fix Swedish flag image path in README.md and add the WeatherAPI CDN icon URL to privacy-policy.html.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@README.md`:
- Line 246: Add `alt` attributes to all flag images in the language support
table (lines 223-253) for accessibility compliance with MD045 standards. For
each flag image tag starting with `<img src='https://flagcdn.com/`, add an
appropriate alt text attribute describing the country flag (for example,
alt="Sweden flag"). This applies to the Swedish entry on line 246 and all other
language entries in the same table range to ensure all images have proper
accessibility descriptions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 376df2d7-e144-4ffa-999c-39922ed602aa
📒 Files selected for processing (3)
README.mdprivacy-policy.htmlscripts/weather.js
✅ Files skipped from review due to trivial changes (1)
- privacy-policy.html
🚧 Files skipped from review as they are similar to previous changes (1)
- scripts/weather.js
| | <img src='https://flagcdn.com/si.svg' width=20> **Slovenian** - Slovenščina | sl-SI | [Linux-Alex](https://github.com/Linux-Alex/) | | ||
| | <img src='https://flagcdn.com/es.svg' width=20> **Spanish** - Español | es-ES | [XengShi](https://github.com/XengShi/), [Isaac Vergara](https://github.com/zRaidev), [Saúl Palacios](https://github.com/palacios22c) | | ||
| | <img src='https://flagcdn.com/sv.svg' width=20> **Swedish** - Svenska | sv | [HELLOEMPO](https://github.com/empohello-imamempogitub/) | | ||
| | <img src='https://flagcdn.com/se.svg' width=20> **Swedish** - Svenska | sv | [HELLOEMPO](https://github.com/empohello-imamempogitub/) | |
There was a problem hiding this comment.
Add alt text to the Swedish flag image for accessibility.
Line 246's flag image lacks an alt attribute, which violates the MD045 markdown accessibility rule. Additionally, all other flag images in the language support table (lines 223–253) have the same issue.
🔧 Proposed fix for line 246 and entire table
-| <img src='https://flagcdn.com/se.svg' width=20> **Swedish** - Svenska | sv | [HELLOEMPO](https://github.com/empohello-imamempogitub/)
+| <img src='https://flagcdn.com/se.svg' alt='Swedish flag' width=20> **Swedish** - Svenska | sv | [HELLOEMPO](https://github.com/empohello-imamempogitub/)To fully comply with accessibility standards, apply this pattern to all flag images in the table (lines 223–253). For example:
-| <img src='https://flagcdn.com/us.svg' width=20> **English**
+| <img src='https://flagcdn.com/us.svg' alt='United States flag' width=20> **English**📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| | <img src='https://flagcdn.com/se.svg' width=20> **Swedish** - Svenska | sv | [HELLOEMPO](https://github.com/empohello-imamempogitub/) | | |
| | <img src='https://flagcdn.com/se.svg' alt='Swedish flag' width=20> **Swedish** - Svenska | sv | [HELLOEMPO](https://github.com/empohello-imamempogitub/) |
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 246-246: Images should have alternate text (alt text)
(MD045, no-alt-text)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.md` at line 246, Add `alt` attributes to all flag images in the
language support table (lines 223-253) for accessibility compliance with MD045
standards. For each flag image tag starting with `<img
src='https://flagcdn.com/`, add an appropriate alt text attribute describing the
country flag (for example, alt="Sweden flag"). This applies to the Swedish entry
on line 246 and all other language entries in the same table range to ensure all
images have proper accessibility descriptions.
Source: Linters/SAST tools
📌 Description
Introduce a selectable weather provider and implement Open-Meteo support. index.html: add a weather provider dropdown UI. privacy-policy.html: document new IP-based GeoJS endpoint, Open-Meteo, and Nominatim usage. scripts/weather.js: update header copyright, add provider selection persistence, implement Open-Meteo location search and forecast fetching (with geocoding/reverse-geocoding fallbacks), map Open-Meteo codes to a WeatherAPI-like response shape, and fall back to WeatherAPI when selected. Also reset cached parsed weather on provider change and wire up the provider select element.
🎨 Visual Changes (Screenshots / Videos)
🔗 Related Issues
✅ Checklist
🤖 AI Assistance (Coding)
Overview
This PR adds a selectable weather provider setting that lets users choose between WeatherAPI and Open-Meteo. It includes new UI for provider selection with persistence across sessions, updated privacy documentation for the additional external services, and enhanced weather/geocoding logic to support Open-Meteo—falling back to WeatherAPI when the selected provider isn’t available. This closes issue
#226.Changes
index.html
privacy-policy.html
scripts/weather.js
fetchLocationSuggestions()now uses the saved provider preference fromlocalStorage.weatherProviderSelect(default:weatherapi){name, region, country}fetchWeather()now branches by selected providerweather_codeinto the existing WeatherAPI-compatible internalfilteredDatashapefilteredDatastructurelocalStorageon load (defaultweatherapi)weatherParsedTimeto force refresh, and reloads to apply the new backendREADME.md
Impact
Users can switch their weather backend via the settings UI, with the selection remembered across sessions. The Open-Meteo integration supports both geocoding and forecast retrieval, while maintaining UI compatibility through mapping into the same internal response format; reliability is improved by automatically falling back to WeatherAPI when needed.