diff --git a/LICENSE b/LICENSE index 93b0e4e..cfbd23b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,39 +1,6 @@ -> Use any license you like, its your extension. - ---- - -# DON'T BE A DICK PUBLIC LICENSE - -> Version 1.1, December 2016 - -> Copyright (C) 2024 Alan Bits - -Everyone is permitted to copy and distribute verbatim or modified -copies of this license document. - -> DON'T BE A DICK PUBLIC LICENSE -> TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - -1. Do whatever you like with the original work, just don't be a dick. - - Being a dick includes - but is not limited to - the following instances: - - 1a. Outright copyright infringement - Don't just copy this and change the name. - 1b. Selling the unmodified original with no work done what-so-ever, that's REALLY being a dick. - 1c. Modifying the original work to contain hidden harmful content. That would make you a PROPER dick. - -2. If you become rich through modifications, related works/services, or supporting the original work, -share the love. Only a dick would make loads off this work and not buy the original work's -creator(s) a pint. - -3. Code is provided with no warranty. Using somebody else's code and bitching when it goes wrong makes -you a DONKEY dick. Fix the problem yourself. A non-dick would submit the fix back. - ---- - # MIT License -> Copyright (c) 2024 Alan Bits +Copyright (c) 2024 Riccardo Balbo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 49c7d37..1bf7653 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,34 @@ -`The README.md typically serves as a guide for using the extension.` +# NWC Service Provider Extension for [LNbits](https://github.com/lnbits/lnbits) -# NWCService - An [LNbits](https://github.com/lnbits/lnbits) Extension +Easily connect your LNbits wallets via [NWC](https://nwc.dev/). -## A Starter Template for Your Own Extension +## Installation -Ready to start hacking? Once you've forked this extension, you can incorporate functions from other extensions as needed. +Install the extension via the .env file or through the admin UI on your LNbits server. More details can be found [here](https://github.com/lnbits/lnbits/wiki/LNbits-Extensions). -### How to Use This Template -> This guide assumes you're using this extension as a base for a new one, and have installed LNbits using https://github.com/lnbits/lnbits/blob/main/docs/guide/installation.md#option-1-recommended-poetry. +## Configuration -1. Install and enable the extension either through the official LNbits manifest or by adding https://raw.githubusercontent.com/lnbits/nwcservice/main/manifest.json to `"Server"/"Server"/"Extension Sources"`. ![Extension Sources](https://i.imgur.com/MUGwAU3.png) ![image](https://github.com/lnbits/nwcservice/assets/33088785/4133123b-c747-4458-ba6c-5cc7c0f124d8) +Configure the extension from the "Settings" page in the top right menu when logged in as admin inside the extension page. -2. `Ctrl c` shut down your LNbits installation. -3. Download the extension files from https://github.com/lnbits/nwcservice to a folder outside of `/lnbits`, and initialize the folder with `git`. Alternatively, create a repo, copy the nwcservice extension files into it, then `git clone` the extension to a location outside of `/lnbits`. -4. Remove the installed extension from `lnbits/lnbits/extensions`. -5. Create a symbolic link using `ln -s /home/ben/Projects/ /home/ben/Projects/lnbits/lnbits/extensions`. -6. Restart your LNbits installation. You can now modify your extension and `git push` changes to a repo. -7. When you're ready to share your manifest so others can install it, edit `/lnbits/nwcservice/manifest.json` to include the git credentials of your extension. -8. IMPORTANT: If you want your extension to be added to the official LNbits manifest, please follow the guidelines here: https://github.com/lnbits/lnbits-extensions#important +### Configuration Options: + +| Key | Description | Default | +|---------------|------------------------------------------------------------------------------------------------------------------------------------|--------------------------------| +| relay | URL of the nostr relay for dispatching and receiving NWC events. Use public relays or a custom one. Specify `nostrclient` to connect to the [nostrclient extension](https://github.com/lnbits/nostrclient). | nostrclient | +| provider_key | Nostr secret key of the NWC Service Provider. | Random key generated on install | +| relay_alias | Relay URL to display in pairing URLs. Set if different from `relay`. | Empty (uses the `relay` value) | + +### Using Nostrclient + +The extension is preconfigured to connect to the nostrclient extension. Install it on the same LNbits instance and configure it to expose public websocket endpoints. Refer to the [nostrclient documentation](https://github.com/lnbits/nostrclient) for more information. + +### Using a Custom Relay + +To use a custom relay, set the `relay` key to the relay URL (e.g., `wss://nostr.wine`) in the extension's Settings page. + +## Usage + +1. Go to the extension page. +2. Select a wallet and click the plus button to create a new NWC connection. +3. Configure expiration, limits, and permissions. +4. A pairing URL will be generated for you to open, copy, or scan with the NWC app. Note that the pairing URL is shown only once, but you can delete and recreate the connection to get a new one. diff --git a/config.json b/config.json index 81b1aca..988bb50 100644 --- a/config.json +++ b/config.json @@ -10,18 +10,5 @@ "role": "Dev" } ], - "images": [ - { - "uri": "https://raw.githubusercontent.com/riccardobl/nwcprovider/main/static/image/1.png" - }, - { - "uri": "https://raw.githubusercontent.com/riccardobl/nwcprovider/main/static/image/2.png" - }, - { - "uri": "https://raw.githubusercontent.com/riccardobl/nwcprovider/main/static/image/3.png" - } - ], - "description_md": "https://raw.githubusercontent.com/riccardobl/nwcprovider/main/description.md", - "terms_and_conditions_md": "https://raw.githubusercontent.com/riccardobl/nwcprovider/main/toc.md", "license": "MIT" } diff --git a/static/image/1.png b/static/image/1.png deleted file mode 100644 index e0a3932..0000000 Binary files a/static/image/1.png and /dev/null differ diff --git a/static/image/2.png b/static/image/2.png deleted file mode 100644 index e0a3932..0000000 Binary files a/static/image/2.png and /dev/null differ diff --git a/static/image/3.png b/static/image/3.png deleted file mode 100644 index e0a3932..0000000 Binary files a/static/image/3.png and /dev/null differ diff --git a/templates/nwcprovider/admin.html b/templates/nwcprovider/admin.html index dbda4a4..940388f 100644 --- a/templates/nwcprovider/admin.html +++ b/templates/nwcprovider/admin.html @@ -79,8 +79,6 @@ try { const response = await LNbits.api .request('POST', '/nwcprovider/api/v1/config', this.g.user.wallets[0].adminkey, data) - - this.$q.notify({ message: 'Config saved, please restart the server', color: 'positive', diff --git a/templates/nwcprovider/index.html b/templates/nwcprovider/index.html index a794dc2..bb7c2d0 100644 --- a/templates/nwcprovider/index.html +++ b/templates/nwcprovider/index.html @@ -8,15 +8,8 @@
- - - - @@ -27,8 +20,6 @@
Connected Apps
- - @@ -69,9 +60,9 @@
-
{{SITE_TITLE}} NWC Service provider extension
+
NWC Service provider

- An extension that turns LNBits into a Nostr Wallet Connect service provider. + Nostr Wallet Connect (NWC) are a way for applications to connect to a remote lightning wallet.

@@ -89,30 +80,13 @@ Settings - +
- - - - - + @@ -152,8 +126,6 @@ Budget (sats)
used/max
- -
Refresh @@ -168,14 +140,10 @@ - - - - Close @@ -186,7 +154,6 @@ - @@ -195,21 +162,15 @@

Please scan this QR code with a supported app

Connect only with app you trust!

-
- - + -
- -

Pairing

Complete the last step of the setup by pasting or scanning your connection's @@ -217,7 +178,6 @@ app to finalise the connection.

Connect only with app you trust!

-