first commit
This commit is contained in:
14
README.md
Normal file
14
README.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# My uploader
|
||||
|
||||
Uploade des screenshots sur Jirafeau depuis Flameshot :
|
||||
|
||||
https://flameshot.org/
|
||||
|
||||
Dépendances : ```curl``` ```notify-send``` ```xclip```
|
||||
|
||||
- Placer *uploader.desktop* dans *~/.local/share/applications/my-uploader.desktop*
|
||||
- Editer *my-uploader* en fonction des besoins et le placer dans *~/.local/bin/my-uploader*
|
||||
|
||||
**Usage** : Faire une capture avec Flameshot -> *Sélectionner une application pour ouvrir la catpure -> *Jirafeau screenshot uploader*
|
||||
|
||||
L'URL de partage sera dans le presse-papier
|
||||
63
my-uploader
Executable file
63
my-uploader
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
# Dependencies: curl, notify-send, xclip
|
||||
|
||||
url='https://jirafeau.tld.com'
|
||||
time='month'
|
||||
upload_password=''
|
||||
apipage='script.php'
|
||||
downloadpage='f.php'
|
||||
curl="/usr/bin/curl"
|
||||
|
||||
function _notify()
|
||||
{
|
||||
notify-send --expire-time 2000 \
|
||||
--app-name 'my-uploader' \
|
||||
--icon 'flameshot' \
|
||||
"$1" "$2"
|
||||
}
|
||||
|
||||
if [ ! -f "$1" ]
|
||||
then
|
||||
_notify 'My uploader' 'Error: Invalid screenshot file.'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#_notify 'My uploader' 'Uploading screenshot to jirafeau ...'
|
||||
|
||||
res=$($curl --silent -XPOST \
|
||||
-F "time=$time" \
|
||||
-F "file=@$1" \
|
||||
$url$apipage)
|
||||
|
||||
if [[ "$res" == Error* ]]; then
|
||||
_notify 'Error while uploading.'
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
code=$(cnt=0; echo "$res" | while read l; do
|
||||
if [[ "$cnt" == "0" ]]; then
|
||||
echo "$l"
|
||||
fi
|
||||
cnt=$(( cnt + 1 ))
|
||||
done)
|
||||
del_code=$(cnt=0; echo "$res" | while read l; do
|
||||
if [[ "$cnt" == "1" ]]; then
|
||||
_notify 'Error'
|
||||
fi
|
||||
cnt=$(( cnt + 1 ))
|
||||
done)
|
||||
key_code=$(cnt=0; echo "$res" | while read l; do
|
||||
if [[ "$cnt" == "2" ]]; then
|
||||
_notify 'Error'
|
||||
fi
|
||||
cnt=$(( cnt + 1 ))
|
||||
done)
|
||||
|
||||
|
||||
if [[ $key_code ]]; then
|
||||
echo -n "${url}${downloadpage}?h=$code&k=$key_code" | xclip -selection clipboard
|
||||
else
|
||||
echo -n "${url}${downloadpage}?h=$code" | xclip -selection clipboard
|
||||
fi
|
||||
_notify 'My uploader' 'Success! The link was sent to your clipboard'
|
||||
8
uploader.desktop
Normal file
8
uploader.desktop
Normal file
@@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=jirafeau screenshot uploader
|
||||
Categories=Graphics
|
||||
Comment=Uploads screenshots to jirafeau using curl
|
||||
Icon=cloud-upload
|
||||
Exec=my-uploader %u
|
||||
Terminal=false
|
||||
Reference in New Issue
Block a user