Repository navigation
fix(currency): correct jsDelivr npm scope - #699
cahthuranag wants to merge 3 commits into
Conversation
The primary URL used the @Fwa0 npm scope, which does not exist on jsDelivr (HTTP 404), so every refresh fell through to pages.dev and there was no fallback left if pages.dev failed. - jsDelivr base now uses @fawazahmed0/currency-api - add a third URL with the same JSON shape after pages.dev - tests: third-endpoint fallback, all-endpoints-fail, and request order Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Thanks @cahthuranag, great catch. The We'd rather keep third-party hosts out of the default chain, since self-hosted users in regulated setups review every outbound host. So we opened #700, which adds a Edit: an earlier version of this comment said #700 would include a docs page using AllRatesToday as the worked example, credited to your team. That page was dropped in review in favor of the flag's own documentation, so the docs won't mention AllRatesToday. Sorry for overpromising. Could you trim this PR to the jsDelivrBase fix plus the ordering tests (dropping the hardcoded third URL)? Then we'll merge both. Review on #700 is welcome too. And if d8a is useful to you, a ⭐ on the repo helps a lot. Thanks again! Generated by Claude Code |
Keep third-party hosts out of the default chain; d8a-tech#700 adds a setting for extra sources instead. This leaves the jsDelivr scope fix and the endpoint-order test.
|
Trimmed: third URL removed, this is now the jsDelivrBase fix plus the ordering tests. Title and description updated. |
* feat(currency): configurable extra rate sources + docs Add currency.extra_source_urls (CURRENCY_EXTRA_SOURCE_URLS, --currency-extra-source-urls): base URLs tried in order after the built-in jsDelivr and pages.dev mirrors. Empty by default, so no new outbound hosts unless configured. - WithExtraSourceURLs option on the FWA converter - test: extra sources tried after mirrors, in order, whitespace and trailing slashes trimmed - docs: Currency rate sources page with an AllRatesToday example Context: #699 * fix(currency): address review on extra rate sources - Drop the currency-rate-sources docs page; the flag usage text documents the option. - Preallocate the URL slice in fetchRates (prealloc). - Wrap a long line in the extra-sources test (lll). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmmPjtm4mM9UzJov5Q6pE3 --------- Co-authored-by: d8a <noreply@d8a.tech> Co-authored-by: Claude <noreply@anthropic.com>
|
@analyticsmessiah-cpu pong, I just merged your competing PR |
|
@analyticsmessiah-cpu #700 is merged, but |
pkg/currency/fwa.gobuilds the primary URL with the npm scope@FWA0:So every refresh fails on jsDelivr and falls through to
latest.currency-api.pages.dev.Changes:
jsDelivrBasenow uses@fawazahmed0/currency-api.TestAPIDownloader_Download_ArrayDriven, andTestAPIDownloader_FetchRates_TriesEndpointsInOrder, which runs against anhttptestserver and checks the exact URL order.Testing:
go vet ./pkg/currency/andgo test ./pkg/currency/pass. I did not run golangci-lint locally.Disclosure: I work on allratestoday.com.