-- Leo's gemini proxy

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

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: actpub
action: commit
revision:
path_from:
revision_from: 4220d922bd0d901c970ce230eb77ade4815030d6:
path_to:
revision_to:

git.thebackupbox.net

actpub

git://git.thebackupbox.net/actpub

commit 4220d922bd0d901c970ce230eb77ade4815030d6
Author: epoch <epoch@thebackupbox.net>
Date:   Wed Mar 22 10:24:53 2023 +0000

    removed direct uses or mention of curl

diff --git a/ap-actor2acct b/ap-actor2acct

index 3506a620171d0cf2083e46fab796fbd2955e6d8b..

index ..1606b43611732719fdaf892c3d68da9f3acfafb3 100755

--- a/ap-actor2acct
+++ b/ap-actor2acct
@@ -10,7 +10,7 @@ fi
 cache_file=~/.cache/ap/actor/"$(sha256sum <<< "$uri" | cut '-d ' -f1)"

 if [ ! -e "$cache_file" ];then
-	curl -o "$cache_file" -sH "Accept: application/activity+json" -g "$uri"
+	ap-signed-get "$uri" > "${cache_file}"
 fi

 domain="$(uricut -d <<< "$uri")"
diff --git a/ap-cacheactor b/ap-cacheactor

index 850977bc624a58ecab1be30a602c31c5ec3ee742..

index ..2deb2f321382efe401f4e6e2a8087d2a120ad0ce 100755

--- a/ap-cacheactor
+++ b/ap-cacheactor
@@ -11,7 +11,7 @@ uri="$1"
 cache_file=~/.cache/ap/actor/"$(sha256sum <<< "$uri" | cut '-d ' -f1)"

 if [ ! -s "$cache_file" ];then
-  curl -so "${cache_file}" -H "Accept: application/activity+json, application/ld+json" -g "$uri"
+	ap-signed-get "$uri" > "${cache_file}"
 fi

 printf "%s\n" "${cache_file}"
diff --git a/ap-cacheobject b/ap-cacheobject

index 5c1c54244436fc8d1b089eaeb7a281930eba78a2..

index ..018d838fae03da4bc0275be19829c07f048d63d1 100755

--- a/ap-cacheobject
+++ b/ap-cacheobject
@@ -10,9 +10,13 @@ uri="$1"
 cache_file=~/.cache/ap/object/"$(sha256sum <<< "$uri" | cut '-d ' -f1)"

 if [ ! -s "$cache_file" ];then
-  curl -s -H "Accept: application/activity+json, application/ld+json" -g "$uri" \
-	| jq -r '. | to_entries | .[].value | select(if type == "object" then . else null end) | select(if .id == "'"$uri"'" then . else null end)' \
-	> "${cache_file}"
+  RESPONSE="$(ap-signed-get "$uri")"
+  OBJECT_DATA="$(printf "%s" "$RESPONSE" | jq -r '. | to_entries | .[].value | select(if type == "object" then . else null end) | select(if .id == "'"$uri"'" then . else null end)')"
+  if [ "$OBJECT_DATA" ];then #we didn't find it... guess just output the original response.
+    printf '%s' "$OBJECT_DATA" #should be all good.
+  else
+    printf '%s' "$RESPONSE" # so we can see errors.
+  fi > "${cache_file}"
 fi

 printf "%s\n" "${cache_file}"
diff --git a/ap-getactor b/ap-getactor

index c2c63d7c61ab343b5b66e38859963d2a6fcd4a83..

index ..6ae0c564c9312871cdd4eb7d7c5b3d7e34b9335d 100755

--- a/ap-getactor
+++ b/ap-getactor
@@ -21,8 +21,6 @@ if [ ! -s ${cache_file} -o "${no_cache}" = 1 ];then
   ### then get the max-age's value,
   ### then set the mtime of the file that far into the future.
   ### so I can find -mtime 0 . -rm on all of the object files. anything in the past gets deleted.
-
-  ###curl -s -o "${cache_file}" -H "Accept: application/activity+json, application/ld+json" -g "$(ap-getactoruri "$target")"
   ### NOTICE: some servers require you to use signed GETs to get an actor file.
   ap-signed-get "$(ap-getactoruri "$target")" > "${cache_file}"
   cache_file2=~/.cache/ap/actor/$(sha256sum < "${cache_file}" | cut '-d ' -f1)
diff --git a/ap-getfollowers b/ap-getfollowers

index 6d902609d5041cccca83e8a757758ca14b6f1c73..

index ..7261745415085d0ecffebbb1cac0cb5857850694 100755

--- a/ap-getfollowers
+++ b/ap-getfollowers
@@ -14,7 +14,7 @@ url="$(ap-getactor "$acct" | jq -r '.followers')"
 next="$url"
 while [ "$next" ];do
   echo "ap-getfollowers: getting $next" >&2
-  resp="$(curl -sg "$next")"
+  resp="$(ap-signed-get "$next")"
   jq -r '.orderedItems//[]' <<< "$resp" | jq -r '.[]'
   next="$(jq -r '.next//.first//""' <<< "$resp")"
 done
diff --git a/ap-getpubkey b/ap-getpubkey

index 8ce54e3d9dafd3c252bba02609ae1bcd875ac079..

index ..f368df20cd46e29da8847a7c03d5cbcaea6b520f 100755

--- a/ap-getpubkey
+++ b/ap-getpubkey
@@ -7,7 +7,6 @@ fi

 ### this needs to be a signed request for some hosts so... I guess we
 ### will probably give the server itself a key it can use.
-#curl -sH 'Accept: application/activity+json, application/ld+json' -g "$keyuri" \
 ap-signed-get "$keyuri" \
 	| jq -r '. | to_entries | .[].value | select(if type == "object" then . else null end) | select(if .id == "'"${keyuri}"'" then . else null end) | .publicKeyPem'

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

-- Response ended

-- Page fetched on Sun Jun 2 15:19:59 2024