18 lines
444 B
Bash
18 lines
444 B
Bash
#!/usr/bin/env bash
|
|
|
|
|
|
file="${1}"
|
|
filename=$(basename -- "$file")
|
|
extension="${filename##*.}"
|
|
new_name="$(openssl rand -hex 12).${extension}"
|
|
url="https://drop.bascht.space/${new_name}"
|
|
|
|
if [[ ! -f "${file}" ]]; then
|
|
echo "File ${file} not readable. Aborting."
|
|
exit 1
|
|
fi
|
|
|
|
scp "${file}" "drop.bascht.space:/home/bascht/drop/${new_name}"
|
|
wl-copy "${url}"
|
|
notify-send -t 1000 "Uploaded successfully" "<a href=\'${url}\'>drop.bascht.space</a>"
|