api tweaks
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
b33e57e886
commit
71744b6325
11
ufw
11
ufw
|
@ -31,11 +31,12 @@ usage() {
|
||||||
-u # Generate a shortlink from URL.
|
-u # Generate a shortlink from URL.
|
||||||
-m # Maximum filesize (takes K, M and G suffixes).
|
-m # Maximum filesize (takes K, M and G suffixes).
|
||||||
-a # Add the file to an album.
|
-a # Add the file to an album.
|
||||||
|
-A # API response format.
|
||||||
|
|
||||||
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
|
||||||
cfg_screenshot_ext # Screenshot file type, used by scrot.
|
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:
|
# Others are self-explanatory:
|
||||||
cfg_url_regex
|
cfg_url_regex
|
||||||
cfg_tmp_dir
|
cfg_tmp_dir
|
||||||
|
@ -112,14 +113,14 @@ upload() {
|
||||||
|
|
||||||
curl -sL \
|
curl -sL \
|
||||||
-F file="@$file" \
|
-F file="@$file" \
|
||||||
-F upload_mode='api' \
|
-F api_format="$cfg_api_format" \
|
||||||
-F flag_private="$flag_private" \
|
-F flag_private="$flag_private" \
|
||||||
-F short="$flag_shortlink" \
|
-F short="$flag_shortlink" \
|
||||||
-F secret="$secret" \
|
-F secret="$secret" \
|
||||||
-F submit="" \
|
-F submit="" \
|
||||||
"${misc_curl_args[@]}" \
|
"${misc_curl_args[@]}" \
|
||||||
-A 'zerofiles.org upload script' \
|
-A 'zerofiles.org upload script' \
|
||||||
"$cfg_service_url/upload"
|
"$cfg_service_url/$cfg_api_path/upload"
|
||||||
|
|
||||||
if (( $? )); then
|
if (( $? )); then
|
||||||
err 'Something has gone wrong with the upload.'
|
err 'Something has gone wrong with the upload.'
|
||||||
|
@ -238,6 +239,8 @@ main() {
|
||||||
cfg_service_url='https://8fw.me'
|
cfg_service_url='https://8fw.me'
|
||||||
cfg_screenshot_ext='png'
|
cfg_screenshot_ext='png'
|
||||||
cfg_max_filesize='200M'
|
cfg_max_filesize='200M'
|
||||||
|
cfg_api_format='plain'
|
||||||
|
cfg_api_path='/api/2'
|
||||||
|
|
||||||
if [[ -f "$HOME/.suprc" ]]; then
|
if [[ -f "$HOME/.suprc" ]]; then
|
||||||
printf 'Found legacy configfile, moving...\n' >&2
|
printf 'Found legacy configfile, moving...\n' >&2
|
||||||
|
@ -263,6 +266,8 @@ main() {
|
||||||
flag_scrot_fullscreen='1'
|
flag_scrot_fullscreen='1'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-A|--api-format) cfg_api_format=$2; shift;;
|
||||||
|
|
||||||
-i|--my-ip) action='getmyip';;
|
-i|--my-ip) action='getmyip';;
|
||||||
|
|
||||||
-S|--short) flag_shortlink='1';;
|
-S|--short) flag_shortlink='1';;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user