Skip to content

Instantly share code, notes, and snippets.

@Froosk
Created November 14, 2018 01:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Froosk/218b42a788f8e0a89b11dada96db0d9f to your computer and use it in GitHub Desktop.
Save Froosk/218b42a788f8e0a89b11dada96db0d9f to your computer and use it in GitHub Desktop.
Flameshot FTP script for Ubuntu/Debian
#!/bin/bash
_notify() {
notify-send --expire-time 2000 \
--app-name 'Flameshot Uploader' \
--icon 'flameshot' \
"$1" "$2"
}
username="" # The username on the server you want to upload to
ip="" # The ip of the server
imagedirpath="" # The path to the folder you want the images in, has to be accessable by your HTTP server
url="" # The base url for your image host
temp=$(mktemp -d)
res=$(flameshot gui -p $temp -r > $temp/img.png && head -n 1 $temp/img.png)
if [[ $res == "screenshot aborted" ]]; then
_notify "My Uploader" "Screenshot aborted"
exit 1
fi
name=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1)
scp $temp/img.png $username@$ip:$imagedirpath/$name.png
link="$url/$name.png"
echo -n "$link" | xclip -selection clipboard -i
_notify "My Uploader" "Success! Link has been copied to the clipboard. Link: $link"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment