I think I fixed the weird posting bug. Posts from within the main loop should work as expected now.
This commit is contained in:
		
							
								
								
									
										25
									
								
								ratatoskr.sh
									
									
									
									
									
								
							
							
						
						
									
										25
									
								
								ratatoskr.sh
									
									
									
									
									
								
							| @@ -142,24 +142,25 @@ post_status() { | ||||
|     if [[ "${1}" == "" ]]; then | ||||
|         return | ||||
|     fi | ||||
|     local text="$@" | ||||
|     visibility="${visibility:-public}" | ||||
|     local content_type="${content_type:-text/markdown}" | ||||
| local json="$(jq -n --arg status "$text" \ | ||||
|         --arg spoiler_text "$spoiler_text" \ | ||||
|         --arg visibility "$visibility" \ | ||||
|         --arg content_type "$content_type" \ | ||||
|     local statusText="$@" | ||||
|     local statusVisibility="${statusVisibility:-public}" | ||||
|     local statusContent_type="${statusContent_type:-text/markdown}" | ||||
|     local statusSpoiler_text="" | ||||
|     local statusJson="$(jq -n --arg status "$statusText" \ | ||||
|         --arg spoiler_text "$statusSpoiler_text" \ | ||||
|         --arg visibility "$statusVisibility" \ | ||||
|         --arg content_type "$statusContent_type" \ | ||||
|         '{ status: $status, spoiler_text: $spoiler_text, visibility: $visibility, content_type: $content_type }')" | ||||
|     local result | ||||
|     result="$(curl -sS --oauth2-bearer "${oauth_token}" -H "Content-Type: application/json" \ | ||||
|         -d "$(echo "$json" | jq 'if .spoiler_text == "" then del(.spoiler_text) else . end | if .visibility == "" then del(.visibility) else . end')" \ | ||||
|     local statusResult | ||||
|     statusResult="$(curl -sS --oauth2-bearer "${oauth_token}" -H "Content-Type: application/json" \ | ||||
|         -d "$(echo "$statusJson" | jq 'if .spoiler_text == "" then del(.spoiler_text) else . end | if .visibility == "" then del(.visibility) else . end')" \ | ||||
|         "${instanceURL}/api/v1/statuses")" | ||||
|     if [[ $? -ne 0 ]]; then | ||||
|         echo "there was a problem contacting the server" | ||||
|         play_sound error | ||||
|         exit 1 | ||||
|     fi | ||||
|     local error="$(echo "$result" | jq -r '.error')" | ||||
|     local error="$(echo "$statusResult" | jq -r '.error')" | ||||
|     if [[ "$error" != "null" ]]; then | ||||
|         echo "Error: $error" | ||||
|         play_sound error | ||||
| @@ -170,6 +171,8 @@ local json="$(jq -n --arg status "$text" \ | ||||
| } | ||||
|  | ||||
|  | ||||
|  | ||||
|  | ||||
| # Display timelines | ||||
| show_timeline() { | ||||
|     result="$(curl -sS --oauth2-bearer "${oauth_token}" "${instanceURL}/api/v1/timelines/${timeline:-home}")" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user