├── README.md
├── config.sh
├── flameshot.sh
└── ftp.sh
/README.md:
--------------------------------------------------------------------------------
1 | # Ftp-Uploader
2 | Small script for automatically uploading screenshots in the clipboard to FTP servers **Now with 🤴🥶😙🤝👳💑 support**
3 |
4 | **Example**: https://mamamoo.xetera.dev/😫👊👵🙀👄😃.png
5 |
6 | Only available for Linux and maybe... Mac? not sure. If you're on Windows just use the almighty [ShareX](https://getsharex.com/), you don't have to mess with silly scripts like these (although ShareX still doesn't support emojis 😉).
7 |
8 | ### Supports [Bunny CDN](https://bunnycdn.com)
9 |
10 | ## Setup
11 | 1. `git clone https://github.com/Xetera/Ftp-Uploader.git`
12 | 2. `sudo apt install xclip`
13 | 3. `cd Ftp-Uploader`
14 | 3. Fill in config.sh
15 | 4. For ease of use with [flameshot](https://github.com/lupoDharkael/flameshot), bind `flameshot.sh` to a shortcut of your choice. ...or using whatever other option non-ubuntu people have.
16 | 5. 🎉 (I hope)
17 |
18 | ## Setttings
19 | Fill in your settings in config.sh
20 |
21 | * USERNAME
22 | * FTP username **OR** for Bunny CDN, the name of your storage zone, you can find this in the Username part of the FTP & API Access page
23 |
24 | * PASSWORD
25 | * FTP password **OR** your API key for Bunny CDN
26 |
27 | * BASE_REDIRECT_URL
28 | * The base url you want to be redirected ot after you download (this link automatically gets pasted into your clipboard after the upload, much like how ShareX works)
29 |
30 | * FILE_NAME_LENGTH
31 | * The amount of random characters for the file name to have. By default generates random alphanumeric, lower + capital letters.
32 |
33 | * UPLOAD_PATH
34 | * The folder that you want the image to be uploaded to (root by default)
35 |
36 |
37 | ## Options
38 | * `-q` Makes output **quiet**
39 | * `-w` Opens the link in a new **window** or tab after uploading
40 | * `-e` 👌 Gives your file a name with **emojis**, otherwise alphanumeric letters 💯
41 |
42 | The redirect will be in the form of:
43 |
44 | ##### BASE_REDIRECT_URL/filename.png
45 |
46 | #### Note:
47 | The total possibility of usable emojis have been reduced as some emojis are made up of other emojis like this one 💆♀️ which can look bad on certain devices.
48 |
49 | 
50 |
51 | ### Important:
52 | Copying urls with emojis in Google Chrome (and possibly others) will give you weirdly encoded urls, I don't know how you can get around this as of now.
53 |
54 | ## Other screenshot tools
55 |
56 | To integrate with other screenshot tools, combine the command with:
57 | ```sh
58 | screenshot-tool-here && bash $(dirname "$0")/bunny.sh
59 | ```
60 | Make sure the screenshot command exits before executing the uploader. The `--raw` option for flameshot is used for this purpose as flameshot does not wait for the screenshot to be taken before exiting the command without it.
61 |
--------------------------------------------------------------------------------
/config.sh:
--------------------------------------------------------------------------------
1 | USERNAME=
2 | HOST="storage.bunnycdn.com"
3 | PASSWORD=
4 | BASE_REDIRECT_URL=
5 | FILE_NAME_LENGTH="9"
6 | UPLOAD_PATH=
7 |
--------------------------------------------------------------------------------
/flameshot.sh:
--------------------------------------------------------------------------------
1 | flameshot gui --raw >& /dev/null && bash $(dirname "$0")/ftp.sh -w -e
2 |
--------------------------------------------------------------------------------
/ftp.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | source $(dirname "$0")/config.sh
4 |
5 | clipboard=$(xclip -o -selection clipboard -t image/png 2> /dev/null)
6 |
7 | if [[ "target image/png not available" == *"$clipboard"* ]]; then
8 | echo "No image found on clipboard!"
9 | exit 1
10 | fi
11 |
12 | emojis=(😀 😁 😂 🤣 😃 😄 😅 😆 😉 😊 😋 😎 😍 😘 🥰 😗 😙 😚 ☺ 🙂 🤗 🤩 🤔 🤨 😐 😑 😶 🙄 😏 😣 😥 😮 🤐 😯 😪 😫 😴 😌 😛 😜 😝 🤤 😒 😓 😔 😕 🙃 🤑 😲 ☹ 🙁 😖 😞 😟 😤 😢 😭 😦 😧 😨 😩 🤯 😬 😰 😱 🥵 🥶 😳 🤪 😵 😡 😠 🤬 😷 🤒 🤕 🤢 🤮 🤧 😇 🤠 🤡 🥳 🥴 🥺 🤥 🤫 🤭 🧐 🤓 😈 👿 👹 👺 💀 ☠ 👻 👽 👾 🤖 💩 😺 😸 😹 😻 😼 😽 🙀 😿 😾 👶 👦 👧 👨 👩 👴 👵 👮 🕵 💂 👷 🤴 👸 👳 👲 🧕 🧔 👱 🤵 👰 🤰 🤱 👼 🎅 🤶 🦸 🦹 🧙 🧛 🧜 🧝 🧞 🧟 🙍 🙎 🙅 🙆 💁 🙋 🙇 🤦 🤷 💆 💇 🚶 🏃 💃 🕺 👯 🧖 🧘 🕴 🗣 👤 👥 👫 👬 👭 💏 💑 👪 🤳 💪 🦵 🦶 👈 👉 ☝ 👆 🖕 👇 ✌ 🤞 🖖 🤘 🤙 🖐 ✋ 👌 👍 👎 ✊ 👊 🤛 🤜 🤚 👋 🤟 ✍ 👏 👐 🙌 🤲 🙏 🤝 💅 👂 👃 👣 👀 👁 🧠 🦴 🦷 👅 👄 💋 👓 🕶 🥽 🥼 👔 👕 👖 🧣 🧤 🧥 🧦 👗 👘 👙 👚 👛 👜 👝 🎒 👞 👟 🥾 🥿 👠 👡 👢 👑 👒 🎩 🎓 🧢 ⛑ 💄 💍 🧳 🌂 ☂ 💼 🧵 🧶)
13 |
14 | declare name
15 | declare -i opt_quiet
16 | declare -i opt_new_window
17 |
18 | while (($#)); do
19 | case "$1" in
20 | -e)
21 | for ((i=0; i<5; i++)); do
22 | name="${name}${emojis[RANDOM % 256]}"
23 | done
24 | ;;
25 | -q)
26 | opt_quiet=1
27 | ;;
28 | -w)
29 | opt_new_window=1
30 | ;;
31 | *)
32 | printf "error: unrecognized argument '$1'\n" >&2
33 | exit 1
34 | ;;
35 | esac
36 | shift
37 | done
38 |
39 | if [[ -z "${name}" ]]; then
40 | name="$(cat /dev/urandom \
41 | | tr -dc 'a-zA-Z0-9' \
42 | | fold -w "${FILE_NAME_LENGTH}" \
43 | | head -n 1)"
44 | fi
45 |
46 | xclip -o -selection clipboard -t image/png -o > "$name.png"
47 | upload_dir=$(echo "$UPLOAD_PATH/$name.png" | tr -s /)
48 | echo "$upload_dir"
49 |
50 | ftp -n "$HOST" <