Commit Graph

336 Commits

Author SHA1 Message Date
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
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
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
spikecodes 364c29c4d5
Use resized icons for awards. Fixes #346 2021-11-28 14:47:50 -08:00
Nick Lowery 888e7b302d
Filter subreddits and users (#317)
* Initial work on filtering subreddits and users

* Fix doubly-prefixed subreddit name in search alt text (e.g. r/r/pics)

* Don't set post title to "Comment" if empty - this could throw off actual posts with the title "Comment"

* Filter search results

* Fix filtering to differentiate between "this subject itself is filtered" vs "all posts on this current page have been filtered"

* Remove unnecessary check

* Clean up

* Cargo format

* Collapse comments from filtered users

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2021-11-26 04:02:04 +00:00
Diego Magdaleno bd413060c6
Support displaying awards (#168)
* Initial implementation of award parsing

* Posts: Implement awards as part of post

* Posts: remove parse_awards dead code

* Posts: initial implementation of displaying Awards at the post title

* Posts: Proxy static award images

* Client: i.redd.it should take path as argument not ID

* Posts: Just like Reddit make award size 16px

* Templates: limit the awards to 4 awards to increase performance

* Comments: Make awards a property of comments and display them

* Format and correct /img/:id

* Update comment.html

* [Optimization] Awards is not longer async

* [Revert] Posts can now display more than 4 awards again

* [Implementation] Awards not display on the frontpage

* [Implementation] Display count on awards

* Post: Start working on awards css

* Awards: Move the image size to css

* Awards: Start implementing tooltips

* Refactor awards code and tweak CSS indentation

* Unify Awards::new and Awards::parse

* Use native tooltips and brighten awards background

Co-authored-by: Spike <19519553+spikecodes@users.noreply.github.com>
2021-11-25 02:08:27 +00:00
spikecodes 8e332b0630
Show full subreddit results in search 2021-11-23 22:24:23 -08:00
spikecodes 85ae7c1f60
Fix indentation and formatting 2021-11-23 22:23:29 -08:00
spikecodes 4faa9d46d6
Fix HTTPS connector 2021-11-21 22:44:05 -08:00
mikupls 768820cd4c
Render markdown correctly in text post previews by using selftext_html. (#335)
* Render markdown correctly in text post previews by using selftext_html.

I was mistakenly under the impression that we somehow render markdown ourselves, but turns out we just take whatever HTML reddit gives us, and we also need to do this for text previews.

Use CSS to limit the size of the previews instead of truncating in the template.

Fix table CSS.

* Fix post_body padding and trim post_previews

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2021-11-21 23:17:52 +00:00