From cf0f7f594def7a4c9f6ed9a14d52b868b42825de Mon Sep 17 00:00:00 2001 From: Wouter R Date: Fri, 28 Jun 2013 13:47:45 +0200 Subject: [PATCH] Code restructure. --- src/{autowifi => }/README | 3 + src/autowifi/ext/autowifi.js | 134 ------------------ src/{autowifi/autowifi.lua => main.lua} | 0 .../reconf.lua => network/netconfig.lua} | 0 .../wifihelper.lua => network/wlanconfig.lua} | 0 src/{autowifi/ext => script}/autowifi_init | 0 src/{autowifi/misc => script}/collect-code.sh | 0 src/{autowifi/ext => script}/wfcf | 0 src/{autowifi => }/util.lua | 0 src/{autowifi => util}/urlcode.lua | 0 src/{autowifi/admin => www}/autowifi.css | 0 src/{autowifi/admin => www}/autowifi.html | 0 src/{autowifi/admin => www}/autowifi.js | 0 .../captive.keep}/.autowifi-inplace | 0 .../ext/www => www/captive.keep}/admin | 0 .../ext/www => www/captive.keep}/cgi-bin/wfcf | 0 .../ext/www => www/captive.keep}/index.html | 0 src/{autowifi/admin => www}/index.html | 0 .../admin => www}/jquery-1.9.1.min.js | 0 19 files changed, 3 insertions(+), 134 deletions(-) rename src/{autowifi => }/README (94%) delete mode 100644 src/autowifi/ext/autowifi.js rename src/{autowifi/autowifi.lua => main.lua} (100%) rename src/{autowifi/reconf.lua => network/netconfig.lua} (100%) rename src/{autowifi/wifihelper.lua => network/wlanconfig.lua} (100%) rename src/{autowifi/ext => script}/autowifi_init (100%) rename src/{autowifi/misc => script}/collect-code.sh (100%) rename src/{autowifi/ext => script}/wfcf (100%) rename src/{autowifi => }/util.lua (100%) rename src/{autowifi => util}/urlcode.lua (100%) rename src/{autowifi/admin => www}/autowifi.css (100%) rename src/{autowifi/admin => www}/autowifi.html (100%) rename src/{autowifi/admin => www}/autowifi.js (100%) rename src/{autowifi/ext/www => www/captive.keep}/.autowifi-inplace (100%) rename src/{autowifi/ext/www => www/captive.keep}/admin (100%) rename src/{autowifi/ext/www => www/captive.keep}/cgi-bin/wfcf (100%) rename src/{autowifi/ext/www => www/captive.keep}/index.html (100%) rename src/{autowifi/admin => www}/index.html (100%) rename src/{autowifi/admin => www}/jquery-1.9.1.min.js (100%) 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($("