Skip to content

Commit

Permalink
Merge branch 'upstream'
Browse files Browse the repository at this point in the history
  • Loading branch information
mayacakmak committed Jun 26, 2021
2 parents 21a18e3 + d86a366 commit acd3154
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 24 deletions.
24 changes: 16 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
};
/////////////////////////

Expand Down
6 changes: 6 additions & 0 deletions bash_scripts/web_interface_installation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
30 changes: 23 additions & 7 deletions operator/operator.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
<head>
<!-- META tags go here -->
<!-- This can improve the appearance of web pages on mobile devices. -->

<!-- CSP exceptions -->
<meta http-equiv="content-type" content="text/html; charset=utf-8 ;">
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline' 'unsafe-eval' https://www.gstatic.com https://code.jquery.com https://cdnjs.cloudflare.com https://stackpath.bootstrapcdn.com https://webrtc.github.io/adapter/; style-src 'self' https://stackpath.bootstrapcdn.com">

<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--<meta name="viewport" content="height=device-height, initial-scale=1.0">-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="styles/style.processed.css">

<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

<!-- <link rel="stylesheet" href="styles/style.processed.css"> -->
</head>
<body onmouseup="stopAction()">

Expand Down Expand Up @@ -386,9 +394,17 @@
</div>

<link rel="stylesheet" type="text/css" href="operator.css" media="screen" />

<!-- <script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase-database.js"></script>
-->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>


<script src="../shared/video_dimensions.js"></script>
<script src="operator.js"></script>
<script type='text/javascript' >
Expand All @@ -402,13 +418,8 @@
import {createUiRegions} from '/operator/operator_ui_regions.js';
createUiRegions();
</script>-->
<script src="/socket.io/socket.io.js"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="../shared/sensors.js"></script>
<script src="../shared/commands.js"></script>
<script src="operator_acquire_av.js"></script>
<script src="operator_recorder.js"></script>
<script src="../shared/send_recv_av.js"></script>
<script src="../shared/database.js"></script>
<script type='text/javascript' >
function runOnOpenDataChannel() {
Expand All @@ -418,5 +429,10 @@
}
var db = new Database(config, runOnOpenDataChannel);
</script>
<script src="/socket.io/socket.io.js"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="operator_acquire_av.js"></script>
<script src="operator_recorder.js"></script>
<script src="../shared/send_recv_av.js"></script>
</body>
</html>
17 changes: 11 additions & 6 deletions shared/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions shared/sensors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion signaling_sockets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit acd3154

Please sign in to comment.