Rename index.pug to frontpage.pug

This commit is contained in:
redmt 2022-06-10 20:05:36 +02:00
parent 354180119f
commit 27ade36805
7 changed files with 31 additions and 31 deletions

View File

@ -30,7 +30,7 @@ module.exports = function(fetch) {
} else { } else {
console.error(`Something went wrong while trying to get an access token from reddit API. ${result.status} ${result.statusText}`) console.error(`Something went wrong while trying to get an access token from reddit API. ${result.status} ${result.statusText}`)
console.error(reddit_api_error_text) console.error(reddit_api_error_text)
return res.render('index', { json: null, http_status_code: result.status }) return res.render('frontpage', { json: null, http_status_code: result.status })
} }
}).catch(error => { }).catch(error => {
console.log(`Error while obtaining a reddit API key.`, error) console.log(`Error while obtaining a reddit API key.`, error)
@ -66,7 +66,7 @@ module.exports = function(fetch) {
} else { } else {
console.error(`Something went wrong while fetching data from reddit API. ${result.status} ${result.statusText}`) console.error(`Something went wrong while fetching data from reddit API. ${result.status} ${result.statusText}`)
console.error(reddit_api_error_text) console.error(reddit_api_error_text)
return res.render('index', { json: null, http_status_code: result.status }) return res.render('frontpage', { json: null, http_status_code: result.status })
} }
}).catch(error => { }).catch(error => {
console.log(`Error while refreshing the reddit API key.`, error) console.log(`Error while refreshing the reddit API key.`, error)

View File

@ -122,7 +122,7 @@ homeRoute.get('/:sort?', async (req, res, next) => {
redis.get(key, (error, json) => { redis.get(key, (error, json) => {
if (error) { if (error) {
console.error('Error getting the frontpage key from redis.', error); console.error('Error getting the frontpage key from redis.', error);
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -148,7 +148,7 @@ homeRoute.get('/:sort?', async (req, res, next) => {
null, null,
req.cookies req.cookies
); );
return res.render('index', { return res.render('frontpage', {
json: processed_json, json: processed_json,
sortby: sortby, sortby: sortby,
past: past, past: past,
@ -184,7 +184,7 @@ homeRoute.get('/:sort?', async (req, res, next) => {
'Error setting the frontpage key to redis.', 'Error setting the frontpage key to redis.',
error error
); );
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -209,7 +209,7 @@ homeRoute.get('/:sort?', async (req, res, next) => {
null, null,
req.cookies req.cookies
); );
return res.render('index', { return res.render('frontpage', {
json: processed_json, json: processed_json,
sortby: sortby, sortby: sortby,
past: past, past: past,
@ -227,7 +227,7 @@ homeRoute.get('/:sort?', async (req, res, next) => {
`Something went wrong while fetching data from Reddit. ${result.status} ${result.statusText}` `Something went wrong while fetching data from Reddit. ${result.status} ${result.statusText}`
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
user_preferences: req.cookies, user_preferences: req.cookies,

View File

@ -42,7 +42,7 @@ preferenceRoutes.get('/import_prefs/:key', (req, res, next) => {
`Error getting the preferences import key ${key} from redis.`, `Error getting the preferences import key ${key} from redis.`,
error error
); );
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });

View File

@ -214,7 +214,7 @@ saveRoutes.get(
'Error getting the short URL for post key from redis.', 'Error getting the short URL for post key from redis.',
error error
); );
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -257,7 +257,7 @@ saveRoutes.get(
'Error setting the short URL for post key to redis.', 'Error setting the short URL for post key to redis.',
error error
); );
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -287,7 +287,7 @@ saveRoutes.get(
`Something went wrong while fetching data from Reddit. ${result.status} ${result.statusText}` `Something went wrong while fetching data from Reddit. ${result.status} ${result.statusText}`
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
user_preferences: req.cookies, user_preferences: req.cookies,

View File

@ -65,7 +65,7 @@ subredditRoutes.get('/r/:subreddit/search', (req, res, next) => {
redis.get(key, (error, json) => { redis.get(key, (error, json) => {
if (error) { if (error) {
console.error('Error getting the search key from redis.', error); console.error('Error getting the search key from redis.', error);
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -126,7 +126,7 @@ subredditRoutes.get('/r/:subreddit/search', (req, res, next) => {
'Error setting the searches key to redis.', 'Error setting the searches key to redis.',
error error
); );
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -162,7 +162,7 @@ subredditRoutes.get('/r/:subreddit/search', (req, res, next) => {
`Something went wrong while fetching data from Reddit. ${result.status} ${result.statusText}` `Something went wrong while fetching data from Reddit. ${result.status} ${result.statusText}`
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
user_preferences: req.cookies, user_preferences: req.cookies,
@ -206,7 +206,7 @@ subredditRoutes.get(
`Error getting the ${subreddit} wiki key from redis.`, `Error getting the ${subreddit} wiki key from redis.`,
error error
); );
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -271,7 +271,7 @@ subredditRoutes.get(
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
} }
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
user_preferences: req.cookies, user_preferences: req.cookies,
@ -339,7 +339,7 @@ subredditRoutes.get('/r/random', (req, res, next) => {
); );
} else { } else {
console.error(`Fetching random subreddit failed.`, json); console.error(`Fetching random subreddit failed.`, json);
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -354,7 +354,7 @@ subredditRoutes.get('/r/random', (req, res, next) => {
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
} }
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
user_preferences: req.cookies, user_preferences: req.cookies,
@ -420,7 +420,7 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
redis.get(key, (error, json) => { redis.get(key, (error, json) => {
if (error) { if (error) {
console.error(`Error getting the ${subreddit} key from redis.`, error); console.error(`Error getting the ${subreddit} key from redis.`, error);
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -557,7 +557,7 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
} }
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
user_preferences: req.cookies, user_preferences: req.cookies,
@ -620,7 +620,7 @@ subredditRoutes.get(
`Error getting the ${comments_url} key from redis.`, `Error getting the ${comments_url} key from redis.`,
error error
); );
return res.render('index', { return res.render('frontpage', {
post: null, post: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -759,7 +759,7 @@ subredditRoutes.get(
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
} }
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
http_statustext: result.statusText, http_statustext: result.statusText,
@ -841,7 +841,7 @@ subredditRoutes.get('/subreddits/:sort?', (req, res, next) => {
redis.get(key, (error, json) => { redis.get(key, (error, json) => {
if (error) { if (error) {
console.error(`Error getting the subreddits key from redis.`, error); console.error(`Error getting the subreddits key from redis.`, error);
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -942,7 +942,7 @@ subredditRoutes.get('/subreddits/:sort?', (req, res, next) => {
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
} }
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
user_preferences: req.cookies, user_preferences: req.cookies,

View File

@ -91,7 +91,7 @@ userRoutes.get('/u/:user/:kind?', (req, res, next) => {
redis.get(key, (error, json) => { redis.get(key, (error, json) => {
if (error) { if (error) {
console.error(`Error getting the user ${key} key from redis.`, error); console.error(`Error getting the user ${key} key from redis.`, error);
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -163,7 +163,7 @@ userRoutes.get('/u/:user/:kind?', (req, res, next) => {
`Error setting the user ${key} key to redis.`, `Error setting the user ${key} key to redis.`,
error error
); );
return res.render('index', { return res.render('frontpage', {
post: null, post: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -208,7 +208,7 @@ userRoutes.get('/u/:user/:kind?', (req, res, next) => {
`Something went wrong while fetching data from Reddit. ${result.status} ${result.statusText}` `Something went wrong while fetching data from Reddit. ${result.status} ${result.statusText}`
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
user_preferences: req.cookies, user_preferences: req.cookies,
@ -220,7 +220,7 @@ userRoutes.get('/u/:user/:kind?', (req, res, next) => {
`Error fetching the overview JSON file from reddit.com/u/${user}`, `Error fetching the overview JSON file from reddit.com/u/${user}`,
error error
); );
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
user_preferences: req.cookies, user_preferences: req.cookies,
@ -236,7 +236,7 @@ userRoutes.get('/u/:user/:kind?', (req, res, next) => {
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
} }
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
http_statustext: result.statusText, http_statustext: result.statusText,
@ -311,7 +311,7 @@ userRoutes.get('/u/:user/m/:custom_feed/:sort?', (req, res, next) => {
`Error getting the ${user} custom_feed key from redis.`, `Error getting the ${user} custom_feed key from redis.`,
error error
); );
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
user_preferences: req.cookies, user_preferences: req.cookies,
}); });
@ -436,7 +436,7 @@ userRoutes.get('/u/:user/m/:custom_feed/:sort?', (req, res, next) => {
); );
console.error(config.reddit_api_error_text); console.error(config.reddit_api_error_text);
} }
return res.render('index', { return res.render('frontpage', {
json: null, json: null,
http_status_code: result.status, http_status_code: result.status,
user_preferences: req.cookies, user_preferences: req.cookies,