diff --git a/app.js b/app.js index ad58bda..c9a42d9 100755 --- a/app.js +++ b/app.js @@ -63,10 +63,18 @@ if (use_content_security_policy) { app.use(helmet.contentSecurityPolicy({ directives:{ defaultSrc:["'self'"], - scriptSrc:["'self'", "'unsafe-inline'", 'static.robotwebtools.org', 'robotwebtools.org', 'webrtc.github.io'], + scriptSrc:["'self'", "'unsafe-inline'", + 'static.robotwebtools.org', + 'robotwebtools.org', + 'webrtc.github.io', + 'www.gstatic.com', + 'code.jquery.com', + 'cdnjs.cloudflare.com', + 'stackpath.bootstrapcdn.com'], connectSrc:["'self'", 'ws://localhost:9090'], imgSrc: ["'self'", 'data:'], - styleSrc:["'self'"], + styleSrc:["'self'", + 'stackpath.bootstrapcdn.com'], fontSrc:["'self'"]}})); } else { // Disable the content security policy. This is helpful during @@ -90,12 +98,12 @@ console.log('require https'); app.all('*', ensureSecure); // at top of routing calls function ensureSecure(req, res, next){ - if(req.secure){ - // OK, continue - return next(); - }; - // handle port numbers if you need non defaults - res.redirect('https://' + req.hostname + req.url); + if(!req.secure){ + // handle port numbers if you need non defaults + res.redirect('https://' + req.hostname + req.url); + } + + return next(); }; ///////////////////////// diff --git a/bash_scripts/web_interface_installation.sh b/bash_scripts/web_interface_installation.sh index 1aa807e..96fdd37 100755 --- a/bash_scripts/web_interface_installation.sh +++ b/bash_scripts/web_interface_installation.sh @@ -15,6 +15,12 @@ echo "Installing rosbridge" sudo apt-get --yes install ros-melodic-rosbridge-server echo "Done." +# TF2 +echo "" +echo "Installing tf2-web-republisher" +sudo apt-get --yes install ros-melodic-tf2-web-republisher +echo "Done." + # NODE 14 echo "" echo "Installing Node.js 14" diff --git a/operator/operator.html b/operator/operator.html index 6633852..db637c7 100644 --- a/operator/operator.html +++ b/operator/operator.html @@ -3,10 +3,18 @@ + + + + + - - + + + + + @@ -386,9 +394,17 @@ + + + + + --> - - - - - + + + + + diff --git a/shared/database.js b/shared/database.js index afe029f..cf659cd 100644 --- a/shared/database.js +++ b/shared/database.js @@ -56,9 +56,11 @@ function Database(config, readyCallback) { * Will need to wait for all libraries to be loaded before * initializing the database. */ + Database.nLibrariesLoaded = 0; - Database.libraryLoadCallbak = function(){ + Database.libraryLoadCallback = function(){ Database.nLibrariesLoaded++; + console.log("Loaded " + Database.nLibrariesLoaded); if (Database.nLibrariesLoaded == 3) { Database.initialize(); } @@ -67,15 +69,18 @@ function Database(config, readyCallback) { Database.loadJSLibrary = function(path) { var js = document.createElement("script"); js.type = "text/javascript"; + //js.onreadystatechange = Database.libraryLoadCallback; + js.onload = Database.libraryLoadCallback; js.src = path; - js.onreadystatechange = Database.libraryLoadCallbak; - js.onload = Database.libraryLoadCallbak; document.head.appendChild(js); + console.log("Will load: " + path); } - Database.loadJSLibrary(src="https://www.gstatic.com/firebasejs/6.3.0/firebase-app.js"); - Database.loadJSLibrary(src="https://www.gstatic.com/firebasejs/6.3.0/firebase-auth.js"); - Database.loadJSLibrary(src="https://www.gstatic.com/firebasejs/6.3.0/firebase-database.js"); + Database.loadJSLibrary(src="https://www.gstatic.com/firebasejs/8.6.8/firebase-app.js"); + Database.loadJSLibrary(src="https://www.gstatic.com/firebasejs/8.6.8/firebase-auth.js"); + Database.loadJSLibrary(src="https://www.gstatic.com/firebasejs/8.6.8/firebase-database.js"); + + // Database.initialize(); Database.signInAnonymously = function() { if (Database.uid == null && Database.userEmail == null) { diff --git a/shared/sensors.js b/shared/sensors.js index 6bc1309..3ddc4e4 100644 --- a/shared/sensors.js +++ b/shared/sensors.js @@ -102,7 +102,7 @@ var wristSensors = { redRegion.setAttribute('fill', 'red'); // make the torque positive and multiply it by a factor to // make sure the video will always be visible even with - var redOpacity = Math.abs(value) * 0.005; + var redOpacity = Math.abs(value) * 0.015; redRegion.setAttribute('fill-opacity', redOpacity); nothingRegion.setAttribute('fill-opacity', 0.0); }, @@ -162,7 +162,7 @@ var gripperSensors = { redRegion.setAttribute('fill', 'red'); // make the torque positive and multiply it by a factor to // make sure the video will always be visible even with - var redOpacity = Math.abs(value) * 0.005; + var redOpacity = Math.abs(value) * 0.015; redRegion.setAttribute('fill-opacity', redOpacity); nothingRegion.setAttribute('fill-opacity', 0.0); } diff --git a/signaling_sockets.js b/signaling_sockets.js index d817d60..5bef2a8 100644 --- a/signaling_sockets.js +++ b/signaling_sockets.js @@ -44,7 +44,7 @@ function createSignalingSocket(io) { // operators that were connected to the robot in a // previous session. - io.of(namespace).in(room).disconnectSockets(true) + io.of(namespace).in(room).disconnectSockets(true); // Add this robot's socket to the following two rooms: // 1) a new room named after the robot used to pair with an operator