git ssb

0+

cel / dillo-gemini



Commit 7113efe71ed4e1d5aebcb7501129ab30b1cfa2fd

Support input status type

cel committed on 2/26/2020, 2:22:44 PM
Parent: 02044cb4be75b9a46439f79179efc828aceb7d50

Files changed

gemini.filter.dpichanged
gemini.filter.dpiView
@@ -49,8 +49,30 @@
4949 printf "Content-type: text/plain\r\n\r\n"
5050 echo Empty status response. $2
5151 }
5252
53 +serve_input() {
54 + printf "<cmd='start_send_page' url='' '>\n"
55 + prompt=$1
56 + # TODO: html-escape prompt
57 + printf "Content-type: text/html\r\n\r\n"
58 + cat <<-EOF
59 + <!doctype html>
60 + <html>
61 + <head>
62 + <title>Input</title>
63 + </head>
64 + <body>
65 + <form action="" method="get">
66 + <h3>$prompt</h3>
67 + <input name=_ style='width:100%'>
68 + <input type=submit>
69 + </form>
70 + </body>
71 + </html>
72 + EOF
73 +}
74 +
5375 serve_success() {
5476 printf "<cmd='start_send_page' url='' '>\n"
5577 type=$1
5678 case "$type" in
@@ -123,8 +145,17 @@
123145 url1=${url#gemini://}
124146 hostname=${url1%%/*}
125147 host=${hostname%%:*}
126148 port=${hostname##*:}
149 +
150 + # replace "?_=" with "?".
151 + # dillo can only submit forms with name=value items, but Gemini
152 + # uses the whole querystring as a single string
153 + url1=${url%%?_=*}
154 + if [ "$url1" != "$url" ]; then
155 + url="${url1}?${url#*?_=}"
156 + fi
157 +
127158 if [ "$host" = "$port" ]; then port=1965; fi
128159 send_status_msg "Sending request..."
129160 printf "%s\r\n" "$url" | openssl s_client -verify_quiet -quiet "$host:$port" | {
130161 read status meta

Built with git-ssb-web