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

Configure Feed

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

at dev 27 lines 1.0 kB view raw
1#!/usr/bin/env bash 2 3function atfile.stream() { 4 collection="$1" 5 did="$2" 6 cursor="$3" 7 compress="$4" 8 9 atfile.util.check_prog "websocat" "https://github.com/vi/websocat" 10 11 [[ "$compress" == 1 ]] && compress="true" 12 13 # shellcheck disable=SC2154 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↳ Compress: $compress" 15 16 collection_query="$(atfile.util.build_query_array "wantedCollections" "$collection")" 17 did_query="$(atfile.util.build_query_array "wantedDids" "$did")" 18 cursor_query="$([[ -n "$cursor" ]] && echo "cursor=$cursor&" || echo "cursor=$(atfile.util.get_date "$_now" "%s")")" 19 compress_query="$([[ -n "$compress" ]] && echo "compress=$compress&")" 20 21 url="$_endpoint_jetstream/subscribe?${collection_query}${did_query}${cursor_query}${compress_query}" 22 url="${url::-1}" 23 24 atfile.say.debug "Using URL '$url'" 25 26 websocat "${url}" 27}