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($("").val(ssid).text(ssid));
- }
- });
- $("#wlan_btn_connect").prop('disabled', false);
- });
-}
-
-function fetchKnownNetworks() {
- $.get(cgiPath + "?op=getknown", function(data) {
- data = parseResponse(data);
- if (data.status == "ERR") setResult(data.msg, true);
-
- data = data.payload.split("\n");
- var container = $("#wlan_known_container");
- container.empty();
- container.append("
SSID | BSSID | channel |
");
- $.each(data, function(index,value) {
- if (value != "") {
- net = parseNetLine(value);
- console.log(net);
- container.append("" + net.ssid + " | " + net.bssid + " | " + net.channel + " |
");
- }
- });
- container.append("
");
- });
-}
-
-function connectBtnHandler() {
- setResultNeutral("Associating with network...");
- ssid = $("#wlan_networks").find(":selected").text();
- phrase = $("#wlan_passphrase").val();
-
- if (ssid == "") {
- alert("Please select a network");
- return;
- }
-
- $.get(cgiPath + "?op=assoc&ssid=" + ssid + "&passphrase=" + phrase, function(data) {
- data = parseResponse(data);
- if (data.status == "ERR") {
- setResult(data.msg, true);
- } else {
- if (data.msg != "") setResult(data.msg, false);
- else setResult("Associated! (or are we?)", false);
- }
-
- fetchKnownNetworks();
- });
-
- return;
-}
-
-$(document).ready(function() {
- fetchNetworkState();
- fetchAvailableNetworks();
- fetchKnownNetworks();
- $("#wlan_btn_connect").click(connectBtnHandler);
-});
diff --git a/src/autowifi/autowifi.lua b/src/main.lua
similarity index 100%
rename from src/autowifi/autowifi.lua
rename to src/main.lua
diff --git a/src/autowifi/reconf.lua b/src/network/netconfig.lua
similarity index 100%
rename from src/autowifi/reconf.lua
rename to src/network/netconfig.lua
diff --git a/src/autowifi/wifihelper.lua b/src/network/wlanconfig.lua
similarity index 100%
rename from src/autowifi/wifihelper.lua
rename to src/network/wlanconfig.lua
diff --git a/src/autowifi/ext/autowifi_init b/src/script/autowifi_init
similarity index 100%
rename from src/autowifi/ext/autowifi_init
rename to src/script/autowifi_init
diff --git a/src/autowifi/misc/collect-code.sh b/src/script/collect-code.sh
similarity index 100%
rename from src/autowifi/misc/collect-code.sh
rename to src/script/collect-code.sh
diff --git a/src/autowifi/ext/wfcf b/src/script/wfcf
similarity index 100%
rename from src/autowifi/ext/wfcf
rename to src/script/wfcf
diff --git a/src/autowifi/util.lua b/src/util.lua
similarity index 100%
rename from src/autowifi/util.lua
rename to src/util.lua
diff --git a/src/autowifi/urlcode.lua b/src/util/urlcode.lua
similarity index 100%
rename from src/autowifi/urlcode.lua
rename to src/util/urlcode.lua
diff --git a/src/autowifi/admin/autowifi.css b/src/www/autowifi.css
similarity index 100%
rename from src/autowifi/admin/autowifi.css
rename to src/www/autowifi.css
diff --git a/src/autowifi/admin/autowifi.html b/src/www/autowifi.html
similarity index 100%
rename from src/autowifi/admin/autowifi.html
rename to src/www/autowifi.html
diff --git a/src/autowifi/admin/autowifi.js b/src/www/autowifi.js
similarity index 100%
rename from src/autowifi/admin/autowifi.js
rename to src/www/autowifi.js
diff --git a/src/autowifi/ext/www/.autowifi-inplace b/src/www/captive.keep/.autowifi-inplace
similarity index 100%
rename from src/autowifi/ext/www/.autowifi-inplace
rename to src/www/captive.keep/.autowifi-inplace
diff --git a/src/autowifi/ext/www/admin b/src/www/captive.keep/admin
similarity index 100%
rename from src/autowifi/ext/www/admin
rename to src/www/captive.keep/admin
diff --git a/src/autowifi/ext/www/cgi-bin/wfcf b/src/www/captive.keep/cgi-bin/wfcf
similarity index 100%
rename from src/autowifi/ext/www/cgi-bin/wfcf
rename to src/www/captive.keep/cgi-bin/wfcf
diff --git a/src/autowifi/ext/www/index.html b/src/www/captive.keep/index.html
similarity index 100%
rename from src/autowifi/ext/www/index.html
rename to src/www/captive.keep/index.html
diff --git a/src/autowifi/admin/index.html b/src/www/index.html
similarity index 100%
rename from src/autowifi/admin/index.html
rename to src/www/index.html
diff --git a/src/autowifi/admin/jquery-1.9.1.min.js b/src/www/jquery-1.9.1.min.js
similarity index 100%
rename from src/autowifi/admin/jquery-1.9.1.min.js
rename to src/www/jquery-1.9.1.min.js