diff --git a/plugins/README.md b/plugins/README.md index 3e85ec93..bbb97497 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -52,10 +52,10 @@ Plugins extend the capabilities of `nnn`. They are _executable_ scripts (or bina | ringtone | Create a variable bitrate mp3 ringtone from file | sh | date, ffmpeg | | splitjoin | Split file or join selection | sh | split, cat | | suedit | Edit file using superuser permissions | sh | sudoedit/sudo/doas | -| transfer | Upload file to transfer.sh | sh | curl | | treeview | Informative tree output in `$EDITOR` | sh | tree | | uidgid | List user and group of all files in dir | sh | ls, less | | upgrade | Upgrade nnn manually on Debian 9 Stretch | sh | curl | +| upload | Upload file to file.io | sh | curl, jq, tr | | vidthumb | Show video thumbnails in terminal | sh | [ffmpegthumbnailer](https://github.com/dirkvdb/ffmpegthumbnailer),
[lsix](https://github.com/hackerb9/lsix) | | wall | Set wallpaper or change colorscheme | sh | nitrogen/pywal | diff --git a/plugins/transfer b/plugins/transfer deleted file mode 100755 index 05992a3f..00000000 --- a/plugins/transfer +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env sh - -# Description: Upload a file to transfer.sh -# -# Shell: POSIX compliant -# Author: Arun Prakash Jana - -if ! [ -z "$1" ]; then - # Upload the file, show the download link and wait till user presses any key - curl -s --upload-file "$1" https://transfer.sh/"$(basename "$1")" - echo - read -r _ - - # To write download link to "$1".loc and exit - # curl -s --upload-file "$1" https://transfer.sh/`basename "$1"` -o `basename "$1"`.loc -fi diff --git a/plugins/upload b/plugins/upload new file mode 100755 index 00000000..f74ee5c8 --- /dev/null +++ b/plugins/upload @@ -0,0 +1,19 @@ +#!/usr/bin/env sh + +# Description: Upload a file to file.io +# Requires: curl, jq, tr +# Note: File set to expire after a week +# +# Shell: POSIX compliant +# Author: Arun Prakash Jana + +if [ -s "$1" ]; then + # Upload the file, show the download link and wait till user presses any key + curl -s -F "file=@$1" https://file.io/?expires=1w | jq '.link' | tr -d '"' + + # To write download link to "$1".loc and exit + # curl -s -F "file=@$1" https://file.io/?expires=1w -o `basename "$1"`.loc +else + echo "empty file!" +fi + read -r _