screenshot-uri - annna - Annna the nice friendly bot. | |
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6… | |
Log | |
Files | |
Refs | |
Tags | |
README | |
--- | |
screenshot-uri (682B) | |
--- | |
1 #!/bin/sh | |
2 | |
3 exit 0 | |
4 | |
5 if [ $# -lt 1 ]; | |
6 then | |
7 printf "usage: %s uri\n" "$(basename "$0")" >&2 | |
8 exit 1 | |
9 fi | |
10 | |
11 # Use Tor. | |
12 proxy="socks5h://127.0.0.1:9050" | |
13 #proxy="" | |
14 export http_proxy="${proxy}" | |
15 export https_proxy="${proxy}" | |
16 export socks_proxy="${proxy}" | |
17 | |
18 uri="$1" | |
19 firefoxargs="--window-size=1024,768" | |
20 pastebase="/br/gopher/paste" | |
21 | |
22 cd "${pastebase}" | |
23 tmpfile="$(mktemp p-XXXXXXXXXXXXX.png)" | |
24 timeout -k 60s 60s firefox $firefoxargs --new-instance --screenshot \ | |
25 "${pastebase}/${tmpfile}" "${uri}" >/dev/null 2>&1 | |
26 # timeout(1) timed out | |
27 [ $? -eq 124 ] || [ $? -eq 137 ] && exit 1 | |
28 | |
29 # Firefox stores with rw---- | |
30 chmod g+wr "${pastebase}/${tmpfile}" | |
31 | |
32 printf "%s/%s\n" "${pastebase}" "${tmpfile}" | |
33 |