diff --git a/src/autowifi/README b/src/README similarity index 94% rename from src/autowifi/README rename to src/README index 4ecb5dc..2861065 100644 --- a/src/autowifi/README +++ b/src/README @@ -1,3 +1,6 @@ +NOTE: text below is otudated, take it with a grain of salt. +----- + Installation: - make sure radio0 in /etc/config/wireless is not disabled - the wlan net must also be added to firewall in the lan zone diff --git a/src/autowifi/ext/autowifi.js b/src/autowifi/ext/autowifi.js deleted file mode 100644 index c04f072..0000000 --- a/src/autowifi/ext/autowifi.js +++ /dev/null @@ -1,134 +0,0 @@ -animSpeed = 200; -cgiPath = "asdasd/cgi-bin/wfcf"; - -function setResultNeutral(text) { - c = $("#op_result"); p = c.parent(); - c.removeClass("result_success").removeClass("result_error").html(text); - if (text == "") p.hide(animSpeed); - else p.show(animSpeed); -} - -/* - * Sets div#op_result content to text, assigns appropiate class based on isError and display: block or, with empty text, display:none. - */ -function setResult(text, isError) { - container = $("#op_result"); - parent = container.parent(); - if (isError) container.removeClass("result_success").addClass("result_error"); - else container.removeClass("result_error").addClass("result_success"); - - if (isError) title = "Error
\n"; - else title = "Success
\n"; - container.html(title + text); - - if (text == "") parent.hide(animSpeed); - else parent.show(animSpeed); -} - -//Returns an array with key 'status' (OK/WARN/ERR), 'msg' (can be empty) and 'status' (remainder of data) -function parseResponse(response) { - var r = {}; - var lines = response.split("\n"); - var st = lines[0].trim().split(','); - lines = lines.slice(1); - - r['status'] = st[0]; - r['msg'] = st.slice(1).join(","); - r['payload'] = lines.join("\n"); - - return r; -} - -function parseNetLine(line) { - var r = {}; - line = line.trim().split(","); - r.ssid = line[0]; - r.bssid = line[1]; - r.channel = line[2]; - r.mode = line[3]; - return r; -} - -function fetchNetworkState() { - $.get(cgiBase + "?op=getstate", function(data) { - data = parseResponse(data); - if (data.status == "ERR") setResult(data.msg, true); - var net = parseNetLine(data.payload); - if (net.mode == "ap") { - $("#wlan_state").text("Access point mode (SSID: " + net.ssid + "; BSSID: " + net.bssid + "; channel: " + net.channel + ")"); - } else { - $("#wlan_state").text("Client mode (SSID: " + net.ssid + "; BSSID: " + net.bssid + "; channel: " + net.channel + ")"); - } - }); -} - -function fetchAvailableNetworks() { - $.get(cgiPath + "?op=getavl", function(data) { - data = parseResponse(data); - if (data.status == "ERR") setResult(data.msg, true); -// else setResult(data.msg, false); - - data = data.payload.split("\n"); - var options = $("#wlan_networks"); - options.empty(); - $.each(data, function(index,value) { - if (value != "") { - var ssid = parseNetLine(value).ssid; - options.append($("