diff options
author | Arun Prakash Jana <engineerarun@gmail.com> | 2019-12-24 11:11:39 +0530 |
---|---|---|
committer | Arun Prakash Jana <engineerarun@gmail.com> | 2019-12-24 11:11:39 +0530 |
commit | f480de0065acdccb5afafa717665fe62b3110f43 (patch) | |
tree | cde66d1c1bf0f9c352ecf0adb3b6e08eb0233c08 /plugins | |
parent | b1207d54ea6fc96fa7244aa5c0f32f264862afc6 (diff) | |
download | nnn-f480de0065acdccb5afafa717665fe62b3110f43.tar.gz |
Use file.io to ipload files
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/README.md | 2 | ||||
-rwxr-xr-x | plugins/transfer | 16 | ||||
-rwxr-xr-x | plugins/upload | 19 |
3 files changed, 20 insertions, 17 deletions
diff --git a/plugins/README.md b/plugins/README.md index 3e85ec9..bbb9749 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),<br>[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 05992a3..0000000 --- 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 0000000..f74ee5c --- /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 _ |