Add setting to show large gallery images with captions

This commit is contained in:
redmt 2022-06-11 21:04:55 +02:00
parent 0bf27cfd6c
commit 9fd891b474
2 changed files with 14 additions and 0 deletions

View File

@ -17,6 +17,7 @@ function resetPreferences(res) {
res.clearCookie('domain_instagram'); res.clearCookie('domain_instagram');
res.clearCookie('videos_muted'); res.clearCookie('videos_muted');
res.clearCookie('prefer_frontpage'); res.clearCookie('prefer_frontpage');
res.clearCookie('show_large_gallery_images');
} }
preferenceRoutes.get('/preferences', (req, res, next) => { preferenceRoutes.get('/preferences', (req, res, next) => {
@ -91,6 +92,7 @@ preferenceRoutes.post('/saveprefs', (req, res, next) => {
let domain_instagram = req.body.domain_instagram; let domain_instagram = req.body.domain_instagram;
let videos_muted = req.body.videos_muted; let videos_muted = req.body.videos_muted;
let prefer_frontpage = req.body.prefer_frontpage; let prefer_frontpage = req.body.prefer_frontpage;
let show_large_gallery_images = req.body.show_large_gallery_images;
res.cookie('theme', theme, { res.cookie('theme', theme, {
maxAge: 365 * 24 * 60 * 60 * 1000, maxAge: 365 * 24 * 60 * 60 * 1000,
@ -174,6 +176,12 @@ preferenceRoutes.post('/saveprefs', (req, res, next) => {
httpOnly: true, 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'); return res.redirect('/preferences');
}); });

View File

@ -126,6 +126,12 @@ html
input(type="checkbox", name="videos_muted", id="videos_muted", checked="checked") input(type="checkbox", name="videos_muted", id="videos_muted", checked="checked")
else else
input(type="checkbox", name="videos_muted", id="videos_muted") 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. small(class="notice") Preferences are stored client-side using cookies without any personal information.
br br
input(type="submit", value="Save preferences") input(type="submit", value="Save preferences")