From 755e9ef4fa8d9a6b9366b5e4080a3e5e9562060d Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Sat, 30 Nov 2024 07:33:25 +0000 Subject: [PATCH] fix remote after new terminal tweaks --- manifest.json | 2 +- package.json | 2 +- remote/index.html | 52 +++++++++++++++++++++++------------------------ remote/remote.js | 35 +++++++++++++++---------------- serviceworker.js | 2 +- 5 files changed, 47 insertions(+), 46 deletions(-) diff --git a/manifest.json b/manifest.json index 1cf378e0..3d665054 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name": "Espruino Web IDE", "short_name": "Espruino IDE", "description": "A Terminal and Graphical code Editor for Espruino JavaScript Microcontrollers", - "version": "0.79.9", + "version": "0.79.10", "app": { "background": { "scripts": ["js/background.js"] diff --git a/package.json b/package.json index 7f0d2c64..881958d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "espruino-web-ide", - "version": "0.79.9", + "version": "0.79.10", "description": "A Terminal and Graphical code Editor for Espruino JavaScript Microcontrollers", "//1": "-------------------------------------------------------- nw.js", "main": "main.html", diff --git a/remote/index.html b/remote/index.html index 1f5dd861..1a93ccb1 100644 --- a/remote/index.html +++ b/remote/index.html @@ -25,32 +25,6 @@ window.location = "https://"+l.substr(7); - - - - - - - - - - - - - - - - - - - - - - - - - - Espruino Remote @@ -94,5 +68,31 @@
Espruino IDE Relay
+ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/remote/remote.js b/remote/remote.js index 41ed7516..688fed1b 100644 --- a/remote/remote.js +++ b/remote/remote.js @@ -1,8 +1,8 @@ var portList; /// webtrc instance when initialised -var webrtc; +var webrtc; /// If not true, the connection was requested from the top-left and we should just disconnect -var connectionRequested = false; +var connectionRequested = false; // THIS IS NEVER SHOWN AT THE MOMENT Espruino.Core.Terminal.OVERRIDE_CONTENTS = ` @@ -10,14 +10,14 @@ var connectionRequested = false; Loading... `; -// ABOUT page +// ABOUT page Espruino.Core.Config.addSection("About", { description : undefined, sortOrder : -1000, getHTML : function(callback) { callback(`

Web IDE Remote Connection Bridge

-This Remote Connection Bridge exists so that you can connect +This Remote Connection Bridge exists so that you can connect the Web IDE to your Espruino devices even if you do not have direct access to them or your main PC doesn't have the required communications (for instance Bluetooth). @@ -32,7 +32,7 @@ that you want to use as the Bridge. ${(webrtc && webrtc.peerId)?`

If you want to connect to this instance of the Bridge, copy the following code -and paste it into the Remote Connection Bridge Peer ID field in your +and paste it into the Remote Connection Bridge Peer ID field in your Web IDE's settings:

${webrtc.peerId}

`:``}`); } @@ -59,7 +59,7 @@ Web IDE's settings: webrtc = webrtcInit({ - bridge:true, + bridge:true, onStatus : function(s) { print(s); }, @@ -77,7 +77,7 @@ Web IDE's settings: clientPeerId = kv[1]; }); } - if (clientPeerId) + if (clientPeerId) webrtc.connectSendPeerId(clientPeerId); }, onGetPorts : function(cb) { @@ -98,7 +98,7 @@ Web IDE's settings: onPortConnect : function(serialPort, cb) { if (Espruino.Core.Serial.isConnected()) Espruino.Core.Serial.close(); - print("Connecting to "+serialPort); + print("Connecting to "+serialPort); connectionRequested = true; Espruino.Core.Serial.open(serialPort, function(cInfo) { // Ensure that data from Espruino goes here @@ -144,7 +144,7 @@ Web IDE's settings: ports = ports.filter(p => !p.promptsUser); if (ports.length) print("The following devices are paired:\n "+ports.map(p=>p.path).join("\n ")); - else + else print("No devices are paired"); print("To add more devices please click the connect icon in the top left."); }); @@ -156,7 +156,8 @@ Web IDE's settings: $("#terminal").css("font-size", Espruino.Config.FONT_SIZE+"px"); print("Web IDE Remote Connection Bridge"); - Espruino.Core.Terminal.addNotification('
',{noBorder:true}) + + //Espruino.Core.Terminal.addNotification('
',{noBorder:true}); Espruino.addProcessor("connected", function(data, callback) { /* If the connection was initiated from the button in the top left @@ -169,7 +170,7 @@ Web IDE's settings: }, 500); } connectionRequested = false; - callback(data); + callback(data); }); Espruino.addProcessor("disconnected", function(data, callback) { @@ -181,7 +182,7 @@ Web IDE's settings: if (data.visible && webrtc) { webrtc.connectVideo(data.stream); } - + callback(data); }); @@ -195,13 +196,13 @@ Web IDE's settings: function startWebSocket() { console.log("Disabling normal terminal"); - - + + console.log("Starting Websocket connection"); print("Starting Websocket connection"); // Create WebSocket connection. - + socket.addEventListener('open', function (event) { Espruino.Core.Notifications.success("Websocket connection open", true); @@ -218,13 +219,13 @@ Web IDE's settings: socketToBLE(event.data); }); - + function socketToBLE(data) { if (data[0]=="\x01") { console.log("BLE <- "+JSON.stringify(data.substr(1))); // Data to send - + } else if (data[0]=="\x20") { print("New client connected"); } else print("Unknown packet type "+JSON.stringify(data[0])); diff --git a/serviceworker.js b/serviceworker.js index 3cb3687c..74b08088 100644 --- a/serviceworker.js +++ b/serviceworker.js @@ -1,5 +1,5 @@ // Service worker for Offline Web IDE -const VERSION = 'v130'; +const VERSION = 'v131'; const CACHED_RESOURCES = [ 'blockly/blockly_espruino.js',