Commit Graph

343 Commits

Author SHA1 Message Date
mikupls
a7f59ccac1 Display previews and inline images for reddit-hosted images.
This version does not change the svg behaviour in the other cases in an attempt to reduce breakage.
2023-03-03 13:50:05 +01:00
domve
eb07a2ce7c
Make gated subreddits accessible by treating them as quarantined (#722)
* Fix gated communities being unviewable by treating them as quarantined

* Show restriction reason in quarantine template

* Add `gated` checks for other requests
2023-02-26 00:40:32 -07:00
wsy2220
58fa213be8
Reuse hyper client. (#727)
Making a new connection on every request is very slow and wasteful, espectially on slower network.

Fix this by reuse a hyper client which shares a connection pool.

I'm able to lower /r/popular loading time from 5s to 1.5s on my machine.
2023-02-26 00:33:55 -07:00
potatoesAreGod
fa68bf561b
added leaving reddit dialog (#643) 2023-02-08 00:24:06 -07:00
Matthew Esposito
8be5fdee2d
Implement instance info endpoint (JSON, YAML, TXT) (#685)
Co-authored-by: Daniel Valentine <daniel@vielle.ws>
Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2023-01-30 02:02:43 -07:00
potatoesAreGod
eb9ef9f6d9
added leaving reddit dialog (#643) 2023-01-12 01:46:56 -07:00
Spenser Black
2a54043afc
Simplify listener definition (#681)
This simplifies the logic to build the listener by using more clap
features instead of manually accessing the PORT environment variable.
This also removes unnecessary `unwrap_or` calls that set defaults that
are already set by clap.
2023-01-12 01:41:59 -07:00
Johannes Schleifenbaum
dff91da877
config: fix SFW test 2023-01-04 11:12:19 +01:00
Daniel Valentine
9a7b3b29f5
Merge remote-tracking branch 'origin/master' into hide_awards 2023-01-03 11:12:27 -07:00
Matthew E
5b06a3fc64
Add config system to read from file (#664)
Co-authored-by: Daniel Valentine <daniel@vielle.ws>
2023-01-03 02:55:22 -07:00
Daniel Valentine
c83a4e0cc8
Landing page for NSFW content, SFW-only mode (#656)
Co-authored-by: Matt <matt@matthew.science>
Co-authored-by: Spike <19519553+spikecodes@users.noreply.github.com>
2023-01-03 02:39:45 -07:00
Matthew Esposito
6a785baa2c Add hide_awards config 2023-01-01 21:39:38 -05:00
elliot
6cf3748642
Fix for #675
/:id route now accepts 7 character post IDs.
2023-01-01 17:06:58 -06:00
gmnsii
9e434e7db6
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'.
2022-12-31 20:57:42 -07:00
gmnsii
ab30b8bbec
Bugfix: 'all posts are hidden because NSFW' when no posts where found (#666)
* Fix 'all_posts_hidden_nsfw' when there are no posts.

If a search query yielded no results and the user set nsfw posts to be
hidden, libreddit would show 'All posts are hidden because they are NSFW.
Enable "Show NSFW posts" in settings to view'. This is fixed by
verifying tnat posts.len > 0 before setting 'all_posts_hidden_nsfw' to
true.

* Add a message when no posts were found.

* Delete 2
2022-12-31 19:11:59 -07:00
Daniel Valentine
5d518cfc18
Cache result of server::determine_compressor. 2022-12-04 17:56:02 -07:00
Daniel Valentine
e579b97442
List post duplicates (resolves #574). 2022-12-03 01:08:36 -07:00
Daniel Valentine
88bed73e5e
Extract Location URL path correctly in client::request. (fixes #645) (#646) 2022-11-21 08:58:40 -07:00
spikecodes
3f3d9e9c3b
Indicate pinned posts on user profiles (close #606) 2022-11-14 18:08:44 -08:00
NKIPSC
fade305f90 Blur NSFW posts.
Reimplementation of libreddit/libreddit#482.

Co-authored by: Daniel Valentine <Daniel-Valentine@users.noreply.github.com>
2022-11-09 08:49:39 -07:00
NKIPSC
e62d33ccae Blur NSFW posts.
Reimplementation of libreddit/libreddit#482.

Co-authored by: Daniel Valentine <Daniel-Valentine@users.noreply.github.com>
2022-11-08 09:01:12 -07:00
Daniel Valentine
465d9b7ba7
Implement 'posts hidden because of NSFW'. (Resolves #159) (#619) 2022-11-07 20:54:49 -07:00
Matthew E
d4ca376e8d
Add format_url tests (#615) 2022-11-05 23:51:56 -06:00
Daniel Valentine
c6487799ed
Redirect /:id to canonical URL for post. (#617)
* Redirect /:id to canonical URL for post.

This implements redirection of `/:id` (a short-form URL to a post) to
the post's canonical URL. Libreddit issues a `HEAD /:id` to Reddit to get
the canonical URL, and on success will send an HTTP 302 to a client with
the canonical URL set in as the value of the `Location:` header.

This also implements support for short IDs for non-ASCII posts, c/o
spikecodes.

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2022-11-05 02:29:04 -06:00
Daniel Valentine
ae3ea2da7c
HTTP compression (Reddit -> Libreddit -> client) (#612)
Implements HTTP compression, between both Reddit and Libreddit and Libreddit
and a web browser. Compression between Reddit and Libreddit is mandatory,
whereas compression between Libreddit and a client is opt-in (client must
specify a compressor in the Accept-Encoding header).

Supported compressors are gzip and brotli. gzip support is ubiquitous,
whereas brotli is supported by almost all modern browsers except Safari
(iOS, iPhone, macOS), although Safari may support brotli in the future.

Co-authored-by: Matthew E <matt@matthew.science>
2022-11-03 22:04:34 -06:00
Spike
170ea384fb
Support /comments endpoint (closes #568)
Code based on @Daniel-Valentine's [implementation](e2c84879d6)
2022-11-01 20:53:42 -07:00
spikecodes
b170a8dd99
Switch Reveddit to Unddit 2022-10-31 22:30:31 -07:00
spikecodes
b4d3f03335
Upgrade dependencies 2022-10-31 20:23:59 -07:00
spikecodes
f5cd48b07f
Fix #514 2022-05-21 21:06:03 -07:00
Mario A
90828cc71c
Fix "Post url contains non-ASCII characters" error (#479) 2022-05-21 05:48:59 +00:00
Nick Lowery
322aa97a18
Fix HTML encoding in templating (#404) 2022-05-21 05:28:31 +00:00
spikecodes
428dc58e3c
Update to v0.22.8 2022-05-20 19:20:44 -07:00
mikupls
60c7b6b23f
Embed css themes to simplify adding and testing new themes (#489) 2022-05-21 01:41:31 +00:00
spikecodes
bb7fb1313d
Fix multireddit subscription redirect url 2022-05-15 13:50:17 -07:00
mikupls
eb6c5e5e1e
Fix backslash url rewriting and add tests for rewrite_urls. (#461)
* Fix backslash url rewriting.

Add test for rewrite_urls.

Fixes #281.

* Update to v0.22.5

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2022-03-26 20:26:30 +00:00
Nick Lowery
f0a6bdc21b
Fix sorting buttons on r/all and r/popular (#402)
* Fix sorting buttons on r/all and r/popular

* Bump version to v0.22.2

* Fix empty sidebar in r/all and r/popular

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2022-03-15 03:39:39 +00:00
Nick Lowery
70ff150ab4
Add user listing buttons (#400)
* Add user listing buttons

* Update to v0.22

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2022-03-13 19:06:27 +00:00
spikecodes
977cd0763a
Fix #379 2022-01-05 16:46:45 -08:00
spikecodes
fcadd44cb3
Update dependencies 2022-01-05 16:39:56 -08:00
Andrew Kaufman
9c325c2cbf
Search fixes (#384)
* Default to searching within subreddit

* Redirect to subreddit from search
2022-01-05 14:06:41 -08:00
spikecodes
f1b3749cf0
Fix #378 — formatting of dates/times 2021-12-29 12:48:57 -08:00
spikecodes
0708fdfb37
Cover more Reddit domains with libreddit link rewrites 2021-12-29 11:38:35 -08:00
spikecodes
6b59976fcf
Fix #376 2021-12-27 23:16:01 -08:00
spikecodes
f9b3981448
Fix debug log in post.rs 2021-12-27 19:56:37 -08:00
spikecodes
db3196df5a
Use Reveddit to show removed posts/comments. Closes #299 2021-12-27 19:40:35 -08:00
spikecodes
b3d4f6f91c
Show external page links again 2021-12-27 18:00:19 -08:00
spikecodes
90fa0b5496
Automatically generate release notes 2021-12-27 10:15:25 -08:00
spikecodes
7aeabfc4bc
Rewrite Reddit post links to Libreddit equivalents 2021-12-26 21:18:20 -08:00
mikupls
341c623be8
Refactor Media parsing (#334)
* Parse video data from cross_post_parent_list as vanilla Reddit does.

introduce testdata directory for testing JSON parsing functions.

refactor Media::parse for slightly more readability.

Add various test cases.

* Trim down to just refactoring

Co-authored-by: Spike <19519553+spikecodes@users.noreply.github.com>
2021-12-20 01:07:20 +00:00
spikecodes
0656756d21
Fix #196 2021-11-29 22:29:41 -08:00