-- Leo's gemini proxy

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

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: fmrl
action: commit
revision:
path_from:
revision_from: 689a43f838909a532de2973158c4b2abc80f223a:
path_to:
revision_to:

git.thebackupbox.net

fmrl

git://git.thebackupbox.net/fmrl

commit 689a43f838909a532de2973158c4b2abc80f223a
Author: epoch <epoch@hack.thebackupbox.net>
Date:   Mon Jan 17 07:44:05 2022 +0000

    fixed some incomplete variable renaming dealing with avatar data.

diff --git a/index.cgi b/index.cgi

index aa12db2145e58eea8987bb7c14f185d876c63eb3..

index ..53d00c7d7108bd11ba829c8113a23d99e0228381 100755

--- a/index.cgi
+++ b/index.cgi
@@ -6,7 +6,9 @@ cd /var/www/fmrl
 if [ "$PATH_INFO" ];then
 case "$PATH_INFO" in
 /user/*)
-  if [ "$REQUEST_METHOD" = "PATCH" ];then
+### spec says to use PATCH for these updats now.
+### https://github.com/makeworld-the-better-one/fmrl/commit/064319af0f2bbe26721c6518a6bc2ebf972c188c#diff-bc6661da34ecae62fbe724bb93fd69b91a7f81143f2683a81163231de7e3b545
+  if [ "$REQUEST_METHOD" = "PATCH" -o "$REQUEST_METHOD" = "PUT" ];then
 #    if [ "allowed" -a "${HTTP_EXPECT}" = "100-continue" ];then
 #      printf "Status: 100 Continue\r\n"
 #    fi
@@ -18,13 +20,14 @@ case "$PATH_INFO" in
       printf "I haven't implemented chunked trasnfer encoding server-side yet.\n"
       exit 0
     fi
-    if [ "$HTTP_EXPECT" ];then
-      printf "Status: 501 Not Implemented\r\n"
-      printf "Content-Type: text/plain\r\n\r\n"
-      printf "I'm pretty sure an Expect header would require me to implement request pipelining.\n"
-      printf "Which I don't want to do right now.\n"
-      exit 0
-    fi
+    #if [ "$HTTP_EXPECT" ];then
+    #  printf "Status: 501 Not Implemented\r\n"
+    #  printf "Content-Type: text/plain\r\n\r\n"
+    #  printf "I'm pretty sure an Expect header would require me to implement request pipelining.\n"
+    #  printf "Expect header value: %s\n" "$HTTP_EXPECT"
+    #  printf "Which I don't want to do right now. but we're going to pass this to the code as if we didn't notice.\n"
+    #  exit 0
+    #fi
     printf "Access-Control-Allow-Origin: *\r\n"
     printf "Content-Type: text/plain\r\n\r\n"
     printf "length: %s type: %s\n" "$CONTENT_LENGTH" "$CONTENT_TYPE"
@@ -32,7 +35,7 @@ case "$PATH_INFO" in
     input_json="$(head -c "$CONTENT_LENGTH")"
 #    if [ "$HTTP_TRANSFER_
     avatar_original="$(printf "%s\n" "$input_json" | jq -r .avatar.original//empty | sed 's|"|%22|g')"
-    if [ ! "$avatar" ];then ### user didn't enter an explicit path so..
+    if [ ! "$avatar_original" ];then ### user didn't enter an explicit path so..
       echo "no avatar path.. checking x-face"
       if [ "$HTTP_X_FACE" ];then ### an X-Face: header will get used if not explicitly defined.
         echo "xface found! using that."
@@ -40,7 +43,7 @@ case "$PATH_INFO" in
       else ### if there is no xface either, use the previously defined avatar.
         echo "no xface found :/"
         avatar_original="$(cat ".users/${user}" | jq -r .avatar.original)"
-        if [ ! "$avatar" ];then ### if there wasn't a previously defined avatar, set it to no-face
+        if [ ! "$avatar_original" ];then ### if there wasn't a previously defined avatar, set it to no-face
           echo "no previous value either. using no-face"
           avatar_original="/cgi-bin/xface.cgi?$(printf "%s\n" "${HTTPSESS_X_FACE_QS_SAFE}" | sed 's|"|%22|g')"
         fi
@@ -104,6 +107,10 @@ END
     printf "Access-Control-Max-Age: 86400\r\n"
   fi
   if [ "$REQUEST_METHOD" = "GET" ];then
+### single user query is supposed to be removed
+### https://github.com/makeworld-the-better-one/fmrl/commit/ee5c90087c7a7a45db94026e95277db19af6ca25#diff-bc6661da34ecae62fbe724bb93fd69b91a7f81143f2683a81163231de7e3b545
+### should return 405 Method Now Allowed now
+### -----BEGIN CODE NO LONGER NEEDED-----
     user="$(printf "%s\n" "$PATH_INFO" | cut -d/ -f3)"
     user_file="/var/www/fmrl/.users/${user}"
     if [ ! -e "${user_file}" ];then
@@ -141,6 +148,8 @@ END
     printf "Content-Type: application/json; charset=utf-8\r\n\r\n"
     cat "${user_file}"
   fi
+### -----END CODE NO LONGER NEEDED-----
+### replace with just a Status: 405 Method Not Allowed
 ;;
 /update/)
   . /var/www/lib/remote_host.cgi

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

-- Response ended

-- Page fetched on Sun Jun 2 17:49:32 2024