📦➔🦋 Store and retrieve files on the Atmosphere
35
fork

Configure Feed

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

various

Ducky a0ddb502 0dccb5f1

+32 -11
+32 -11
atfile.sh
··· 180 180 curl -s -L -X GET "$endpoint/$actor" 181 181 } 182 182 183 - didplc_doc="$(atfile.util.get_didplc_doc.request_doc "$_endpoint_plc_directory" "$actor")" 183 + didplc_endpoint="$_endpoint_plc_directory" 184 + didplc_doc="$(atfile.util.get_didplc_doc.request_doc "$didplc_endpoint" "$actor")" 184 185 185 186 if [[ "$didplc_doc" != "{"* ]]; then 186 - didplc_doc="$(atfile.util.get_didplc_doc.request_doc "https://plc.directory" "$actor")" 187 + didplc_endpoint="https://plc.directory" 188 + didplc_doc="$(atfile.util.get_didplc_doc.request_doc "$didplc_endpoint" "$actor")" 187 189 fi 188 190 189 - echo "$didplc_doc" 191 + echo "$(echo $didplc_doc | jq ". += {\"directory\": \"$didplc_endpoint\"}")" 192 + } 193 + 194 + function atfile.util.get_didweb_doc_url() { 195 + actor="$1" 196 + echo "https://$(echo "$actor" | sed "s/did:web://")/.well-known/did.json" 190 197 } 191 198 192 199 function atfile.util.get_envvar() { ··· 771 778 772 779 case "$actor" in 773 780 "did:plc:"*) did_doc="$(atfile.util.get_didplc_doc "$actor")" ;; 774 - "did:web:"*) did_doc="$(curl -s -L -X GET "$(echo "$actor" | sed "s/did:web://")/.well-known/did.json")" ;; 781 + "did:web:"*) did_doc="$(curl -s -L -X GET "$(atfile.util.get_didweb_doc_url "$actor")")" ;; 775 782 esac 776 783 777 784 if [[ $? != 0 || -z "$did_doc" ]]; then 778 785 atfile.die "Unable to fetch DID Doc for '$actor'" 779 786 else 780 787 did="$(echo "$did_doc" | jq -r ".id")" 788 + didplc_dir="$(echo "$did_doc" | jq -r ".directory")" 781 789 pds="$(echo "$did_doc" | jq -r '.service[] | select(.id == "#atproto_pds") | .serviceEndpoint')" 782 790 handle="$(echo "$did_doc" | jq -r '.alsoKnownAs[0]')" 791 + 792 + [[ $didplc_dir == "null" ]] && unset didplc_dir 783 793 784 - echo "$did|$pds|$handle" 794 + echo "$did|$pds|$handle|$didplc_dir" 785 795 fi 786 796 else 787 797 atfile.die "Unable to resolve '$actor'" ··· 1865 1875 1866 1876 alias="$(echo $resolved_did | cut -d "|" -f 3)" 1867 1877 did="$(echo $resolved_did | cut -d "|" -f 1)" 1878 + did_doc="$(echo $resolved_did | cut -d "|" -f 4)/$did" 1868 1879 did_type="did:$(echo $did | cut -d ":" -f 2)" 1869 1880 handle="$(echo $resolved_did | cut -d "|" -f 3 | cut -d "/" -f 3)" 1870 1881 pds="$(echo $resolved_did | cut -d "|" -f 2)" ··· 1880 1891 app_pdsls="https://pdsls.dev/at/$did" 1881 1892 app_whitewind="https://whtwnd.com/$handle" 1882 1893 1883 - if [[ $did_type == "did:plc" ]]; then 1884 - app_internect="https://internect.info/did/$did" 1885 - fi 1894 + case "$did_type" in 1895 + "did:plc") 1896 + app_internect="https://internect.info/did/$did" 1897 + ;; 1898 + "did:web") 1899 + did_doc="$(atfile.util.get_didweb_doc_url "$actor")" 1900 + ;; 1901 + esac 1886 1902 1887 1903 atfile.say.debug "Resolving actor on Bridgy Fed..." 1888 1904 if [[ $(atfile.util.is_url_okay "$app_bridgyfed") == 0 ]]; then ··· 1894 1910 \"alias\": \"$alias\", 1895 1911 \"apps\": { 1896 1912 \"Bluesky\": \"$app_bluesky\", 1897 - \"BridgyFed\": \"$app_bridgyfed\", 1913 + \"BridgyFed\": $(if [[ -z $app_bridgyfed ]]; then echo "null"; else echo "\"$app_bridgyfed\""; fi), 1898 1914 \"Frontpage\": \"$app_frontpage\", 1899 1915 \"Internect\": $(if [[ -z $app_internect ]]; then echo "null"; else echo "\"$app_internect\""; fi), 1900 1916 \"PDSls\": \"$app_pdsls\", 1901 1917 \"Whitewind\": \"$app_whitewind\" 1902 1918 }, 1903 1919 \"did\": \"$did\", 1920 + \"doc\": \"$did_doc\", 1904 1921 \"pds\": { 1905 1922 \"endpoint\": \"$pds\", 1906 1923 \"name\": \"$pds_name\", ··· 1911 1928 else 1912 1929 echo "$did" 1913 1930 echo "↳ Type: $did_type" 1931 + echo " ↳ Doc: $did_doc" 1914 1932 echo "↳ Alias: $alias" 1915 1933 echo "↳ PDS: $pds_name" 1916 1934 echo " ↳ Endpoint: $pds" ··· 2274 2292 _enable_hidden_commands_default=0 2275 2293 _endpoint_jetstream_default="wss://jetstream.atproto.tools" 2276 2294 _endpoint_resolve_handle_default="https://zio.blue" # lol wtf is bsky.social 2277 - _endpoint_plc_directory_default="https://plc.directory" 2295 + _endpoint_plc_directory_default="https://plc.zio.blue" 2278 2296 _fmt_blob_url_default="[server]/xrpc/com.atproto.sync.getBlob?did=[did]&cid=[cid]" 2279 2297 _fmt_out_file_default="[key]__[name]" 2280 2298 _include_fingerprint_default=0 ··· 2446 2464 2447 2465 session="$(com.atproto.server.getSession)" 2448 2466 if [[ $(atfile.util.is_xrpc_success $? "$session") == 0 ]]; then 2449 - atfile.die "Unable to authenticate as \"$_username\" on \"$_server\"" 2467 + atfile.die "Unable to authenticate" 2450 2468 else 2451 2469 _username="$(echo $session | jq -r ".did")" 2452 2470 fi ··· 2598 2616 fi 2599 2617 2600 2618 atfile.invoke.get_url "$2" 2619 + ;; 2620 + "temp-diddoc") 2621 + atfile.util.resolve_identity "$2" 2601 2622 ;; 2602 2623 *) 2603 2624 atfile.die.unknown_command "$_command"