From 5c2b7405ab5f4228192c9a65265b380a458f3dc3 Mon Sep 17 00:00:00 2001 From: Ione 15 <> Date: Fri, 10 May 2024 18:47:23 +0200 Subject: [PATCH] adding inital upload file --- plasma_upload.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 plasma_upload.sh diff --git a/plasma_upload.sh b/plasma_upload.sh new file mode 100755 index 0000000..7334e24 --- /dev/null +++ b/plasma_upload.sh @@ -0,0 +1,36 @@ +#!/bin/bash +if [ ! -f "$1" ]; then + kdialog --passivepopup "No File!" 5 + exit +fi + +base=${1%.*} +baseName=$(basename "$1") +ext=${baseName##*.} +variable=$(openssl rand -hex 8) +remote_path=/var/www/html/images #this is the path the file will be uploaded to + +i=1 + +while [ -f "$1" ] +do + +rclone moveto "$1" remote:"$remote_path/$variable.$ext" -v --ignore-existing # ignore existing in case the file already exists + + if [ -f "$1" ]; then # if the file is still in /tmp we must've gotten some kind of error, we assume its a Collision + kdialog --sorry "Collision $i" + i=$((i+1)) + variable=$(openssl rand -hex 8) + fi + +done + + +if [ "$XDG_SESSION_TYPE" == "x11" ]; then + echo "$remote_path/$variable.$ext" | xclip -selection clipboard +else + wl-copy "$remote_path/$variable.$ext" &> /dev/null +fi + +kdialog --passivepopup "Uploaded! $remote_path/$variable.$ext" 5 +ffplay /usr/share/sounds/freedesktop/stereo/service-login.oga -hide_banner -autoexit -nodisp