-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathphosphene.ls
39 lines (34 loc) · 1.2 KB
/
phosphene.ls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require! {request, express}
express!
..get '/:board/thumbs/:no/:file' (req, res) !->
{board, file, no: tno} = req.params
console.log "proxing #file from thread #tno in #board"
res.header 'expires' new Date(Date.now! + 60_000).toUTCString!
request.get do
url: "http://t.4cdn.org/#board/#file"
headers:
\Referer : "http://boards.4chan.org/#board/thread/#tno"
\User-Agent : 'Phosphene/0.0.0'
.pipe res
.on \error !-> res.send 502
..get '/:board/src/:no/:file' (req, res) !->
{board, file, no: tno} = req.params
console.log "proxing full #file from thread #tno in #board"
request.get do
url: "http://i.4cdn.org/#board/#file"
headers:
\Referer : "http://boards.4chan.org/#board/thread/#tno"
\User-Agent : 'Phosphene/0.0.0'
.pipe res
.on \error !-> res.send 502
..get '/:board/static/:file' (req, res) !->
{board, file} = req.params
console.log "proxing static image #file for #board"
request.get do
url: "http://s.4cdn.org/image/#file"
headers:
\Referer : "http://boards.4chan.org/#board/"
\User-Agent : 'Phosphene/0.0.0'
.pipe res
.on \error !-> res.send 502
.listen 3700