Skip to content

Commit

Permalink
refactor(route): set lemmy sort param to enum and add popular category
Browse files Browse the repository at this point in the history
  • Loading branch information
pseudoyu committed Sep 24, 2024
1 parent a95c5b6 commit 58e6fe5
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions lib/routes/lemmy/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,41 @@ import ConfigNotFoundError from '@/errors/types/config-not-found';

export const route: Route = {
path: '/:community/:sort?',
categories: ['social-media'],
categories: ['social-media', 'popular'],
example: '/lemmy/technology@lemmy.world/Hot',
parameters: { community: 'Lemmmy community, for example technology@lemmy.world', sort: 'Sort by, defaut to Active' },
parameters: {
community: 'Lemmmy community, for example technology@lemmy.world',
sort: {
description: 'Sort by',
options: [
{ value: 'Active', label: 'Active' },
{ value: 'Hot', label: 'Hot' },
{ value: 'New', label: 'New' },
{ value: 'Old', label: 'Old' },
{ value: 'TopDay', label: 'TopDay' },
{ value: 'TopWeek', label: 'TopWeek' },
{ value: 'TopMonth', label: 'TopMonth' },
{ value: 'TopYear', label: 'TopYear' },
{ value: 'TopAll', label: 'TopAll' },
{ value: 'MostComments', label: 'MostComments' },
{ value: 'NewComments', label: 'NewComments' },
{ value: 'TopHour', label: 'TopHour' },
{ value: 'TopSixHour', label: 'TopSixHour' },
{ value: 'TopTwelveHour', label: 'TopTwelveHour' },
{ value: 'TopThreeMonths', label: 'TopThreeMonths' },
{ value: 'TopSixMonths', label: 'TopSixMonths' },
{ value: 'TopNineMonths', label: 'TopNineMonths' },
{ value: 'Controversial', label: 'Controversial' },
{ value: 'Scaled', label: 'Scaled' },
],
default: 'Active',
},
},
features: {
requireConfig: [
{
name: 'ALLOW_USER_SUPPLY_UNSAFE_DOMAIN',
description: '',
description: 'Allow user to supply unsafe domain',
},
],
requirePuppeteer: false,
Expand All @@ -27,7 +54,7 @@ export const route: Route = {
supportScihub: false,
},
name: 'Community',
maintainers: ['wb14123'],
maintainers: ['wb14123', 'pseudoyu'],
handler,
};

Expand Down

0 comments on commit 58e6fe5

Please sign in to comment.