Skip to content

Commit

Permalink
Main script completed.
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph authored and joseph committed Feb 13, 2022
1 parent 852a5b8 commit 0f60626
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
5 changes: 1 addition & 4 deletions srvrupload.desktop
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ Icon=cloud-upload
Actions=transferFile;
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
X-KDE-StartupNotify=false
X-KDE-Priority=TopLevel
X-KDE-Submenu=Upload to server

[Desktop Action transferFile]
Name=Upload to server (Copy link)
Exec=sh $HOME/.local/share/kservices5/srvrupload/srvrupload.sh %f 0 0 0
Exec=sh $HOME/.local/share/kservices5/srvrupload/srvrupload.sh %f
Icon=cloud-upload
22 changes: 21 additions & 1 deletion srvrupload.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@

#!/bin/sh

#### EDIT THESE VARIABLES ####
# The URL or IP of your server
serverURL="yourserver.com"
# The username and password of the remote user you'll be using SFTP with
serverUsername="user"
serverPassword="strongandcomplicatedpassword"
# The port expected by the server
serverPort=22
# Remote path to upload the file to
remote_path=/var/www/public/
# The URL (excluding file name) you expect the file to have to be accessible
expectedURL="https://yourserver.com/public/"

local_path=$1
sshpass -p $serverPassword scp -P $serverPort $local_path $serverUsername@$serverURL:$remote_path
fileName=$(basename $local_path)
link=$expectedURL$fileName
echo $link | xclip
notify-send --app-name="Server Upload" --icon="cloud-upload" "Link copied to xclip $link" --expire-time=5000 > /dev/null 2>&1

0 comments on commit 0f60626

Please sign in to comment.