Skip to content

Proposal to reduce router development and maintenance costs by using standardized manifest files #14685

@DIYgod

Description

@DIYgod

What feature is it?

To add a new route, developers currently have to create three files in the namespace: maintainer.ts, radar.ts, and router.ts, as well as manually adding documents. This process is cumbersome, non-standardized, error-prone, and challenging for review. To address this issue, a new development and maintenance approach is suggested: simply include a manifest.ts file with all necessary information in a fixed format within the namespace. The RSSHub core will then read this manifest file to load routes. Moreover, automated scripts will generate the required markdown files for documentation purposes.

What problem does this feature solve?

As mentioned above

Additional description

Update2: Implement here #14718

Update1: #14685 (comment)

(Outdated) I propose a preliminary manifest format here:

type Route = {
    name: string;
    url?: string;
    maintainers: string[];
    handler: string;
    example: string;
    parameters?: Record<string, string>;
    description?: string;
    categories: string[];

    features: {
        requireConfig?: string[];
        requirePuppeteer?: boolean;
        antiCrawler?: boolean;
        supportRadar?: boolean;
        supportBT?: boolean;
        supportPodcast?: boolean;
        supportScihub?: boolean;
    };
    radar: {
        source: string[];
        target: string;
    };
};

type Manifest = {
    name: string;
    url?: string;
    categories: string[];
    description?: string;

    routes: Record<string, Route>;
};

For example:

export default {
    name: 'GitHub',
    url: 'https://github.com',
    categories: ['programming'],
    description: `
:::tip
GitHub provides some official RSS feeds:

-   Repo releases: 'https://github.com/:owner/:repo/releases.atom'
-   Repo commits: 'https://github.com/:owner/:repo/commits.atom'
-   User activities: 'https://github.com/:user.atom'
-   Private feed: 'https://github.com/:user.private.atom?token=:secret' (You can find **Subscribe to your news feed** in [dashboard](https://github.com) page after login)
-   Wiki history: 'https://github.com/:owner/:repo/wiki.atom'
:::
    `,

    routes: {
        '/trending/:since/:language/:spoken_language?': {
            name: 'Trending',
            url: 'https://github.com/trending',
            maintainers: ['DIYgod', 'jameschensmith'],
            handler: './trending',
            example: 'https://rsshub.app/github/trending/daily/javascript',
            parameters: {
                since: 'time frame, available in [Trending page](https://github.com/trending/javascript?since=monthly) \'s URL, possible values are: `daily`, `weekly` or `monthly`',
                language: 'the feed language, available in [Trending page](https://github.com/trending/javascript?since=monthly) \'s URL, don\'t filter option is `any`',
                spoken_language: 'natural language, available in [Trending page](https://github.com/trending/javascript?since=monthly) \'s URL',
            },
            description: '',
            features: {
                requireConfig: ['GITHUB_ACCESS_TOKEN'],
                requirePuppeteer: false,
                antiCrawler: false,
                supportRadar: true,
                supportBT: false,
                supportPodcast: false,
                supportScihub: false,
            },

            radar: {
                source: 'github.com/trending',
                target: '/trending/daily',
            },

            // Override the parent's configuration
            categories: ['programming'],
        }
    },
};

This is not a duplicated feature request or new RSS proposal

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions