Quickly upload files from nautilus to ffsend

What is ffsend?

Firefox Send was an end-to-end encrypted file sharing service that was discontinued in 2021.

timvisee/send is a community-maintained fork of Mozilla’s Send.

timvisee/ffsend is a command line tool to up- and download files to/from a Send instance.

What does this script do?

Placed in ~/.local/share/nautilus/scripts/, this script will add a button to Nautilus’ context menu, to upload files to your Send instance. After upload, the script will paste the link to your clipboard.

Requirement
Make sure you have xclip installed so the script can copy to your clipboard.
#!/bin/sh
host="https://ffsend.example.com"

files=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | tr '\n' ' ')
files=${files::-2}
filenum=$(echo "$files" | wc -l)

ffsendupload="ffsend upload -q -I --host $host"
copytoclipboard="xclip -selection clipboard"

if [[ $((filenum)) -lt 1 ]]; then
	exit 1
fi

notid=$(notify-send "Uploading file(s)" -p)
$ffsendupload $files | $copytoclipboard
notify-send "Link copied to clipboard" -r $notid 

Make sure to mark the script as executable: sudo chmod +x ~/.local/share/nautilus/scripts/ffsend.

To see the new field in the context menu you might have restart nautilus: nautilus -q