Documentation Updates (#202)

Updates for user manager and subdomains extensions

Co-authored-by: Tiago Vasconcelos <tvasconcelos@gmail.com>
This commit is contained in:
Tiago Vasconcelos
2021-06-09 12:07:42 -03:00
committed by GitHub
co-authored by Tiago Vasconcelos
parent a1e12fcd0e
commit 2e8145faac
4 changed files with 86 additions and 62 deletions
+13 -13
View File
@@ -1,27 +1,29 @@
<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.
[![video tutorial livestream](http://img.youtube.com/vi/O1X0fy3uNpw/0.jpg)](https://youtu.be/O1X0fy3uNpw 'video tutorial subdomains')
## Requirements
- Free cloudflare account
- Cloudflare as a dns server provider
- Cloudflare TOKEN and Cloudflare zone-id where the domain is parked
- Free Cloudflare account
- Cloudflare as a DNS server provider
- Cloudflare TOKEN and Cloudflare zone-ID where the domain is parked
## Usage
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
3. Get Cloudflare zoneID for your domain
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
3. Get Cloudflare zone-ID for your domain
<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/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
- Extension also supports webhooks so you can get notified when someone buys a new domain
<img src="https://i.imgur.com/hiauxeR.png">
- Extension also supports webhooks so you can get notified when someone buys a new subdomain\
<img src="https://i.imgur.com/hiauxeR.png">
## 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>
- DELETE /api/v1/subdomains/<subdomain_id>
## Useful
### Cloudflare
- Cloudflare offers programmatic subdomain registration... (create new A record)
+26 -3
View File
@@ -1,3 +1,26 @@
<h1>User Manager</h1>
<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.
# User 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\
![new user](https://i.imgur.com/4yZyfJE.png)
2. Fill the user information\
- username
- the generated wallet name, user can create other wallets later on
- email
- set a password
![user information](https://i.imgur.com/40du7W5.png)
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\
![user wallet](https://i.imgur.com/gAyajbx.png)
5. If you need to create more wallets for some user, click "NEW WALLET" at the top\
![multiple wallets](https://i.imgur.com/wovVnim.png)
- select the existing user you wish to add the wallet
- set a wallet name\
![new wallet](https://i.imgur.com/sGwG8dC.png)
@@ -214,7 +214,7 @@
</div>
{% endblock %} {% block scripts %} {{ window_vars(user) }}
<script>
var mapUserManager = function (obj) {
var mapUserManager = function(obj) {
obj.date = Quasar.utils.date.formatDate(
new Date(obj.time * 1000),
'YYYY-MM-DD HH:mm'
@@ -228,7 +228,7 @@
new Vue({
el: '#vue',
mixins: [windowMixin],
data: function () {
data: function() {
return {
wallets: [],
users: [],
@@ -277,8 +277,8 @@
}
},
computed: {
userOptions: function () {
return this.users.map(function (obj) {
userOptions: function() {
return this.users.map(function(obj) {
console.log(obj.id)
return {
value: String(obj.id),
@@ -290,7 +290,7 @@
methods: {
///////////////Users////////////////////////////
getUsers: function () {
getUsers: function() {
var self = this
LNbits.api
@@ -299,20 +299,20 @@
'/usermanager/api/v1/users',
this.g.user.wallets[0].inkey
)
.then(function (response) {
self.users = response.data.map(function (obj) {
.then(function(response) {
self.users = response.data.map(function(obj) {
return mapUserManager(obj)
})
})
},
openUserUpdateDialog: function (linkId) {
openUserUpdateDialog: function(linkId) {
var link = _.findWhere(this.users, {id: linkId})
this.userDialog.data = _.clone(link._data)
this.userDialog.show = true
},
sendUserFormData: function () {
sendUserFormData: function() {
if (this.userDialog.data.id) {
} else {
var data = {
@@ -329,7 +329,7 @@
}
},
createUser: function (data) {
createUser: function(data) {
var self = this
LNbits.api
.request(
@@ -338,47 +338,48 @@
this.g.user.wallets[0].inkey,
data
)
.then(function (response) {
.then(function(response) {
self.users.push(mapUserManager(response.data))
self.userDialog.show = false
self.userDialog.data = {}
data = {}
self.getWallets()
})
.catch(function (error) {
.catch(function(error) {
LNbits.utils.notifyApiError(error)
})
},
deleteUser: function (userId) {
deleteUser: function(userId) {
var self = this
console.log(userId)
LNbits.utils
.confirmDialog('Are you sure you want to delete this User link?')
.onOk(function () {
.onOk(function() {
LNbits.api
.request(
'DELETE',
'/usermanager/api/v1/users/' + userId,
self.g.user.wallets[0].inkey
)
.then(function (response) {
self.users = _.reject(self.users, function (obj) {
.then(function(response) {
self.users = _.reject(self.users, function(obj) {
return obj.id == userId
})
})
.catch(function (error) {
.catch(function(error) {
LNbits.utils.notifyApiError(error)
})
})
},
exportUsersCSV: function () {
exportUsersCSV: function() {
LNbits.utils.exportCSV(this.usersTable.columns, this.users)
},
///////////////Wallets////////////////////////////
getWallets: function () {
getWallets: function() {
var self = this
LNbits.api
@@ -387,19 +388,19 @@
'/usermanager/api/v1/wallets',
this.g.user.wallets[0].inkey
)
.then(function (response) {
self.wallets = response.data.map(function (obj) {
.then(function(response) {
self.wallets = response.data.map(function(obj) {
return mapUserManager(obj)
})
})
},
openWalletUpdateDialog: function (linkId) {
openWalletUpdateDialog: function(linkId) {
var link = _.findWhere(this.users, {id: linkId})
this.walletDialog.data = _.clone(link._data)
this.walletDialog.show = true
},
sendWalletFormData: function () {
sendWalletFormData: function() {
if (this.walletDialog.data.id) {
} else {
var data = {
@@ -414,7 +415,7 @@
}
},
createWallet: function (data) {
createWallet: function(data) {
var self = this
LNbits.api
.request(
@@ -423,43 +424,43 @@
this.g.user.wallets[0].inkey,
data
)
.then(function (response) {
.then(function(response) {
self.wallets.push(mapUserManager(response.data))
self.walletDialog.show = false
self.walletDialog.data = {}
data = {}
})
.catch(function (error) {
.catch(function(error) {
LNbits.utils.notifyApiError(error)
})
},
deleteWallet: function (userId) {
deleteWallet: function(userId) {
var self = this
LNbits.utils
.confirmDialog('Are you sure you want to delete this wallet link?')
.onOk(function () {
.onOk(function() {
LNbits.api
.request(
'DELETE',
'/usermanager/api/v1/wallets/' + userId,
self.g.user.wallets[0].inkey
)
.then(function (response) {
self.wallets = _.reject(self.wallets, function (obj) {
.then(function(response) {
self.wallets = _.reject(self.wallets, function(obj) {
return obj.id == userId
})
})
.catch(function (error) {
.catch(function(error) {
LNbits.utils.notifyApiError(error)
})
})
},
exportWalletsCSV: function () {
exportWalletsCSV: function() {
LNbits.utils.exportCSV(this.walletsTable.columns, this.wallets)
}
},
created: function () {
created: function() {
if (this.g.user.wallets.length) {
this.getUsers()
this.getWallets()