Commit 21493c1e authored by Peter Kovary's avatar Peter Kovary
Browse files

Add cgi for the web version

parent 20a6233f
#!/bin/bash
echo Content-type: text/html
echo
echo '<HTML><HEAD><title>WebApps group finder v0.1</title>'
echo '<style>
td { padding-right:24px; }
a:visited { color:blue; }
</style></HEAD><BODY><table border="0" cellspacing="0">'
~/LabStalker/whosinlabs | grep -v fullness | ~/LabStalker/group-finder | sort -n | perl -pe 's!(.+?) +(.+?) +(.+?) +(\((.+(1[0-9]))\))!<tr><td>\1</td><td>\2</td><td><a href="#" onclick="return false;" target="_blank">\3</a></td><td>\4</td></tr>!'
echo '</table><br></BODY></HTML>'
#!/bin/bash
echo Content-type: text/html
echo
echo '<HTML><HEAD><title>Lab Stalker Online v0.2</title><style>
td { padding-right:24px }
a:visited { color:blue }
.split { height: 100%; position: fixed; top: 0; overflox-x: hidden; padding: 20px; }
.left { width: 33%; left: 0; }
.right { width: 66%; right: 0; }
img { max-width: 100%; max-height: 100%; object-fit: contain; }
</style></HEAD><BODY>
<div class="split left"><table border="0" cellspacing="0">'
premium=$(grep -o ${REMOTE_USER} /homes/pk3115/Public/LabStalker/premium || true)
donate='\1<a href="\2\3/5.00?d=LabStalker%20is%20worth%20a%20pint%20('${REMOTE_USER}')">\3</a><br>'
[ "${premium}" ] && donate=""
echo "Hello $(ssh shell1 "finger ${REMOTE_USER} | grep -oPm1 'Name: \K.+'")!<br>"
~/LabStalker/whosinlabs | perl -pe 's!(.+?) +(.+?) +(\((.+(1[0-9]))\))!<tr><td>\1</td><td><a href="https://teachdb.doc.ic.ac.uk/photo/student/pics\5/\4.jpg" target="_blank">\2</a></td><td>\3</td></tr>!' | sed -E 's!(.+)(https://)(monzo.me/peterkovary)!'"${donate}"'!'
#~/LabStalker/whosinlabs | grep -v turinglab46 | grep -v fullness | perl -pe 's!(.+?) +(.+?) +(\((.+(1[0-9]))\))!<tr><td>\1</td><td><a href="https://teachdb.doc.ic.ac.uk/photo/student/pics\5/\4.jpg" target="_blank">\2</a></td><td>\3</td></tr>!' | sed -E 's!(.+)(https://)(monzo.me/peterkovary)!'"${donate}"'!'
#~/LabStalker/whosinlabs | grep -v turinglab46 | grep -v fullness | perl -pe 's!(.+?) +(.+?) +(\((.+(1[0-9]))\))!<tr><td>\1</td><td><a href="#" onclick="return false;" target="_blank">\2</a></td><td>\3</td></tr>!' | sed -E 's!(.+)(https://)(monzo.me/peterkovary)!'"${donate}"'!'
echo '</table><br></div><div class="split right"><img src="./map.png"></div>
</BODY></HTML>'
echo "$(date --iso-8601=seconds) ${REMOTE_USER}" >> /homes/pk3115/Public/log
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment