blob: 9121cdb157d698fc738d58c889f1d1f00f9d6f97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/bin/bash
META="text/gemini; charset=utf-8"
input="${QUERY_STRING//[^abcde12345CFW+-><]/}"
if [ -n "$input" ]; then
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.5s;
done
attempt_ptn="$new_ptn$input."
output=$(geminict ${attempt_ptn@Q})
if [ "$?" == "0" ]; then
ct1986=$(echo "$output" | awk '/ct1986 says:/ {print $3}')
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/$(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;
|