summaryrefslogtreecommitdiff
path: root/tak
diff options
context:
space:
mode:
authortslil clingman <>2021-10-06 08:51:06 -0400
committertslil clingman <>2021-10-06 09:16:55 -0400
commitd76c3fd4d057f31d5767cc45d980b87ffff9de33 (patch)
tree0330b370dae4c55ea002831e0adbc97a6ce5db7d /tak
parent77964f239c4f22197da101e2db6f43689705c4ea (diff)
Fixes to Tak CGI
Diffstat (limited to 'tak')
-rwxr-xr-xtak16
1 files changed, 9 insertions, 7 deletions
diff --git a/tak b/tak
index 62ff252..9121cdb 100755
--- a/tak
+++ b/tak
@@ -1,24 +1,26 @@
#!/bin/bash
META="text/gemini; charset=utf-8"
-input="${QUERY_STRING//[^abcde12345CFW]/}"
+input="${QUERY_STRING//[^abcde12345CFW+-><]/}"
if [ -n "$input" ]; then
- new_ptn="${PATH_INFO//[^abcde12345CFW.]/}"
+ new_ptn="${PATH_INFO//[^abcde12345CFW.+-LR]/}"
+ new_ptn=$(echo ${new_ptn@Q} | tr 'LR' '<>')
printf '20 %s\r\n' "$META"
printf '```\n'
while [ "$(pgrep geminict | wc -l)" > "10" ]; do
- sleep 0.25s;
+ sleep 0.5s;
done
- output="$(geminict "$new_ptn$input.")"
+ attempt_ptn="$new_ptn$input."
+ output=$(geminict ${attempt_ptn@Q})
if [ "$?" == "0" ]; then
ct1986=$(echo "$output" | awk '/ct1986 says:/ {print $3}')
- new_ptn="$new_ptn$input.$ct1986."
+ new_ptn="$attempt_ptn.$ct1986."
fi;
printf '%s\n' "$output"
printf '```\n'
echo 'Please be patient, ct1986 is a slow bot and no more than 10 instances are allowed concurrently on the server.'
- echo "=> gemini://l-3.space/tak/$new_ptn/ Enter ply"
- echo 'Note: all input is stripped to match only [abcde12345CFW].'
+ echo "=> gemini://l-3.space/tak/$(echo ${new_ptn@Q} | tr '<>' 'LR')/ Enter ply"
+ echo 'Note: all input is stripped to match only [abcde12345CFW+-<>].'
else
printf "10 Enter ply:\r\n"
fi;