From 9fd891b4742b44522d8bd29354b13b00b23c42c3 Mon Sep 17 00:00:00 2001 From: redmt Date: Sat, 11 Jun 2022 21:04:55 +0200 Subject: [PATCH] Add setting to show large gallery images with captions --- routes/preferences.js | 8 ++++++++ views/preferences.pug | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/routes/preferences.js b/routes/preferences.js index 9d7169b..e36c28b 100644 --- a/routes/preferences.js +++ b/routes/preferences.js @@ -17,6 +17,7 @@ function resetPreferences(res) { res.clearCookie('domain_instagram'); res.clearCookie('videos_muted'); res.clearCookie('prefer_frontpage'); + res.clearCookie('show_large_gallery_images'); } preferenceRoutes.get('/preferences', (req, res, next) => { @@ -91,6 +92,7 @@ preferenceRoutes.post('/saveprefs', (req, res, next) => { let domain_instagram = req.body.domain_instagram; let videos_muted = req.body.videos_muted; let prefer_frontpage = req.body.prefer_frontpage; + let show_large_gallery_images = req.body.show_large_gallery_images; res.cookie('theme', theme, { maxAge: 365 * 24 * 60 * 60 * 1000, @@ -174,6 +176,12 @@ preferenceRoutes.post('/saveprefs', (req, res, next) => { httpOnly: true, }); + if (show_large_gallery_images === 'on') show_large_gallery_images = 'true'; + res.cookie('show_large_gallery_images', show_large_gallery_images, { + maxAge: 365 * 24 * 60 * 60 * 1000, + httpOnly: true, + }); + return res.redirect('/preferences'); }); diff --git a/views/preferences.pug b/views/preferences.pug index 8a0d220..08c935b 100644 --- a/views/preferences.pug +++ b/views/preferences.pug @@ -126,6 +126,12 @@ html input(type="checkbox", name="videos_muted", id="videos_muted", checked="checked") else input(type="checkbox", name="videos_muted", id="videos_muted") + .setting + label(for="show_large_gallery_images") Show large gallery images with captions: + if (user_preferences.show_large_gallery_images == 'true') + input(type="checkbox", name="show_large_gallery_images", id="show_large_gallery_images", checked="checked") + else + input(type="checkbox", name="show_large_gallery_images", id="show_large_gallery_images") small(class="notice") Preferences are stored client-side using cookies without any personal information. br input(type="submit", value="Save preferences")