mirror of
https://codeberg.org/teddit/teddit
synced 2025-01-21 14:27:47 +01:00
Merge pull request 'API light mode subreddit' (#277) from gawii0/teddit:main into main
Reviewed-on: https://codeberg.org/teddit/teddit/pulls/277
This commit is contained in:
commit
ab076d020f
@ -9,7 +9,8 @@ module.exports = function () {
|
||||
from,
|
||||
api_type,
|
||||
api_target,
|
||||
subreddit
|
||||
subreddit,
|
||||
mode
|
||||
) => {
|
||||
if (!config.api_enabled) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
@ -182,6 +183,10 @@ module.exports = function () {
|
||||
}
|
||||
}
|
||||
|
||||
if (mode === 'light') {
|
||||
processed_json.selftext_html = null;
|
||||
}
|
||||
|
||||
return res.end(JSON.stringify(processed_json));
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,8 @@ homeRoute.get('/:sort?', async (req, res, next) => {
|
||||
'redis',
|
||||
api_type,
|
||||
api_target,
|
||||
'/'
|
||||
'/',
|
||||
'full'
|
||||
);
|
||||
} else {
|
||||
let processed_json = await processJsonSubreddit(
|
||||
@ -168,7 +169,8 @@ homeRoute.get('/:sort?', async (req, res, next) => {
|
||||
'from_online',
|
||||
api_type,
|
||||
api_target,
|
||||
'/'
|
||||
'/',
|
||||
'full'
|
||||
);
|
||||
} else {
|
||||
let processed_json = await processJsonSubreddit(
|
||||
|
@ -373,6 +373,7 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
|
||||
let api_req = req.query.api;
|
||||
let api_type = req.query.type;
|
||||
let api_target = req.query.target;
|
||||
let api_mode = req.query.mode;
|
||||
|
||||
if (req.query.hasOwnProperty('api')) api_req = true;
|
||||
else api_req = false;
|
||||
@ -430,7 +431,8 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
|
||||
'redis',
|
||||
api_type,
|
||||
api_target,
|
||||
subreddit
|
||||
subreddit,
|
||||
api_mode
|
||||
);
|
||||
} else {
|
||||
let processed_json = await processJsonSubreddit(
|
||||
@ -506,7 +508,8 @@ subredditRoutes.get('/r/:subreddit/:sort?', (req, res, next) => {
|
||||
'from_online',
|
||||
api_type,
|
||||
api_target,
|
||||
subreddit
|
||||
subreddit,
|
||||
api_mode
|
||||
);
|
||||
} else {
|
||||
let processed_json = await processJsonSubreddit(
|
||||
|
@ -327,7 +327,8 @@ userRoutes.get('/u/:user/m/:custom_feed/:sort?', (req, res, next) => {
|
||||
'redis',
|
||||
api_type,
|
||||
api_target,
|
||||
subreddit
|
||||
subreddit,
|
||||
'full'
|
||||
);
|
||||
} else {
|
||||
let processed_json = await processJsonSubreddit(
|
||||
@ -397,7 +398,8 @@ userRoutes.get('/u/:user/m/:custom_feed/:sort?', (req, res, next) => {
|
||||
'from_online',
|
||||
api_type,
|
||||
api_target,
|
||||
subreddit
|
||||
subreddit,
|
||||
'full'
|
||||
);
|
||||
} else {
|
||||
let processed_json = await processJsonSubreddit(
|
||||
|
Loading…
Reference in New Issue
Block a user