Files
RSSHub/lib/routes/voronoiapp/latest.ts
T
CesaryuanandTony f9e891b360 feat(route): add voronoiapp (#16790)
* feat(route): add voronoiapp

* refactor: validate logic

* refactor: validate logic

* refactor: add validation for missing username in author route

* fix: route title

* refactor: update common route properties in voronoiapp routes

* refactor: rename base.ts

* refactor: change categories to picture and set view to Pictures

* refactor: add CommonDataProperties

* Update maintainers name's spell

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Fix voronoiapp/search.ts radar's return url

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Fix post's link

Thanks @TonyRL. In Which Nation is the Most Happy? from /voronoiapp/author/visualcapitalist, post.category is joined by - though a space still work.

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

* Remove reduntant username check code

Co-authored-by: Tony <TonyRL@users.noreply.github.com>

---------
2024-09-25 10:42:15 +08:00

29 lines
924 B
TypeScript

import type { Data, Route } from '@/types';
import { getPostItems, CategoryParam, CommonRouteProperties, CommonDataProperties } from './common';
export const route: Route = {
...CommonRouteProperties,
name: 'Latest Posts',
path: '/latest/:category?',
radar: [
{
source: ['www.voronoiapp.com/posts/latest'],
target: '/latest',
},
],
example: '/voronoiapp/latest',
parameters: {
category: CategoryParam,
},
handler: async (ctx) => {
const { category = '' } = ctx.req.param();
const items = await getPostItems({ swimlane: 'LATEST', category: category === '' ? undefined : category });
return {
...CommonDataProperties,
title: `Voronoi Latest Posts${category ? ` - ${category}` : ''}`,
link: 'https://www.voronoiapp.com/latest',
item: items,
} as Data;
},
};