Browse Source

Merge branch 'master' of https://github.com/marcoskirsch/nodemcu-httpserver

Marcos Kirsch 7 years ago
parent
commit
472af17b18
2 changed files with 8 additions and 5 deletions
  1. 6 4
      Makefile
  2. 2 1
      httpserver-header.lua

+ 6 - 4
Makefile

@@ -7,6 +7,8 @@ NODEMCU-UPLOADER=../nodemcu-uploader/nodemcu-uploader.py
 PORT=/dev/cu.SLAB_USBtoUART
 SPEED=115200
 
+NODEMCU-COMMAND=$(NODEMCU-UPLOADER) -b $(SPEED) --start_baud $(SPEED) -p $(PORT) upload
+
 ######################################################################
 # End of user config
 ######################################################################
@@ -33,17 +35,17 @@ usage:
 
 # Upload one files only
 upload:
-	@python $(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(FILE)
+	@python $(NODEMCU-COMMAND) $(FILE)
 
 # Upload HTTP files only
 upload_http: $(HTTP_FILES)
-	@python $(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
+	@python $(NODEMCU-COMMAND) $(foreach f, $^, $(f))
 
 # Upload httpserver lua files (init and server module)
 upload_server: $(LUA_FILES)
-	@python $(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
+	@python $(NODEMCU-COMMAND) $(foreach f, $^, $(f))
 
 # Upload all
 upload_all: $(LUA_FILES) $(HTTP_FILES)
-	@python $(NODEMCU-UPLOADER) -b $(SPEED) -p $(PORT) upload $(foreach f, $^, $(f))
+	@python $(NODEMCU-COMMAND) $(foreach f, $^, $(f))
 

+ 2 - 1
httpserver-header.lua

@@ -13,7 +13,8 @@ return function (connection, code, extension, isGzipped)
 
    local function getMimeType(ext)
       -- A few MIME types. Keep list short. If you need something that is missing, let's add it.
-      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", xml = "text/xml"}
+      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", xml = "text/xml"}
       if mt[ext] then return mt[ext] else return "text/plain" end
    end