Skip to content
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

fix: lnurl scheme parsing #2975

Merged
merged 3 commits into from
Jan 5, 2024

Conversation

ekzyis
Copy link

@ekzyis ekzyis commented Dec 31, 2023

Describe the changes you have made in this PR

In #2927, I noticed that links that start with lnurl open the Alby extension. This means that even links to content unrelated to lightning like lnurlpay_comments.mp4 open the Alby extension.

I looked up what schemes are meant to be parsed and I found LUD-17.

So I think only the following link prefixes should open the Alby extension:

lightning:, lnurlc:, lnurlw:, lnurlp:

Link this PR to an issue [optional]

Fixes #2927

Type of change

  • fix: Bug fix (non-breaking change which fixes an issue)

Screenshots of the changes [optional]

video
2023-12-31.01-07-47.mp4

How has this been tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Checklist

  • Self-review of changed code
  • Manual testing
  • Added automated tests where applicable
  • Update Docs & Guides
  • For UI-related changes
  • Darkmode
  • Responsive layout

@ekzyis ekzyis force-pushed the 2927-fix-lnurl-scheme-parsing branch from ffcdb6b to 1c63e51 Compare December 31, 2023 00:07
@pavanjoshi914 pavanjoshi914 requested a review from rolznz January 1, 2024 07:19
@pavanjoshi914
Copy link
Contributor

had a round of tests. LGTM cc @rolznz the error is just because we use more generalised matcher which can cause such error with relative links having lnurl inlcuded in the link

@@ -45,10 +45,12 @@ function registerLightningLinkClickHandler() {
return;
}
const lightningLink = target.closest('[href^="lightning:" i]');
const lnurlLink = target.closest('[href^="lnurl" i]');
const lnurlLink = target.closest(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we link to the relevant spec? I think it is LUD-17

Copy link
Contributor

@rolznz rolznz Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we support keyauth too? (I think this change will currently break it)

Copy link
Author

@ekzyis ekzyis Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we link to the relevant spec? I think it is LUD-17

Done in 385af36

Should we support keyauth too? (I think this change will currently break it)

I think you never supported keyauth so this change will not break it. I searched for keyauth in your source code and no occurrence was found:

$ grep -R "keyauth" src/

I have never seen keyauth in the wild and LNURL-auth already works with Alby. So I think this is a part of a spec that isn't necessary to implement. But might still make sense to add it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, thanks! I'll made a new issue for that: #2984

Copy link
Contributor

@rolznz rolznz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@rolznz rolznz enabled auto-merge January 4, 2024 11:55
@pavanjoshi914 pavanjoshi914 disabled auto-merge January 5, 2024 06:56
@pavanjoshi914 pavanjoshi914 merged commit 5b70035 into getAlby:master Jan 5, 2024
6 of 7 checks passed
@ekzyis ekzyis deleted the 2927-fix-lnurl-scheme-parsing branch March 8, 2024 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] non-LNURL link with "lnurl" in it incorrectly opens Alby extension
3 participants