Commit Graph

372 Commits

Author SHA1 Message Date
465d9b7ba7 Implement 'posts hidden because of NSFW'. (Resolves ) () 2022-11-07 20:54:49 -07:00
d4ca376e8d Add format_url tests () 2022-11-05 23:51:56 -06:00
c6487799ed Redirect /:id to canonical URL for post. ()
* 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
ae3ea2da7c HTTP compression (Reddit -> Libreddit -> client) ()
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
170ea384fb Support /comments endpoint (closes )
Code based on @Daniel-Valentine's [implementation](e2c84879d6)
2022-11-01 20:53:42 -07:00
b170a8dd99 Switch Reveddit to Unddit 2022-10-31 22:30:31 -07:00
b4d3f03335 Upgrade dependencies 2022-10-31 20:23:59 -07:00
f5cd48b07f Fix 2022-05-21 21:06:03 -07:00
90828cc71c Fix "Post url contains non-ASCII characters" error () 2022-05-21 05:48:59 +00:00
322aa97a18 Fix HTML encoding in templating () 2022-05-21 05:28:31 +00:00
428dc58e3c Update to v0.22.8 2022-05-20 19:20:44 -07:00
60c7b6b23f Embed css themes to simplify adding and testing new themes () 2022-05-21 01:41:31 +00:00
bb7fb1313d Fix multireddit subscription redirect url 2022-05-15 13:50:17 -07:00
eb6c5e5e1e Fix backslash url rewriting and add tests for rewrite_urls. ()
* Fix backslash url rewriting.

Add test for rewrite_urls.

Fixes .

* Update to v0.22.5

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2022-03-26 20:26:30 +00:00
f0a6bdc21b Fix sorting buttons on r/all and r/popular ()
* 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
70ff150ab4 Add user listing buttons ()
* 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
977cd0763a Fix 2022-01-05 16:46:45 -08:00
fcadd44cb3 Update dependencies 2022-01-05 16:39:56 -08:00
9c325c2cbf Search fixes ()
* Default to searching within subreddit

* Redirect to subreddit from search
2022-01-05 14:06:41 -08:00
f1b3749cf0 Fix — formatting of dates/times 2021-12-29 12:48:57 -08:00
0708fdfb37 Cover more Reddit domains with libreddit link rewrites 2021-12-29 11:38:35 -08:00
6b59976fcf Fix 2021-12-27 23:16:01 -08:00
f9b3981448 Fix debug log in post.rs 2021-12-27 19:56:37 -08:00
db3196df5a Use Reveddit to show removed posts/comments. Closes 2021-12-27 19:40:35 -08:00
b3d4f6f91c Show external page links again 2021-12-27 18:00:19 -08:00
90fa0b5496 Automatically generate release notes 2021-12-27 10:15:25 -08:00
7aeabfc4bc Rewrite Reddit post links to Libreddit equivalents 2021-12-26 21:18:20 -08:00
341c623be8 Refactor Media parsing ()
* 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
0656756d21 Fix 2021-11-29 22:29:41 -08:00
364c29c4d5 Use resized icons for awards. Fixes 2021-11-28 14:47:50 -08:00
888e7b302d Filter subreddits and users ()
* 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
bd413060c6 Support displaying awards ()
* 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
8e332b0630 Show full subreddit results in search 2021-11-23 22:24:23 -08:00
85ae7c1f60 Fix indentation and formatting 2021-11-23 22:23:29 -08:00
4faa9d46d6 Fix HTTPS connector 2021-11-21 22:44:05 -08:00
768820cd4c Render markdown correctly in text post previews by using selftext_html. ()
* 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
5d9c320a7e Format post and comment votes with a decimal place, like vanilla reddit does. ()
* Format post and comment votes with a decimal place, like vanilla reddit does.

Before this change, a vote count of 1999 was displayed as 1k, which is a pretty big gap. The displayed count also differed from what Reddit does. Now, the behaviour is consistent.

Added some tests for format_num.

* Provide more space for post scores

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2021-11-21 04:07:45 +00:00
c2053524c7 Add text post previews. ()
* Add text post previews.

* Add mask gradient over post preview text

* Increase post title font weight for contrast

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2021-11-20 21:13:50 +00:00
731a407466 Collapse (sticky) bot comments by default. ()
* Collapse bot comments by default.

Comments are considered bot comments if they are posted by a moderator and are stickied. Some false positives are expected.

* Remove unneeded String conversion

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2021-11-19 05:42:53 +00:00
34ea679519 Update crates and optimize parameters 2021-11-14 18:51:36 -08:00
0f7ba3c61d Add "open in reddit" button to all pages ()
* Pass the url parameter to all templates. Add a reddit_link to the navbar, which opens the current url on reddit.

* Add icon for reddit link

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2021-11-15 02:39:33 +00:00
2486347b14 Fix follows not being case-sensitive () 2021-11-15 00:45:18 +00:00
1d4ea50a45 Add setting to autoplay videos 2021-10-25 21:27:55 -07:00
350b796571 Support Deployment to Heroku ()
* Added heroku.yml

* Added app.json

* PORT as env var
2021-09-19 19:03:01 +00:00
6a4191f3b5 Fix 2021-09-09 17:28:55 -07:00
982f57efd9 Fix user profiles showing up in search engines 2021-09-06 12:05:03 -07:00
41b3dc5739 More apt error messages for Reddit outages 2021-08-11 20:49:42 -07:00
45a5778571 Escape text-only flairs 2021-07-19 10:20:00 -07:00
be253d40dd Escape html characters in post flairs ()
* Encode HTML characters in flairs

* Encode HTML characters in flairs

* Use esc! macro for HTML escaping

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2021-07-19 17:15:15 +00:00
345f8e7b80 Dampen title color of visited posts. Fixes 2021-07-18 14:53:08 -07:00