-- Leo's gemini proxy

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

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: htmx-gallery
action: blob
revision:
path_from: edit.cgi
revision_from: refs/heads/master:
path_to:
revision_to:

git.thebackupbox.net

htmx-gallery

git://git.thebackupbox.net/htmx-gallery

blob of:

htmx-gallery

/ edit.cgi

refs/heads/master:/edit.cgi
 #!/usr/bin/env bash
 printf "Content-Type: text/html\r\n\r\n"

 if [ "$REQUEST_METHOD" = "PUT" ];then
   #head -c "$CONTENT_LENGTH" > "$QUERY_STRING"
   head -c "$CONTENT_LENGTH" | tr '&' '\n' | grep ^desc= | cut -d= -f2- | uriunescape > "$QUERY_STRING.desc"
   ./desc.cgi | tail -n+3
   #heh. skip the headers
   #uses $QUERY_STRING
 fi

 if [ "$REQUEST_METHOD" = "GET" ];then
   printf '<form hx-put="edit.cgi?%s" hx-target="this" hx-swap="outerHTML">\n' "$QUERY_STRING"
   printf '<input type="text" name="desc" value="%s">\n' "$(cat "$QUERY_STRING.desc")"
   printf '<button>submit</button>\n'
   printf '<button hx-get="desc.cgi?%s">cancel</button>' "$QUERY_STRING"
   printf '</form>\n'
 fi

-- Response ended

-- Page fetched on Sun Jun 2 14:28:11 2024