diff --git a/Makefile b/Makefile index 1d1d900..faab4fe 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +<<<<<<< HEAD:Makefile ###################################################################### # User configuration ###################################################################### @@ -34,3 +35,39 @@ upload: $(LUA_FILES) $(HTTP_FILES) #test test: $(LUA_FILES) $(HTTP_FILES) echo -b $(SPEED) -p $(PORT) upload $(foreach f, $^, -f $(f) -d $(f)) +======= +###################################################################### +# User configuration +###################################################################### +# Path to nodemcu-uploader (https://github.com/kmpm/nodemcu-uploader) +NODEMCU-UPLOADER=../nodemcu-uploader/nodemcu-uploader.py +# Serial port +PORT=/dev/cu.usbserial-A602HRAZ +# Bauds for the serial connection +SPEED=115200 + +###################################################################### +# End of user config +###################################################################### +HTTP_FILES := $(wildcard http/*) +LUA_FILES := init.lua httpserver.lua httpserver-request.lua httpserver-static.lua httpserver-error.lua + +# Print usage +usage: + @echo "make upload_http to upload files to be served" + @echo "make upload_server to upload the server code and init.lua" + @echo "make upload to upload all" + +# Upload HTTP files only +upload_http: $(HTTP_FILES) + @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f)) + +# Upload httpserver lua files (init and server module) +upload_server: $(LUA_FILES) + @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f)) + +# Upload all +upload: $(LUA_FILES) $(HTTP_FILES) + @$(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f)) + +>>>>>>> 2357415466bb24cba8ee33109146f6a6a2df0282:makefile diff --git a/http/node_info.lua b/http/node_info.lua index 7ca4e4e..8d99fe1 100644 --- a/http/node_info.lua +++ b/http/node_info.lua @@ -1,5 +1,9 @@ local function sendHeader(connection) +<<<<<<< HEAD connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nCache-Control: private, no-store\r\n\r\n") +======= + connection:send("HTTP/1.0 200 OK\r\nContent-Type: text/html\rCache-Control: private, no-store\r\n\r\n") +>>>>>>> 2357415466bb24cba8ee33109146f6a6a2df0282 end local function sendAttr(connection, attr, val) diff --git a/httpserver-static.lua b/httpserver-static.lua index faba719..9579996 100644 --- a/httpserver-static.lua +++ b/httpserver-static.lua @@ -5,6 +5,7 @@ local function getMimeType(ext) local gzip = false -- A few MIME types. Keep list short. If you need something that is missing, let's add it. +<<<<<<< HEAD local mt = {css = "text/css", gif = "image/gif", html = "text/html", ico = "image/x-icon", jpeg = "image/jpeg", jpg = "image/jpeg", js = "application/javascript", json = "application/json", png = "image/png"} if ext:find("gz$") then ext = ext:sub(1, -4) @@ -12,6 +13,10 @@ local function getMimeType(ext) end if mt[ext] then contentType = mt[ext] else contentType = "text/plain" end return {contentType = contentType, gzip = gzip } +======= + local mt = {css = "text/css", gif = "image/gif", html = "text/html", ico = "image/x-icon", jpeg = "image/jpeg", jpg = "image/jpeg", js = "application/javascript", json="application/json", png = "image/png"} + if mt[ext] then return mt[ext] else return "text/plain" end +>>>>>>> 2357415466bb24cba8ee33109146f6a6a2df0282 end local function sendHeader(connection, code, codeString, mimeType)