mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-21 14:10:30 +02:00
Documentation Updates (#202)
Updates for user manager and subdomains extensions Co-authored-by: Tiago Vasconcelos <tvasconcelos@gmail.com>
This commit is contained in:
committed by
GitHub
parent
a1e12fcd0e
commit
2e8145faac
@@ -5,15 +5,11 @@ title: Installation
|
|||||||
nav_order: 1
|
nav_order: 1
|
||||||
---
|
---
|
||||||
|
|
||||||
|
# Installation
|
||||||
Installation
|
|
||||||
============
|
|
||||||
|
|
||||||
Download the latest stable release https://github.com/lnbits/lnbits/releases
|
Download the latest stable release https://github.com/lnbits/lnbits/releases
|
||||||
|
|
||||||
|
## Application dependencies
|
||||||
Application dependencies
|
|
||||||
------------------------
|
|
||||||
|
|
||||||
The application uses [Pipenv][pipenv] to manage Python packages.
|
The application uses [Pipenv][pipenv] to manage Python packages.
|
||||||
While in development, you will need to install all dependencies:
|
While in development, you will need to install all dependencies:
|
||||||
@@ -24,7 +20,7 @@ $ pipenv install --dev
|
|||||||
```
|
```
|
||||||
|
|
||||||
If any of the modules fails to install, try checking and upgrading your setupTool module.
|
If any of the modules fails to install, try checking and upgrading your setupTool module.
|
||||||
`pip install -U setuptools`
|
`pip install -U setuptools`
|
||||||
|
|
||||||
If you wish to use a version of Python higher than 3.7:
|
If you wish to use a version of Python higher than 3.7:
|
||||||
|
|
||||||
@@ -41,9 +37,7 @@ E.g. when you want to use LND you have to `pipenv run pip install lndgrpc` and `
|
|||||||
|
|
||||||
Take a look at [Polar][polar] for an excellent way of spinning up a Lightning Network dev environment.
|
Take a look at [Polar][polar] for an excellent way of spinning up a Lightning Network dev environment.
|
||||||
|
|
||||||
|
## Running the server
|
||||||
Running the server
|
|
||||||
------------------
|
|
||||||
|
|
||||||
LNbits uses [Quart][quart] as an application server.
|
LNbits uses [Quart][quart] as an application server.
|
||||||
|
|
||||||
@@ -51,12 +45,18 @@ LNbits uses [Quart][quart] as an application server.
|
|||||||
$ pipenv run python -m lnbits
|
$ pipenv run python -m lnbits
|
||||||
```
|
```
|
||||||
|
|
||||||
Frontend
|
**Note**: You'll need to use _https_ for some endpoints and/or extensions. You can use [ngrok](https://ngrok.com/) for that. Follow the installation instructions on the website and when it's all set you can run:
|
||||||
--------
|
|
||||||
|
```sh
|
||||||
|
$ ./nrok http 5000
|
||||||
|
```
|
||||||
|
|
||||||
|
this will give you an _https_ tunnel for the _localhost_, use that URL for navigating to LNBits.
|
||||||
|
|
||||||
|
## Frontend
|
||||||
|
|
||||||
The frontend uses [Vue.js and Quasar][quasar].
|
The frontend uses [Vue.js and Quasar][quasar].
|
||||||
|
|
||||||
|
|
||||||
[quart]: https://pgjones.gitlab.io/
|
[quart]: https://pgjones.gitlab.io/
|
||||||
[pipenv]: https://pipenv.pypa.io/
|
[pipenv]: https://pipenv.pypa.io/
|
||||||
[polar]: https://lightningpolar.com/
|
[polar]: https://lightningpolar.com/
|
||||||
|
@@ -1,27 +1,29 @@
|
|||||||
<h1>Subdomains Extension</h1>
|
<h1>Subdomains Extension</h1>
|
||||||
|
|
||||||
So the goal of the extension is to allow the owner of a domain to sell their subdomain to the anyone who is willing to pay some money for it.
|
So the goal of the extension is to allow the owner of a domain to sell subdomains to anyone who is willing to pay some money for it.
|
||||||
|
|
||||||
|
[](https://youtu.be/O1X0fy3uNpw 'video tutorial subdomains')
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Free cloudflare account
|
- Free Cloudflare account
|
||||||
- Cloudflare as a dns server provider
|
- Cloudflare as a DNS server provider
|
||||||
- Cloudflare TOKEN and Cloudflare zone-id where the domain is parked
|
- Cloudflare TOKEN and Cloudflare zone-ID where the domain is parked
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
1. Register at cloudflare and setup your domain with them. (Just follow instructions they provide...)
|
1. Register at Cloudflare and setup your domain with them. (Just follow instructions they provide...)
|
||||||
2. Change DNS server at your domain registrar to point to cloudflare's
|
2. Change DNS server at your domain registrar to point to Cloudflare's
|
||||||
3. Get Cloudflare zoneID for your domain
|
3. Get Cloudflare zone-ID for your domain
|
||||||
<img src="https://i.imgur.com/xOgapHr.png">
|
<img src="https://i.imgur.com/xOgapHr.png">
|
||||||
4. get Cloudflare API TOKEN
|
4. Get Cloudflare API TOKEN
|
||||||
<img src="https://i.imgur.com/BZbktTy.png">
|
<img src="https://i.imgur.com/BZbktTy.png">
|
||||||
<img src="https://i.imgur.com/YDZpW7D.png">
|
<img src="https://i.imgur.com/YDZpW7D.png">
|
||||||
5. Open the lnbits subdomains extension and register your domain with lnbits
|
5. Open the LNBits subdomains extension and register your domain
|
||||||
6. Click on the button in the table to open the public form that was generated for your domain
|
6. Click on the button in the table to open the public form that was generated for your domain
|
||||||
|
|
||||||
- Extension also supports webhooks so you can get notified when someone buys a new domain
|
- Extension also supports webhooks so you can get notified when someone buys a new subdomain\
|
||||||
<img src="https://i.imgur.com/hiauxeR.png">
|
<img src="https://i.imgur.com/hiauxeR.png">
|
||||||
|
|
||||||
## API Endpoints
|
## API Endpoints
|
||||||
|
|
||||||
@@ -36,8 +38,6 @@ So the goal of the extension is to allow the owner of a domain to sell their sub
|
|||||||
- GET /api/v1/subdomains/<payment_hash>
|
- GET /api/v1/subdomains/<payment_hash>
|
||||||
- DELETE /api/v1/subdomains/<subdomain_id>
|
- DELETE /api/v1/subdomains/<subdomain_id>
|
||||||
|
|
||||||
## Useful
|
|
||||||
|
|
||||||
### Cloudflare
|
### Cloudflare
|
||||||
|
|
||||||
- Cloudflare offers programmatic subdomain registration... (create new A record)
|
- Cloudflare offers programmatic subdomain registration... (create new A record)
|
||||||
|
@@ -1,3 +1,26 @@
|
|||||||
<h1>User Manager</h1>
|
# User Manager
|
||||||
<h2>Make and manager users/wallets</h2>
|
|
||||||
To help developers use LNbits to manage their users, the User Manager extension allows the creation and management of users and wallets. For example, a games developer may be developing a game that needs each user to have their own wallet, LNbits can be included in the develpoers stack as the user and wallet manager.
|
## Make and manage users/wallets
|
||||||
|
|
||||||
|
To help developers use LNbits to manage their users, the User Manager extension allows the creation and management of users and wallets.
|
||||||
|
|
||||||
|
For example, a games developer may be developing a game that needs each user to have their own wallet, LNbits can be included in the developers stack as the user and wallet manager. Or someone wanting to manage their family's wallets (wife, children, parents, etc...) or you want to host a community Lightning Network node and want to manage wallets for the users.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
1. Click the button "NEW USER" to create a new user\
|
||||||
|

|
||||||
|
2. Fill the user information\
|
||||||
|
- username
|
||||||
|
- the generated wallet name, user can create other wallets later on
|
||||||
|
- email
|
||||||
|
- set a password
|
||||||
|

|
||||||
|
3. After creating your user, it will appear in the **Users** section, and a user's wallet in the **Wallets** section.
|
||||||
|
4. Next you can share the wallet with the corresponding user\
|
||||||
|

|
||||||
|
5. If you need to create more wallets for some user, click "NEW WALLET" at the top\
|
||||||
|

|
||||||
|
- select the existing user you wish to add the wallet
|
||||||
|
- set a wallet name\
|
||||||
|

|
||||||
|
@@ -214,7 +214,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %} {% block scripts %} {{ window_vars(user) }}
|
{% endblock %} {% block scripts %} {{ window_vars(user) }}
|
||||||
<script>
|
<script>
|
||||||
var mapUserManager = function (obj) {
|
var mapUserManager = function(obj) {
|
||||||
obj.date = Quasar.utils.date.formatDate(
|
obj.date = Quasar.utils.date.formatDate(
|
||||||
new Date(obj.time * 1000),
|
new Date(obj.time * 1000),
|
||||||
'YYYY-MM-DD HH:mm'
|
'YYYY-MM-DD HH:mm'
|
||||||
@@ -228,7 +228,7 @@
|
|||||||
new Vue({
|
new Vue({
|
||||||
el: '#vue',
|
el: '#vue',
|
||||||
mixins: [windowMixin],
|
mixins: [windowMixin],
|
||||||
data: function () {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
wallets: [],
|
wallets: [],
|
||||||
users: [],
|
users: [],
|
||||||
@@ -277,8 +277,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
userOptions: function () {
|
userOptions: function() {
|
||||||
return this.users.map(function (obj) {
|
return this.users.map(function(obj) {
|
||||||
console.log(obj.id)
|
console.log(obj.id)
|
||||||
return {
|
return {
|
||||||
value: String(obj.id),
|
value: String(obj.id),
|
||||||
@@ -290,7 +290,7 @@
|
|||||||
methods: {
|
methods: {
|
||||||
///////////////Users////////////////////////////
|
///////////////Users////////////////////////////
|
||||||
|
|
||||||
getUsers: function () {
|
getUsers: function() {
|
||||||
var self = this
|
var self = this
|
||||||
|
|
||||||
LNbits.api
|
LNbits.api
|
||||||
@@ -299,20 +299,20 @@
|
|||||||
'/usermanager/api/v1/users',
|
'/usermanager/api/v1/users',
|
||||||
this.g.user.wallets[0].inkey
|
this.g.user.wallets[0].inkey
|
||||||
)
|
)
|
||||||
.then(function (response) {
|
.then(function(response) {
|
||||||
self.users = response.data.map(function (obj) {
|
self.users = response.data.map(function(obj) {
|
||||||
return mapUserManager(obj)
|
return mapUserManager(obj)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
openUserUpdateDialog: function (linkId) {
|
openUserUpdateDialog: function(linkId) {
|
||||||
var link = _.findWhere(this.users, {id: linkId})
|
var link = _.findWhere(this.users, {id: linkId})
|
||||||
|
|
||||||
this.userDialog.data = _.clone(link._data)
|
this.userDialog.data = _.clone(link._data)
|
||||||
this.userDialog.show = true
|
this.userDialog.show = true
|
||||||
},
|
},
|
||||||
sendUserFormData: function () {
|
sendUserFormData: function() {
|
||||||
if (this.userDialog.data.id) {
|
if (this.userDialog.data.id) {
|
||||||
} else {
|
} else {
|
||||||
var data = {
|
var data = {
|
||||||
@@ -329,7 +329,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
createUser: function (data) {
|
createUser: function(data) {
|
||||||
var self = this
|
var self = this
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request(
|
.request(
|
||||||
@@ -338,47 +338,48 @@
|
|||||||
this.g.user.wallets[0].inkey,
|
this.g.user.wallets[0].inkey,
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
.then(function (response) {
|
.then(function(response) {
|
||||||
self.users.push(mapUserManager(response.data))
|
self.users.push(mapUserManager(response.data))
|
||||||
self.userDialog.show = false
|
self.userDialog.show = false
|
||||||
self.userDialog.data = {}
|
self.userDialog.data = {}
|
||||||
data = {}
|
data = {}
|
||||||
|
self.getWallets()
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function(error) {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deleteUser: function (userId) {
|
deleteUser: function(userId) {
|
||||||
var self = this
|
var self = this
|
||||||
|
|
||||||
console.log(userId)
|
console.log(userId)
|
||||||
LNbits.utils
|
LNbits.utils
|
||||||
.confirmDialog('Are you sure you want to delete this User link?')
|
.confirmDialog('Are you sure you want to delete this User link?')
|
||||||
.onOk(function () {
|
.onOk(function() {
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request(
|
.request(
|
||||||
'DELETE',
|
'DELETE',
|
||||||
'/usermanager/api/v1/users/' + userId,
|
'/usermanager/api/v1/users/' + userId,
|
||||||
self.g.user.wallets[0].inkey
|
self.g.user.wallets[0].inkey
|
||||||
)
|
)
|
||||||
.then(function (response) {
|
.then(function(response) {
|
||||||
self.users = _.reject(self.users, function (obj) {
|
self.users = _.reject(self.users, function(obj) {
|
||||||
return obj.id == userId
|
return obj.id == userId
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function(error) {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
exportUsersCSV: function () {
|
exportUsersCSV: function() {
|
||||||
LNbits.utils.exportCSV(this.usersTable.columns, this.users)
|
LNbits.utils.exportCSV(this.usersTable.columns, this.users)
|
||||||
},
|
},
|
||||||
|
|
||||||
///////////////Wallets////////////////////////////
|
///////////////Wallets////////////////////////////
|
||||||
|
|
||||||
getWallets: function () {
|
getWallets: function() {
|
||||||
var self = this
|
var self = this
|
||||||
|
|
||||||
LNbits.api
|
LNbits.api
|
||||||
@@ -387,19 +388,19 @@
|
|||||||
'/usermanager/api/v1/wallets',
|
'/usermanager/api/v1/wallets',
|
||||||
this.g.user.wallets[0].inkey
|
this.g.user.wallets[0].inkey
|
||||||
)
|
)
|
||||||
.then(function (response) {
|
.then(function(response) {
|
||||||
self.wallets = response.data.map(function (obj) {
|
self.wallets = response.data.map(function(obj) {
|
||||||
return mapUserManager(obj)
|
return mapUserManager(obj)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
openWalletUpdateDialog: function (linkId) {
|
openWalletUpdateDialog: function(linkId) {
|
||||||
var link = _.findWhere(this.users, {id: linkId})
|
var link = _.findWhere(this.users, {id: linkId})
|
||||||
|
|
||||||
this.walletDialog.data = _.clone(link._data)
|
this.walletDialog.data = _.clone(link._data)
|
||||||
this.walletDialog.show = true
|
this.walletDialog.show = true
|
||||||
},
|
},
|
||||||
sendWalletFormData: function () {
|
sendWalletFormData: function() {
|
||||||
if (this.walletDialog.data.id) {
|
if (this.walletDialog.data.id) {
|
||||||
} else {
|
} else {
|
||||||
var data = {
|
var data = {
|
||||||
@@ -414,7 +415,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
createWallet: function (data) {
|
createWallet: function(data) {
|
||||||
var self = this
|
var self = this
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request(
|
.request(
|
||||||
@@ -423,43 +424,43 @@
|
|||||||
this.g.user.wallets[0].inkey,
|
this.g.user.wallets[0].inkey,
|
||||||
data
|
data
|
||||||
)
|
)
|
||||||
.then(function (response) {
|
.then(function(response) {
|
||||||
self.wallets.push(mapUserManager(response.data))
|
self.wallets.push(mapUserManager(response.data))
|
||||||
self.walletDialog.show = false
|
self.walletDialog.show = false
|
||||||
self.walletDialog.data = {}
|
self.walletDialog.data = {}
|
||||||
data = {}
|
data = {}
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function(error) {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
deleteWallet: function (userId) {
|
deleteWallet: function(userId) {
|
||||||
var self = this
|
var self = this
|
||||||
|
|
||||||
LNbits.utils
|
LNbits.utils
|
||||||
.confirmDialog('Are you sure you want to delete this wallet link?')
|
.confirmDialog('Are you sure you want to delete this wallet link?')
|
||||||
.onOk(function () {
|
.onOk(function() {
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request(
|
.request(
|
||||||
'DELETE',
|
'DELETE',
|
||||||
'/usermanager/api/v1/wallets/' + userId,
|
'/usermanager/api/v1/wallets/' + userId,
|
||||||
self.g.user.wallets[0].inkey
|
self.g.user.wallets[0].inkey
|
||||||
)
|
)
|
||||||
.then(function (response) {
|
.then(function(response) {
|
||||||
self.wallets = _.reject(self.wallets, function (obj) {
|
self.wallets = _.reject(self.wallets, function(obj) {
|
||||||
return obj.id == userId
|
return obj.id == userId
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function(error) {
|
||||||
LNbits.utils.notifyApiError(error)
|
LNbits.utils.notifyApiError(error)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
exportWalletsCSV: function () {
|
exportWalletsCSV: function() {
|
||||||
LNbits.utils.exportCSV(this.walletsTable.columns, this.wallets)
|
LNbits.utils.exportCSV(this.walletsTable.columns, this.wallets)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function() {
|
||||||
if (this.g.user.wallets.length) {
|
if (this.g.user.wallets.length) {
|
||||||
this.getUsers()
|
this.getUsers()
|
||||||
this.getWallets()
|
this.getWallets()
|
||||||
|
Reference in New Issue
Block a user