Search - add support for raw reddit links (#663)

* Search - add support for raw reddit links

If a search query starts with 'https://www.reddit.com/' or 'https://old.reddit.com/',
this prefix will be truncated and the query will be processed normally.
For example, a search query 'https://www.reddit.com/r/rust' will redirect to
r/rust.

* Search - support a wider variety of reddit links.

Add once cell dependency for static regex support (avoid compiling the
same regex multiple times).
All search queries are now matched against a regex (provided by @Daniel-Valentine)
that determines if it is a reddit link. If it is, the prefix specifying
the reddit instance will be truncated from the query that will then be
processed normally.
For example, the query 'https://www.reddit.com/r/rust' will be treated
the same way as the query 'r/rust'.
This commit is contained in:
gmnsii 2022-12-31 19:57:42 -08:00 committed by GitHub
parent ab30b8bbec
commit 9e434e7db6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

1
Cargo.lock generated
View file

@ -677,6 +677,7 @@ dependencies = [
"hyper-rustls",
"libflate",
"lipsum",
"once_cell",
"percent-encoding",
"regex",
"route-recognizer",