-
Notifications
You must be signed in to change notification settings - Fork 192
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
feat: Add window.alby methods #1916
Conversation
🚀 Thanks for the pull request! Here are the current build files for testing: Download and unzip the file for your browser. Refer to the readme for detailed install instructions. This build is brought to you by:
Want to sponsor the next build? send some sats to ⚡️builds@getalby.com (don't forget to provide your name) Don't forget: keep earning sats! |
thanks for this PR and tackling this! looks pretty good, I will review this asap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For more clear separation I am thinking about also splitting up the content script code into a specil alby script.
then we would have one for webln, nostr, and alby.
Eventhough this means some code duplication (which we can also refactor into some helpers likely) I think this separation makes it a bit clearer and easier to follow to flow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After chatting with @reneaaron we think it's best to move the content script for this in its own file - to have this separate. Then every provider has it's own corresponding content script and we are fully flexible there and those are independent of each other.
but we don't do an enable call there as we always prompt the user anyway.
wdyt?
If ok, then we get this in the next release.
@AaronDewes do you still have time for this? otherwise maybe @im-adithya could you also help here? |
Without an enable call the user will not be able to reject further requests. Is this ok? |
I agree it would be good to split this into a separate file. With 3 files and much duplication I think it would be best to refactor this, but I guess could be done in a follow up MR. Maybe we can also migrate these files to Typescript. Why are these files called "onend"? |
👍
They are added via at |
To add an account, do await alby.enable();
await alby.addAccount(
"name", "lndhub",
{
lnAddress: "name@getalby.com",
login: "xxxxx",
password: "xxxx",
url: "https://ln.getalby.com"
}); |
@im-adithya Can you please address the review feedback in this PR. Let's get this merged! 🚀 |
@reneaaron Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading the code it seems there should be a success message but there is none.
I think that adding the success message (and delaying the popup from closing) could be tricky, so I would maybe just remove it for now.
There are efforts to introduce success messages in #2171 that we could reuse here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pushed some last improvements and did some final testing. Published some docs here:
https://guides.getalby.com/alby-extension-apis/
tACK
Describe the changes you have made in this PR
This adds a
window.alby
API and adds an initial method to it:window.alby.addAccount
allows websites to register an account in Alby.Link this PR to an issue [optional]
Fixes #ISSUE-NUMBER
Type of change
feat
: New feature (non-breaking change which adds functionality)Screenshots of the changes [optional]
How has this been tested?
Manually calling the function from the browser dev tools. I'll create a demo app later.
Checklist
Things that are still missing
window.alby
(Maybe with a custom library similar to the existing webln lib on npm?)I opened this PR to gather feedback on this API. I already suggested it in the Alby telegram channel.