This is a very simple HTTP server for sharing files and directories via web interface.
I host this on my Raspberry Pi for accessing files in home network. Just because I don't want to set up samba access for each device and sometimes need a way to share file. I can simply send a link to any device and download.
I'm not sure that this server is secure or can withstand attacks. Use it in private networks only.
Setting "allowFileUploading=true" is definitely unsafe and enables experimental code for file saving.
I'm using Scala 3, builtin java HttpServer and night-config for config file.
- Make a jar file:
sbt assembly. It will appear inside directorytarget/scala-3.4.2. - Create
config.tomlfile and specify port and paths. Seeconfig example.conf. - run
java -jar fileswebserver-assembly-0.1.0-SNAPSHOT.jar. - Access it in browser via
127.0.0.1:8081/some/path.
portmaxThreadsCount- maximum amount of simultaneous connections. Server spawn threads lazily, unused threads will be freed after 60 seconds of waiting.- section for each entry point:
browserPath = "/some/other/Path"path in browser, for example127.0.0.1:8081/some/other/PathfailIfMappedDirectoryNotExistsfail fast if mapped directory doesn't exist in file system. If disabled, server will respond "not found" for mappings without file system directory.fsPath = "/file/system/other/path"corresponding directory in the file systemallowFileUploading = true- false by default. Allow uploading files to server, implementation is experimental and unsafe.