From e6ce8b1500ca373de40c7ce0d783a14e03d90bef Mon Sep 17 00:00:00 2001 From: Alejandro Pedraza Date: Wed, 21 Feb 2024 12:46:52 -0500 Subject: [PATCH] Add `bitcoin` protocol handler for PWA Closes #547 In my testing I could only make the `bitcoin` handler work. This is likely due to the ["safelisted schemes"](https://html.spec.whatwg.org/multipage/system-state.html#safelisted-scheme). The `send?invoice=%s` url was already being handled by the `parsePaste` function but the invoice data wasn't getting picked up, so I had to add the `handleDestination` call in there. --- manifest.ts | 6 ++++++ src/routes/Send.tsx | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/manifest.ts b/manifest.ts index f2534cea..40dc8276 100644 --- a/manifest.ts +++ b/manifest.ts @@ -517,6 +517,12 @@ const manifest: Partial = { } ] } + ], + protocol_handlers: [ + { + protocol: "bitcoin", + url: "/send?invoice=%s" + } ] }; diff --git a/src/routes/Send.tsx b/src/routes/Send.tsx index 6e856f8d..428f2d00 100644 --- a/src/routes/Send.tsx +++ b/src/routes/Send.tsx @@ -260,7 +260,7 @@ export function Send() { }, (result) => { actions.setScanResult(result); - navigate("/send", { state: { previous: "/search" } }); + handleDestination(state.scan_result); } ); }