UNPKG

rsshub

Version:
52 lines (50 loc) 1.67 kB
import "./dist-Bog6z_OM.mjs"; import { t as config } from "./config-MQ-7ebJ_.mjs"; import { t as ViewType } from "./types-gOySfSXJ.mjs"; import "./logger-C4avouvV.mjs"; import "./ofetch-DKl_Ma9g.mjs"; import "./parse-date-r5WDWHno.mjs"; import "./is-worker-DESPicPc.mjs"; import "./cache-SV6W5EPy.mjs"; import "./helpers-Bo4JQYdN.mjs"; import { t as got_default } from "./got-CO-ndVl2.mjs"; import { t as config_not_found_default } from "./config-not-found-zoFMPvbz.mjs"; import { t as utils_default } from "./utils-DLtwWSsg.mjs"; //#region lib/routes/misskey/featured-notes.ts const route = { path: "/notes/featured/:site", categories: ["social-media"], view: ViewType.SocialMedia, example: "/misskey/notes/featured/misskey.io", parameters: { site: "instance address, domain only, without `http://` or `https://` protocol header" }, features: { requireConfig: false, requirePuppeteer: false, antiCrawler: false, supportBT: false, supportPodcast: false, supportScihub: false }, name: "Featured Notes", maintainers: ["Misaka13514"], handler }; async function handler(ctx) { const site = ctx.req.param("site"); if (!config.feature.allow_user_supply_unsafe_domain && !utils_default.allowSiteList.includes(site)) throw new config_not_found_default(`This RSS is disabled unless 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN' is set to 'true'.`); const list = (await got_default({ method: "post", url: `https://${site}/api/notes/featured`, json: { limit: 10, offset: 0 } })).data; return { title: `Featured Notes on ${site}`, link: `https://${site}/explore`, item: utils_default.parseNotes(list, site) }; } //#endregion export { route };