1
0
mirror of https://codeberg.org/teddit/teddit synced 2025-02-18 05:00:37 +01:00

Update user.js to pass instance_config to template

This commit is contained in:
redmt 2022-06-11 19:35:27 +02:00
parent 53a5766de7
commit 1f6f5d621d

View File

@ -94,6 +94,7 @@ userRoutes.get('/u/:user/:kind?', (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) {
@ -126,6 +127,7 @@ userRoutes.get('/u/:user/:kind?', (req, res, next) => {
sortby: sortby, sortby: sortby,
past: past, past: past,
user_preferences: req.cookies, user_preferences: req.cookies,
instance_config: config,
}); });
} }
})(); })();
@ -166,6 +168,7 @@ userRoutes.get('/u/:user/:kind?', (req, res, next) => {
return res.render('frontpage', { return res.render('frontpage', {
post: null, post: null,
user_preferences: req.cookies, user_preferences: req.cookies,
instance_config: config,
}); });
} else { } else {
(async () => { (async () => {
@ -196,6 +199,7 @@ userRoutes.get('/u/:user/:kind?', (req, res, next) => {
sortby: sortby, sortby: sortby,
past: past, past: past,
user_preferences: req.cookies, user_preferences: req.cookies,
instance_config: config,
}); });
} }
})(); })();
@ -212,6 +216,7 @@ userRoutes.get('/u/:user/:kind?', (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,
}); });
} }
}) })
@ -224,6 +229,7 @@ userRoutes.get('/u/:user/:kind?', (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,
}); });
}); });
}); });
@ -241,6 +247,7 @@ userRoutes.get('/u/:user/:kind?', (req, res, next) => {
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,
}); });
} }
}) })
@ -314,6 +321,7 @@ userRoutes.get('/u/:user/m/:custom_feed/: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) {
@ -350,6 +358,7 @@ userRoutes.get('/u/:user/m/:custom_feed/: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', {
@ -357,6 +366,7 @@ userRoutes.get('/u/:user/m/:custom_feed/: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,
}); });
} }
} }
@ -384,6 +394,7 @@ userRoutes.get('/u/:user/m/:custom_feed/: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(
@ -420,6 +431,7 @@ userRoutes.get('/u/:user/m/:custom_feed/: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,
}); });
} }
})(); })();
@ -440,6 +452,7 @@ userRoutes.get('/u/:user/m/:custom_feed/: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,
}); });
} }
}) })