sudomesh/disaster-radio

Serve user defined files from SD card

samuk opened this issue · 3 comments

samuk commented

It would be interesting to serve files such as the Android app https://play.google.com/store/apps/details?id=tk.giesecke.disaster_radio

From the SD when in Wifi mode. Is it feasible to just serve up whatever arbitrary files the user adds to the SD?

This is as simple as adding the file to the /web/static directory on the SD card. Then, just request the page http://192.168.4.1/filename and you should automatically download the file. Obviously, we may want to eventually build some sort of file browser/downloader into the web app to make this feature more accessible, but as a proof of concept this would get you started.

samuk commented

Thanks I'll try copying the webapp to SD.

Would it be possible to do it even when the webapp is hosted on the spiffs filesystem?

Yes, the same concept applies, obviously the size of the file is a greater concern if you are using SPIFFS. Just copy the desired fiie into web/static/ after building the webapp, but prior to running pio run -t uploadfs and it will be written to the SPIFFS along with the webapp.