diff --git a/routes/preferences.js b/routes/preferences.js index d438603..e9fe22a 100644 --- a/routes/preferences.js +++ b/routes/preferences.js @@ -16,6 +16,7 @@ function resetPreferences(res) { res.clearCookie('domain_youtube'); res.clearCookie('domain_instagram'); res.clearCookie('videos_muted'); + res.clearCookie('prefer_frontpage'); } preferenceRoutes.get('/preferences', (req, res, next) => { @@ -88,6 +89,7 @@ preferenceRoutes.post('/saveprefs', (req, res, next) => { let domain_youtube = req.body.domain_youtube; let domain_instagram = req.body.domain_instagram; let videos_muted = req.body.videos_muted; + let prefer_frontpage = req.body.prefer_frontpage; res.cookie('theme', theme, { maxAge: 365 * 24 * 60 * 60 * 1000, @@ -165,6 +167,11 @@ preferenceRoutes.post('/saveprefs', (req, res, next) => { httpOnly: true, }); + res.cookie('prefer_frontpage', prefer_frontpage, { + maxAge: 365 * 24 * 60 * 60 * 1000, + httpOnly: true, + }); + return res.redirect('/preferences'); }); diff --git a/views/preferences.pug b/views/preferences.pug index 47a857f..013d49d 100644 --- a/views/preferences.pug +++ b/views/preferences.pug @@ -105,6 +105,12 @@ html input(type="checkbox", name="show_upvotes", id="show_upvotes", checked="checked") else input(type="checkbox", name="show_upvotes", id="show_upvotes") + .setting + label(for="prefer_frontpage") + if(user_preferences.prefer_frontpage == 'true') + input(type="checkbox", name="prefer_frontpage", id="prefer_frontpage", checked="true") + else + input(type="checkbox", name="prefer_frontpage", id="prefer_frontpage") legend Media .setting label(for="videos_muted") Mute videos by default: