mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-22 15:57:28 +02:00
update link broken
This commit is contained in:
2
lnbits/data/.gitignore
vendored
2
lnbits/data/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
*
|
|
||||||
!.gitignore
|
|
@@ -27,9 +27,9 @@ async def create_copilot(
|
|||||||
animation2webhook: Optional[str] = None,
|
animation2webhook: Optional[str] = None,
|
||||||
animation3webhook: Optional[str] = None,
|
animation3webhook: Optional[str] = None,
|
||||||
lnurl_title: Optional[str] = None,
|
lnurl_title: Optional[str] = None,
|
||||||
show_message: Optional[int] = None,
|
show_message: Optional[int] = 0,
|
||||||
show_ack: Optional[int] = None,
|
show_ack: Optional[int] = 0,
|
||||||
show_price: Optional[int] = None,
|
show_price: Optional[int] = 0,
|
||||||
amount_made: Optional[int] = None,
|
amount_made: Optional[int] = None,
|
||||||
) -> Copilots:
|
) -> Copilots:
|
||||||
copilot_id = urlsafe_short_hash()
|
copilot_id = urlsafe_short_hash()
|
||||||
|
@@ -183,7 +183,7 @@
|
|||||||
|
|
||||||
const obj = JSON.stringify({
|
const obj = JSON.stringify({
|
||||||
event: "bts:subscribe",
|
event: "bts:subscribe",
|
||||||
data: { channel: "live_trades_btcusd" },
|
data: { channel: "live_trades_" + self.copilot.show_price},
|
||||||
})
|
})
|
||||||
|
|
||||||
this.connectionBitStamp.onmessage = function (e) {
|
this.connectionBitStamp.onmessage = function (e) {
|
||||||
|
@@ -104,6 +104,9 @@
|
|||||||
<q-tooltip> Delete copilot </q-tooltip>
|
<q-tooltip> Delete copilot </q-tooltip>
|
||||||
</q-btn>
|
</q-btn>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
<q-td auto-width>
|
||||||
|
<q-btn flat dense size="xs" @click="openUpdateCopilotLink(props.row.id)" icon="edit" color="light-blue"></q-btn>
|
||||||
|
</q-td>
|
||||||
<q-td
|
<q-td
|
||||||
v-for="col in props.cols"
|
v-for="col in props.cols"
|
||||||
:key="col.name"
|
:key="col.name"
|
||||||
@@ -344,6 +347,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row q-mt-lg">
|
<div class="row q-mt-lg">
|
||||||
<q-btn
|
<q-btn
|
||||||
|
v-if="formDialogCopilot.data.id"
|
||||||
|
unelevated
|
||||||
|
color="deep-purple"
|
||||||
|
:disable="
|
||||||
|
formDialogCopilot.data.title == ''"
|
||||||
|
type="submit"
|
||||||
|
>Update Copilot</q-btn
|
||||||
|
>
|
||||||
|
<q-btn
|
||||||
|
v-else
|
||||||
unelevated
|
unelevated
|
||||||
color="deep-purple"
|
color="deep-purple"
|
||||||
:disable="
|
:disable="
|
||||||
@@ -472,10 +485,19 @@
|
|||||||
sendFormDataCopilot: function () {
|
sendFormDataCopilot: function () {
|
||||||
var self = this
|
var self = this
|
||||||
console.log(self.formDialogCopilot.data.animation1threshold)
|
console.log(self.formDialogCopilot.data.animation1threshold)
|
||||||
this.createCopilot(
|
if(self.formDialogCopilot.data.id){
|
||||||
|
this.updateCopilot(
|
||||||
self.g.user.wallets[0].adminkey,
|
self.g.user.wallets[0].adminkey,
|
||||||
self.formDialogCopilot.data
|
self.formDialogCopilot.data
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.createCopilot(
|
||||||
|
self.g.user.wallets[0].adminkey,
|
||||||
|
self.formDialogCopilot.data
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
createCopilot: function (wallet, data) {
|
createCopilot: function (wallet, data) {
|
||||||
@@ -533,21 +555,21 @@
|
|||||||
'scrollbars=no, resizable=no,status=no,location=no,toolbar=no,menubar=no,width=400,height=450,left=10,top=400'
|
'scrollbars=no, resizable=no,status=no,location=no,toolbar=no,menubar=no,width=400,height=450,left=10,top=400'
|
||||||
open('../copilot/pn/', '_blank', params)
|
open('../copilot/pn/', '_blank', params)
|
||||||
},
|
},
|
||||||
deleteCopilotLink: function (chargeId) {
|
deleteCopilotLink: function (copilotId) {
|
||||||
var self = this
|
var self = this
|
||||||
var link = _.findWhere(this.CopilotLinks, {id: chargeId})
|
var link = _.findWhere(this.CopilotLinks, {id: copilotId})
|
||||||
LNbits.utils
|
LNbits.utils
|
||||||
.confirmDialog('Are you sure you want to delete this pay link?')
|
.confirmDialog('Are you sure you want to delete this pay link?')
|
||||||
.onOk(function () {
|
.onOk(function () {
|
||||||
LNbits.api
|
LNbits.api
|
||||||
.request(
|
.request(
|
||||||
'DELETE',
|
'DELETE',
|
||||||
'/copilot/api/v1/copilot/' + chargeId,
|
'/copilot/api/v1/copilot/' + copilotId,
|
||||||
self.g.user.wallets[0].adminkey
|
self.g.user.wallets[0].adminkey
|
||||||
)
|
)
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
self.CopilotLinks = _.reject(self.CopilotLinks, function (obj) {
|
self.CopilotLinks = _.reject(self.CopilotLinks, function (obj) {
|
||||||
return obj.id === chargeId
|
return obj.id === copilotId
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
@@ -555,6 +577,33 @@
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
openUpdateCopilotLink: function (copilotId) {
|
||||||
|
var self = this
|
||||||
|
var copilot = _.findWhere(this.CopilotLinks, {id: copilotId})
|
||||||
|
self.formDialogCopilot.data = _.clone(copilot._data)
|
||||||
|
self.formDialogCopilot.show = true
|
||||||
|
},
|
||||||
|
updateCopilot: function (wallet, data) {
|
||||||
|
var self = this
|
||||||
|
var updatedData = {}
|
||||||
|
console.log(data)
|
||||||
|
for (const property in data) {
|
||||||
|
if(data[property]){
|
||||||
|
updatedData[property] = data[property]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log(updatedData)
|
||||||
|
|
||||||
|
LNbits.api
|
||||||
|
.request('PUT', '/copilot/api/v1/copilot/' + updatedData.id, wallet, updatedData)
|
||||||
|
.then(function (response) {
|
||||||
|
self.CopilotLinks.push(mapCopilot(response.data))
|
||||||
|
self.formDialogCopilot.show = false
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
LNbits.utils.notifyApiError(error)
|
||||||
|
})
|
||||||
|
},
|
||||||
exportcopilotCSV: function () {
|
exportcopilotCSV: function () {
|
||||||
var self = this
|
var self = this
|
||||||
LNbits.utils.exportCSV(self.CopilotsTable.columns, this.CopilotLinks)
|
LNbits.utils.exportCSV(self.CopilotsTable.columns, this.CopilotLinks)
|
||||||
|
@@ -29,22 +29,23 @@ from .crud import (
|
|||||||
"title": {"type": "string", "empty": False, "required": True},
|
"title": {"type": "string", "empty": False, "required": True},
|
||||||
"lnurl_toggle": {"type": "integer", "empty": False, "required": True},
|
"lnurl_toggle": {"type": "integer", "empty": False, "required": True},
|
||||||
"wallet": {"type": "string", "empty": False, "required": False},
|
"wallet": {"type": "string", "empty": False, "required": False},
|
||||||
"animation1": {"type": "string", "required": False},
|
"animation1": {"type": "string", "empty": True, "required": False},
|
||||||
"animation2": {"type": "string", "required": False},
|
"animation2": {"type": "string", "empty": True, "required": False},
|
||||||
"animation3": {"type": "string", "required": False},
|
"animation3": {"type": "string", "empty": True, "required": False},
|
||||||
"animation1threshold": {"type": "string", "required": False},
|
"animation1threshold": {"type": "string", "empty": True, "required": False},
|
||||||
"animation2threshold": {"type": "string", "required": False},
|
"animation2threshold": {"type": "string", "empty": True, "required": False},
|
||||||
"animation3threshold": {"type": "string", "required": False},
|
"animation3threshold": {"type": "string", "empty": True, "required": False},
|
||||||
"animation1webhook": {"type": "string", "required": False},
|
"animation1webhook": {"type": "string", "empty": True, "required": False},
|
||||||
"animation2webhook": {"type": "string", "required": False},
|
"animation2webhook": {"type": "string", "empty": True, "required": False},
|
||||||
"animation3webhook": {"type": "string", "required": False},
|
"animation3webhook": {"type": "string", "empty": True, "required": False},
|
||||||
"lnurl_title": {"type": "string", "empty": False, "required": False},
|
"lnurl_title": {"type": "string", "empty": True, "required": False},
|
||||||
"show_message": {"type": "integer", "empty": False, "required": False},
|
"show_message": {"type": "integer", "empty": True, "required": False},
|
||||||
"show_ack": {"type": "integer", "empty": False, "required": True},
|
"show_ack": {"type": "integer", "empty": True, "required": True},
|
||||||
"show_price": {"type": "integer", "empty": False, "required": True},
|
"show_price": {"type": "string", "empty": True},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
async def api_copilot_create_or_update(copilot_id=None):
|
async def api_copilot_create_or_update(copilot_id=None):
|
||||||
|
print("dfbad")
|
||||||
if not copilot_id:
|
if not copilot_id:
|
||||||
copilot = await create_copilot(user=g.wallet.user, **g.data)
|
copilot = await create_copilot(user=g.wallet.user, **g.data)
|
||||||
return jsonify(copilot._asdict()), HTTPStatus.CREATED
|
return jsonify(copilot._asdict()), HTTPStatus.CREATED
|
||||||
|
Reference in New Issue
Block a user