From 0f60626528c038fab4f12514741e47ea8f96603a Mon Sep 17 00:00:00 2001
From: joseph <joseph@X6>
Date: Sun, 13 Feb 2022 16:06:14 +0000
Subject: [PATCH] Main script completed.

---
 srvrupload.desktop |  5 +----
 srvrupload.sh      | 22 +++++++++++++++++++++-
 2 files changed, 22 insertions(+), 5 deletions(-)
 mode change 100644 => 100755 srvrupload.desktop
 mode change 100644 => 100755 srvrupload.sh

diff --git a/srvrupload.desktop b/srvrupload.desktop
old mode 100644
new mode 100755
index c25ea14..8557750
--- a/srvrupload.desktop
+++ b/srvrupload.desktop
@@ -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
\ No newline at end of file
diff --git a/srvrupload.sh b/srvrupload.sh
old mode 100644
new mode 100755
index 8d1c8b6..4c8f6b2
--- a/srvrupload.sh
+++ b/srvrupload.sh
@@ -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
\ No newline at end of file
-- 
GitLab