Skip to content

Commit

Permalink
fix(route/mastodon): Correct the only_media param
Browse files Browse the repository at this point in the history
  • Loading branch information
sinchang committed Nov 11, 2024
1 parent ef86602 commit db5abba
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/routes/mastodon/account-id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const route: Route = {
async function handler(ctx) {
const site = ctx.req.param('site');
const account_id = ctx.req.param('account_id');
const only_media = ctx.req.param('only_media') ? 'true' : 'false';
const only_media = ctx.req.param('only_media') === 'true' ? 'true' : 'false';
if (!config.feature.allow_user_supply_unsafe_domain && !utils.allowSiteList.includes(site)) {
throw new ConfigNotFoundError(`This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/mastodon/acct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ However, you can still specify these route-specific configurations if you need t

async function handler(ctx) {
const acct = ctx.req.param('acct');
const only_media = ctx.req.param('only_media') ? 'true' : 'false';
const only_media = ctx.req.param('only_media') === 'true' ? 'true' : 'false';

const { site, account_id } = await utils.getAccountIdByAcct(acct);

Expand Down
4 changes: 2 additions & 2 deletions lib/routes/mastodon/timeline-local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const route: Route = {

async function handler(ctx) {
const site = ctx.req.param('site');
const only_media = ctx.req.param('only_media') ? 'true' : 'false';
const only_media = ctx.req.param('only_media') === 'true' ? 'true' : 'false';
if (!config.feature.allow_user_supply_unsafe_domain && !utils.allowSiteList.includes(site)) {
throw new ConfigNotFoundError(`This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
}
Expand All @@ -47,7 +47,7 @@ async function handler(ctx) {
const list = response.data;

return {
title: `Local Public${ctx.req.param('only_media') ? ' Media' : ''} Timeline on ${site}`,
title: `Local Public${ctx.req.param('only_media') === 'true' ? ' Media' : ''} Timeline on ${site}`,
link: `https://${site}`,
item: utils.parseStatuses(list),
};
Expand Down
4 changes: 2 additions & 2 deletions lib/routes/mastodon/timeline-remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const route: Route = {

async function handler(ctx) {
const site = ctx.req.param('site');
const only_media = ctx.req.param('only_media') ? 'true' : 'false';
const only_media = ctx.req.param('only_media') === 'true' ? 'true' : 'false';
if (!config.feature.allow_user_supply_unsafe_domain && !utils.allowSiteList.includes(site)) {
throw new ConfigNotFoundError(`This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`);
}
Expand All @@ -47,7 +47,7 @@ async function handler(ctx) {
const list = response.data;

return {
title: `Federated Public${ctx.req.param('only_media') ? ' Media' : ''} Timeline on ${site}`,
title: `Federated Public${ctx.req.param('only_media') === 'true' ? ' Media' : ''} Timeline on ${site}`,
link: `https://${site}`,
item: utils.parseStatuses(list),
};
Expand Down

0 comments on commit db5abba

Please sign in to comment.