localstorage paneltest
This commit is contained in:
parent
8f3a8e4880
commit
1736198a7d
4 changed files with 34 additions and 30 deletions
|
|
@ -497,10 +497,29 @@
|
||||||
LNbits.utils.notifyApiError(error)
|
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) {
|
opencopilotCompose: function (copilot_id) {
|
||||||
|
localStorage.setItem(
|
||||||
|
'copilot',
|
||||||
|
JSON.stringify(this.getCopilot(copilot_id))
|
||||||
|
)
|
||||||
let params =
|
let params =
|
||||||
'scrollbars=no, resizable=no,status=no,location=no,toolbar=no,menubar=no,width=1722,height=972,left=200,top=200'
|
'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) {
|
deleteCopilotLink: function (chargeId) {
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,7 @@
|
||||||
</center>
|
</center>
|
||||||
</div>
|
</div>
|
||||||
<center>
|
<center>
|
||||||
<div class="col" style="margin: 15px; font-size: 25px">
|
<div class="col" style="margin: 15px; font-size: 25px">Title:</div>
|
||||||
Title: {{ copilot.title }}
|
|
||||||
</div>
|
|
||||||
</center>
|
</center>
|
||||||
<q-separator></q-separator>
|
<q-separator></q-separator>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
|
|
@ -120,7 +118,7 @@
|
||||||
openCompose: function () {
|
openCompose: function () {
|
||||||
let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=1722,height=972,left=200,top=200`
|
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) {
|
animationBTN: function (name) {
|
||||||
this.connection.send(name)
|
this.connection.send(name)
|
||||||
|
|
@ -130,7 +128,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
console.log('{{ copilot.id }}')
|
var copilot = JSON.parse(localStorage.getItem('copilot'))
|
||||||
|
console.log(copilot.id)
|
||||||
|
|
||||||
if (location.protocol == 'https:') {
|
if (location.protocol == 'https:') {
|
||||||
console.log(location.protocol)
|
console.log(location.protocol)
|
||||||
|
|
@ -139,7 +138,8 @@
|
||||||
document.domain +
|
document.domain +
|
||||||
':' +
|
':' +
|
||||||
location.port +
|
location.port +
|
||||||
'/copilot/ws/panel/{{ copilot.id }}'
|
'/copilot/ws/panel/' +
|
||||||
|
copilot.id
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
this.connection = new WebSocket(
|
this.connection = new WebSocket(
|
||||||
|
|
@ -147,7 +147,8 @@
|
||||||
document.domain +
|
document.domain +
|
||||||
':' +
|
':' +
|
||||||
location.port +
|
location.port +
|
||||||
'/copilot/ws/panel/{{ copilot.id }}'
|
'/copilot/ws/panel/' +
|
||||||
|
copilot.id
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
this.connection.addEventListener('open', function (event) {})
|
this.connection.addEventListener('open', function (event) {})
|
||||||
|
|
|
||||||
|
|
@ -21,29 +21,14 @@ async def index():
|
||||||
return await render_template("copilot/index.html", user=g.user)
|
return await render_template("copilot/index.html", user=g.user)
|
||||||
|
|
||||||
|
|
||||||
@copilot_ext.route("/cp/<copilot_id>")
|
@copilot_ext.route("/cp/")
|
||||||
async def compose(copilot_id):
|
async def compose():
|
||||||
copilot = await get_copilot(copilot_id) or abort(
|
return await render_template("copilot/compose.html")
|
||||||
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("/<copilot_id>")
|
@copilot_ext.route("/pn/")
|
||||||
async def panel(copilot_id):
|
async def panel():
|
||||||
copilot = await get_copilot(copilot_id) or abort(
|
return await render_template("copilot/panel.html")
|
||||||
HTTPStatus.NOT_FOUND, "Copilot link does not exist."
|
|
||||||
)
|
|
||||||
return await render_template("copilot/panel.html", copilot=copilot)
|
|
||||||
|
|
||||||
|
|
||||||
##################WEBSOCKET ROUTES########################
|
##################WEBSOCKET ROUTES########################
|
||||||
|
|
|
||||||
|
|
@ -103,4 +103,3 @@ async def api_copilot_ws_relay(copilot_id, comment, data):
|
||||||
await updater(data, comment, copilot_id)
|
await updater(data, comment, copilot_id)
|
||||||
print(comment)
|
print(comment)
|
||||||
return "", HTTPStatus.OK
|
return "", HTTPStatus.OK
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue