functions.zsh: add flexibility to upload()
This commit is contained in:
parent
cb1e721073
commit
26089f154f
@ -15,16 +15,17 @@ upload() {
|
||||
# make eternity the default lifespan
|
||||
FILE_LIFESPAN=${2:-e}
|
||||
FILE_ID=$(base64 /dev/urandom | tr -d '/+' | dd bs=16 count=1 2>/dev/null)
|
||||
FILENAME=$(basename $1)
|
||||
|
||||
rsync -auvP -4 $1 nebula:/var/www/htdocs/dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$1
|
||||
rsync -auvP -4 $1 "nebula:/var/www/htdocs/dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$FILENAME"
|
||||
|
||||
FILE_URL="https://dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$1"
|
||||
FILE_URL="https://dotya.ml/files/$FILE_LIFESPAN/$FILE_ID-$FILENAME"
|
||||
|
||||
if [[ -z "$WAYLAND_DISPLAY" ]]; then
|
||||
echo $FILE_URL | xclip -selection clipboard
|
||||
echo $FILE_URL | xsel --clipboard --input
|
||||
else
|
||||
echo $FILE_URL | wl-copy
|
||||
wl-copy --trim-newline $FILE_URL
|
||||
fi
|
||||
|
||||
echo $FILE_URL
|
||||
|
Loading…
Reference in New Issue
Block a user