New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add context menu item for selected bolt11 payment requests #108

Merged
merged 8 commits into from Dec 28, 2018

Conversation

Projects
None yet
2 participants
@jamaljsr
Copy link
Collaborator

jamaljsr commented Dec 22, 2018

Closes #9

Description

Added a context menu item to "Pay Lightning Invoice" when a BOLT-11 payment request string is highlighted on the page and right-clicked. When this menu item is clicked, the payment popup is displayed allowing you to confirm the payment. The extension makes an effort to only show the menu item when a valid payment request is highlighted

Steps to Test

  1. Visit a website that accepts lightning payments
  2. Click Buy button in order to be presented with a Lightning payment request string
  3. Highlight the string then right-click
  4. Click on the Pay Lightning Invoice menu item
  5. Click Confirm in the popup to send the bitcoin

Screenshots

joule_context_menu

@wbobeirne

This comment has been minimized.

Copy link
Owner

wbobeirne commented Dec 27, 2018

This is a really clever work-around for the extension API's lack of a way to show conditionally based on the content highlighted. I had hoped it'd work even without highlighting the BOLT-11 string, just by reading the content of the element, but it doesn't look like there's a straightforward way to do that. I'm going to dig in a little bit and see if that can be done, but if not, I'll merge this in.

Thanks for the contribution!

@jamaljsr

This comment has been minimized.

Copy link
Collaborator Author

jamaljsr commented Dec 27, 2018

I had not even considered the case where the user right-clicks without highlighting first, but that’s even better than what i have so far. I think it is may be possible if the mousedown event captures the associated DOM element. Then it’s just a matter of navigating up to the parent tag and getting the innerText. I will try this tomorrow and let you know how i make out.

@wbobeirne

This comment has been minimized.

Copy link
Owner

wbobeirne commented Dec 27, 2018

That sounds great, thanks for looking into it.

jamaljsr added some commits Dec 27, 2018

@wbobeirne
Copy link
Owner

wbobeirne left a comment

Works great, just the one bug introduced.

Show resolved Hide resolved src/background_script/index.ts
@wbobeirne
Copy link
Owner

wbobeirne left a comment

Thanks for the fix!

@wbobeirne wbobeirne merged commit 9881a9f into wbobeirne:develop Dec 28, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment