Commit Graph

406 Commits

Author SHA1 Message Date
r1ckstardev
3836fe6b38 BTCMaps v2: add btcmap import-RPC submit path alongside directory submission
Adds a second downstream lane to /apis/btcmaps/v1/submit that forwards
the merchant payload to teambtcmap/btcmap-api's submit_place RPC
(merged 2026-05-24 in teambtcmap/btcmap-api#91).

Request schema:

- New fields Lat, Lon, Category, ExternalId on BtcMapsSubmitRequest,
  required iff SubmitToBtcMap=true. Validator enforces lat/lon
  ranges, lowercase-identifier category, and 1-200 char external_id.
  Plugin side (rollforsats/BTCPayServerPlugins) composes external_id
  as hostname:storeId so the namespace stays unique per BTCPay
  instance.
- New SubmitToDirectory + SubmitToBtcMap routing flags. The
  directory flag defaults true to preserve existing callers; btcmap
  defaults false so new callers must opt in.
- New Phone field forwarded as OSM Key:phone in extra_fields.

Service layer:

- BtcMapsService.SubmitToBtcMapAsync POSTs a JSON-RPC 2.0 envelope
  ({jsonrpc, method, params, id}) to BTCMAPS:BtcMapImportEndpoint
  (default https://api.btcmap.org/rpc) with method=submit_place,
  origin=btcpayserver, and the merchant payload mapped to the
  documented param shape. Bearer auth from BTCMAPS:BtcMapImportToken.
- Optional fields (website, description, twitter, github, onion,
  phone, country) ride along in extra_fields using OSM tag keys
  (contact:twitter, addr:country, etc.) plus the implicit
  payment:bitcoin=yes marker.
- New BtcMapTokenMissingException parallels the existing
  DirectoryTokenMissingException so the controller can return 503
  with a distinct error code when ops haven't provisioned the
  scoped token yet.

Controller:

- /apis/btcmaps/v1/submit branches on SubmitToDirectory +
  SubmitToBtcMap. At least one must be true (rejected 400 otherwise).
- Each lane has its own exception ladder symmetric to the existing
  directory path: token-missing 503 (directory-not-configured /
  btcmap-not-configured), caller-cancel rethrow, upstream-timeout
  504, generic-failure 502 - error codes namespaced by lane so ops
  can tell them apart.

HttpClient registration:

- New HttpClientNames.BtcMap named client registered with 15s
  per-call timeout and JSON Accept header, matching the
  BtcMapsDirectory budget for bounded worst-case behavior.

Tests:

- 12 new validation tests in BtcMapsServiceTests covering the
  SubmitToBtcMap=true required-field paths (Lat / Lon / Category /
  ExternalId; range checks; lowercase-identifier policy; overlong
  external_id) plus the default-false directory-only-still-works
  baseline. 37/37 BtcMapsServiceTests passing.
2026-05-25 14:45:46 +00:00
thgO.O
8ffea888af
Merge pull request #222 from btcpayserver/ft/request_listing_flow
Some checks failed
PluginBuilder Tests / test (push) Has been cancelled
Improve plugin listing request flow
2026-05-18 11:02:33 -03:00
thgO.O
474264419a
chore: remove reviewer feedback leftovers 2026-05-18 00:30:59 -03:00
thgO.O
3d4068aa43
fix: keep listing rejection pending-only 2026-05-18 00:30:26 -03:00
Chukwuleta Tobechi
61218fa8bb fix code rabbit suggestion 2026-05-14 11:42:35 +01:00
Chukwuleta Tobechi
21c2a93fdd revert changes 2026-05-14 11:21:20 +01:00
r1ckstardev
170d56d6d8 btcmaps v1: timeout vs caller-cancel split + canonical-case type/subType on write
Addresses thgO-O review id 4274558448 (PR #224) items #2 and #3.

#2 OperationCanceledException vs HttpClient.Timeout: the prior
catch-when filter excluded OCE wholesale to avoid swallowing client
disconnects, but HttpClient.Timeout surfaces as TaskCanceledException
(inherits from OCE) so an upstream GitHub timeout slipped through and
fell out as a 500 instead of the intended 502. Now split into three
arms: caller-cancel rethrows (info-log + drop the connection),
upstream-timeout returns 504 with discriminant directory-upstream-
timeout, anything else still 502 directory-upstream-failed.

#3 type/subType case normalization on write: ValidTypes +
ValidMerchantSubTypes match OrdinalIgnoreCase at validation, but the
write at BuildMerchantEntry preserved the user-submitted casing. A
submission of "Merchants" / "Books" would pass validation and land
non-canonical in merchants.json. Normalize to ToLowerInvariant on
write so the file stays in the lowercase convention. Country is
already validated against a case-sensitive Ordinal set so the
validator rejects non-uppercase before reaching the writer; no write-
path change needed there.
2026-05-13 12:42:50 +00:00
Chukwuleta Tobechi
66d9d5e172 Remove feedback and move request listing to side nav 2026-05-11 21:12:01 +01:00
r1ckstardev
b84538f2c2 btcmaps v1: IHttpClientFactory + markdown-safe PR body + idempotent branch + ISO whitelist
Addresses post-#224 review feedback from @rollforsats + CodeRabbit:

- IHttpClientFactory + named HttpClientNames.BtcMapsDirectory client
  replaces per-request `new HttpClient()`. 15s per-call timeout caps the
  ~5-7 GitHub round-trips at a bounded worst case instead of the default
  100s x N. Bearer token stays per-request (the BTCMAPS token is distinct
  from the global PluginBuilder GitHub token; must not leak into the
  singleton handler).
- Markdown injection guard on the PR body. User fields (Name, Type,
  SubType, Country, Twitter, GitHub) are wrapped in inline code spans
  with backtick-escape so a doctored merchant name can't render as a
  clickable link in the maintainer-facing PR description. Description
  goes inside a fenced code block. URL is rendered as <bare-url> autolink
  so the maintainer always sees the actual destination.
- Idempotent branch name: SHA-1-derived suffix from the normalized URL
  replaces the random GUID. Two concurrent same-URL submissions now
  collide on `git/refs` create instead of racing through preflight and
  opening duplicate PRs. The 422 "Reference already exists" surface is
  caught and mapped to the open-PR lookup or `branch-exists-no-open-pr`.
- NormalizeUrl lowercases scheme + host only and preserves path + query
  case verbatim. Lowercasing the whole URL falsely de-duplicates
  case-sensitive paths.
- Country code validation moves to an actual ISO 3166-1 alpha-2 set
  built from CultureInfo at startup. Replaces the
  `length==2 && IsUpper` shape that accepted reserved/unassigned codes
  like ZZ.
- Missing BTCMAPS:DirectoryGithubToken throws
  DirectoryTokenMissingException at the service layer; controller maps
  it to 503 with `directory-not-configured`. Previously surfaced as a
  200 OK with `Skipped` which a client could misread as "accepted".

5 new tests:
- Validate_RejectsNonAssignedTwoLetterCountry (ZZ)
- NormalizeUrl_PreservesPathCase
- NormalizeUrl_PreservesQueryCase
- BuildBranchName_DeterministicForSameUrl
- BuildBranchName_DiffersForDifferentUrls

25/25 BtcMapsServiceTests pass on Release build.
2026-05-11 16:32:04 +00:00
r1ckstardev
33148aafcd BTCMaps v1: directory-only submission API
Supersedes PR #211. Per-store OSM OAuth moves to the BTC Map
plugin side (rollforsats/BTCPayServerPlugins PR #5); the
plugin-builder side keeps only the directory PR submission.

Drops vs PR #211:
- TagOnOsmAsync / UnlistFromOsmAsync service paths and all
  OSM XML + changeset infrastructure (~430 lines)
- TagOnOsm / UnlistFromOsm / OsmNodeId / OsmNodeType /
  Latitude / Longitude / OsmCategory / AcceptsLightning
  request fields
- BtcMapsOsmResult response shape + Address sub-model
- OSM-specific validators

Keeps:
- POST /apis/btcmaps/v1/submit opens a PR against
  btcpayserver/directory.btcpayserver.org's merchants.json
- GET /apis/btcmaps/v1/ping
- Rate limit: 5 submissions / 24h per source IP
- Validation for name / url / description / type / subType /
  country / twitter / github / onionUrl

Build clean (Release); 20 unit tests cover validation, slug,
URL normalization.
2026-05-10 18:52:16 +00:00
thgO.O
4480aa01d4
Merge pull request #223 from ak91456/master
Some checks failed
PluginBuilder Tests / test (push) Has been cancelled
add Unlisted badge to plugin cards in public directory search results
2026-05-09 01:07:30 -03:00
thgO.O
4616f040dd
refactor: use visibility enum for unlisted check 2026-05-09 00:47:56 -03:00
Khushvendra Singh
e0c8972366
Align antiforgery error details flow with BTCPay UI handling (#196) (#197)
* Align antiforgery error details flow with BTCPay UI handling (#196)

- add UIControllerAntiforgeryTokenAttribute equivalent and register it globally in MVC\n- populate UIErrorController.ErrorDetailsKey on antiforgery validation failures\n- keep UI-only/non-safe-method antiforgery behavior aligned with BTCPay policy semantics\n- add focused unit tests for validation, existing failure enrichment, GET bypass, API bypass, and IgnoreAntiforgeryToken bypass\n- add integration-style error page test to verify generic UI error view renders CSRF details

* Align antiforgery policy precedence for UI error handling

* Fix antiforgery error details and exempt NIP-07 verify endpoint

* Preserve detailed antiforgery error messages

* Keep antiforgery PR focused

* fix: keep antiforgery details generic

* test: focus antiforgery coverage

---------

Co-authored-by: thgO.O <thgo.o.btc@proton.me>
2026-05-08 18:40:12 -03:00
Psycological
d3af9746b8 add Unlisted badge to plugin cards in public directory search results 2026-05-08 08:10:39 +05:30
Chukwuleta Tobechi
85a8581e06 Improve plugin listing request flow 2026-05-06 15:47:46 +01:00
thgO.O
cf99e25872
Merge pull request #214 from makeentosch/feature/api-validation
Some checks failed
PluginBuilder Tests / test (push) Has been cancelled
Api validation implemented
2026-05-04 18:01:08 -03:00
makeentosch
5ee5f70c6d api validation implemented 2026-04-28 20:06:28 +03:00
thgO.O
04a64d9178
Handle local loopback plugin downloads
Add an explicit local artifact download proxy flag for development and tests.

Keep the public download endpoint as a redirect while routing enabled loopback artifacts through the internal proxy.
2026-04-26 12:45:37 -03:00
Chukwuleta Tobechi
fa9e2673d9
Merge pull request #207 from btcpayserver/ft/remove_logo_on_Create_plugin
clean up create plugin page
2026-04-21 21:00:46 +01:00
Chukwuleta Tobechi
9a5c8614d5 code rabbit suggestion 2026-04-17 15:21:44 +01:00
Chukwuleta Tobechi
0366e9ce8e if logo upload fails, return warning message 2026-04-17 14:08:43 +01:00
Chukwuleta Tobechi
660f86bc18 resolve coderabbit suggestion 2026-04-17 14:04:29 +01:00
Chukwuleta Tobechi
f0ddd89293 clean up create plugin page 2026-04-17 13:53:50 +01:00
psycarlo
4829306bb5 feat: gitlab provider and IGitHostingProvider abstraction 2026-04-13 18:49:04 +01:00
thgO.O
ad18746ac1
fix : handle create media failures gracefully 2026-04-11 22:28:48 -03:00
Tim
91ae5f726c
Merge branch 'btcpayserver:master' into master 2026-04-11 11:20:06 +02:00
Timothé
0281bc437c refactor : create slug before uploading logo/images 2026-04-09 10:11:53 +02:00
Timothé
ea02f78e40 fix : limitation images url in create endpoint 2026-04-09 09:26:45 +02:00
Timothé
a2ce9d5094 fix : repopulate images in settings 2026-04-06 19:29:54 +02:00
Timothé
581a9ed1ee fix : limitation images url 2026-04-06 19:13:38 +02:00
Chukwuleta Tobechi
4983d18c66 resolve JS validation 2026-04-06 16:20:38 +01:00
Chukwuleta Tobechi
cf9e8f05fc Increase Kestrel max request body size to support image uploads 2026-04-06 15:53:32 +01:00
Chukwuleta Tobechi
315c80fe05 clean up controller 2026-04-06 12:27:09 +01:00
Timothé
78c0629823 test : fix pw tests 2026-04-03 16:29:06 +02:00
Timothé
d6246d2e24 fix : change requestform to fromform 2026-04-03 14:02:23 +02:00
Timothé
c1e7670995 refactor : partial view for edit/settings images parts 2026-04-03 12:18:22 +02:00
thgO.O
8c50b6aad3
fix(api): accept RC BTCPay host versions in compatibility filters 2026-04-02 08:21:59 -03:00
thgO.O
55260634fa
Merge pull request #187 from 1amKhush/feat/unify-error-pages-158
Some checks failed
PluginBuilder Tests / test (push) Waiting to run
Publish Docker image / Push Docker image to Docker Hub (push) Has been cancelled
Port BTCPay-style error pages and pipeline (404/500)
2026-04-01 11:58:04 -03:00
Timothé
af146b9d36 fix : coderabbit review 2026-04-01 11:53:07 +02:00
Timothé
53b3d654e7 refactor : edit/settings drag&drop + view + rm image 2026-03-31 23:35:55 +02:00
Timothé
5791b03961 refactor : edit view + remove cross (button) 2026-03-31 23:11:33 +02:00
Timothé
ed1454e408 rm : screenshots -> images 2026-03-31 19:36:40 +02:00
1amKhush
45390be6d5 Fix error status codes and owner leave redirect flow 2026-03-31 19:30:18 +05:30
Timothé
4edb993eae
Merge branch 'btcpayserver:master' into master 2026-03-31 15:23:17 +02:00
1amKhush
ab399f77a7 Align BTCPay error pages and lock special-route behavior with focused tests 2026-03-31 18:29:47 +05:30
Chukwuleta Tobechi
556f72d910 adjustments 2026-03-30 21:30:15 +01:00
1amKhush
691768c3a4 use UI error DOM marker, fail fast on admin role setup 2026-03-30 22:27:54 +05:30
Timothé
f6c07cd6fd
Merge branch 'btcpayserver:master' into master 2026-03-30 17:05:10 +02:00
Timothé
e9ff5c2661 fix: little UI/UX fixes 2026-03-30 15:02:02 +02:00
Timothé
ba82867753 feat : add preview to settings & edit views 2026-03-30 14:15:50 +02:00