diff --git a/send.to.0x0.sh b/send.to.0x0.sh index b33e828..f759b44 100755 --- a/send.to.0x0.sh +++ b/send.to.0x0.sh @@ -14,6 +14,7 @@ flag_clipboard=false flag_inline=false flag_file=false flag_url=false +flag_text=false null_service_url="https://null.101010.fr" @@ -120,7 +121,22 @@ debug_message "− Get Content : content to be sended : ${content_to_send}" # Try to determine the type of the content (file, remote URL or text) determine_content_type "${content_to_send}" -content_url="" +# Try to send the content according to it's type [[[ +if [ "${flag_file}" = "true" ]; then + ## Command to send a local file to 0x0 service + debug_message "− send data : Send it as a file" + content_url=$(curl -sF"file=@${content_to_send}" "${null_service_url}") +elif [ "${flag_url}" = "true" ]; then + ## Command to send a remote URL to 0x0 service + debug_message "− send data : Send it as a remote URL" + content_url=$(curl -sF"url=${content_to_send}" "${null_service_url}") +else + ## Otherwise, it's a content + flag_text=true + debug_message "− send data : Send it as a text" + content_url=$(printf "%b" "${content_to_send}" | curl -sF'file=@-;' "${null_service_url}") +fi +# ]]] # Manage the result [[[ ## If the URL should simply be printed to stdout