11 stable releases
1.4.1 | May 26, 2023 |
---|---|
1.4.0 | May 24, 2023 |
1.2.1 | Apr 28, 2023 |
#19 in HTTP server
138 downloads per month
205KB
7K
SLoC
PaferaFileServer: The Little File Server That Could
Version 1.4.0 By Jim Yu (me@pafera.com)
Released under the GPL 3+
Updates
The 1.4 version added
- Rsync support
- Transcoding
- Compressing and uncompressing archives
- Running shell commands inside the current folder
Introduction
Due to the complexity of the interface, I have written an entire article detailing this server app at pafera.com/blog/1b9m21/2023/04/18/doessharingfileswithafriendhavetobesohard.en.html
Small and quick HTTP file server designed for use on Android Termux so that you can quickly share files on your phone to your friends just by having them connect to your hotspot or IP address if you're on the same wireless network.
It also includes directory search, recursive directory search, a slideshow viewer, and a recursive slideshow viewer with hotkeys and swipe gesture support capable of handling hundreds of thousands of files with ease. Instances running on separate devices can also detect other servers and send files to each other just by clicking on the server name and entering the password.
Being written in Rust and using minimal scripting with a mini version of the Pafera Framework, I've found this browser based slide show to be almost as fast as native image viewers, and much faster than Windows Explorer... not that being faster than Explorer is much of a bar to clear.
The JavaScript based image viewer can be started by tapping on an image. Swipe left and right to change images, up to rename this image to imagefile.deleted for later house cleaning, and swipe down to exit the viewer and return to the directory listing. The up, down, left, and right arrow keys on the keyboard will do the exact same actions as swiping in those directions.
Image and video thumbnail generation requires ImageMagick's convert and ffmpeg to be installed on your Termux installation. Of course, this server will also work for any Linux or Windows system where those two programs are installed.
Note that for security reasons, this server will not actually delete any files. It will simply append ".deleted" to the filename so that you can restore accidentally deleted files at a later time just by removing the ".deleted" extension or selecting "Undelete" from the menu.
If you really want to delete a file, then you can delete a file twice or select "Permanent Delete" from the menu. Be careful with this option.
Hotkeys
Hotkeys are supported for most functions as given:
Normal View
v | Change view style |
---|---|
i | Show hidden files |
s | Sort files |
a | Select all |
n | Select none |
r | Rename selected files |
m | Move selected files |
c | Copy selected files |
d | Delete selected files |
p | Permanently delete selected files |
u | Undelete selected files |
e | Show recently changed files |
t | Search this folder |
f | Search this folder and any subfolders |
w | Set password |
o | Create new subfolder |
z | Start slide show |
x | Start deep slide show |
h | Show this hotkeys help |
Slide Show View
Left Arrow | Previous image |
---|---|
Right Arrow | Next image |
Up Arrow | Delete image |
Down Arrow/Escape | Exit slide show |
r | Random image |
g | Go to image number |
q | Rotate 90 degrees counterclockwise |
e | Rotate 90 degrees clockwise |
Command line usage:
paferafileserver [hostname=localhost] [serverroot=/home/jim] [password=password] [ip=0.0.0.0]
[port=9999]
If you wanted to serve Jim's Pictures directory to all visitors on port 5000, you would use
paferafileserver serverroot=/home/jim/Pictures port=5000
If you don't specify serverroot, it will default to your home directory.
If you don't specify ip and port, it will default to 0.0.0.0:9999.
Additionally, the following options can be typed on the command line to disable certain functionality even if the user has the right password.
- disabledelete
- disablerename
- disablemove
- disablecopy
- disablenewfolder
- disabledelete
- disablepermanentdelete
- disablesend
- disableupload
All command line arguments can also be specified in a JSON file called paferafileserver.cfg such as
{
"hostname": "JimsLaptop",
"password": "SecretPassword12345",
"disabledelete": 1,
"disablepermanentdelete": 1
}
For Android 5 and 6, Termux won't run since it requires 7 and above, so we must install UserLand's Debian distribution instead. It is quite a bit more complicated than Termux, but is still better than not being able to run Linux programs at all.
Once you have installed Userland and Debian, type
sudo apt install imagemagick ffmpeg iproute2 openssl
If you want to build from source, you'll also need
sudo apt install curl build-essential gcc make libssl-dev pkg-config
and change the image thumbnail code to call "convert" instead of "magick" "convert" since Debian's Imagemagick does not have the magick executable yet.
You can find your phone's filesystem under /host-rootfs, thus if you want to serve your SD card, you could use
paferafileserver serverroot=/host-rootfs/storage/emulated/legacy
Installation
The main source repository is at
https://codeberg.org/pafera/paferafileserver
Prebuilt binaries for Linux, Termux, and Windows can be found at
https://codeberg.org/pafera/paferafileserver/src/branch/main/bin
Contributing
All contributions are welcome, no matter how large or small. The current server is enough for my personal purposes, but off of the top of my head, some further improvements could be:
- Sending files to a selectable destination directory instead of /Received
- Translations for different languages
As always, have fun using this server, and I hope that it will be useful to you in some way! Much appreciation to all of the folks who have contributed to Rust, Cargo, crates.io, Actix, and the rest of the code used in this project.
Dependencies
~19–28MB
~605K SLoC