From 417cfba394f41d7fd3cdef74090e6e48fbdc9ce4 Mon Sep 17 00:00:00 2001 From: teddit Date: Tue, 13 Apr 2021 16:40:20 +0200 Subject: [PATCH] add support for setting preferences for privacy domains via URL --- routes.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/routes.js b/routes.js index 34e9389..9551a31 100644 --- a/routes.js +++ b/routes.js @@ -64,6 +64,24 @@ module.exports = (app, redis, fetch, RedditAPI) => { res.cookie('show_upvoted_percentage', showUpvotedPercentage, { maxAge: 31536000, httpOnly: true }) } + let domainTwitter = req.query.domain_twitter + if(domainTwitter) { + req.cookies.domain_twitter = domainTwitter + res.cookie('domain_twitter', domainTwitter, { maxAge: 31536000, httpOnly: true }) + } + + let domainYoutube = req.query.domain_youtube + if(domainYoutube) { + req.cookies.domain_youtube = domainYoutube + res.cookie('domain_youtube', domainYoutube, { maxAge: 31536000, httpOnly: true }) + } + + let domainInstagram = req.query.domain_instagram + if(domainInstagram) { + req.cookies.domain_instagram = domainInstagram + res.cookie('domain_instagram', domainInstagram, { maxAge: 31536000, httpOnly: true }) + } + if(!config.rate_limiting) { return next() }