Add video proxy support

This commit is contained in:
Zed
2019-08-19 20:53:47 +02:00
parent f5fef0ff3a
commit ce6dace1d7
4 changed files with 20 additions and 6 deletions

View File

@ -182,16 +182,19 @@ routes:
get "/video/@sig/@url":
cond "http" in @"url"
cond "video.twimg" in @"url"
let url = decodeUrl(@"url")
var url = decodeUrl(@"url")
let prefs = cookiePrefs()
if getHmac(url) != @"sig":
resp showError("Failed to verify signature", cfg.title)
let client = newAsyncHttpClient()
let video = await client.getContent(url)
client.close()
var content = await client.getContent(url)
resp video, mimetype(url)
if ".m3u8" in url:
content = proxifyVideo(content, prefs.proxyVideos)
client.close()
resp content, mimetype(url)
runForever()