all repos — nimhttpd @ a6044d3cd7d53aca0e813de6b33513c76594cea7

A useful static file web server.

Improvements.
h3rald h3rald@h3rald.com
Thu, 22 Apr 2021 20:26:25 +0000
commit

a6044d3cd7d53aca0e813de6b33513c76594cea7

parent

cdbe2c7a46a0c8bc1f892a204a30bf3228f3af36

3 files changed, 8 insertions(+), 6 deletions(-)

jump to
M README.mdREADME.md

@@ -9,10 +9,12 @@ _NimHTTPd_ is a minimal web server that can be used to serve static files.

## Usage -**nimhttpd** **[** **-p:**_port_ **]** **[** _directory_ **]** +**nimhttpd** **[** **-p:**_port_ **-t:**_title_ **-a:_address_ **]** **[** _directory_ **]** Where: * _directory_ is the directory to serve (default: current directory). * _port_ is the port to listen to (default: 1337). If the specified port is unavailable, the number will be incremented until an available port is found. +* _address_ is the address to bind to (default: 0.0.0.0). +* _title_ is the title to use when listing the contents of a directory.
M src/nimhttpd.nimsrc/nimhttpd.nim

@@ -130,12 +130,10 @@ var file = path.readFile

return (code: Http200, content: file, headers: {"Content-Type": mimetype}.newHttpHeaders) proc sendDirContents(settings: NimHttpSettings, dir: string): NimHttpResponse = - let cwd = settings.directory + let cwd = settings.directory.absolutePath var res: NimHttpResponse var files = newSeq[string](0) var path = dir.absolutePath - echo path - echo cwd if not path.startsWith(cwd): path = cwd if path != cwd and path != cwd&"/" and path != cwd&"\\":
M src/style.csssrc/style.css

@@ -132,10 +132,12 @@ text-decoration: underline;

} @media screen and (max-width: 659px) { a { - font-size: 150%; + font-size: 130%; + line-height: 130%; } li .entypo { - font-size: 150%; + font-size: 130%; + line-height: 130%; } body { width: 100%;