From 7d85310f308cd1aeb01c4a56cb9c7d813dcc7f1c Mon Sep 17 00:00:00 2001 From: Ben Arc Date: Tue, 20 Apr 2021 14:57:59 +0100 Subject: [PATCH] added prop to panel --- .../copilot/templates/copilot/panel.html | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lnbits/extensions/copilot/templates/copilot/panel.html b/lnbits/extensions/copilot/templates/copilot/panel.html index 5b573741..eec1f25c 100644 --- a/lnbits/extensions/copilot/templates/copilot/panel.html +++ b/lnbits/extensions/copilot/templates/copilot/panel.html @@ -101,7 +101,8 @@ return { fullscreen_cam: true, textareaModel: '', - iframe: '' + iframe: '', + copilot: {} } }, methods: { @@ -130,36 +131,37 @@ } }, created: function () { - var copilot = JSON.parse(localStorage.getItem('copilot')) - console.log(copilot.id) + self = this + self.copilot = JSON.parse(localStorage.getItem('copilot')) + console.log(this.copilot.id) if (location.protocol == 'https:') { console.log(location.protocol) - this.connection = new WebSocket( + self.connection = new WebSocket( 'wss://' + document.domain + ':' + location.port + '/copilot/ws/panel/' + - copilot.id + self.copilot.id ) } else { - this.connection = new WebSocket( + self.connection = new WebSocket( 'ws://' + document.domain + ':' + location.port + '/copilot/ws/panel/' + - copilot.id + self.copilot.id ) } - this.connection.addEventListener('open', function (event) {}) + self.connection.addEventListener('open', function (event) {}) - this.connection.addEventListener('message', function (event) { + self.connection.addEventListener('message', function (event) { console.log('Message from server ', event.data) }) - this.connection.addEventListener('close', function (event) { + self.connection.addEventListener('close', function (event) { console.log('The connection has been closed') }) }