2 # CGI script to get irc logs from scoop. Powers https://logs.armaanb.net.
4 channel=$(echo "$PATH_INFO" | awk -F / '{print $2}')
5 if [ -z "$channel" ]; then
6 echo "Content-type: text/plain\n"
7 echo "Logged channels:"
8 cat /etc/scoop-cgi/channels
10 url format: /channel/date
11 date is optional, and defaults to the current day"
15 channel=$(grep -x "$channel" /etc/scoop-cgi/channels)
16 if [ -z "$channel" ]; then
18 echo "Content-type: text/plain\n"
19 echo "404. Channel not logged."
23 time=$(echo "$PATH_INFO" | awk -F / '{print $3}' | xargs date -I -d)
24 db=$(cat /etc/scoop-cgi/database)
26 echo "Content-type: text/plain\n"
27 scoop -d "$db" -p "$channel" -D "${time:-now}" -F "%Y-%m-%d %H:%M:%S" \
28 | awk '{$1=""; print substr($0, 2, length($0) - 1)}'