A simple file host manager for various image hosting services
  • C 93.9%
  • Shell 3.7%
  • CMake 1.7%
  • Nix 0.7%
Find a file
2026-04-17 08:34:38 +00:00
.github/workflows ci: use tarballs 2026-03-09 04:11:40 +00:00
include/hostman feat: add no-clipboard option 2026-02-21 02:02:47 +00:00
src feat(cli): parse global args in any position 2026-04-17 08:34:38 +00:00
.clang-format Formatting, add --version 2025-04-23 01:12:14 +01:00
.gitignore update nix flake 2026-03-09 01:58:43 +00:00
BUILD.md doc: add build instructions and update README 2026-03-09 01:31:15 +00:00
bump.sh fix: redirect build output to stderr in bump.sh for proper tarball creation 2025-12-08 05:34:57 +00:00
CHANGELOG.md Bump version to 1.2.4 2026-03-09 01:53:54 +00:00
CMakeLists.txt ci: find cjson include directory properly on windows 2026-03-09 03:39:48 +00:00
flake.lock chore: add nix flake 2026-02-18 20:10:09 +00:00
flake.nix update nix flake 2026-03-09 01:58:43 +00:00
LICENSE Create LICENSE 2025-04-22 00:13:53 +01:00
README.md ci: make uploaded files unique 2026-03-09 04:07:23 +00:00

Hostman

A command line image host manager

Build and Release

Installation

Either get the latest binary release from GitHub or build from source according to BUILD.md

Usage

First Run

When running Hostman for the first time, it will guide you through setting up your first host configuration.

Basic Commands

# 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 DEBUG

Configuration

Hostman 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"
    }
  }
}

File Deletion Support

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, response_url_json_path supports:

  • Dot JSON paths like url or data.url
  • Array indexing like files[0].url
  • Raw text responses via raw or text (uses the full response body)

You can specify the JSON path to the deletion URL in the response using response_deletion_url_json_path. 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:

  1. The deletion URL will be displayed and stored in the database
  2. In the upload history, records with deletion URLs are marked with [D]
  3. You can use hostman delete-file <id> to delete the file from the remote host

License

This project is licensed under the MIT License.