📦➔🦋 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 62e6911b 6c68764a

+93 -18
+1 -1
README.md
··· 26 26 * 🟡 **Linux**: GNU, MinGW and Termux only; musl² not supported 27 27 * 🟢 **macOS**: Compatible with built-in version of Bash (3.2) 28 28 * 🔴 **Windows**: No native version available 29 - * Run with MinGW (Cygwin, Git Bash, MSYS2, etc.) or WSL (See Linux caveats above) 29 + * Run with MinGW (Cygwin, Git Bash, MSYS2, etc.) or WSL (see Linux caveats above) 30 30 * 🟢 __*BSD__: FreeBSD, NetBSD, OpenBSD, and other *BSD's 31 31 * 🟢 **Haiku**: [Yes, really](https://bsky.app/profile/did:plc:kv7sv4lynbv5s6gdhn5r5vcw/post/3lboqznyqgs26) 32 32 * 🔴 **Solaris**: <span title="Don't we all?">Has issues</span>; low priority
+6 -4
atfile.sh
··· 59 59 unset ATFILE_DEVEL_ENTRY 60 60 unset ATFILE_DEVEL_SOURCE 61 61 62 - #if [ -p /dev/stdin ] ||\ 63 - # [[ "$0" == "bash" || $0 == *"/bin/bash" ]]; then 64 - # atfile.devel.die "Piping is not supported" 65 - #fi 62 + if [[ $ATFILE_DEVEL_ALLOW_PIPING != 1 ]]; then 63 + if [ -p /dev/stdin ] ||\ 64 + [[ "$0" == "bash" || $0 == *"/bin/bash" ]]; then 65 + atfile.devel.die "Piping is not supported\n ↳ Set ATFILE_DEVEL_ALLOW_PIPING=1 to ignore" 66 + fi 67 + fi 66 68 67 69 if [[ "${BASH_SOURCE[0]}" != "$0" ]]; then 68 70 ATFILE_DEVEL=1
+80 -4
src/commands/install.sh
··· 4 4 function atfile.install() { 5 5 override_path="$1" 6 6 override_version="$2" 7 + override_did="$3" 8 + 9 + # shellcheck disable=SC2154 10 + [[ $_output_json == 1 ]] && atfile.die "Command not available as JSON" 7 11 8 12 uid="$(id -u)" 13 + # shellcheck disable=SC2154 9 14 conf_dir="${_path_envvar%/*}" 10 15 install_file="atfile" 16 + unset found_version 11 17 unset install_dir 18 + unset source_did 12 19 13 20 atfile.util.check_prog "curl" 14 21 atfile.util.check_prog "jq" ··· 26 33 if [[ $uid == 0 ]]; then 27 34 install_dir="/usr/local/bin" 28 35 else 36 + # shellcheck disable=SC2154 29 37 install_dir="$_path_home/.local/bin" 30 38 fi 31 39 ;; 32 40 esac 33 41 42 + if [[ $# -gt 0 ]]; then 43 + atfile.say.debug "Overriden variables\n↳ Path: $override_path\n↳ Version: $override_version\n↳ DID: $override_did" 44 + fi 45 + 46 + atfile.say.debug "Setting up..." 47 + 34 48 [[ -n "$override_path" ]] && install_dir="$override_path" 35 49 mkdir -p "$conf_dir" 50 + # shellcheck disable=SC2154 36 51 touch "$conf_dir/$_file_envvar" 37 52 38 - atfile.say.debug "Installing...\n↳ OS: $_os\n↳ Install: $install_dir/$install_file\n↳ Config: $conf_dir/$_file_envvar" 39 - 40 53 if [[ -f "$install_dir/$install_file" ]]; then 41 54 atfile.die "Already installed ($install_dir/$install_file)" 42 55 fi 43 56 57 + atfile.say.debug "Resolving latest version..." 58 + 59 + # shellcheck disable=SC2154 60 + if [[ -z "$override_did" ]]; then 61 + if [[ $_meta_did == "{:"*":}" ]]; then 62 + # shellcheck disable=SC2154 63 + source_did="$(atfile.util.get_envvar "${_envvar_prefix}_FORCE_META_DID")" 64 + else 65 + source_did="$_meta_did" 66 + fi 67 + else 68 + source_did="$override_did" 69 + fi 70 + 71 + atfile.util.override_actor "$source_did" 72 + # BUG: $_fmt_blob_url_default is unpopulated 73 + _fmt_blob_url="[server]/xrpc/com.atproto.sync.getBlob?did=[did]&cid=[cid]" 74 + 75 + if [[ -z "$override_version" ]]; then 76 + latest_version_record="$(com.atproto.repo.getRecord "$source_did" "self.atfile.latest" "self")" 77 + error="$(atfile.util.get_xrpc_error $? "$latest_version_record")" 78 + [[ -n "$error" ]] && atfile.die "Unable to fetch latest version" 79 + 80 + found_version="$(echo "$latest_version_record" | jq -r '.value.version')" 81 + else 82 + found_version="$override_version" 83 + fi 84 + 85 + parsed_found_version="$(atfile.util.parse_version "$found_version")" 86 + 87 + found_version_key="atfile-$parsed_found_version" 88 + found_version_record="$(com.atproto.repo.getRecord "$source_did" "blue.zio.atfile.upload" "$found_version_key")" 89 + error="$(atfile.util.get_xrpc_error $? "$found_version_record")" 90 + [[ -n "$error" ]] && atfile.die "Unable to fetch record for '$found_version'" 91 + 92 + found_version_blob="$(echo "$found_version_record" | jq -r ".value.blob.ref.\"\$link\"")" 93 + # shellcheck disable=SC2154 94 + blob_url="$(atfile.util.build_blob_uri "$source_did" "$found_version_blob" "$_server")" 95 + 96 + atfile.say.debug "Found latest version\n↳ Version: $found_version ($parsed_found_version)\n↳ Source: $source_did\n↳ Blob: $found_version_blob" 97 + 98 + atfile.say.debug "Download '$blob_url'..." 99 + 100 + curl -s -o "${install_dir}/$install_file" "$blob_url" 101 + [[ $? != 0 ]] && atfile.die "Unable to download" 102 + 103 + atfile.say.debug "Installing...\n↳ OS: $_os\n↳ Install: $install_dir/$install_file\n↳ Config: $conf_dir/$_file_envvar" 104 + 105 + chmod +x "${install_dir}/$install_file" 106 + [[ $? != 0 ]] && atfile.die "Unable to set as executable" 107 + 108 + if [[ ! -f "$conf_dir/$_file_envvar" ]] || [[ ! -s "$conf_dir/$_file_envvar" ]]; then 109 + atfile.say.debug "Creating config file..." 110 + 111 + echo -e "ATFILE_USERNAME=<your-username>\nATFILE_PASSWORD=<your-password>" > "$conf_dir/$_file_envvar" 112 + [[ $? != 0 ]] && die "Unable to create config file ($conf_dir/$_file_envvar)" 113 + fi 114 + 44 115 atfile.say "😎 Installed ATFile" 45 - atfile.say " ↳ Path: $install_dir/$install_file" 46 - atfile.say " ↳ Config: $conf_dir/$_file_envvar" 116 + atfile.say " ↳ Version: $latest_version" 117 + atfile.say " ↳ Paths" 118 + atfile.say " ↳ Install: $install_dir/$install_file" 119 + atfile.say " ↳ Config: $conf_dir/$_file_envvar" 120 + atfile.say " ↳ Source: atfile://$source_did/$found_version_key" 47 121 atfile.say " ---" 48 122 atfile.say " Before running, set your credentials in the config file!" 49 123 atfile.say " Run '$install_file help' to get started" 50 124 # ------------------------------------------------------------------------------ 125 + 126 + atfile.util.override_actor_reset 51 127 }
+2 -2
src/entry.sh
··· 109 109 if [[ $_is_piped == 1 ]] ||\ 110 110 [[ "$1" == "install" ]]; then 111 111 if [[ "$1" == "install" ]]; then 112 - atfile.install "$2" "$3" 112 + atfile.install "$2" "$3" "$4" 113 113 install_exit="$?" 114 114 else 115 - atfile.install "$1" "$2" 115 + atfile.install "$1" "$2" "$3" 116 116 install_exit="$?" 117 117 fi 118 118
+1 -1
src/lexi/com_atproto.sh
··· 62 62 did="$1" 63 63 cid="$2" 64 64 65 - atfile.xrpc.pds.get "com.atproto.sync.getBlob" "did=$did&cid=$cid" "*/*" 65 + atfile.xrpc.pds.get "com.atproto.sync.getBlob" "cid=$cid&did=$did" "*/*" 66 66 } 67 67 68 68 function com.atproto.sync.listBlobs() {
+2 -1
src/shared/invoke.sh
··· 92 92 atfile.invoke.get "${args[0]}" 93 93 ;; 94 94 "install") 95 - atfile.install 95 + # TODO: Disable when installed (how?), similar to `release` 96 + atfile.install "${args[0]}" "${args[1]}" "${args[2]}" 96 97 ;; 97 98 "list") 98 99 if [[ "${args[0]}" == *.* || "${args[0]}" == did:* ]]; then
+1 -5
src/shared/util.sh
··· 984 984 985 985 _username="$(echo "$resolved_did" | cut -d "|" -f 1)" 986 986 _server="$(echo "$resolved_did" | cut -d "|" -f 2)" 987 - 988 - # shellcheck disable=SC2154 989 - if [[ "$_fmt_blob_url" != "$_fmt_blob_url_default" ]]; then 990 - export _fmt_blob_url="$_fmt_blob_url_default" 991 - fi 987 + _fmt_blob_url="$_fmt_blob_url_default" 992 988 993 989 atfile.say.debug "Overridden identity\n↳ DID: $_username\n↳ PDS: $_server\n↳ Blob URL: $_fmt_blob_url" 994 990 }