diff --git a/js/SettingsWindow.js b/js/SettingsWindow.js index 8917938..6be02d2 100644 --- a/js/SettingsWindow.js +++ b/js/SettingsWindow.js @@ -28,6 +28,7 @@ var settings = { function SettingsWindow() { this.wifiboxURL; + this.wifiboxCGIBinURL this.window; this.form; this.timeoutTime = 3000; @@ -78,8 +79,9 @@ function SettingsWindow() { var self = this; - this.init = function(wifiboxURL) { + this.init = function(wifiboxURL,wifiboxCGIBinURL) { this.wifiboxURL = wifiboxURL; + this.wifiboxCGIBinURL = wifiboxCGIBinURL; this.window = $("#settings"); this.window.find(".btnOK").click(this.submitwindow); @@ -520,7 +522,7 @@ function SettingsWindow() { console.log(" postData: ",postData); if (communicateWithWifibox) { $.ajax({ - url: self.wifiboxURL + "/network/associate", + url: self.wifiboxCGIBinURL + "/network/associate", type: "POST", data: postData, dataType: 'json', @@ -545,7 +547,7 @@ function SettingsWindow() { this.createAP = function() { if (communicateWithWifibox) { $.ajax({ - url: self.wifiboxURL + "/network/openap", + url: self.wifiboxCGIBinURL + "/network/openap", type: "POST", dataType: 'json', timeout: self.timeoutTime, diff --git a/js/main.js b/js/main.js index be66d4c..6420c12 100644 --- a/js/main.js +++ b/js/main.js @@ -10,6 +10,8 @@ var settingsWindow = new SettingsWindow(); var firstTimeSettingsLoaded = true; +var wifiboxURL; // Using the uhttpd lua handler as default, because of better performance +var wifiboxCGIBinURL; // CGI-bin, for some network stuff, where it needs to restart the webserver for example var $drawAreaContainer, $doodleCanvas, doodleCanvas, doodleCanvasContext, $previewContainer; @@ -26,9 +28,11 @@ $(function() { if (getURLParameter("u") != "null") autoUpdate = (getURLParameter("u") == "1"); if (wifiboxIsRemote) { - wifiboxURL = "http://192.168.5.1/cgi-bin/d3dapi"; + wifiboxURL = "http://192.168.5.1/d3dapi"; + wifiboxCGIBinURL = "http://192.168.5.1/cgi-bin/d3dapi"; } else { wifiboxURL = "http://" + window.location.host + "/d3dapi"; + wifiboxCGIBinURL = "http://" + window.location.host + "/cgi-bin/d3dapi"; } if (!communicateWithWifibox) { @@ -52,7 +56,7 @@ $(function() { printer.init(); $(document).on(Printer.UPDATE,update); - settingsWindow.init(wifiboxURL); + settingsWindow.init(wifiboxURL,wifiboxCGIBinURL); $(document).on(SettingsWindow.SETTINGS_LOADED, settingsLoaded); if(debugMode) {