# HG changeset patch # User Christophe Lincoln # Date 1389712323 -3600 # Node ID 2886f4c59d8fcdc43c6afe40c015482016703224 # Parent 8db5b459287399cb616a111ba7c9269560daf1f6 Add new CGI interface for irc.slitaz.org diff -r 8db5b4592873 -r 2886f4c59d8f irc/README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irc/README Tue Jan 14 16:12:03 2014 +0100 @@ -0,0 +1,15 @@ +SliTaz IRC +=============================================================================== + +The main purpose of the logs is to provide records of meetings and dicussions +we have on IRC. TazIRC Log Bot may runs in a conspy session on Tank. + + * index.cgi : The main CGI SHell script + * lib/ : HTML template and eventual JS functions + * log/ : All the logs produced by tazirc-lb + +Host: irc.slitaz.org +IP: 37.187.4.13 (tank) + + +=============================================================================== diff -r 8db5b4592873 -r 2886f4c59d8f irc/images/logo.png Binary file irc/images/logo.png has changed diff -r 8db5b4592873 -r 2886f4c59d8f irc/index.cgi --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irc/index.cgi Tue Jan 14 16:12:03 2014 +0100 @@ -0,0 +1,106 @@ +#!/bin/sh +# +# Small CGI example to display TazIRC Log Bot logs. +# +. /usr/lib/slitaz/httphelper + +host="irc.freenode.net" +chan="slitaz" +logdir="log/$host/$chan" + +# HTML 5 header +html_header() { + cat lib/header.html | sed -e s!'%LOG%'!"$log"!g +} + +# HTML 5 footer +html_footer() { + if [ -f "lib/footer.html" ]; then + cat $tiny/lib/footer.html + else + cat << EOT + + + + + + + + +EOT + fi +} + +# Handle GET actions +case " $(GET) " in + *\ log\ *) + # Display a daily log + log="$(GET log)" + header + html_header + echo "

#${chan} $log

" + IFS="|" + cat ${logdir}/${log}.log | while read time user text + do + cat << EOT +
+[$time] $user: $text +
+EOT + done + unset IFS + html_footer ;; + *\ webirc\ *) + # Web IRC + log="#slitaz" + header + html_header + cat << EOT +
+ +
+EOT + html_footer ;; + *) + # Info, log list and stats. + log="Logs" + header + html_header + cat << EOT +

Welcome to SliTaz IRC World!

+

+ This service let you read online the SliTaz IRC support channel on + Freenode and provide a web IRC client. On a + SliTaz system you can also use a graphical or a text mode IRC client + such as Xchat or TazIRC: +

+
+$ tazirc irc.freenode.net [nick] slitaz
+
+ +

#${chan} $log

+ +
+EOT
+		IFS=" "
+		wc -l ${logdir}/*.log | while read count day
+		do
+			case "$day" in
+				total)
+					# Last line is total
+					echo "
" + echo "

Total: $count messages

" ;; + *) + day=$(basename $day) + log="${day%.log}" + echo "$log $count messages" ;; + esac + done + unset IFS + html_footer +esac + +exit 0 diff -r 8db5b4592873 -r 2886f4c59d8f irc/lib/header.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irc/lib/header.html Tue Jan 14 16:12:03 2014 +0100 @@ -0,0 +1,36 @@ + + + + SliTaz IRC - %LOG% + + + + + + + + + + + + +
diff -r 8db5b4592873 -r 2886f4c59d8f irc/style.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/irc/style.css Tue Jan 14 16:12:03 2014 +0100 @@ -0,0 +1,138 @@ +/* CSS style for SliTaz IRC */ + +html { min-height: 102%; } +body { font: 13px sans-serif, vernada, arial; margin: 0; } +h1 { margin: 0; padding: 8px; color: #fff; font-size: 20px; } +h1 a { color: #fff; text-decoration: none; } +h2 { color: #444; } h3 { color: #666; font-size: 140%; } +a { text-decoration: underline; color: #215090; } +a:hover { text-decoration: none; } +img { border: 0pt none; vertical-align: middle; } +pre { + overflow: auto; + font-size: 98%; +} + +/* Header */ + +#header { + background: #222; + height: 40px; + border-bottom: 4px solid #afafaf; +} + +#header h1 { + margin: 0; + padding: 8px 0 0 42px; + width: 250px; +} + +#header h1 a { + color: white; + text-decoration: none; + font-size: 20px; + font-style: italic; +} + +#header h1 a:hover { + color: #afafaf; +} + +/* Header links */ + +#network { + float: right; + padding: 14px 5px 0; + font-size: 12px; +} + +#network a, #network span { + padding: 0 4px; + color: #fff; + font-weight: bold; + text-decoration: none; +} + +#network a:hover, #network span { color: #afafaf; } + +/* Logo */ + +#logo { + background: url(images/logo.png) no-repeat left; + position: absolute; + float: left; + left: 0px; + top: 0px; + width: 40px; + height: 40px; +} + +/* Search */ + +#search { + position: absolute; + right: 20px; + top: 60px; +} + +#search input[type="text"] { + width: 200px; + + padding: 4px; + margin: 4px 0px; + font-size: 14px; + line-height: 1.2em; + background: #fefefe; + border: 2px solid #afafaf; + -webkit-appearance: none; + -webkit-padding-end: 12px; + -webkit-padding-start: 6px; +} + +/* Content */ + +#content { + margin: 40px auto; + padding: 0 20px; + text-align: justify; + max-width: 720px; +} + +.box { + padding: 6px; + margin: 4px 0px; +} + +pre, .box { + background-color: #f8f8f8; + border: 1px solid #ddd; +} + +pre { + padding: 10px; +} + +pre img { margin: 4px 4px 4px 0px; } + +.error { color: red; } +.ok { color: green; } +.date { color: #666; font-size: 96%; } + +/* Round corner */ + +pre, img, .box, input[type="text"] { + -moz-border-radius: 4px; + -webkit-border-radius: 4px; + border-radius: 4px; +} + +/* Footer */ + +#footer { + text-align: center; + padding: 20px; + border-top: 1px solid #ddd; + font-size: 90%; +} + +#footer a { padding: 0 2px; }