New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically select a bridge based on a URL #928

Merged
merged 6 commits into from Nov 26, 2018

Conversation

Projects
None yet
3 participants
@Roliga
Contributor

Roliga commented Nov 15, 2018

Hey some time ago I opened #743 and I thought I'd give implementing this feature a shot.

To summarize idea here is to add a new detect action which when given a URL automatically redirects the user directly to a feed, similar to the "I'm feeling lucky" feature some search engines have.

For example to get a feed from: #rss-bridge on twitter we could send a request to:
/?action=detect&format=Atom&url=twitter.com/search%3Fq%3D%2523rss-bridge
which would redirect to: /?action=display&q=%23rss-bridge&bridge=Twitter&format=Atom.

My personal use case for this is integration with my web browser: A browser shortcut that sends the current page URL to rss-bridge which then gives me a feed right away.

In #743 it was brought up to use this to display and auto-fill a bridge in the rss-bridge web UI. That'd need some more work, but it should be compatible with the server-side code in this PR I'd imagine!

Either way feedback appreciated! (:

Roliga added some commits Nov 15, 2018

Roliga
core: Add bridge parameter auto detection
This adds a new 'detect' action which accepts a URL from which an
appropriate bridge is selected and relevant parameters are extracted.
The user is then automatically redirected to the selected bridge.

For example to get a feed from: https://twitter.com/search?q=%23rss-bridge
we could send a request to:
'/?action=detect&format=Atom&url=twitter.com/search%3Fq%3D%2523rss-bridge'
which would redirect to:
'/?action=display&q=%23rss-bridge&bridge=Twitter&format=Atom'.

This auto detection happens on a per-bridge basis, so a new function
'detectParameters' is added to BridgeInterface which bridges may implement.
It takes a URL for an argument and returns a list of parameters that were
extracted, or null if the URL isn't relevant for the bridge.
Roliga
[BridgeAbstract] Add generic parameter detection
This adds generic "paramater detection" for bridges that don't have any
parameters defined. If the queried URL matches the URI defined in the
bridge (ignoring https://, www. and trailing /) an emtpy list of parameters is
returned.
Roliga
@LogMANOriginal

LogMANOriginal requested changes Nov 18, 2018 edited

Thanks for the PR, this is an awesome addition! 🥇

Find below a few comments.

I'll push lots of documentation changes in a few minutes (to master), which is why I added comments regarding function documentation to your PR.

Show resolved Hide resolved lib/BridgeInterface.php Outdated
Show resolved Hide resolved lib/BridgeInterface.php Outdated
Show resolved Hide resolved lib/BridgeAbstract.php
Show resolved Hide resolved index.php Outdated
Show resolved Hide resolved index.php
Show resolved Hide resolved index.php Outdated
Show resolved Hide resolved index.php Outdated

LogMANOriginal and others added some commits Nov 20, 2018

Apply suggestions from code review
Co-Authored-By: Roliga <roliga.here@gmail.com>

@LogMANOriginal LogMANOriginal merged commit 49da67c into RSS-Bridge:master Nov 26, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@LogMANOriginal

This comment has been minimized.

Member

LogMANOriginal commented Nov 26, 2018

Merged. Thanks for adding the changes!

Please add some documentation to the Wiki if possible:
https://github.com/RSS-Bridge/rss-bridge/wiki/Actions

@Roliga

This comment has been minimized.

Contributor

Roliga commented Nov 27, 2018

Sweet, thanks!

I added some documentation on the Actions page as well as a new page for the detectParameters function!

@yardenac

This comment has been minimized.

Contributor

yardenac commented Nov 30, 2018

This is wonderful. A game-changer, IMO. Thank you so much for getting it done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment