mirror of
https://codeberg.org/teddit/teddit
synced 2025-02-07 06:35:39 +01:00
Update subreddit.js to pass instance_config to template
This commit is contained in:
parent
20db540b5c
commit
afbad4ae3b
@ -28,6 +28,7 @@ subredditRoutes.get('/r/:subreddit/search', (req, res, next) => {
|
|||||||
sortby: undefined,
|
sortby: undefined,
|
||||||
past: undefined,
|
past: undefined,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +69,7 @@ subredditRoutes.get('/r/:subreddit/search', (req, res, next) => {
|
|||||||
return res.render('frontpage', {
|
return res.render('frontpage', {
|
||||||
json: null,
|
json: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (json) {
|
if (json) {
|
||||||
@ -90,6 +92,7 @@ subredditRoutes.get('/r/:subreddit/search', (req, res, next) => {
|
|||||||
sortby: sortby,
|
sortby: sortby,
|
||||||
past: past,
|
past: past,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
} else {
|
} else {
|
||||||
@ -129,6 +132,7 @@ subredditRoutes.get('/r/:subreddit/search', (req, res, next) => {
|
|||||||
return res.render('frontpage', {
|
return res.render('frontpage', {
|
||||||
json: null,
|
json: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('Fetched search results from Reddit.');
|
console.log('Fetched search results from Reddit.');
|
||||||
@ -150,6 +154,7 @@ subredditRoutes.get('/r/:subreddit/search', (req, res, next) => {
|
|||||||
sortby: sortby,
|
sortby: sortby,
|
||||||
past: past,
|
past: past,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
@ -166,6 +171,7 @@ subredditRoutes.get('/r/:subreddit/search', (req, res, next) => {
|
|||||||
json: null,
|
json: null,
|
||||||
http_status_code: result.status,
|
http_status_code: result.status,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -209,6 +215,7 @@ subredditRoutes.get(
|
|||||||
return res.render('frontpage', {
|
return res.render('frontpage', {
|
||||||
json: null,
|
json: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (json) {
|
if (json) {
|
||||||
@ -221,6 +228,7 @@ subredditRoutes.get(
|
|||||||
: formatWikipagelisting(json, subreddit),
|
: formatWikipagelisting(json, subreddit),
|
||||||
subreddit: subreddit,
|
subreddit: subreddit,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
let url = '';
|
let url = '';
|
||||||
@ -245,6 +253,7 @@ subredditRoutes.get(
|
|||||||
return res.render('subreddit', {
|
return res.render('subreddit', {
|
||||||
json: null,
|
json: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
@ -257,6 +266,7 @@ subredditRoutes.get(
|
|||||||
: formatWikipagelisting(json, subreddit),
|
: formatWikipagelisting(json, subreddit),
|
||||||
subreddit: subreddit,
|
subreddit: subreddit,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,6 +285,7 @@ subredditRoutes.get(
|
|||||||
json: null,
|
json: null,
|
||||||
http_status_code: result.status,
|
http_status_code: result.status,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -328,6 +339,7 @@ subredditRoutes.get('/r/random', (req, res, next) => {
|
|||||||
return res.render('subreddit', {
|
return res.render('subreddit', {
|
||||||
json: null,
|
json: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
@ -342,6 +354,7 @@ subredditRoutes.get('/r/random', (req, res, next) => {
|
|||||||
return res.render('frontpage', {
|
return res.render('frontpage', {
|
||||||
json: null,
|
json: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -358,6 +371,7 @@ subredditRoutes.get('/r/random', (req, res, next) => {
|
|||||||
json: null,
|
json: null,
|
||||||
http_status_code: result.status,
|
http_status_code: result.status,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -423,6 +437,7 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
|
|||||||
return res.render('frontpage', {
|
return res.render('frontpage', {
|
||||||
json: null,
|
json: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (json) {
|
if (json) {
|
||||||
@ -465,6 +480,7 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
|
|||||||
redis_key: key,
|
redis_key: key,
|
||||||
after: req.query.after,
|
after: req.query.after,
|
||||||
before: req.query.before,
|
before: req.query.before,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return res.render('subreddit', {
|
return res.render('subreddit', {
|
||||||
@ -472,6 +488,7 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
|
|||||||
error: true,
|
error: true,
|
||||||
data: processed_json,
|
data: processed_json,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -499,6 +516,7 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
|
|||||||
return res.render('subreddit', {
|
return res.render('subreddit', {
|
||||||
json: null,
|
json: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
@ -541,6 +559,7 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
|
|||||||
redis_key: key,
|
redis_key: key,
|
||||||
after: req.query.after,
|
after: req.query.after,
|
||||||
before: req.query.before,
|
before: req.query.before,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@ -561,6 +580,7 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
|
|||||||
json: null,
|
json: null,
|
||||||
http_status_code: result.status,
|
http_status_code: result.status,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -623,6 +643,7 @@ subredditRoutes.get(
|
|||||||
return res.render('frontpage', {
|
return res.render('frontpage', {
|
||||||
post: null,
|
post: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (json) {
|
if (json) {
|
||||||
@ -670,6 +691,7 @@ subredditRoutes.get(
|
|||||||
instance_videos_muted: config.videos_muted,
|
instance_videos_muted: config.videos_muted,
|
||||||
post_media_max_heights: config.post_media_max_heights,
|
post_media_max_heights: config.post_media_max_heights,
|
||||||
redis_key: comments_key,
|
redis_key: comments_key,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
} else {
|
} else {
|
||||||
@ -696,6 +718,7 @@ subredditRoutes.get(
|
|||||||
return res.render('post', {
|
return res.render('post', {
|
||||||
post: null,
|
post: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
@ -744,6 +767,7 @@ subredditRoutes.get(
|
|||||||
instance_videos_muted: config.videos_muted,
|
instance_videos_muted: config.videos_muted,
|
||||||
post_media_max_heights: config.post_media_max_heights,
|
post_media_max_heights: config.post_media_max_heights,
|
||||||
redis_key: comments_key,
|
redis_key: comments_key,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
@ -764,6 +788,7 @@ subredditRoutes.get(
|
|||||||
http_status_code: result.status,
|
http_status_code: result.status,
|
||||||
http_statustext: result.statusText,
|
http_statustext: result.statusText,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -844,6 +869,7 @@ subredditRoutes.get('/subreddits/:sort?', (req, res, next) => {
|
|||||||
return res.render('frontpage', {
|
return res.render('frontpage', {
|
||||||
json: null,
|
json: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (json) {
|
if (json) {
|
||||||
@ -867,6 +893,7 @@ subredditRoutes.get('/subreddits/:sort?', (req, res, next) => {
|
|||||||
subreddits_front: !before && !after ? true : false,
|
subreddits_front: !before && !after ? true : false,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
instance_nsfw_enabled: config.nsfw_enabled,
|
instance_nsfw_enabled: config.nsfw_enabled,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return res.render('subreddits_explore', {
|
return res.render('subreddits_explore', {
|
||||||
@ -874,6 +901,7 @@ subredditRoutes.get('/subreddits/:sort?', (req, res, next) => {
|
|||||||
error: true,
|
error: true,
|
||||||
data: processed_json,
|
data: processed_json,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
@ -907,6 +935,7 @@ subredditRoutes.get('/subreddits/:sort?', (req, res, next) => {
|
|||||||
return res.render('subreddits_explore', {
|
return res.render('subreddits_explore', {
|
||||||
json: null,
|
json: null,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(`Fetched the JSON from reddit.com/subreddits.`);
|
console.log(`Fetched the JSON from reddit.com/subreddits.`);
|
||||||
@ -928,6 +957,7 @@ subredditRoutes.get('/subreddits/:sort?', (req, res, next) => {
|
|||||||
subreddits_front: !before && !after ? true : false,
|
subreddits_front: !before && !after ? true : false,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
instance_nsfw_enabled: config.nsfw_enabled,
|
instance_nsfw_enabled: config.nsfw_enabled,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
@ -946,6 +976,7 @@ subredditRoutes.get('/subreddits/:sort?', (req, res, next) => {
|
|||||||
json: null,
|
json: null,
|
||||||
http_status_code: result.status,
|
http_status_code: result.status,
|
||||||
user_preferences: req.cookies,
|
user_preferences: req.cookies,
|
||||||
|
instance_config: config,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user