Python rewrite

This commit is contained in:
David Allemang
2026-01-24 23:30:03 -05:00
parent 72c63a2e75
commit e24ae6c457
6 changed files with 489 additions and 1 deletions

69
README.md Normal file
View File

@@ -0,0 +1,69 @@
Upload images to self-hosted static file server via sshfs.
---
Example usage:
Upload an image on the clipboard and copy the url to the
clipboard.
$ imup
Upload an image from one or more files or urls.
$ imup https://example.com/image.png
$ imup foo.png bar.png baz.png
Upload an image from stdin.
$ convert foo.png -flip - | imup -
## Installation and setup.
This assumes you already have some hosted static files and ssh configured with write permissions to that directory. Images are copied to the host via `scp`. Thus authentication is deferred to other systems like VPN and SSH, and hosting is deferred to static web servers like nginx. This tool is only a convenience to normalize/strip image data and upload the files.
The client depends on `imagemagick`, `sshfs`, and `xclip`. The host only needs to serve ssh and static files.
```zsh
apt install imagemagick sshfs xclip
```
Clone the repository, and install it via tool like `pipx` or `uv`.
```zsh
uv tool install 'imup@git+https://git.allemangd.dev/me/imup.git'
```
Configure imup with `~/.config/imup.toml`. For example, my config is:
```toml
[imup]
target = "imup-host:/var/www/i.allemangd.dev"
base_url = "https://i.allemangd.dev/"
```
Granted write permissions to `/var/www/i.allemangd.dev` to my ssh user, and configure an ssh host with keys for that user.
```
# ssh config
Host imup-host
HostName ...
User ...
IdentifyFile ...
```
Configure the static file host; for example on my host I have the following nginx server config:
```
# nginx config
server {
listen 80;
# (ssl settings omitted)
server_name i.allemangd.dev;
location / {
root /var/www/i.allemangd.dev/;
}
}
```