[Added] Added example config file
This commit is contained in:
parent
12860165dc
commit
668cb93a38
@ -67,9 +67,9 @@ This script requires a **free API key** from ImgBB:
|
||||
1. Go to [https://api.imgbb.com/](https://api.imgbb.com/) and register or log in to get your key.
|
||||
2. Set the API key using *one* of these methods (script checks in this order):
|
||||
* Store the key in `.config/imgbb/uploader/api_key`.
|
||||
* **File** Create the config file `~/.config/imgbb_uploader.conf` and add a line like:
|
||||
* **File** Move the `imgbb_uploader.conf` from the root directory of this project into `~/.config`.
|
||||
* Edit the file to include your API key, and optionally set up your own personal defaults.
|
||||
```bash
|
||||
echo "api_key="YOUR_KEY_HERE" > ~/.config/imgbb_uploader.conf
|
||||
# Set permissions so only you can read it:
|
||||
chmod 600 ~/.config/imgbb_uploader.conf
|
||||
```
|
||||
|
14
imgbb
14
imgbb
@ -13,13 +13,17 @@
|
||||
|
||||
# === Default Configuration & Argument Parsing. ===
|
||||
|
||||
api_key=""
|
||||
config_file="$HOME/.config/imgbb_uploader.conf"
|
||||
# imgbb first reads defaults from ~/.config/imgbb_uploader.conf.
|
||||
# If defaults not found in the config file, it reads them from the values
|
||||
# assigned below.
|
||||
# Optional flags override both config and values below.
|
||||
api_key=""
|
||||
filepath=""
|
||||
expire_seconds="7200" # 2h - Set to "" for no expiry. or use flag -e 0, never or none.
|
||||
expire_seconds=""
|
||||
custom_name=""
|
||||
markdown_mode="false"
|
||||
org_mode="false"
|
||||
markdown_mode=""
|
||||
org_mode=""
|
||||
clipboard="$XDG_SESSION_TYPE"
|
||||
|
||||
[ ! -e "$config_file" ] || . "$config_file"
|
||||
@ -270,6 +274,8 @@ curl_opts+=(--form "image=@$TMP_IMG")
|
||||
|
||||
if [ -n "$expire_seconds" ]; then
|
||||
curl_opts+=(--form "expiration=$expire_seconds")
|
||||
# Confirm what value is being sent.
|
||||
echo "Sending expiration: $expire_seconds seconds."
|
||||
fi
|
||||
if [ -n "$custom_name" ]; then
|
||||
curl_opts+=(--form "name=$custom_name")
|
||||
|
17
imgbb_uploader.conf
Normal file
17
imgbb_uploader.conf
Normal file
@ -0,0 +1,17 @@
|
||||
# Template Configuration File. Place this under ~/.config/
|
||||
|
||||
# (REQUIRED) Replace this with your actual key.
|
||||
api_key="YOUR_API_KEY_FROM_IMG_BB_WEBSITE"
|
||||
|
||||
# Set default expiration time in seconds.
|
||||
# expire_seconds="3600" # Default to 1 hour.
|
||||
# expire_seconds="86400" # Default to 1 day.
|
||||
expire_seconds="" # Default to NO expiration.
|
||||
|
||||
# Set default output format (only set one! Or none for raw URL which is the default).
|
||||
#markdown_mode="true"
|
||||
#org_mode="true"
|
||||
|
||||
|
||||
# Default custom name (I think this isn't ideal to set as a default).
|
||||
# custom_name="MyDefaultUploadName"
|
Loading…
Reference in New Issue
Block a user