Get working index.html

This commit is contained in:
Fitti
2021-06-28 18:50:56 +02:00
parent d24980aa3c
commit 841da76a8c
2 changed files with 34 additions and 40 deletions

View File

@@ -50,6 +50,16 @@
icon="link"
:color="($q.dark.isActive) ? 'grey-7' : 'grey-5'"
type="a"
:href="props.row.authUrl"
target="_blank"
></q-btn>
<q-btn
unelevated
dense
size="xs"
icon="send"
:color="($q.dark.isActive) ? 'grey-8' : 'grey-6'"
type="a"
:href="props.row.displayUrl"
target="_blank"
></q-btn>
@@ -57,16 +67,6 @@
<q-td v-for="col in props.cols" :key="col.name" :props="props">
{{ col.value }}
</q-td>
<q-td auto-width>
<q-btn
flat
dense
size="xs"
@click="updateserviceDialog(props.row.id)"
icon="edit"
color="light-blue"
></q-btn>
</q-td>
<q-td auto-width>
<q-btn
flat
@@ -237,7 +237,8 @@
'YYYY-MM-DD HH:mm'
)
obj.fsat = new Intl.NumberFormat(LOCALE).format(obj.amount)
obj.displayUrl = ['/twitchalerts/api/v1/getaccess/', obj.id].join('')
obj.authUrl = ['/twitchalerts/api/v1/getaccess/', obj.id].join('')
obj.displayUrl = ['/twitchalerts/', obj.state].join('')
return obj
}
@@ -364,11 +365,7 @@
})
var data = this.serviceDialog.data
if (data.id) {
this.updateService(wallet, data)
} else {
this.createService(wallet, data)
}
this.createService(wallet, data)
},
createService: function(wallet, data) {
@@ -395,29 +392,6 @@
this.serviceDialog.data.client_secret = link.client_secret
this.serviceDialog.show = true
},
updateService: function(wallet, data) {
var self = this
console.log(data)
LNbits.api
.request(
'PUT',
'/twitchalerts/api/v1/services/' + data.id,
wallet.inkey,
data
)
.then(function(response) {
self.services = _.reject(self.services, function(obj) {
return obj.id == data.id
})
self.services.push(mapTwitchAlerts(response.data))
self.serviceDialog.show = false
self.serviceDialog.data = {}
})
.catch(function(error) {
LNbits.utils.notifyApiError(error)
})
},
deleteService: function(servicesId) {
var self = this
var services = _.findWhere(this.services, {id: servicesId})

View File

@@ -17,7 +17,8 @@ from .crud import (
get_services,
authenticate_service,
update_donation,
update_service
update_service,
delete_service
)
from ..satspay.crud import create_charge, get_charge
@@ -254,3 +255,22 @@ async def api_delete_donation(donation_id):
await delete_donation(donation_id)
return "", HTTPStatus.NO_CONTENT
@twitchalerts_ext.route("/api/v1/services/<service_id>", methods=["DELETE"])
@api_check_wallet_key("invoice")
async def api_delete_service(service_id):
service = await get_service(service_id)
if not service:
return (
jsonify({"message": "No service with this ID!"}),
HTTPStatus.NOT_FOUND
)
if service.wallet != g.wallet.id:
return (
jsonify({"message": "Not authorized to delete this service!"}),
HTTPStatus.FORBIDDEN
)
await delete_service(service_id)
return "", HTTPStatus.NO_CONTENT