๐Ÿ“ฆโž”๐Ÿฆ‹ Store and retrieve files on the Atmosphere
35
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix/ignore various shellcheck issues

Ducky dd98f5c3 251c1402

+140 -110
+12 -2
.vscode/settings.json
··· 1 1 { 2 2 "cSpell.words": [ 3 - "ATFILE", 3 + "appview", 4 + "atfile", 4 5 "bsky", 5 - "DEVEL", 6 + "choo", 7 + "devel", 8 + "exiftool", 6 9 "feedgens", 10 + "jetstream", 7 11 "lexi", 12 + "mediainfo", 13 + "nsid", 14 + "pkgman", 15 + "rkey", 16 + "termux", 17 + "websocat", 8 18 "xrpc" 9 19 ] 10 20 }
+1
src/commands/auth.sh
··· 19 19 if [[ -z "$_server" ]]; then 20 20 skip_resolving=0 21 21 22 + # shellcheck disable=SC2154 22 23 if [[ -z $override_username ]] && [[ $_is_sourced == 0 ]]; then 23 24 # NOTE: Speeds things up a little if the user is overriding actor 24 25 # Keep this in-sync with the main case in `../entry.sh`!
+1 -1
src/commands/bsky_profile.sh
··· 77 77 # Do not modify the spacing here! 78 78 bsky_profile_output=" 79 79 \e[1;37m$name\e[0m 80 - \e[37m$(atfile.util.repeat_char "-" $name_length)\e[0m 80 + \e[37m$(atfile.util.repeat_char "-" "$name_length")\e[0m 81 81 $bio_formatted \e[37m$(atfile.util.repeat_char "-" 3)\e[0m 82 82 ๐Ÿ”Œ @$handle โˆ™ #๏ธโƒฃ $did 83 83 โฌ‡๏ธ $count_followers $(atfile.util.get_int_suffix "$count_followers" "\e[37mFollower\e[0m" "\e[37mFollowers\e[0m") โˆ™ โฌ†๏ธ $count_following \e[37mFollowing\e[0m โˆ™ โญ๏ธ $count_likes $(atfile.util.get_int_suffix "$count_likes" "\e[37mLike\e[0m" "\e[37mLikes\e[0m")
+1 -1
src/commands/now.sh
··· 2 2 3 3 function atfile.invoke.now() { 4 4 date="$1" 5 - atfile.util.get_date "$1" 5 + atfile.util.get_date "$date" 6 6 }
+51 -42
src/commands/old_cmds.sh
··· 9 9 error="$(atfile.util.get_xrpc_error $? "$blobs")" 10 10 11 11 if [[ -z "$error" ]]; then 12 - records="$(echo $blobs | jq -c '.cids[]')" 12 + records="$(echo "$blobs" | jq -c '.cids[]')" 13 13 if [[ -z "$records" ]]; then 14 14 if [[ -n "$cursor" ]]; then 15 15 atfile.die "No more blobs for '$_username'" ··· 24 24 unset record_count 25 25 unset json_output 26 26 27 + # shellcheck disable=SC2154 27 28 if [[ $_output_json == 0 ]]; then 28 29 echo -e "Blob" 29 30 echo -e "----" ··· 60 61 else 61 62 json_output="${json_output::-1}" 62 63 json_output+="]," 63 - json_output+="\"browser_accessible\": $(atfile.util.get_yn $browser_accessible)," 64 + json_output+="\"browser_accessible\": $(atfile.util.get_yn "$browser_accessible")," 64 65 json_output+="\"cursor\": \"$last_cid\"}" 65 66 echo -e "$json_output" | jq 66 67 fi ··· 90 91 lock_record="$(com.atproto.repo.getRecord "$_username" "blue.zio.atfile.lock" "$key")" 91 92 92 93 if [[ $(echo "$lock_record" | jq -r ".value.lock") == true ]]; then 94 + # shellcheck disable=SC2154 93 95 atfile.die "Unable to delete '$key' โ€” file is locked\n Run \`$_prog unlock $key\` to unlock file" 94 96 fi 95 97 98 + # shellcheck disable=SC2154 96 99 record="$(com.atproto.repo.deleteRecord "$_username" "$_nsid_upload" "$key")" 97 100 error="$(atfile.util.get_xrpc_error $? "$record")" 98 101 ··· 118 121 [[ $? != 0 || -z "$record" || "$record" == "{}" || "$record" == *"\"error\":"* ]] && success=0 119 122 120 123 if [[ $success == 1 ]]; then 121 - blob_uri="$(atfile.util.build_blob_uri "$(echo $record | jq -r ".uri" | cut -d "/" -f 3)" "$(echo $record | jq -r ".value.blob.ref.\"\$link\"")")" 124 + blob_uri="$(atfile.util.build_blob_uri "$(echo "$record" | jq -r ".uri" | cut -d "/" -f 3)" "$(echo "$record" | jq -r ".value.blob.ref.\"\$link\"")")" 122 125 file_name="$(echo "$record" | jq -r '.value.file.name')" 123 - key="$(atfile.util.get_rkey_from_at_uri "$(echo $record | jq -r ".uri")")" 126 + key="$(atfile.util.get_rkey_from_at_uri "$(echo "$record" | jq -r ".uri")")" 124 127 downloaded_file="$(atfile.util.build_out_filename "$key" "$file_name")" 125 128 126 129 curl -H "User-Agent: $(atfile.util.get_uas)" --silent "$blob_uri" -o "$downloaded_file" ··· 128 131 fi 129 132 130 133 if [[ $decrypt == 1 && $success == 1 ]]; then 131 - new_downloaded_file="$(echo $downloaded_file | sed -s s/.gpg//)" 134 + new_downloaded_file="$(echo "$downloaded_file" | sed -s s/.gpg//)" 132 135 133 136 gpg --quiet --output "$new_downloaded_file" --decrypt "$downloaded_file" 134 137 ··· 167 170 if [[ $success == 1 ]]; then 168 171 file_type="$(echo "$record" | jq -r '.value.file.mimeType')" 169 172 did="$(echo $record | jq -r ".uri" | cut -d "/" -f 3)" 170 - key="$(atfile.util.get_rkey_from_at_uri "$(echo $record | jq -r ".uri")")" 171 - blob_uri="$(atfile.util.build_blob_uri "$did" "$(echo $record | jq -r ".value.blob.ref.\"\$link\"")")" 172 - cdn_uri="$(atfile.util.get_cdn_uri "$did" "$(echo $record | jq -r ".value.blob.ref.\"\$link\"")" "$file_type")" 173 + key="$(atfile.util.get_rkey_from_at_uri "$(echo "$record" | jq -r ".uri")")" 174 + blob_uri="$(atfile.util.build_blob_uri "$did" "$(echo "$record" | jq -r ".value.blob.ref.\"\$link\"")")" 175 + cdn_uri="$(atfile.util.get_cdn_uri "$did" "$(echo "$record" | jq -r ".value.blob.ref.\"\$link\"")" "$file_type")" 173 176 174 177 unset locked 175 178 unset encrypted 176 179 180 + # shellcheck disable=SC2154 177 181 atfile.say.debug "Getting record...\nโ†ณ NSID: $_nsid_lock\nโ†ณ Repo: $_username\nโ†ณ Key: $key" 178 182 locked_record="$(com.atproto.repo.getRecord "$_username" "$_nsid_lock" "$key")" 179 183 if [[ $? == 0 ]] && [[ -n "$locked_record" ]]; then 180 - if [[ $(echo $locked_record | jq -r ".value.lock") == true ]]; then 184 + if [[ $(echo "$locked_record" | jq -r ".value.lock") == true ]]; then 181 185 locked="$(atfile.util.get_yn 1)" 182 186 else 183 187 locked="$(atfile.util.get_yn 0)" ··· 191 195 fi 192 196 193 197 if [[ $_output_json == 1 ]]; then 194 - browser_accessible=$(atfile.util.get_yn $(atfile.util.is_url_accessible_in_browser "$blob_uri")) 198 + browser_accessible=$(atfile.util.get_yn "$(atfile.util.is_url_accessible_in_browser "$blob_uri")") 195 199 196 200 echo "{ \"encrypted\": $encrypted, \"locked\": $locked, \"upload\": $(echo "$record" | jq -r ".value"), \"url\": { \"blob\": \"$blob_uri\", \"browser_accessible\": $browser_accessible, \"cdn\": { \"bsky\": \"$cdn_uri\" } } }" | jq 197 201 else ··· 203 207 file_name="$(echo "$record" | jq -r '.value.file.name')" 204 208 file_name_pretty="$(atfile.util.get_file_name_pretty "$(echo "$record" | jq -r '.value')")" 205 209 file_size="$(echo "$record" | jq -r '.value.file.size')" 206 - file_size_pretty="$(atfile.util.get_file_size_pretty $file_size)" 210 + file_size_pretty="$(atfile.util.get_file_size_pretty "$file_size")" 207 211 208 212 unset finger_type 209 213 header="$file_name_pretty" ··· 212 216 file_hash_pretty="(None)" 213 217 fi 214 218 215 - if [[ "$(echo $record | jq -r ".value.finger")" != "null" ]]; then 216 - finger_type="$(echo $record | jq -r ".value.finger.\"\$type\"" | cut -d "#" -f 2)" 219 + if [[ "$(echo "$record" | jq -r ".value.finger")" != "null" ]]; then 220 + finger_type="$(echo "$record" | jq -r ".value.finger.\"\$type\"" | cut -d "#" -f 2)" 217 221 fi 218 222 219 223 echo "$header" ··· 240 244 echo -e "โ†ณ Source: $finger_browser_uas" 241 245 ;; 242 246 "machine") 243 - finger_machine_app="$(echo $record | jq -r ".value.finger.app")" 244 - finger_machine_host="$(echo $record | jq -r ".value.finger.host")" 245 - finger_machine_os="$(echo $record | jq -r ".value.finger.os")" 247 + finger_machine_app="$(echo "$record" | jq -r ".value.finger.app")" 248 + finger_machine_host="$(echo "$record" | jq -r ".value.finger.host")" 249 + finger_machine_os="$(echo "$record" | jq -r ".value.finger.os")" 246 250 247 251 [[ -z $finger_machine_app || $finger_machine_app == "null" ]] && finger_machine_app="(Unknown)" 248 252 ··· 270 274 error="$(atfile.util.get_xrpc_error $? "$record")" 271 275 272 276 if [[ -z "$error" ]]; then 273 - blob_url="$(atfile.util.build_blob_uri "$(echo $record | jq -r ".uri" | cut -d "/" -f 3)" "$(echo $record | jq -r ".value.blob.ref.\"\$link\"")")" 277 + blob_url="$(atfile.util.build_blob_uri "$(echo "$record" | jq -r ".uri" | cut -d "/" -f 3)" "$(echo "$record" | jq -r ".value.blob.ref.\"\$link\"")")" 274 278 275 279 if [[ $_output_json == 1 ]]; then 276 280 echo -e "{\"url\": \"$blob_url\" }" | jq ··· 295 299 "com.github.neithern.g4music" 296 300 ) 297 301 298 - if [[ ${handlers[@]} =~ $handler ]]; then 302 + if [[ ${handlers[*]} =~ $handler ]]; then 299 303 echo 1 300 304 elif [[ $type == "text/"* ]]; then 301 305 echo 1 ··· 306 310 307 311 [[ $_output_json == 1 ]] && atfile.die "Command not available as JSON" 308 312 309 - actor="$(echo $uri | cut -d "/" -f 3)" 310 - key="$(echo $uri | cut -d "/" -f 4)" 313 + actor="$(echo "$uri" | cut -d "/" -f 3)" 314 + key="$(echo "$uri" | cut -d "/" -f 4)" 311 315 312 316 if [[ -n "$actor" && -n "$key" ]]; then 313 317 atfile.util.override_actor "$actor" ··· 317 321 error="$(atfile.util.get_xrpc_error $? "$record")" 318 322 [[ -n "$error" ]] && atfile.die.gui.xrpc_error "Unable to get '$key'" "$error" 319 323 320 - blob_cid="$(echo $record | jq -r ".value.blob.ref.\"\$link\"")" 324 + blob_cid="$(echo "$record" | jq -r ".value.blob.ref.\"\$link\"")" 321 325 blob_uri="$(atfile.util.build_blob_uri "$_username" "$blob_cid")" 322 - file_type="$(echo $record | jq -r '.value.file.mimeType')" 326 + file_type="$(echo "$record" | jq -r '.value.file.mimeType')" 323 327 324 328 if [[ $_os == "linux"* ]] && \ 325 329 [ -x "$(command -v xdg-mime)" ] && \ ··· 330 334 331 335 if [[ -z $handler ]]; then 332 336 atfile.say.debug "Querying for handler '$file_type'..." 333 - handler="$(xdg-mime query default $file_type)" 337 + handler="$(xdg-mime query default "$file_type")" 334 338 else 335 339 handler="$handler.desktop" 336 340 atfile.say.debug "Handler manually set to '$handler'" ··· 344 348 atfile.say.debug "Unsupported for streaming" 345 349 346 350 download_success=1 351 + # shellcheck disable=SC2154 347 352 tmp_path="$_path_blobs_tmp/$blob_cid" 348 353 349 354 if ! [[ -f "$tmp_path" ]]; then ··· 393 398 [[ -z "$app_uri" ]] && atfile.die.gui \ 394 399 "Unable to resolve AT URI to App" 395 400 396 - app_proto="$(echo $app_uri | cut -d ":" -f 1)" 401 + app_proto="$(echo "$app_uri" | cut -d ":" -f 1)" 397 402 398 403 atfile.say.debug "Opening '$app_uri' ($app_proto)..." 399 404 ··· 413 418 error="$(atfile.util.get_xrpc_error $? "$records")" 414 419 415 420 if [[ -z "$error" ]]; then 416 - records="$(echo $records | jq -c '.records[]')" 421 + records="$(echo "$records" | jq -c '.records[]')" 417 422 if [[ -z "$records" ]]; then 418 423 if [[ -n "$cursor" ]]; then 419 424 atfile.die "No more files for '$_username'" ··· 512 517 function atfile.invoke.manage_record.get_collection() { 513 518 collection="$_nsid_upload" 514 519 parameter_output="$1" 515 - [[ -n "$1" ]] && collection="$1" # fuck it, manage all the records from atfile! 520 + 521 + [[ -n "$parameter_output" ]] && collection="$1" # fuck it, manage all the records from atfile! 516 522 echo "$collection" 517 523 } 518 524 ··· 534 540 535 541 if [[ "$key" == at:* ]]; then 536 542 at_uri="$key" 537 - collection="$(echo $at_uri | cut -d "/" -f 4)" 538 - key="$(echo $at_uri | cut -d "/" -f 5)" 539 - username="$(echo $at_uri | cut -d "/" -f 3)" 543 + collection="$(echo "$at_uri" | cut -d "/" -f 4)" 544 + key="$(echo "$at_uri" | cut -d "/" -f 5)" 545 + username="$(echo "$at_uri" | cut -d "/" -f 3)" 540 546 541 547 [[ "$username" != "$_username" ]] && atfile.die "Unable to delete record โ€” not owned by you ($_username)" 542 548 fi ··· 551 557 552 558 if [[ "$key" == at:* ]]; then 553 559 at_uri="$key" 554 - collection="$(echo $at_uri | cut -d "/" -f 4)" 555 - key="$(echo $at_uri | cut -d "/" -f 5)" 556 - username="$(echo $at_uri | cut -d "/" -f 3)" 560 + collection="$(echo "$at_uri" | cut -d "/" -f 4)" 561 + key="$(echo "$at_uri" | cut -d "/" -f 5)" 562 + username="$(echo "$at_uri" | cut -d "/" -f 3)" 557 563 fi 558 564 559 565 if [[ -z "$username" ]]; then 560 566 username="$_username" 561 567 else 568 + # shellcheck disable=SC2053 562 569 if [[ $username != $_username ]]; then 563 570 atfile.util.override_actor "$username" 564 571 fi ··· 567 574 com.atproto.repo.getRecord "$username" "$collection" "$key" | jq 568 575 atfile.util.override_actor_reset 569 576 ;; 570 - "put") # BUG: Collection is always blue.zio.atfile.upload when not using at:// 577 + # BUG: Collection is always blue.zio.atfile.upload when not using at:// 578 + "put") 571 579 collection="$(atfile.invoke.manage_record.get_collection "$4")" 572 580 key="$2" 573 581 record="$3" ··· 579 587 580 588 if [[ "$key" == at:* ]]; then 581 589 at_uri="$key" 582 - collection="$(echo $at_uri | cut -d "/" -f 4)" 583 - key="$(echo $at_uri | cut -d "/" -f 5)" 584 - username="$(echo $at_uri | cut -d "/" -f 3)" 590 + collection="$(echo "$at_uri" | cut -d "/" -f 4)" 591 + key="$(echo "$at_uri" | cut -d "/" -f 5)" 592 + username="$(echo "$at_uri" | cut -d "/" -f 3)" 585 593 586 594 [[ "$username" != "$_username" ]] && atfile.die "Unable to put record โ€” not owned by you ($_username)" 587 595 fi ··· 600 608 error="$(atfile.util.get_xrpc_error $? "$record")" 601 609 602 610 if [[ -z "$error" ]]; then 603 - blob_uri="$(atfile.util.build_blob_uri "$(echo $record | jq -r ".uri" | cut -d "/" -f 3)" "$(echo $record | jq -r ".value.blob.ref.\"\$link\"")")" 611 + blob_uri="$(atfile.util.build_blob_uri "$(echo "$record" | jq -r ".uri" | cut -d "/" -f 3)" "$(echo "$record" | jq -r ".value.blob.ref.\"\$link\"")")" 604 612 file_type="$(echo "$record" | jq -r '.value.file.mimeType')" 605 613 606 614 curl -H "$(atfile.util.get_uas)" -s -L "$blob_uri" --output - ··· 670 678 fi 671 679 672 680 if [[ $_output_json == 0 ]]; then 673 - if [[ "$_server" == *".host.bsky.network" ]]; then 681 + # shellcheck disable=SC2154 682 + if [[ $_server == *".host.bsky.network" ]]; then 674 683 atfile.util.print_copyright_warning 675 684 fi 676 685 fi ··· 679 688 file_crypt="$(dirname "$file")/$(basename "$file").gpg" 680 689 681 690 [[ $_output_json == 0 ]] && echo -e "Encrypting '$file_crypt'..." 682 - gpg --yes --quiet --recipient $recipient --output "$file_crypt" --encrypt "$file" 691 + gpg --yes --quiet --recipient "$recipient" --output "$file_crypt" --encrypt "$file" 683 692 684 693 if [[ $? == 0 ]]; then 685 694 file="$file_crypt" ··· 715 724 esac 716 725 717 726 file_hash="$(atfile.util.get_md5 "$file")" 718 - file_hash_checksum="$(echo $file_hash | cut -d "|" -f 1)" 719 - file_hash_type="$(echo $file_hash | cut -d "|" -f 2)" 727 + file_hash_checksum="$(echo "$file_hash" | cut -d "|" -f 1)" 728 + file_hash_type="$(echo "$file_hash" | cut -d "|" -f 2)" 720 729 file_name="$(basename "$file")" 721 730 722 731 if [[ -n $recipient ]]; then ··· 744 753 file_size_surplus="$(atfile.util.get_file_size_surplus_for_pds "$file_size" "$_server")" 745 754 746 755 if [[ $file_size_surplus != 0 ]]; then 747 - die_message="File '$file_name' is too large ($(atfile.util.get_file_size_pretty $file_size_surplus) over)" 756 + die_message="File '$file_name' is too large ($(atfile.util.get_file_size_pretty "$file_size_surplus") over)" 748 757 atfile.die "$die_message" 749 758 fi 750 759
+6 -5
src/commands/release.sh
··· 1 1 #!/usr/bin/env bash 2 2 3 3 function atfile.release() { 4 + # shellcheck disable=SC2154 4 5 [[ $_os != "linux" ]] && atfile.die "Only available on Linux (GNU)\nโ†ณ Detected OS: $_os" 5 6 6 7 function atfile.release.replace_template_var() { ··· 70 71 if [[ $include_line == 1 ]]; then 71 72 if [[ $line == *"{:"* && $line == *":}"* ]]; then 72 73 # NOTE: Not using atfile.util.get_envvar() here, as confusion can arise from config file 73 - line="$(atfile.release.replace_template_var "$line" "meta_author" $ATFILE_FORCE_META_AUTHOR)" 74 - line="$(atfile.release.replace_template_var "$line" "meta_did" $ATFILE_FORCE_META_DID)" 75 - line="$(atfile.release.replace_template_var "$line" "meta_repo" $ATFILE_FORCE_META_REPO)" 76 - line="$(atfile.release.replace_template_var "$line" "meta_year" $ATFILE_FORCE_META_YEAR)" 77 - line="$(atfile.release.replace_template_var "$line" "version" $ATFILE_FORCE_VERSION)" 74 + line="$(atfile.release.replace_template_var "$line" "meta_author" "$ATFILE_FORCE_META_AUTHOR")" 75 + line="$(atfile.release.replace_template_var "$line" "meta_did" "$ATFILE_FORCE_META_DID")" 76 + line="$(atfile.release.replace_template_var "$line" "meta_repo" "$ATFILE_FORCE_META_REPO")" 77 + line="$(atfile.release.replace_template_var "$line" "meta_year" "$ATFILE_FORCE_META_YEAR")" 78 + line="$(atfile.release.replace_template_var "$line" "version" "$ATFILE_FORCE_VERSION")" 78 79 fi 79 80 80 81 echo "$line" >> "$dist_path"
+8 -12
src/commands/resolve.sh
··· 11 11 error="$(atfile.util.get_xrpc_error $? "$resolved_did")" 12 12 [[ -n "$error" ]] && atfile.die.xrpc_error "Unable to resolve '$actor'" "$resolved_did" 13 13 14 - aliases="$(echo $resolved_did | cut -d "|" -f 5)" 15 - did="$(echo $resolved_did | cut -d "|" -f 1)" 16 - did_doc="$(echo $resolved_did | cut -d "|" -f 4)/$did" 17 - did_type="did:$(echo $did | cut -d ":" -f 2)" 18 - handle="$(echo $resolved_did | cut -d "|" -f 3 | cut -d "/" -f 3)" 19 - pds="$(echo $resolved_did | cut -d "|" -f 2)" 14 + aliases="$(echo "$resolved_did" | cut -d "|" -f 5)" 15 + did="$(echo "$resolved_did" | cut -d "|" -f 1)" 16 + did_doc="$(echo "$resolved_did" | cut -d "|" -f 4)/$did" 17 + did_type="did:$(echo "$did" | cut -d ":" -f 2)" 18 + handle="$(echo "$resolved_did" | cut -d "|" -f 3 | cut -d "/" -f 3)" 19 + pds="$(echo "$resolved_did" | cut -d "|" -f 2)" 20 20 pds_name="$(atfile.util.get_pds_pretty "$pds")" 21 21 pds_software="Bluesky PDS" 22 22 atfile.say.debug "Getting PDS version for '$pds'..." ··· 32 32 fi 33 33 34 34 case "$did_type" in 35 - "did:plc") 36 - # SEE: https://bsky.app/profile/did:web:bhh.sh/post/3lc2jkmhxq225 37 - # pls stop breaking my shit, @benharri.org 38 - [[ $actor == "did:web:"* ]] && did_doc="$(atfile.util.get_didweb_doc_url "$actor")" 39 - ;; 40 35 "did:web") 41 36 did_doc="$(atfile.util.get_didweb_doc_url "$did")" 42 37 ;; 43 38 esac 44 39 40 + # shellcheck disable=SC2154 45 41 if [[ $_output_json == 1 ]]; then 46 42 did_doc_data="$(curl -H "User-Agent: $(atfile.util.get_uas)" -s -l -X GET "$did_doc")" 47 43 aliases_json="$(echo "$did_doc_data" | jq -r ".alsoKnownAs")" 48 44 49 45 echo -e "{ 50 - \"aka\": "$aliases_json", 46 + \"aka\": $aliases_json, 51 47 \"did\": \"$did\", 52 48 \"doc\": { 53 49 \"data\": $did_doc_data,
+24 -21
src/commands/something_broke.sh
··· 4 4 prog_not_installed_placeholder="(Not Installed)" 5 5 6 6 function atfile.something_broke.print_envvar() { 7 + # shellcheck disable=SC2154 7 8 variable_name="${_envvar_prefix}_$1" 8 9 variable_default="$2" 9 10 ··· 21 22 22 23 [[ -z "$version_arg" ]] && version_arg="--version" 23 24 24 - if [ -x "$(command -v $prog)" ]; then 25 + if [ -x "$(command -v "$prog")" ]; then 25 26 eval "$prog $version_arg 2>&1" 26 27 else 27 28 echo "$prog_not_installed_placeholder" 28 29 fi 29 30 } 30 31 32 + # shellcheck disable=SC2154 31 33 if [[ $_output_json == 1 ]]; then 32 34 atfile.die "Command not available as JSON" 33 35 fi ··· 36 38 finger_record="$(atfile.util.get_finger_record 1)" 37 39 mediainfo_version="$(atfile.something_broke.print_prog_version "mediainfo")" 38 40 41 + # shellcheck disable=SC2154 39 42 if [[ $_os == "linux-musl" ]]; then 40 43 md5sum_version="$(atfile.something_broke.print_prog_version "md5sum" "--help")" 41 44 else ··· 66 69 $(atfile.something_broke.print_envvar "DEVEL") 67 70 $(atfile.something_broke.print_envvar "DEVEL_DIR") 68 71 $(atfile.something_broke.print_envvar "DEVEL_ENTRY") 69 - $(atfile.something_broke.print_envvar "DEVEL_PUBLISH" $_devel_publish_default) 72 + $(atfile.something_broke.print_envvar "DEVEL_PUBLISH" "$_devel_publish_default") 70 73 โ†ณ ${_envvar_prefix}_DEVEL_SOURCES: 71 74 $(for s in "${ATFILE_DEVEL_SOURCES[@]}"; do echo " โ†ณ $s"; done) 72 - $(atfile.something_broke.print_envvar "DISABLE_UPDATE_CHECKING" $_disable_update_checking_default) 73 - $(atfile.something_broke.print_envvar "DISABLE_UPDATER" $_disable_updater_default) 75 + $(atfile.something_broke.print_envvar "DISABLE_UPDATE_CHECKING" "$_disable_update_checking_default") 76 + $(atfile.something_broke.print_envvar "DISABLE_UPDATER" "$_disable_updater_default") 74 77 โ†ณ ${_envvar_prefix}_DIST_PASSWORD: $([[ -n $(atfile.util.get_envvar "${_envvar_prefix}_DIST_PASSWORD") ]] && echo "(Set)") 75 - $(atfile.something_broke.print_envvar "DIST_USERNAME" $_dist_username_default) 76 - $(atfile.something_broke.print_envvar "ENABLE_FINGERPRINT" $_enable_fingerprint_default) 77 - $(atfile.something_broke.print_envvar "ENABLE_UPDATE_GIT_CLOBBER" $_enable_update_git_clobber) 78 - $(atfile.something_broke.print_envvar "ENDPOINT_APPVIEW_BSKY" $_endpoint_appview_bsky_default) 79 - $(atfile.something_broke.print_envvar "ENDPOINT_APPVIEW_BSKY_VIDEO" $_endpoint_appview_bsky_video_default) 80 - $(atfile.something_broke.print_envvar "ENDPOINT_JETSTREAM" $_endpoint_jetstream_default) 78 + $(atfile.something_broke.print_envvar "DIST_USERNAME" "$_dist_username_default") 79 + $(atfile.something_broke.print_envvar "ENABLE_FINGERPRINT" "$_enable_fingerprint_default") 80 + $(atfile.something_broke.print_envvar "ENABLE_UPDATE_GIT_CLOBBER" "$_enable_update_git_clobber") 81 + $(atfile.something_broke.print_envvar "ENDPOINT_APPVIEW_BSKY" "$_endpoint_appview_bsky_default") 82 + $(atfile.something_broke.print_envvar "ENDPOINT_APPVIEW_BSKY_VIDEO" "$_endpoint_appview_bsky_video_default") 83 + $(atfile.something_broke.print_envvar "ENDPOINT_JETSTREAM" "$_endpoint_jetstream_default") 81 84 $(atfile.something_broke.print_envvar "ENDPOINT_PDS") 82 - $(atfile.something_broke.print_envvar "ENDPOINT_PLC_DIRECTORY" $_endpoint_plc_directory_default) 83 - $(atfile.something_broke.print_envvar "ENDPOINT_RESOLVE_HANDLE" $_endpoint_resolve_handle_default) 85 + $(atfile.something_broke.print_envvar "ENDPOINT_PLC_DIRECTORY" "$_endpoint_plc_directory_default") 86 + $(atfile.something_broke.print_envvar "ENDPOINT_RESOLVE_HANDLE" "$_endpoint_resolve_handle_default") 84 87 $(atfile.something_broke.print_envvar "FMT_BLOB_URL" "$_fmt_blob_url_default") 85 88 $(atfile.something_broke.print_envvar "FMT_OUT_FILE" "$_fmt_out_file_default") 86 89 $(atfile.something_broke.print_envvar "FORCE_META_AUTHOR") ··· 90 93 $(atfile.something_broke.print_envvar "FORCE_NOW") 91 94 $(atfile.something_broke.print_envvar "FORCE_OS") 92 95 $(atfile.something_broke.print_envvar "FORCE_VERSION") 93 - $(atfile.something_broke.print_envvar "INCLUDE_FINGERPRINT" $_enable_fingerprint_default) 94 - $(atfile.something_broke.print_envvar "MAX_LIST" $_max_list_default) 95 - $(atfile.something_broke.print_envvar "OUTPUT_JSON" $_output_json_default) 96 + $(atfile.something_broke.print_envvar "INCLUDE_FINGERPRINT" "$_enable_fingerprint_default") 97 + $(atfile.something_broke.print_envvar "MAX_LIST" "$_max_list_default") 98 + $(atfile.something_broke.print_envvar "OUTPUT_JSON" "$_output_json_default") 96 99 $(atfile.something_broke.print_envvar "PATH_CONF" "$_path_envvar") 97 - $(atfile.something_broke.print_envvar "SKIP_AUTH_CHECK" $_skip_auth_check_default) 98 - $(atfile.something_broke.print_envvar "SKIP_COPYRIGHT_WARN" $_skip_copyright_warn_default) 99 - $(atfile.something_broke.print_envvar "SKIP_NI_EXIFTOOL" $_skip_ni_exiftool_default) 100 - $(atfile.something_broke.print_envvar "SKIP_NI_MD5SUM" $_skip_ni_md5sum_default) 101 - $(atfile.something_broke.print_envvar "SKIP_NI_MEDIAINFO" $_skip_ni_mediainfo_default) 102 - $(atfile.something_broke.print_envvar "SKIP_UNSUPPORTED_OS_WARN" $_skip_unsupported_os_warn) 100 + $(atfile.something_broke.print_envvar "SKIP_AUTH_CHECK" "$_skip_auth_check_default") 101 + $(atfile.something_broke.print_envvar "SKIP_COPYRIGHT_WARN" "$_skip_copyright_warn_default") 102 + $(atfile.something_broke.print_envvar "SKIP_NI_EXIFTOOL" "$_skip_ni_exiftool_default") 103 + $(atfile.something_broke.print_envvar "SKIP_NI_MD5SUM" "$_skip_ni_md5sum_default") 104 + $(atfile.something_broke.print_envvar "SKIP_NI_MEDIAINFO" "$_skip_ni_mediainfo_default") 105 + $(atfile.something_broke.print_envvar "SKIP_UNSUPPORTED_OS_WARN" "$_skip_unsupported_os_warn") 103 106 โ†ณ ${_envvar_prefix}_PASSWORD: $([[ -n $(atfile.util.get_envvar "${_envvar_prefix}_PASSWORD") ]] && echo "(Set)") 104 107 $(atfile.something_broke.print_envvar "USERNAME") 105 108 Paths
+1
src/commands/stream.sh
··· 10 10 11 11 [[ "$compress" == 1 ]] && compress="true" 12 12 13 + # shellcheck disable=SC2154 13 14 atfile.say.debug "Streaming: $_endpoint_jetstream\nโ†ณ Collection: $(echo "$collection" | sed -s 's/;/, /g')\nโ†ณ DID: $(echo "$did" | sed -s 's/;/, /g')\nโ†ณ Cursor: $cursor\nโ†ณ Cursor: $compress" 14 15 15 16 collection_query="$(atfile.util.build_query_array "wantedCollections" "$collection")"
+9 -3
src/commands/update.sh
··· 6 6 unset error 7 7 8 8 if [[ "$cmd" == "check-only" ]]; then 9 + # shellcheck disable=SC2154 9 10 [[ $_disable_update_checking == 1 ]] && return 11 + # shellcheck disable=SC2154 10 12 [[ $_disable_updater == 1 ]] && return 13 + # shellcheck disable=SC2154 11 14 [[ $_is_git == 1 && $_enable_update_git_clobber == 0 ]] && return 15 + # shellcheck disable=SC2154 12 16 [[ $_output_json == 1 ]] && return 13 17 14 18 last_checked="$(atfile.cache.get "update-check")" 15 19 current_checked="$(atfile.util.get_date "" "%s")" 16 20 check_sleep=3600 17 - next_check=$(( $last_checked + $check_sleep )) 21 + next_check=$(( last_checked + check_sleep )) 18 22 19 23 atfile.say.debug "Checking for last update check...\nโ†ณ Last: $last_checked\nโ†ณ Cur.: $current_checked\nโ†ณ Next: $next_check" 20 24 21 - if [[ $(( $next_check < $current_checked )) == 0 ]]; then 25 + if [[ $(( next_check < current_checked )) == 0 ]]; then 22 26 return 23 27 else 24 28 last_checked="$(atfile.cache.set "update-check" "$current_checked")" ··· 27 31 28 32 [[ $_output_json == 1 ]] && atfile.die "Command not available as JSON" 29 33 34 + # shellcheck disable=SC2154 30 35 update_did="$_dist_username" 31 36 32 37 atfile.util.override_actor "$update_did" ··· 47 52 48 53 atfile.say.debug "Checking version...\nโ†ณ Latest: $latest_version ($parsed_latest_version)\n โ†ณ Date: $latest_version_date\n โ†ณ Commit: $latest_version_commit\nโ†ณ Running: $_version ($parsed_running_version)" 49 54 50 - if [[ $(( $parsed_latest_version > $parsed_running_version )) == 1 ]]; then 55 + if [[ $(( parsed_latest_version > parsed_running_version )) == 1 ]]; then 51 56 update_available=1 52 57 fi 53 58 ··· 76 81 [[ $_disable_updater == 1 ]] &&\ 77 82 atfile.die "Cannot update system-managed version: update from your package manager" # NOTE: This relies on packaged versions having a wrapper that sets this var 78 83 84 + # shellcheck disable=SC2154 79 85 temp_updated_path="$_prog_dir/${_prog}-${latest_version}.tmp" 80 86 81 87 atfile.say.debug "Touching temporary path ($temp_updated_path)..."
+12 -14
src/entry.sh
··· 8 8 9 9 _start="$(atfile.util.get_date "" "%s")" 10 10 _command="$1" 11 - _command_full="$@" 11 + _command_full="$*" 12 12 _envvar_prefix="ATFILE" 13 13 _os="$(atfile.util.get_os)" 14 14 _is_git=0 ··· 83 83 _fmt_out_file_default="[key]__[name]" 84 84 _enable_fingerprint_default=0 85 85 _max_list_buffer=6 86 - _max_list_default=$(( $(atfile.util.get_term_rows) - $_max_list_buffer )) 86 + _max_list_default=$(( $(atfile.util.get_term_rows) - _max_list_buffer )) 87 87 _output_json_default=0 88 88 _skip_auth_check_default=0 89 89 _skip_copyright_warn_default=0 ··· 99 99 100 100 #### Set 101 101 102 - _debug="$(atfile.util.get_envvar "${_envvar_prefix}_DEBUG" $_debug_default)" 102 + _debug="$(atfile.util.get_envvar "${_envvar_prefix}_DEBUG" "$_debug_default")" 103 103 _devel_publish="$(atfile.util.get_envvar "${_envvar_prefix}_DEVEL_PUBLISH" $_devel_publish_default)" 104 104 _disable_update_checking="$(atfile.util.get_envvar "${_envvar_prefix}_DISABLE_UPDATE_CHECKING" $_disable_update_checking_default)" 105 105 _disable_updater="$(atfile.util.get_envvar "${_envvar_prefix}_DISABLE_UPDATER" $_disable_updater_default)" 106 - _dist_password="$(atfile.util.get_envvar "${_envvar_prefix}_DIST_PASSWORD" $_dist_password_default)" 106 + _dist_password="$(atfile.util.get_envvar "${_envvar_prefix}_DIST_PASSWORD")" 107 107 _dist_username="$(atfile.util.get_envvar "${_envvar_prefix}_DIST_USERNAME" $_dist_username_default)" 108 108 _enable_fingerprint="$(atfile.util.get_envvar "${_envvar_prefix}_ENABLE_FINGERPRINT" "$_enable_fingerprint_default")" 109 109 _enable_update_git_clobber="$(atfile.util.get_envvar "${_envvar_prefix}_ENABLE_UPDATE_GIT_CLOBBER" "$_enable_update_git_clobber_default")" ··· 143 143 144 144 ## Source detection 145 145 146 - if [[ "$0" != "$BASH_SOURCE" ]] && [[ "$ATFILE_DEVEL" != 1 ]]; then 146 + if [[ "$0" != "${BASH_SOURCE[0]}" ]] && [[ "$ATFILE_DEVEL" != 1 ]]; then 147 147 _debug=0 148 148 _is_sourced=1 149 149 _output_json=1 ··· 162 162 atfile.say.debug "Overriding Copyright Author (\$_meta_author)\nโ†ณ ${_envvar_prefix}_FORCE_META_AUTHOR set to '$_force_meta_author'" 163 163 [[ -n $_force_meta_did ]] && \ 164 164 _meta_did="$_force_meta_did" &&\ 165 - _dist_username="$(atfile.util.get_envvar "${_envvar_prefix}_DIST_USERNAME" $_meta_did)" &&\ 165 + _dist_username="$(atfile.util.get_envvar "${_envvar_prefix}_DIST_USERNAME" "$_meta_did")" &&\ 166 166 atfile.say.debug "Overriding DID (\$_meta_did)\nโ†ณ ${_envvar_prefix}_FORCE_META_DID set to '$_force_meta_did'" 167 167 [[ -n $_force_meta_repo ]] && \ 168 168 _meta_repo="$_force_meta_repo" &&\ ··· 182 182 183 183 ### Legacy 184 184 185 - [[ $_enable_fingerprint == $_enable_fingerprint_default ]] &&\ 185 + [[ $_enable_fingerprint == "$_enable_fingerprint_default" ]] &&\ 186 186 _include_fingerprint_depr="$(atfile.util.get_envvar "${_envvar_prefix}_INCLUDE_FINGERPRINT" "$_enable_fingerprint_default")" &&\ 187 187 atfile.say.debug "Setting ${_envvar_prefix}_ENABLE_FINGERPRINT to $_include_fingerprint_depr\nโ†ณ ${_envvar_prefix}_INCLUDE_FINGERPRINT (deprecated) set to 1" &&\ 188 188 _enable_fingerprint=$_include_fingerprint_depr 189 189 190 190 ### Validation 191 191 192 - [[ $_output_json == 1 ]] && [[ $_max_list == $_max_list_default ]] &&\ 192 + [[ $_output_json == 1 ]] && [[ $_max_list == "$_max_list_default" ]] &&\ 193 193 atfile.say.debug "Setting ${_envvar_prefix}_MAX_LIST to $_max_list_fallback\nโ†ณ ${_envvar_prefix}_OUTPUT_JSON set to 1" &&\ 194 194 _max_list=$_max_list_fallback 195 - [[ $(( $_max_list > $_max_list_fallback )) == 1 ]] &&\ 195 + [[ $(( _max_list > _max_list_fallback )) == 1 ]] &&\ 196 196 atfile.say.debug "Setting ${_envvar_prefix}_MAX_LIST to $_max_list_fallback\nโ†ณ Maximum is $_max_list_fallback" &&\ 197 197 _max_list=$_max_list_fallback 198 198 ··· 246 246 [[ $_skip_ni_md5sum == 0 ]] && atfile.util.check_prog "md5sum" "" "${_envvar_prefix}_SKIP_NI_MD5SUM" 247 247 248 248 ## Lifecycle commands 249 - 250 - is_lifecycle_command=0 251 249 252 250 if [[ $_is_sourced == 0 ]] && [[ $_command == "" || $_command == "help" || $_command == "h" || $_command == "--help" || $_command == "-h" ]]; then 253 251 atfile.help ··· 308 306 ## Commands 309 307 310 308 if [[ $_is_sourced == 0 ]] && [[ $ATFILE_DEVEL_NO_INVOKE != 1 ]]; then 311 - atfile.say.debug "Running '$_command_full'...\nโ†ณ Command: $_command\nโ†ณ Arguments: ${@:2}" 309 + atfile.say.debug "Running '$_command_full'...\nโ†ณ Command: $_command\nโ†ณ Arguments: ${*:2}" 312 310 313 311 case "$_command" in 314 312 "ai") ··· 363 361 ;; 364 362 "handle") 365 363 uri="$2" 366 - protocol="$(atfile.util.get_uri_segment $uri protocol)" 364 + protocol="$(atfile.util.get_uri_segment "$uri" protocol)" 367 365 368 366 if [[ $protocol == "https" ]]; then 369 367 http_uri="$uri" ··· 374 372 if [[ -z "$uri" ]]; then 375 373 atfile.die "Unable to map '$http_uri' to at:// URI" 376 374 else 377 - protocol="$(atfile.util.get_uri_segment $uri protocol)" 375 + protocol="$(atfile.util.get_uri_segment "$uri" protocol)" 378 376 fi 379 377 fi 380 378
+4 -1
src/lexi/app_bsky_video.sh
··· 17 17 function app.bsky.video.uploadVideo() { 18 18 file="$1" 19 19 20 + # shellcheck disable=SC2154 20 21 aud="did:web:$(atfile.util.get_uri_segment "$_server" host)" 22 + # shellcheck disable=SC2154 21 23 did="$_username" 22 24 name="$(basename "$file")" 23 25 type="video/mp4" 24 26 25 - curl -s -X POST $_endpoint_appview_bsky_video/xrpc/app.bsky.video.uploadVideo?did=$did\&name=$name \ 27 + # shellcheck disable=SC2154 28 + curl -s -X POST "$_endpoint_appview_bsky_video/xrpc/app.bsky.video.uploadVideo?did=$did\&name=$name" \ 26 29 -H "Authorization: Bearer $(atfile.xrpc.bsky_video.jwt "com.atproto.repo.uploadBlob" "$aud")" \ 27 30 -H "Content-Type: $type" \ 28 31 -H "User-Agent: $(atfile.util.get_uas)" \
+1 -1
src/lexi/blue_zio_atfile.sh
··· 132 132 \"gps\": { 133 133 \"alt\": $gps_alt, 134 134 \"lat\": $gps_lat, 135 - \"long\": "$gps_long" 135 + \"long\": $gps_long 136 136 }, 137 137 \"orientation\": \"$orientation\", 138 138 \"software\": \"$software\",
+1
src/shared/cache.sh
··· 14 14 key="$(atfile.util.get_cache_path $1)" 15 15 value="$2" 16 16 17 + # shellcheck disable=SC2154 17 18 mkdir -p "$_path_cache" 18 19 echo "$value" > "$key" 19 20 echo "$value"
+8 -7
src/shared/util.sh
··· 387 387 size="$1" 388 388 suffix="" 389 389 390 - if (( $size >= 1048576 )); then 391 - size=$(( $size / 1048576 )) 390 + if (( size >= 1048576 )); then 391 + size=$(( size / 1048576 )) 392 392 suffix="MiB" 393 - elif (( $size >= 1024 )); then 394 - size=$(( $size / 1024 )) 393 + elif (( size >= 1024 )); then 394 + size=$(( size / 1024 )) 395 395 suffix="KiB" 396 396 else 397 397 suffix="B" ··· 408 408 unset max_filesize 409 409 410 410 case $pds in 411 - *".host.bsky.network") max_filesize=52428800 ;; 411 + *".host.bsky.network") max_filesize=1073741824 ;; 412 412 esac 413 413 414 414 if [[ -z $max_filesize ]] || [[ $max_filesize == 0 ]] || (( $size < $max_filesize )); then 415 415 echo 0 416 416 else 417 - echo $(( $size - $max_filesize )) 417 + echo $(( size - max_filesize )) 418 418 fi 419 419 } 420 420 ··· 721 721 722 722 function atfile.util.get_seconds_since_start() { 723 723 current="$(atfile.util.get_date "" "%s")" 724 - echo "$(( $current - $_start ))" 724 + # shellcheck disable=SC2154 725 + echo "$(( current - _start ))" 725 726 } 726 727 727 728 function atfile.util.get_term_cols() {