diff --git a/.gitignore b/.gitignore index 3a46f40..5537fb4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.DS_Store + d3/ font-awesome-4.7.0/ jquery* \ No newline at end of file diff --git a/README.md b/README.md index 61ac42b..1564d24 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ On your web browser, just access the file `graphexp.html`. Next step, configure the server settings on the bottom of the page. The default Gremlin server address is `localhost:8182`. You will have to specify the communication protocol `websocket` or `REST` and the gremlin server version. Graphexp is not able to handle secure connections yet and a contribution on this topic would be welcome. -Graphexp works with [Amazon Neptune](https://aws.amazon.com/neptune) thanks to a pull request of [jwalton922](https://github.com/jwalton922). With this database, set `SINGLE_COMMANDS_AND_NO_VARS = true` in the file `graphConf.js`. +Graphexp works with [Amazon Neptune](https://aws.amazon.com/neptune). With this database, set `SINGLE_COMMANDS_AND_NO_VARS = true` in the file `graphConf.js`. if you use REST over `https` you may need to set `REST_USE_HTTPS = true` as well. Additional parameters can be configured inside the file `graphConf.js`. diff --git a/graphexp.html b/graphexp.html index 654423a..7ae324c 100644 --- a/graphexp.html +++ b/graphexp.html @@ -145,6 +145,7 @@

Graph Explorer v 0.6

diff --git a/scripts/graphConf.js b/scripts/graphConf.js index f002e39..5f13c1d 100644 --- a/scripts/graphConf.js +++ b/scripts/graphConf.js @@ -8,6 +8,9 @@ const host = false; // For implementations like Neptune where only single commands are allowed per request // set to true const SINGLE_COMMANDS_AND_NO_VARS = false; +// For implementations like Neptune where communication only over https is allowed +// set to true +const REST_USE_HTTPS = false; // Time out for the REST protocol. Increase it if the graphDB is slow. const REST_TIMEOUT = 2000 diff --git a/scripts/graphioGremlin.js b/scripts/graphioGremlin.js index 46bb2b5..b35675e 100644 --- a/scripts/graphioGremlin.js +++ b/scripts/graphioGremlin.js @@ -172,7 +172,7 @@ var graphioGremlin = (function(){ var edge_filter = $('#edge_filter').val(); var communication_method = $('#communication_method').val(); var id = d.id; - if(isNaN(id)){ // Add quotes if id is a string (not a number). + if (typeof id === 'string' || id instanceof String) { // Add quotes if id is a string (not a number). id = '"'+id+'"'; } // Gremlin query @@ -216,13 +216,22 @@ var graphioGremlin = (function(){ let server_port = $('#server_port').val(); let COMMUNICATION_PROTOCOL = $('#server_protocol').val(); if (COMMUNICATION_PROTOCOL == 'REST'){ - let server_url = "http://"+server_address+":"+server_port; + let server_url = "" + if(REST_USE_HTTPS){ + server_url = "https://"+server_address+":"+server_port; + } else{ + server_url = "http://"+server_address+":"+server_port; + } run_ajax_request(gremlin_query,server_url,query_type,active_node,message,callback); } else if (COMMUNICATION_PROTOCOL == 'websocket'){ let server_url = "ws://"+server_address+":"+server_port+"/gremlin" run_websocket_request(gremlin_query,server_url,query_type,active_node,message,callback); } + else if (COMMUNICATION_PROTOCOL == 'websockets'){ + let server_url = "wss://"+server_address+":"+server_port+"/gremlin" + run_websocket_request(gremlin_query,server_url,query_type,active_node,message,callback); + } else { console.log('Bad communication protocol. Check configuration file. Accept "REST" or "websocket" .') } @@ -442,7 +451,7 @@ var graphioGremlin = (function(){ // find the element in list with id equal to elem // return its index or null if there is no for (var i=0;i