mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-27 12:26:19 +02:00
localstorage paneltest
This commit is contained in:
@@ -497,10 +497,29 @@
|
||||
LNbits.utils.notifyApiError(error)
|
||||
})
|
||||
},
|
||||
getCopilot: function (copilot_id) {
|
||||
var self = this
|
||||
LNbits.api
|
||||
.request(
|
||||
'GET',
|
||||
'/copilot/api/v1/copilot/' + copilot_id,
|
||||
this.g.user.wallets[0].inkey
|
||||
)
|
||||
.then(function (response) {
|
||||
return response.data
|
||||
})
|
||||
.catch(function (error) {
|
||||
LNbits.utils.notifyApiError(error)
|
||||
})
|
||||
},
|
||||
opencopilotCompose: function (copilot_id) {
|
||||
localStorage.setItem(
|
||||
'copilot',
|
||||
JSON.stringify(this.getCopilot(copilot_id))
|
||||
)
|
||||
let params =
|
||||
'scrollbars=no, resizable=no,status=no,location=no,toolbar=no,menubar=no,width=1722,height=972,left=200,top=200'
|
||||
open('../copilot/cp/' + copilot_id, 'test', params)
|
||||
open('../copilot/cp/', 'test', params)
|
||||
},
|
||||
|
||||
deleteCopilotLink: function (chargeId) {
|
||||
|
@@ -15,9 +15,7 @@
|
||||
</center>
|
||||
</div>
|
||||
<center>
|
||||
<div class="col" style="margin: 15px; font-size: 25px">
|
||||
Title: {{ copilot.title }}
|
||||
</div>
|
||||
<div class="col" style="margin: 15px; font-size: 25px">Title:</div>
|
||||
</center>
|
||||
<q-separator></q-separator>
|
||||
<div class="col">
|
||||
@@ -120,7 +118,7 @@
|
||||
openCompose: function () {
|
||||
let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=1722,height=972,left=200,top=200`
|
||||
|
||||
open('../copilot/cp/{{ copilot.id }}', 'test', params)
|
||||
open('../copilot/cp/', 'test', params)
|
||||
},
|
||||
animationBTN: function (name) {
|
||||
this.connection.send(name)
|
||||
@@ -130,7 +128,8 @@
|
||||
}
|
||||
},
|
||||
created: function () {
|
||||
console.log('{{ copilot.id }}')
|
||||
var copilot = JSON.parse(localStorage.getItem('copilot'))
|
||||
console.log(copilot.id)
|
||||
|
||||
if (location.protocol == 'https:') {
|
||||
console.log(location.protocol)
|
||||
@@ -139,7 +138,8 @@
|
||||
document.domain +
|
||||
':' +
|
||||
location.port +
|
||||
'/copilot/ws/panel/{{ copilot.id }}'
|
||||
'/copilot/ws/panel/' +
|
||||
copilot.id
|
||||
)
|
||||
} else {
|
||||
this.connection = new WebSocket(
|
||||
@@ -147,7 +147,8 @@
|
||||
document.domain +
|
||||
':' +
|
||||
location.port +
|
||||
'/copilot/ws/panel/{{ copilot.id }}'
|
||||
'/copilot/ws/panel/' +
|
||||
copilot.id
|
||||
)
|
||||
}
|
||||
this.connection.addEventListener('open', function (event) {})
|
||||
|
@@ -21,29 +21,14 @@ async def index():
|
||||
return await render_template("copilot/index.html", user=g.user)
|
||||
|
||||
|
||||
@copilot_ext.route("/cp/<copilot_id>")
|
||||
async def compose(copilot_id):
|
||||
copilot = await get_copilot(copilot_id) or abort(
|
||||
HTTPStatus.NOT_FOUND, "Copilot link does not exist."
|
||||
)
|
||||
if copilot.lnurl_toggle:
|
||||
return await render_template(
|
||||
"copilot/compose.html",
|
||||
copilot=copilot,
|
||||
lnurl=copilot.lnurl,
|
||||
lnurl_toggle=copilot.lnurl_toggle,
|
||||
)
|
||||
return await render_template(
|
||||
"copilot/compose.html", copilot=copilot, lnurl_toggle=copilot.lnurl_toggle
|
||||
)
|
||||
@copilot_ext.route("/cp/")
|
||||
async def compose():
|
||||
return await render_template("copilot/compose.html")
|
||||
|
||||
|
||||
@copilot_ext.route("/<copilot_id>")
|
||||
async def panel(copilot_id):
|
||||
copilot = await get_copilot(copilot_id) or abort(
|
||||
HTTPStatus.NOT_FOUND, "Copilot link does not exist."
|
||||
)
|
||||
return await render_template("copilot/panel.html", copilot=copilot)
|
||||
@copilot_ext.route("/pn/")
|
||||
async def panel():
|
||||
return await render_template("copilot/panel.html")
|
||||
|
||||
|
||||
##################WEBSOCKET ROUTES########################
|
||||
|
@@ -103,4 +103,3 @@ async def api_copilot_ws_relay(copilot_id, comment, data):
|
||||
await updater(data, comment, copilot_id)
|
||||
print(comment)
|
||||
return "", HTTPStatus.OK
|
||||
|
||||
|
Reference in New Issue
Block a user