68 lines
No EOL
1.7 KiB
Bash
68 lines
No EOL
1.7 KiB
Bash
GREEN="\e[32m"
|
|
YELLOW="\e[33m"
|
|
RED="\e[31m"
|
|
CYAN="\e[36m"
|
|
BOLD="\e[1m"
|
|
RESET="\e[0m"
|
|
|
|
CONFIG_DIR="$HOME/.config/grabIT"
|
|
CONFIG_FILE="$CONFIG_DIR/config.json"
|
|
NEEDS_SETUP=0
|
|
|
|
declare -A ALLOWED_KEYS=(
|
|
["log_level"]="^(DEBUG|INFO|WARN|ERROR)$"
|
|
["SHOW_CAPTURE_PREVIEW"]="^(true|false)$"
|
|
["SHOW_NOTIFICATIONS"]="^(true|false)$"
|
|
["SAVE_IMAGES"]="^(true|false)$"
|
|
["SAVE_DIR"]="^.+$"
|
|
["DOMAIN"]="^.+$"
|
|
["DEFAULT_OPTION"]="^(upload|save|copy)$"
|
|
["SERVICE"]="^(zipline|nest|fakecrime|ez|guns|pixelvault)$"
|
|
|
|
# zipline specific
|
|
["x-zipline-max-views"]="^.+$"
|
|
["x-zipline-image-compression-percent"]="^.+$"
|
|
["x-zipline-original-name"]="^.+$"
|
|
["x-zipline-format"]="^.+$"
|
|
)
|
|
|
|
REQUIRED_KEYS=(
|
|
"SHOW_CAPTURE_PREVIEW"
|
|
"SHOW_NOTIFICATIONS"
|
|
"SAVE_IMAGES"
|
|
"DEFAULT_OPTION"
|
|
)
|
|
|
|
valid_services=("zipline" "nest" "fakecrime" "ez" "guns" "pixelvault")
|
|
valid_args=("--help" "--version" "--config" "-c" "-u" "-f" "-d" "--silent")
|
|
|
|
for service in "${valid_services[@]}"; do
|
|
valid_args+=("--$service")
|
|
ALLOWED_KEYS["${service}_auth"]="^.+$"
|
|
done
|
|
|
|
declare -A UPLOADERS=(
|
|
["pixelvault"]="https://pixelvault.co"
|
|
["guns"]="https://guns.lol/api/upload"
|
|
["ez"]="https://api.e-z.host/files"
|
|
["fakecrime"]="https://upload.fakecrime.bio"
|
|
["nest"]="https://nest.rip/api/files/upload"
|
|
)
|
|
|
|
declare -A UPLOAD_HEADERS=(
|
|
["pixelvault"]="https://pixelvault.co|Authorization"
|
|
["guns"]="key"
|
|
["ez"]="key"
|
|
["fakecrime"]="Authorization"
|
|
["nest"]="Authorization"
|
|
["zipline"]="authorization"
|
|
)
|
|
|
|
declare -A UPLOAD_JSON_KEYS=(
|
|
["pixelvault"]="resource"
|
|
["nest"]="fileURL"
|
|
["guns"]="link"
|
|
["ez"]="imageUrl"
|
|
["fakecrime"]="url"
|
|
["zipline"]="files[0].url"
|
|
) |