# HG changeset patch # User Nicholas Jillings # Date 1461833841 -3600 # Node ID f7604317ac271e458d28c5e37242d526d17ed901 # Parent 18d390c66b476db8222c710bcb773ac6b855dd08 Fix for #39. projectReturn is now used to determine which server to save the session to if using different servers for hosting and analysis diff -r 18d390c66b47 -r f7604317ac27 js/core.js --- a/js/core.js Wed Apr 27 20:44:00 2016 +0100 +++ b/js/core.js Thu Apr 28 09:57:21 2016 +0100 @@ -408,7 +408,13 @@ popup.popupContent.appendChild(a); } else { var xmlhttp = new XMLHttpRequest; - xmlhttp.open("POST","php/save.php?key="+storage.SessionKey.key,true); + var returnURL = ""; + if (typeof specification.projectReturn == "string") { + if (specification.projectReturn.substr(0,4) == "http") { + returnURL = specification.projectReturn; + } + } + xmlhttp.open("POST",returnURL+"php/save.php?key="+storage.SessionKey.key,true); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.onerror = function(){ console.log('Error saving file to server! Presenting download locally'); @@ -2837,14 +2843,26 @@ }, generateKey: function() { var temp_key = randomString(32); - this.request.open("GET","php/keygen.php?key="+temp_key,true); + var returnURL = ""; + if (typeof specification.projectReturn == "string") { + if (specification.projectReturn.substr(0,4) == "http") { + returnURL = specification.projectReturn; + } + } + this.request.open("GET",returnURL+"php/keygen.php?key="+temp_key,true); this.request.addEventListener("load",this); this.request.send(); }, update: function() { this.parent.root.setAttribute("state","update"); var xmlhttp = new XMLHttpRequest(); - xmlhttp.open("POST","php/"+specification.projectReturn+"?key="+this.key); + var returnURL = ""; + if (typeof specification.projectReturn == "string") { + if (specification.projectReturn.substr(0,4) == "http") { + returnURL = specification.projectReturn; + } + } + xmlhttp.open("POST",returnURL+"php/save.php?key="+this.key); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.onerror = function(){ console.log('Error updating file to server!');