Browse Source

More typo fixes

Artem Pastukhov 9 years ago
parent
commit
269b6e35bf
6 changed files with 34 additions and 48 deletions
  1. 1 1
      http/args.lua
  2. 1 1
      http/file_list.lua
  3. 2 2
      http/garage_door_opener.lua
  4. 29 29
      http/node_info.lua
  5. 0 14
      http/updateaplist.lua
  6. 1 1
      init.lua

+ 1 - 1
http/args.lua

@@ -1,5 +1,5 @@
 return function (connection, args)
-   connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\Cache-Control: private, no-store\r\n\r\n")
+   connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nCache-Control: private, no-store\r\n\r\n")
    connection:send('<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Arguments</title></head>')
    connection:send('<body>')
    connection:send('<h1>Arguments</h1>')

+ 1 - 1
http/file_list.lua

@@ -1,5 +1,5 @@
 return function (connection, args)
-   connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\Cache-Control: private, no-store\r\n\r\n")
+   connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nCache-Control: private, no-store\r\n\r\n")
    connection:send('<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>Server File Listing</title></head>')
    connection:send('<body>')
    connection:send('<h1>Server File Listing</h1>')

+ 2 - 2
http/garage_door_opener.lua

@@ -16,7 +16,7 @@ local function pushTheButton(connection, pin)
    gpio.mode(pin, gpio.INPUT)
 
    -- Send back JSON response.
-   connection:send("HTTP/1.0 200 OK\r\nContent-Type: application/json\r\Cache-Control: private, no-store\r\n\r\n")
+   connection:send("HTTP/1.0 200 OK\r\nContent-Type: application/json\r\nCache-Control: private, no-store\r\n\r\n")
    connection:send('{"error":0, "message":"OK"}')
 
 end
@@ -26,7 +26,7 @@ return function (connection, args)
    if     args.door == "1" then pushTheButton(connection, 3)   -- GPIO0
    elseif args.door == "2" then pushTheButton(connection, 4)   -- GPIO2
    else
-      connection:send("HTTP/1.0 400 OK\r\nContent-Type: application/json\r\Cache-Control: private, no-store\r\n\r\n")
+      connection:send("HTTP/1.0 400 OK\r\nContent-Type: application/json\r\nCache-Control: private, no-store\r\n\r\n")
       connection:send('{"error":-1, "message":"Bad door"}')
    end
 end

+ 29 - 29
http/node_info.lua

@@ -1,29 +1,29 @@
-local function sendHeader(connection)
-   connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\Cache-Control: private, no-store\r\n\r\n")
-end
-
-local function sendAttr(connection, attr, val)
-   connection:send("<li><b>".. attr .. ":</b> " .. val .. "<br></li>\n")
-end
-
-return function (connection, args)
-   collectgarbage()
-   sendHeader(connection)
-   connection:send('<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>A Lua script sample</title></head>')
-   connection:send('<body>')
-   connection:send('<h1>Node info</h1>')
-   majorVer, minorVer, devVer, chipid, flashid, flashsize, flashmode, flashspeed = node.info();
-   sendAttr(connection, "majorVer"              , majorVer)
-   sendAttr(connection, "devVer"                , devVer)
-   sendAttr(connection, "chipid"                , chipid)
-   sendAttr(connection, "flashid"               , flashid)
-   sendAttr(connection, "flashsize"             , flashsize)
-   sendAttr(connection, "flashmode"             , flashmode)
-   sendAttr(connection, "flashspeed"            , flashspeed)
-   sendAttr(connection, "node.heap()"           , node.heap())
-   sendAttr(connection, 'Memory in use (KB)'    , collectgarbage("count"))
-   sendAttr(connection, 'IP address'            , wifi.sta.getip())
-   sendAttr(connection, 'MAC address'           , wifi.sta.getmac())
-   connection:send('</ul>')
-   connection:send('</body></html>')
-end
+local function sendHeader(connection)
+   connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nCache-Control: private, no-store\r\n\r\n")
+end
+
+local function sendAttr(connection, attr, val)
+   connection:send("<li><b>".. attr .. ":</b> " .. val .. "<br></li>\n")
+end
+
+return function (connection, args)
+   collectgarbage()
+   sendHeader(connection)
+   connection:send('<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>A Lua script sample</title></head>')
+   connection:send('<body>')
+   connection:send('<h1>Node info</h1>')
+   majorVer, minorVer, devVer, chipid, flashid, flashsize, flashmode, flashspeed = node.info();
+   sendAttr(connection, "majorVer"              , majorVer)
+   sendAttr(connection, "devVer"                , devVer)
+   sendAttr(connection, "chipid"                , chipid)
+   sendAttr(connection, "flashid"               , flashid)
+   sendAttr(connection, "flashsize"             , flashsize)
+   sendAttr(connection, "flashmode"             , flashmode)
+   sendAttr(connection, "flashspeed"            , flashspeed)
+   sendAttr(connection, "node.heap()"           , node.heap())
+   sendAttr(connection, 'Memory in use (KB)'    , collectgarbage("count"))
+   sendAttr(connection, 'IP address'            , wifi.sta.getip())
+   sendAttr(connection, 'MAC address'           , wifi.sta.getmac())
+   connection:send('</ul>')
+   connection:send('</body></html>')
+end

+ 0 - 14
http/updateaplist.lua

@@ -1,14 +0,0 @@
-local function storelist(t)
---      connection:send(cjson.encode(t))
---      print(cjson.encode(t))
-      file.remove("http/aplist.json")
-      file.open("http/aplist.json","w+")
-      file.writeline(cjson.encode(t))
-      file.close()
-end
-
-return function(connection,args) 
-    wifi.sta.getap(storelist)
-    connection:send("HTTP/1.0 200 OK\r\nContent-Type: application/json\r\nCache-Control: private, no-store\r\n\r\n")
-    connection:send('{"error":0, "message":"OK"}')
-end

+ 1 - 1
init.lua

@@ -25,7 +25,7 @@ local compileAndRemoveIfNeeded = function(f)
    end
 end
 
-local serverFiles = {'httpserver.lua', 'httpserver-request.lua', 'httpserver-static.lua', 'httpserver-error.lua'}
+local serverFiles = {'httpserver.lua', 'httpserver-request.lua', 'httpserver-static.lua', 'httpserver-error.lua','http/ual.lua'}
 for i, f in ipairs(serverFiles) do compileAndRemoveIfNeeded(f) end
 
 compileAndRemoveIfNeeded = nil