Compare commits
No commits in common. "master" and "1.21.1" have entirely different histories.
14
ufw
14
ufw
@ -43,7 +43,7 @@ usage() {
|
|||||||
-t|--tags "<tag1[, tag2,..]>" # Add tags to the file.
|
-t|--tags "<tag1[, tag2,..]>" # Add tags to the file.
|
||||||
-q|--quiet # Be quiet.
|
-q|--quiet # Be quiet.
|
||||||
-v|--void # Don't add the file to my files.
|
-v|--void # Don't add the file to my files.
|
||||||
-c|--clipboard # Throw the result into the clipboard
|
-c|--clipboard # Throw the result into the clipboard
|
||||||
|
|
||||||
Config options (~/.config/ufw):
|
Config options (~/.config/ufw):
|
||||||
secret # Your personal token. Get it at https://zfh.so/settings_form
|
secret # Your personal token. Get it at https://zfh.so/settings_form
|
||||||
@ -84,10 +84,7 @@ get_max_filesize() {
|
|||||||
get_album_id() {
|
get_album_id() {
|
||||||
declare api_response api_status api_status_message
|
declare api_response api_status api_status_message
|
||||||
|
|
||||||
api_response=$( curl --get \
|
api_response=$( curl -f "$cfg_service_url/albumctl.json?m=new&name=$1&secret=$secret" )
|
||||||
--data-urlencode "name=$1" \
|
|
||||||
--data-urlencode "secret=$secret" \
|
|
||||||
"$cfg_service_url/albumctl.json?m=new" )
|
|
||||||
|
|
||||||
get_api_status <<< "$api_response"
|
get_api_status <<< "$api_response"
|
||||||
|
|
||||||
@ -191,10 +188,7 @@ upload() {
|
|||||||
get_shortlink() {
|
get_shortlink() {
|
||||||
declare url=$1 api_response api_status api_status_message
|
declare url=$1 api_response api_status api_status_message
|
||||||
|
|
||||||
api_response=$( curl --data-urlencode "url=$url" \
|
api_response=$( curl "$cfg_service_url/shrink.json?url=${url}&secret=$secret" )
|
||||||
--data-urlencode "secret=$secret" \
|
|
||||||
"$cfg_service_url/shrink.json" )
|
|
||||||
|
|
||||||
get_api_status <<< "$api_response"
|
get_api_status <<< "$api_response"
|
||||||
|
|
||||||
if (( api_status == 200 )); then
|
if (( api_status == 200 )); then
|
||||||
@ -450,7 +444,7 @@ main() {
|
|||||||
get_token || return $?
|
get_token || return $?
|
||||||
|
|
||||||
for t in "${args[@]}"; do
|
for t in "${args[@]}"; do
|
||||||
get_shortlink "$t"
|
get_shortlink "$1"
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
30
ufwd
30
ufwd
@ -11,33 +11,14 @@ err() { echo "$*" >&2; }
|
|||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf 'Usage: ufwd [-hn] [-d workdir] -D [check delay]\n'
|
printf 'Usage: ufwd [-hn] [-d workdir] -D [check delay]\n'
|
||||||
printf ' -h # Show this message.\n'
|
printf ' -h # Show this message.\n'
|
||||||
printf ' -n # Enable notifications with notify-send. Must be installed.\n'
|
printf ' -n # Enable notifications with notify-send. Must be installed.\n'
|
||||||
printf ' -d [path] # Set the dir that is to be watched.\n'
|
printf ' -d [path] # Set the dir that is to be watched.\n'
|
||||||
printf ' -s # Push the file url into the clipboard.\n'
|
printf ' -s # Push the file url into the clipboard.\n'
|
||||||
printf ' --magick <type:format> # Convert files of `type` into `format` with magick.\n'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
upload() {
|
upload() {
|
||||||
declare file=$1 file_type _type _target upload_output upload_return
|
declare file=$1; shift
|
||||||
shift
|
|
||||||
|
|
||||||
if [[ $cfg_magick ]]; then
|
|
||||||
file_type=$(file -ib "$file")
|
|
||||||
file_type="${file_type%;*}"
|
|
||||||
|
|
||||||
for x in "${cfg_magick[@]}"; do
|
|
||||||
_type="${x%:*}"
|
|
||||||
_target="${x#*:}"
|
|
||||||
|
|
||||||
[[ $_type == "$file_type" ]] && {
|
|
||||||
magick "$file" "${file%.*}.$_target"
|
|
||||||
rm -v "$file"
|
|
||||||
|
|
||||||
exit 0 # The next instance of the script will pick the file up.
|
|
||||||
}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
upload_output=$( ufw -R "$@" "$file" )
|
upload_output=$( ufw -R "$@" "$file" )
|
||||||
upload_return=$?
|
upload_return=$?
|
||||||
@ -66,7 +47,6 @@ main() {
|
|||||||
(--clipboard|-c) flag_enable_clipboard=1;;
|
(--clipboard|-c) flag_enable_clipboard=1;;
|
||||||
|
|
||||||
(--workdir|-d) cfg_workdir+=( "$2" ); shift;;
|
(--workdir|-d) cfg_workdir+=( "$2" ); shift;;
|
||||||
(--magick) cfg_magick+=( "$2" ); shift;;
|
|
||||||
|
|
||||||
(--) shift; break;;
|
(--) shift; break;;
|
||||||
(-*) err "Unknown key: $1"; usage; return 1;;
|
(-*) err "Unknown key: $1"; usage; return 1;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user