-- 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: 66542cbf78b6b1829abbefb20d0379f88bb33b74:
path_to:
revision_to:

git.thebackupbox.net

actpub

git://git.thebackupbox.net/actpub

commit 66542cbf78b6b1829abbefb20d0379f88bb33b74
Author: epoch <epoch@thebackupbox.net>
Date:   Tue Jun 20 22:11:28 2023 +0000

    add caching of ap-object2html output to ap-activity2html

diff --git a/ap-activity2html b/ap-activity2html

index ae971282f0a3457a2f2e10c6da0478a1b06807b5..

index ..46d5de0415b52c26c5a53805a9ec89c706bc86f2 100755

--- a/ap-activity2html
+++ b/ap-activity2html
@@ -90,7 +90,12 @@ string)
       printf '<span class="error">failed to download and cache object</span>'
     else
       printf 'Object: <a href="%s">%s</a><br/>' "${uri}" "${uri}"
-      ap-object2html "${cache_file}" 2>&1
+      html_cache=~/.cache/ap/html/object-"$(sha256sum < "${cache_file}")"
+      if [ ! -e "${html_cache}" ];then
+        ap-object2html "${cache_file}" 2>&1 | tee "${html_cache}"
+      else
+        cat "${html_cache}"
+      fi
     fi
   fi
   ;;
@@ -102,7 +107,12 @@ object)
     cache_file=~/.cache/ap/object/"$(sha256sum <<< "$uri" | cut '-d ' -f1)"
     jq -r '.object//""' < "${activity_file}" > "${cache_file}"
     if [ -e "${cache_file}" ];then
-      ap-object2html "${cache_file}" 2>&1
+      html_cache=~/.cache/ap/html/object-"$(sha256sum < "${cache_file}" | cut '-d ' -f1)"
+      if [ ! -e "${html_cache}" ];then
+        ap-object2html "${cache_file}" 2>&1 | tee "${html_cache}"
+      else
+        cat "${html_cache}"
+      fi
     else
       printf 'Object: <a href="%s">%s</a><br/>\n' "$uri" "$uri"
       printf '<span class="error">object empty or nonexistent</span>'

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

-- Response ended

-- Page fetched on Sun Jun 2 18:33:18 2024