Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
2026-11-27 23:41:42 +00:00
parent 57f083772e
commit df9f749726
2 changed files with 24 additions and 13 deletions
+15 -7
View File
@@ -46,9 +46,9 @@ usage() {
-c|--clipboard # Throw the result into the clipboard
-i|--my-ip # Get the IP you're reaching the service with, usually it will be your public address.
-l|--login <username> # Get a login token sent to email for <username>
-C|--xclip-selector # Set the xclip selector explicitly
--tmp-dir # Set the temp dir
--url # Set the service url
-C|--xclip-selector <sel> # Set the xclip selector explicitly
--tmp-dir <path> # Set the temp dir
--url <url> # Set the service url
Config options (~/.config/ufw):
secret # Your personal token. Get it at https://8fw.me/settings_form
@@ -250,7 +250,9 @@ get_my_ip() {
login() {
declare api_response login=$1
api_response=$( curl "$cfg_service_url/token_request.json?login=$login" )
api_response=$( curl --get \
--data-urlencode "login=$login" \
"$cfg_service_url/token_request.json" )
if get_api_status <<< "$api_response"; then
printf 'Check your email.\n'
@@ -270,7 +272,14 @@ get_token() {
read -sp 'Password: ' password
printf '\n'
login_response=$(curl -c "$cfg_file.cookiejar" -d "login=$login" -d "password=$password" -sl "$cfg_service_url/login.json")
login_response=$(curl -f -c "$cfg_file.cookiejar" -d "login=$login" -d "password=$password" -sl "$cfg_service_url/login.json")
(( $? )) || {
err "Login failed."
return 1
}
chmod 600 "$cfg_file.cookiejar"
get_api_status <<< "$login_response" || {
jq -r '.status.message' <<< "$login_response"
return 1
@@ -379,7 +388,6 @@ main() {
(--tmp-dir) cfg_tmp_dir=$2; shift;;
(--url) cfg_service_url=$2; shift;;
(--max-filesize) cfg_max_filesize=$2; shift;;
(-i|--my-ip) action='getmyip';;
(-u|--shorten) action='url';;
@@ -448,7 +456,7 @@ main() {
(( ${#args[@]} )) || return 1
if [[ "$album_name" ]]; then
get_album_id "$album_name"
get_album_id "$album_name" || return 1
fi
for t in "${args[@]}"; do