shouya / rss-funnel

Self-hosted RSS multi-tool
https://rss-funnel-demo.fly.dev
GNU General Public License v3.0
112 stars 4 forks source link

feat: Placeholders in source #139

Closed shouya closed 2 months ago

shouya commented 2 months ago

This PR adds support for placeholders in the source url. This is useful for cases where the portion of source url is dynamic and can be specified when users request for the endpoint. The feature can be considered a pragmatic middle ground between static source and dynamic source.

Implements the feature request in https://github.com/shouya/rss-funnel/issues/137.

Here's an example to demonstrate the usage:

endpoints:
  - path: /telegram.xml
    source:
      template: https://bridge.easter.fr/?action=display&bridge=TelegramBridge&username=${username}&format=Atom
      placeholders:
        username: {}
    filters: []

For each placeholders, you can define the default value and/or a validation regex:

endpoints:
  - path: /telegram.xml
    source:
      template: https://bridge.easter.fr/?action=display&bridge=TelegramBridge&username=${username}&format=Atom
      placeholders:
        username:
          validation: "^\\w+$"
          default: MANJULtoons
    filters: []

Then you can request the endpoint with the corresponding parameter like http://127.0.0.1:4080/telegram.xml?username=MANJULtoons.

NOTE: The Inspector UI for this particular source type is unsupported yet. I'm planning for a rewrite of the Inspector UI so before the rewrite the Inspector UI won't keep up with new features.