add nsfw warning pages to posts when nsfw content is disabled

This commit is contained in:
teddit
2020-12-27 23:25:39 +01:00
parent 357c6402cd
commit 5f8e8eb7a3
8 changed files with 224 additions and 154 deletions
+5
View File
@@ -27,6 +27,11 @@ module.exports = function() {
let images = null
let is_self_link = false
let valid_reddit_self_domains = ['reddit.com']
if(data.over_18)
if((config.nsfw_enabled === false && user_preferences.nsfw_enabled != 'true') || user_preferences.nsfw_enabled === 'false')
continue
if(data.domain) {
let tld = data.domain.split('self.')
+5
View File
@@ -1,4 +1,5 @@
module.exports = function() {
const config = require('../config');
this.processJsonUser = function(json, parsed, after, before, user_preferences) {
return new Promise(resolve => {
(async () => {
@@ -39,6 +40,10 @@ module.exports = function() {
let post_id = post.permalink.split('/').slice(-2)[0] + '/'
let url = post.permalink.replace(post_id, '')
if(post.over_18)
if((config.nsfw_enabled === false && user_preferences.nsfw_enabled != 'true') || user_preferences.nsfw_enabled === 'false')
continue
if(type === 't3') {
let duration = null