Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
3cfdcb1209 | |||
ad256e83e3 | |||
3a48f36d43 |
@@ -16,7 +16,7 @@ ufw
|
|||||||
ufw can upload files to 8fw.me, shorten urls and show you your ip.
|
ufw can upload files to 8fw.me, shorten urls and show you your ip.
|
||||||
Call ufw -h for help.
|
Call ufw -h for help.
|
||||||
|
|
||||||
Dependencies: curl, jshon
|
Dependencies: curl, jq
|
||||||
|
|
||||||
ufwd
|
ufwd
|
||||||
----
|
----
|
||||||
|
12
ufw
12
ufw
@@ -82,7 +82,7 @@ get_album_id() {
|
|||||||
get_api_status <<< "$api_response"
|
get_api_status <<< "$api_response"
|
||||||
|
|
||||||
if (( api_status == 200 )); then
|
if (( api_status == 200 )); then
|
||||||
album_id=$( jshon -e data -e album -e id -u <<< "$api_response" )
|
album_id=$( jq -r '.data.album.id' <<< "$api_response" )
|
||||||
misc_curl_args+=( -F album_id="$album_id" )
|
misc_curl_args+=( -F album_id="$album_id" )
|
||||||
else
|
else
|
||||||
printf 'Error [album]: %s %s\n' "$api_status" "$api_status_message"
|
printf 'Error [album]: %s %s\n' "$api_status" "$api_status_message"
|
||||||
@@ -110,7 +110,7 @@ upload() {
|
|||||||
|
|
||||||
get_max_filesize || { return 1; }
|
get_max_filesize || { return 1; }
|
||||||
|
|
||||||
curl --max-filesize "$max_filesize_bytes" -skL "$target" > "$file"
|
curl --max-filesize "$max_filesize_bytes" -sL "$target" > "$file"
|
||||||
curl_result=$?
|
curl_result=$?
|
||||||
|
|
||||||
if (( curl_result )); then
|
if (( curl_result )); then
|
||||||
@@ -162,7 +162,7 @@ upload() {
|
|||||||
get_api_status <<< "$api_response"
|
get_api_status <<< "$api_response"
|
||||||
|
|
||||||
if (( api_status == 200 )); then
|
if (( api_status == 200 )); then
|
||||||
file_link=$( jshon -e data -e "$file_url_request" -u <<< "$api_response" )
|
file_link=$( jq -r ".data.${file_url_request}" <<< "$api_response" )
|
||||||
|
|
||||||
(( flag_shortlink )) || {
|
(( flag_shortlink )) || {
|
||||||
(( flag_directlink )) || file_link="${file_link#*.}"
|
(( flag_directlink )) || file_link="${file_link#*.}"
|
||||||
@@ -188,7 +188,7 @@ get_shortlink() {
|
|||||||
|
|
||||||
if (( api_status == 200 )); then
|
if (( api_status == 200 )); then
|
||||||
read -r short_url real_url < <(
|
read -r short_url real_url < <(
|
||||||
jshon -e data -e short_url -u <<< "$api_response"
|
jq -r '.data.short_url' <<< "$api_response"
|
||||||
)
|
)
|
||||||
|
|
||||||
printf '%s\n' "$short_url"
|
printf '%s\n' "$short_url"
|
||||||
@@ -221,7 +221,7 @@ take_screenshot() {
|
|||||||
|
|
||||||
get_api_status() {
|
get_api_status() {
|
||||||
read -d '' -r api_status api_status_message < <(
|
read -d '' -r api_status api_status_message < <(
|
||||||
jshon -e status -e code -u -p -e message -u
|
jq -r '.status.code, .status.message'
|
||||||
)
|
)
|
||||||
|
|
||||||
if ! (( api_status == 200 )); then
|
if ! (( api_status == 200 )); then
|
||||||
@@ -252,7 +252,7 @@ get_my_ip() {
|
|||||||
get_api_status <<< "$api_response"
|
get_api_status <<< "$api_response"
|
||||||
|
|
||||||
if (( api_status == 200 )); then
|
if (( api_status == 200 )); then
|
||||||
my_ip=$( jshon -e data -e ip -u <<< "$api_response" )
|
my_ip=$( jq -r '.data.ip' <<< "$api_response" )
|
||||||
printf '%s\n' "$my_ip"
|
printf '%s\n' "$my_ip"
|
||||||
else
|
else
|
||||||
printf 'Error: %s %s\n' "$api_status" "$api_status_message"
|
printf 'Error: %s %s\n' "$api_status" "$api_status_message"
|
||||||
|
Reference in New Issue
Block a user