UNPKG

rsshub

Version:
57 lines (55 loc) 1.92 kB
import "./esm-shims-CzJ_djXG.mjs"; import "./config-C37vj7VH.mjs"; import "./types-D84BRIt4.mjs"; import "./dist-BInvbO1W.mjs"; import "./logger-Czu8UMNd.mjs"; import "./ofetch-BIyrKU3Y.mjs"; import "./parse-date-BrP7mxXf.mjs"; import { a as TabParam, i as TabMap, n as CommonDataProperties, o as TimeRangeParam, r as CommonRouteProperties, s as getPostItems, t as CategoryParam } from "./common-Bz4cAewj.mjs"; //#region lib/routes/voronoiapp/popular.ts const route = { ...CommonRouteProperties, name: "Popular Posts", path: "/popular/:tab?/:time_range?/:category?", radar: [ { title: "Most Liked Posts", source: ["www.voronoiapp.com/posts/most-popular"], target: "/popular/most-popular" }, { title: "Most Discussed Posts", source: ["www.voronoiapp.com/posts/most-discussed"], target: "/popular/most-discussed" }, { title: "Most Viewed Posts", source: ["www.voronoiapp.com/posts/most-viewed"], target: "/popular/most-viewed" } ], parameters: { tab: TabParam, time_range: TimeRangeParam, category: CategoryParam }, example: "/voronoiapp/popular/most-popular/MONTH", handler: async (ctx) => { const { tab = "most-popular", time_range = "MONTH", category = "" } = ctx.req.param(); if (!TabMap[tab.toLowerCase()]) throw new Error(`Invalid tab: ${tab}`); const items = await getPostItems({ swimlane: "POPULAR", tab: TabMap[tab.toLowerCase()], time_range: time_range === "" ? void 0 : time_range.toUpperCase(), category: category === "" ? void 0 : category }); return { ...CommonDataProperties, title: `Voronoi ${TabParam.options.find((option) => option.value === tab.toLowerCase())?.label} Posts in ${TimeRangeParam.options.find((option) => option.value === time_range.toUpperCase())?.label}${category ? ` - ${category}` : ""}`, link: `https://www.voronoiapp.com/posts/${tab}`, item: items }; } }; //#endregion export { route };