-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: fmrl-client
action: commit
revision:
path_from:
revision_from: 5760a313f33f8e1a1aafcbb90430106bb99a74fb:
path_to:
revision_to:

git.thebackupbox.net

fmrl-client

git://git.thebackupbox.net/fmrl-client

commit 5760a313f33f8e1a1aafcbb90430106bb99a74fb
Author: epoch <epoch@thebackupbox.net>
Date:   Sun Dec 24 11:41:54 2023 -0600

    fmrl-parse-status got a lot of stuff changed. fiik.

diff --git a/fmrl-parse-status b/fmrl-parse-status

index 66474700524744b99db042ede10032af7e95ebaa..

index ..9e44bb9906b3f79c56d30f95788276c8e3ab52dc 100755

--- a/fmrl-parse-status
+++ b/fmrl-parse-status
@@ -7,6 +7,7 @@ printf "user: %s\n" "${user}" >&2
 printf "host: %s\n" "${host}" >&2

 host_cache_file=~/.cache/fmrl/@"${host}"
+u_last_checked="$(cat "${host_cache_file}.last_checked")"

 if [ ! -e "${host_cache_file}" ];then
   printf "host cache file is missing. need to grab that first.\n" 2>&1
@@ -21,28 +22,31 @@ if [ "$u_code" == 200 ];then ## we only need to update our version if we got a r
   jq -r '.[] | select(.username == "'"${user}"'").data' < "${host_cache_file}" > "${user_cache_file}"
 fi

-if [ ! -e "${user_cache_file}" ];then
-  printf "[!!!] something went wrong. missing: %s\r\n" "${user_cache_file}"
-  exit 1
+if [ -e "${user_cache_file}" ];then
+  u_avatar_url="https://${host}$(jq -r .avatar.original < "${user_cache_file}")"
+  u_status="$(jq -r .status < "${user_cache_file}")"
+  u_name="$(jq -r .name < "${user_cache_file}")"
+  u_emoji="$(jq -r .emoji < "${user_cache_file}")"
+  u_media="$(jq -r .media < "${user_cache_file}")"
+  u_media_type="$(jq -r .media_type < "${user_cache_file}" | tr -cd '0-9')"
+  u_uri="$(jq -r .uri < "${user_cache_file}")"
+
+  avatar_cache=~/.cache/fmrl/"${user}"@"${host}".png
+
+  ### need a way to find out if the avatar value was changed from last time and not just
+  ### reply on it getting cleaned out by the user.
+  if [ ! -e "${avatar_cache}" -o "$no_cache" ];then
+    echo "downloading avatar from %s" "$u_avatar_url" >&2
+    curl -s -A "$ua" -H "Referer: ${ref}" -g "$u_avatar_url" > "${avatar_cache}"
+  else
+    echo "using cached avatar..." >&2
+  fi
+
+  if [ "$u_media_type" -a "$u_media_type" != "0" ];then
+    echo "media_type: $u_media_type" >&2
+    media_verb="reading,watching,watching,listening to,listening to,playing"
+    u_media_verb="$(printf "%s\n" "$media_verb" | cut -d, -f$u_media_type)"
+  else
+    echo "media_type: $u_media_type" >&2
+  fi
 fi
-
-
-u_avatar_url="${scheme}://${host}$(jq -r .avatar.original < "${user_cache_file}")"
-u_status="$(jq -r .status < "${user_cache_file}")"
-u_name="$(jq -r .name < "${user_cache_file}")"
-u_emoji="$(jq -r .emoji < "${user_cache_file}")"
-u_media="$(jq -r .media < "${user_cache_file}")"
-u_media_type="$(jq -r .media_type < "${user_cache_file}" | tr -cd '0-9')"
-u_uri="$(jq -r .uri < "${user_cache_file}")"
-
-avatar_cache=~/.cache/fmrl/"${user}"@"${host}".png
-
-if [ ! -e "${avatar_cache}" -o "$no_cache" ];then
-  echo "downloading avatar..." >&2
-  curl -s -A "$ua" -H "Referer: ${ref}" -g "$u_avatar_url" > "${avatar_cache}"
-else
-  echo "using cached avatar..." >&2
-fi
-
-media_verb="reading,watching,watching,listening to,listening to,playing"
-u_media_verb="$(printf "%s\n" "$media_verb" | cut -d, -f$u_media_type)"

-----END OF PAGE-----

-- Response ended

-- Page fetched on Sun Jun 2 16:54:38 2024