mirror of
https://codeberg.org/teddit/teddit
synced 2025-02-01 20:07:21 +01:00
Merge pull request 'Add option to hide posts upvotes and comments points' (#293) from sartateme/teddit:main into main
Reviewed-on: https://codeberg.org/teddit/teddit/pulls/293
This commit is contained in:
commit
d71c88871c
@ -36,6 +36,7 @@ const config = {
|
|||||||
cache_control: !('CACHE_CONTROL' in process.env) || process.env.CACHE_CONTROL === 'true', // If true, teddit will automatically remove all cached static files. By default this is set to true.
|
cache_control: !('CACHE_CONTROL' in process.env) || process.env.CACHE_CONTROL === 'true', // If true, teddit will automatically remove all cached static files. By default this is set to true.
|
||||||
cache_control_interval: process.env.CACHE_CONTROL_INTERVAL || 24, // How often the cache directory for static files is emptied (in hours). Requires cache_control to be true. Default is every 24 hours.
|
cache_control_interval: process.env.CACHE_CONTROL_INTERVAL || 24, // How often the cache directory for static files is emptied (in hours). Requires cache_control to be true. Default is every 24 hours.
|
||||||
show_upvoted_percentage: !('SHOW_UPVOTED_PERCENTAGE' in process.env) || process.env.SHOW_UPVOTED_PERCENTAGE === 'true',
|
show_upvoted_percentage: !('SHOW_UPVOTED_PERCENTAGE' in process.env) || process.env.SHOW_UPVOTED_PERCENTAGE === 'true',
|
||||||
|
show_upvotes: !('SHOW_UPVOTES' in process.env) || process.env.SHOW_UPVOTES === 'true', // If true, teddit will show number of upvotes in posts and points in comments.
|
||||||
post_media_max_heights: {
|
post_media_max_heights: {
|
||||||
/**
|
/**
|
||||||
* Sets the max-height value for images and videos in posts.
|
* Sets the max-height value for images and videos in posts.
|
||||||
|
1606
package-lock.json
generated
1606
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -10,6 +10,7 @@ function resetPreferences(res) {
|
|||||||
res.clearCookie('post_media_max_height');
|
res.clearCookie('post_media_max_height');
|
||||||
res.clearCookie('collapse_child_comments');
|
res.clearCookie('collapse_child_comments');
|
||||||
res.clearCookie('show_upvoted_percentage');
|
res.clearCookie('show_upvoted_percentage');
|
||||||
|
res.clearCookie('show_upvotes')
|
||||||
res.clearCookie('subbed_subreddits');
|
res.clearCookie('subbed_subreddits');
|
||||||
res.clearCookie('domain_twitter');
|
res.clearCookie('domain_twitter');
|
||||||
res.clearCookie('domain_youtube');
|
res.clearCookie('domain_youtube');
|
||||||
@ -82,6 +83,7 @@ preferenceRoutes.post('/saveprefs', (req, res, next) => {
|
|||||||
let post_media_max_height = req.body.post_media_max_height;
|
let post_media_max_height = req.body.post_media_max_height;
|
||||||
let collapse_child_comments = req.body.collapse_child_comments;
|
let collapse_child_comments = req.body.collapse_child_comments;
|
||||||
let show_upvoted_percentage = req.body.show_upvoted_percentage;
|
let show_upvoted_percentage = req.body.show_upvoted_percentage;
|
||||||
|
let show_upvotes = req.body.show_upvotes;
|
||||||
let domain_twitter = req.body.domain_twitter;
|
let domain_twitter = req.body.domain_twitter;
|
||||||
let domain_youtube = req.body.domain_youtube;
|
let domain_youtube = req.body.domain_youtube;
|
||||||
let domain_instagram = req.body.domain_instagram;
|
let domain_instagram = req.body.domain_instagram;
|
||||||
@ -136,6 +138,13 @@ preferenceRoutes.post('/saveprefs', (req, res, next) => {
|
|||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (show_upvotes === 'on') show_upvotes = 'true';
|
||||||
|
else show_upvotes = 'false';
|
||||||
|
res.cookie('show_upvotes', show_upvotes, {
|
||||||
|
maxAge: 365 * 24 * 60 * 60 * 1000,
|
||||||
|
httpOnly: true,
|
||||||
|
});
|
||||||
|
|
||||||
if (videos_muted === 'on') videos_muted = 'true';
|
if (videos_muted === 'on') videos_muted = 'true';
|
||||||
else videos_muted = 'false';
|
else videos_muted = 'false';
|
||||||
res.cookie('videos_muted', videos_muted, {
|
res.cookie('videos_muted', videos_muted, {
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
.link
|
.link
|
||||||
|
if user_preferences.show_upvotes === 'false'
|
||||||
|
style.
|
||||||
|
.upvotes {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
.upvotes
|
.upvotes
|
||||||
.arrow
|
.arrow
|
||||||
span #{kFormatter(link.ups)}
|
span #{kFormatter(link.ups)}
|
||||||
|
@ -38,6 +38,7 @@ html
|
|||||||
#intro
|
#intro
|
||||||
h1 Welcome to teddit
|
h1 Welcome to teddit
|
||||||
h2 the alternative, privacy respecting, front page of internet.
|
h2 the alternative, privacy respecting, front page of internet.
|
||||||
|
|
||||||
#links.sr
|
#links.sr
|
||||||
if sortby === 'top' || sortby === 'controversial'
|
if sortby === 'top' || sortby === 'controversial'
|
||||||
details
|
details
|
||||||
|
@ -46,6 +46,12 @@ html
|
|||||||
video_muted = false
|
video_muted = false
|
||||||
}
|
}
|
||||||
.info
|
.info
|
||||||
|
if user_preferences.show_upvotes === 'false'
|
||||||
|
style.
|
||||||
|
.comment .meta .ups, #post .score, #user .upvotes {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.score
|
.score
|
||||||
div.arrow
|
div.arrow
|
||||||
span #{kFormatter(post.ups)}
|
span #{kFormatter(post.ups)}
|
||||||
|
@ -96,6 +96,12 @@ html
|
|||||||
input(type="checkbox", name="show_upvoted_percentage", id="show_upvoted_percentage", checked="checked")
|
input(type="checkbox", name="show_upvoted_percentage", id="show_upvoted_percentage", checked="checked")
|
||||||
else
|
else
|
||||||
input(type="checkbox", name="show_upvoted_percentage", id="show_upvoted_percentage")
|
input(type="checkbox", name="show_upvoted_percentage", id="show_upvoted_percentage")
|
||||||
|
.setting
|
||||||
|
label(for="show_upvotes") Show upvotes:
|
||||||
|
if (user_preferences.show_upvotes == 'true')
|
||||||
|
input(type="checkbox", name="show_upvotes", id="show_upvotes", checked="checked")
|
||||||
|
else
|
||||||
|
input(type="checkbox", name="show_upvotes", id="show_upvotes")
|
||||||
legend Media
|
legend Media
|
||||||
.setting
|
.setting
|
||||||
label(for="videos_muted") Mute videos by default:
|
label(for="videos_muted") Mute videos by default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user