From 71744b6325e3ac89d0741689905c453efe9c3c6e Mon Sep 17 00:00:00 2001 From: fbt Date: Sun, 6 Mar 2016 06:57:47 +0300 Subject: [PATCH] api tweaks Signed-off-by: fbt --- ufw | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ufw b/ufw index 8bd692a..b2fa43e 100755 --- a/ufw +++ b/ufw @@ -31,11 +31,12 @@ usage() { -u # Generate a shortlink from URL. -m # Maximum filesize (takes K, M and G suffixes). -a # Add the file to an album. + -A # API response format. Config options (~/.config/ufw): secret # Your personal token. Get it at https://zfh.so/settings_form cfg_screenshot_ext # Screenshot file type, used by scrot. - cfg_max_filesize # Maximum filesize in megabytes. + cfg_max_filesize # Maximum filesize in megabytes. # Others are self-explanatory: cfg_url_regex cfg_tmp_dir @@ -112,14 +113,14 @@ upload() { curl -sL \ -F file="@$file" \ - -F upload_mode='api' \ + -F api_format="$cfg_api_format" \ -F flag_private="$flag_private" \ -F short="$flag_shortlink" \ -F secret="$secret" \ -F submit="" \ "${misc_curl_args[@]}" \ -A 'zerofiles.org upload script' \ - "$cfg_service_url/upload" + "$cfg_service_url/$cfg_api_path/upload" if (( $? )); then err 'Something has gone wrong with the upload.' @@ -238,6 +239,8 @@ main() { cfg_service_url='https://8fw.me' cfg_screenshot_ext='png' cfg_max_filesize='200M' + cfg_api_format='plain' + cfg_api_path='/api/2' if [[ -f "$HOME/.suprc" ]]; then printf 'Found legacy configfile, moving...\n' >&2 @@ -263,6 +266,8 @@ main() { flag_scrot_fullscreen='1' ;; + -A|--api-format) cfg_api_format=$2; shift;; + -i|--my-ip) action='getmyip';; -S|--short) flag_shortlink='1';;