fix(route/mastodon): Correct the only_media param (#17531)

This commit is contained in:
Jeff Wen
2024-11-11 13:23:20 +08:00
committed by GitHub
parent a490992da2
commit 787cb1c76a
4 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -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'.`);
}
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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'.`);
}
@@ -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),
};
+2 -2
View File
@@ -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'.`);
}
@@ -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),
};