0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-22 09:17:56 +01:00

Using cgi-bin for network/openap and network/associate

This commit is contained in:
peteruithoven 2013-10-16 12:31:22 +02:00
parent 50cb44b865
commit 6419af4055
2 changed files with 11 additions and 5 deletions

View File

@ -28,6 +28,7 @@ var settings = {
function SettingsWindow() { function SettingsWindow() {
this.wifiboxURL; this.wifiboxURL;
this.wifiboxCGIBinURL
this.window; this.window;
this.form; this.form;
this.timeoutTime = 3000; this.timeoutTime = 3000;
@ -78,8 +79,9 @@ function SettingsWindow() {
var self = this; var self = this;
this.init = function(wifiboxURL) { this.init = function(wifiboxURL,wifiboxCGIBinURL) {
this.wifiboxURL = wifiboxURL; this.wifiboxURL = wifiboxURL;
this.wifiboxCGIBinURL = wifiboxCGIBinURL;
this.window = $("#settings"); this.window = $("#settings");
this.window.find(".btnOK").click(this.submitwindow); this.window.find(".btnOK").click(this.submitwindow);
@ -520,7 +522,7 @@ function SettingsWindow() {
console.log(" postData: ",postData); console.log(" postData: ",postData);
if (communicateWithWifibox) { if (communicateWithWifibox) {
$.ajax({ $.ajax({
url: self.wifiboxURL + "/network/associate", url: self.wifiboxCGIBinURL + "/network/associate",
type: "POST", type: "POST",
data: postData, data: postData,
dataType: 'json', dataType: 'json',
@ -545,7 +547,7 @@ function SettingsWindow() {
this.createAP = function() { this.createAP = function() {
if (communicateWithWifibox) { if (communicateWithWifibox) {
$.ajax({ $.ajax({
url: self.wifiboxURL + "/network/openap", url: self.wifiboxCGIBinURL + "/network/openap",
type: "POST", type: "POST",
dataType: 'json', dataType: 'json',
timeout: self.timeoutTime, timeout: self.timeoutTime,

View File

@ -10,6 +10,8 @@ var settingsWindow = new SettingsWindow();
var firstTimeSettingsLoaded = true; 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; var $drawAreaContainer, $doodleCanvas, doodleCanvas, doodleCanvasContext, $previewContainer;
@ -26,9 +28,11 @@ $(function() {
if (getURLParameter("u") != "null") autoUpdate = (getURLParameter("u") == "1"); if (getURLParameter("u") != "null") autoUpdate = (getURLParameter("u") == "1");
if (wifiboxIsRemote) { 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 { } else {
wifiboxURL = "http://" + window.location.host + "/d3dapi"; wifiboxURL = "http://" + window.location.host + "/d3dapi";
wifiboxCGIBinURL = "http://" + window.location.host + "/cgi-bin/d3dapi";
} }
if (!communicateWithWifibox) { if (!communicateWithWifibox) {
@ -52,7 +56,7 @@ $(function() {
printer.init(); printer.init();
$(document).on(Printer.UPDATE,update); $(document).on(Printer.UPDATE,update);
settingsWindow.init(wifiboxURL); settingsWindow.init(wifiboxURL,wifiboxCGIBinURL);
$(document).on(SettingsWindow.SETTINGS_LOADED, settingsLoaded); $(document).on(SettingsWindow.SETTINGS_LOADED, settingsLoaded);
if(debugMode) { if(debugMode) {