Hostman is a robust, cross-platform command-line application for uploading files (primarily images) to various hosting services.
- C compiler (GCC or Clang)
- CMake
- libcurl
- cJSON
- SQLite3
- OpenSSL
git clone https://github.com/Bestire/hostman && cd hostman
cmake -B build -DHOSTMAN_USE_TUI=ON && cmake --build build
sudo cmake --install build # optional, installs the binary to /usr/local/binWhen running Hostman for the first time, it will guide you through setting up your first host configuration.
# Upload a file using the default host
hostman upload path/to/file.png
# Upload multiple files at once
hostman upload file1.png file2.jpg file3.gif
# Upload all files from a directory
hostman upload --directory ./screenshots/
hostman upload -d ./images/ --continue-on-error
# List all configured hosts
hostman list-hosts
# Add a new host (interactive)
hostman add-host
# Upload with a specific host
hostman upload --host myhost path/to/file.png
# Remove a host
hostman remove-host myhost
# Set default host
hostman set-default-host myhost
# View upload history
hostman list-uploads
# View upload history with pagination
hostman list-uploads --page 2 --limit 10
# Delete an upload record from local history
hostman delete-upload <id>
# Delete a file from the remote host (if deletion URL is available)
hostman delete-file <id>
# Interactive configuration editor (TUI)
hostman config
# View/modify configuration via CLI
hostman config get log_level
hostman config set log_level DEBUGHostman uses a JSON configuration file located at $HOME/.config/hostman/config.json. The structure is as follows:
{
"version": 1,
"default_host": "myhost",
"log_level": "INFO",
"log_file": "/path/to/log/file.log",
"hosts": {
"myhost": {
"api_endpoint": "https://example.com/api/upload",
"auth_type": "header",
"api_key_name": "Authorization",
"api_key_encrypted": "...",
"request_body_format": "multipart",
"file_form_field": "file",
"static_form_fields": {
"folder": "hostman"
},
"response_url_json_path": "url",
"response_deletion_url_json_path": "deletionUrl"
}
}
}Hostman supports deletion of files from hosting services that provide deletion URLs in their upload responses. Not all hosts support this feature.
When configuring a host, you can specify the JSON path to the deletion URL in the response using the response_deletion_url_json_path field. Leave this blank if the host doesn't support file deletion.
For example, if your hosting service returns:
{
"success": true,
"url": "https://example.com/xyz123.png",
"deletionUrl": "https://example.com/delete?key=abc123"
}You would set:
response_url_json_path: url
response_deletion_url_json_path: deletionUrl
When you upload a file to a host with deletion URL support:
- The deletion URL will be displayed and stored in the database
- In the upload history, records with deletion URLs are marked with
[D] - You can use
hostman delete-file <id>to delete the file from the remote host
This project is licensed under the MIT License.