36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
echo "Content-type: image/svg+xml"
|
|
echo "Cache-Control: no-store, no-cache, must-revalidate, max-age=0"
|
|
echo "Cache-Control: post-check=0, pre-check=0"
|
|
echo "Pragma: no-cache"
|
|
|
|
# Get an unique session id to start storing sessions.
|
|
# This is better than using the ip directly, as it
|
|
# changes for each browsing session. This way it is
|
|
# impossible to link past browsing activity
|
|
|
|
if [ -z "$HTTP_COOKIE" ]
|
|
then
|
|
SESSION_ID=$(echo "$(date) $REMOTE_ADDR" | sha1sum | head -c -4)
|
|
echo "Set-Cookie: $SESSION_ID; Path=/"
|
|
else
|
|
SESSION_ID=$HTTP_COOKIE
|
|
fi
|
|
|
|
# End of headers
|
|
echo ""
|
|
|
|
# Generate the key and date
|
|
KEY=$(echo -n $HTTP_REFERER | cut -d/ -f3- | cut -d? -f1 | sed 's:/*$::' | sha1sum | head -c -4)
|
|
UNIQUE=$(date '+%Y-%m-%d')
|
|
|
|
# store
|
|
echo $SESSION_ID >> "./data/$KEY/$UNIQUE" || (mkdir -p "./data/$KEY" && echo $SESSION_ID >> "./data/$KEY/$UNIQUE")
|
|
|
|
# reply
|
|
echo '<svg width="0" height="0" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="" class=""></path><!-- Simple privacy minded analytics for the ~verse. https://tilde.team/~steph for more info --></svg>'
|
|
|
|
exit 0
|
|
|