Commit Graph

363 Commits

Author SHA1 Message Date
0c591149d5 Add option to disable all indexing. 2023-04-26 12:52:12 +01:00
af8fe176ea Fix clippy warnings 2023-04-19 10:37:47 -04:00
4a1b448abb Merge pull request from iTzBoboCz/polls 2023-04-17 18:12:02 -04:00
991677cd1e Add variable for now_utc, format 2023-04-17 18:00:41 -04:00
3b8a13d050 Merge pull request from libreddit/fmt_clippy 2023-04-15 11:01:19 -04:00
5f87875b8e Merge branch 'master' into bypass-gate 2023-04-15 10:56:28 -04:00
ec226e0cab fix(polls): apply clippy suggestions 2023-04-08 10:41:12 +02:00
75af984154 fix(polls): apply suggestions and fix id parsing 2023-04-01 14:26:04 +02:00
8bed342a6d fix: print time suffix only for relative dates 2023-04-01 13:21:15 +02:00
de5d8d5f86 Requested code style changes 2023-03-26 11:52:02 -07:00
f465394f93 Address fmt + clippy 2023-03-25 16:32:42 -04:00
1e418619f1 Feat: search for comments within posts
Add the ability to search for specific comments within posts.
Known issues:
  - Just like on reddit, this does not work with comment sorting. The
    sorting order is ignored during the search and changing the sorting
    order after the search does not change anything. I do not think we
    can fix this before reddit does, since in my understanding we rely
    on them for the sorting. However we could implement a default
    sorting method ourselves by taking the vector of comments returned
    from the search and sorting it manually.
  - The UI could be improved on mobile. On screens with a max width
    inferior to 480 pixels, the comment search bar is displayed below
    the comment sorting form. It would be great if we could make the
    search bar have the same width as the whole comment sorting form
    but I do not have the willpower to write any more css.
2023-03-24 17:41:26 -07:00
8be69f6fe5 Checks if the link contains the parameter instead of ends with it
To know if the gate should be bypassed, we check if the link contains
the pasameter instead of checking if the link ends with it. This is
impostant, for example if we were to implement searching for comments
within a post. If we wanted to search for comments within a post that we
have bypassed the gate to view: the link will look like
https://libreddit-instance/r/somesub/comments/post-id/post-title&bypass_nsfw_landing/?q=some-query&type=comment
2023-03-23 12:36:04 -07:00
a0726c5903 Change the bypass message and format code
The bypass message now indicates that the bypass is only temporary.
2023-03-23 11:09:33 -07:00
c1c867a5ff feat: add polls 2023-03-23 13:21:09 +01:00
5dc3279ac3 fix: make time work with future dates 2023-03-23 13:18:48 +01:00
e046144bf3 Allow bypassing nsfw gate for posts
On instances that are not sfw-only, the nsfw gate for posts can now be
bypassed.
2023-03-22 23:18:35 -07:00
412ce8f1f3 Fix default subscriptions ()
Co-authored-by: Daniel Valentine <daniel@vielle.ws>
2023-03-08 21:53:23 -07:00
01f9907aaf show the count of 'more replies'. ()
Co-authored-by: Daniel Valentine <daniel@vielle.ws>
Co-authored-by: Matthew Esposito <matt@matthew.science>
2023-03-08 21:30:41 -07:00
bf19ff513f add support for gifs in galleries. () 2023-03-08 21:04:26 -07:00
ffc9ca2e98 use the documented LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION config option. () 2023-03-04 13:04:40 -07:00
eb07a2ce7c Make gated subreddits accessible by treating them as quarantined ()
* 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
58fa213be8 Reuse hyper client. ()
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
fa68bf561b added leaving reddit dialog () 2023-02-08 00:24:06 -07:00
8be5fdee2d Implement instance info endpoint (JSON, YAML, TXT) ()
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
eb9ef9f6d9 added leaving reddit dialog () 2023-01-12 01:46:56 -07:00
2a54043afc Simplify listener definition ()
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
dff91da877 config: fix SFW test 2023-01-04 11:12:19 +01:00
9a7b3b29f5 Merge remote-tracking branch 'origin/master' into hide_awards 2023-01-03 11:12:27 -07:00
5b06a3fc64 Add config system to read from file ()
Co-authored-by: Daniel Valentine <daniel@vielle.ws>
2023-01-03 02:55:22 -07:00
c83a4e0cc8 Landing page for NSFW content, SFW-only mode ()
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
6a785baa2c Add hide_awards config 2023-01-01 21:39:38 -05:00
6cf3748642 Fix for
/:id route now accepts 7 character post IDs.
2023-01-01 17:06:58 -06:00
9e434e7db6 Search - add support for raw reddit links ()
* 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
ab30b8bbec Bugfix: 'all posts are hidden because NSFW' when no posts where found ()
* 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
5d518cfc18 Cache result of server::determine_compressor. 2022-12-04 17:56:02 -07:00
e579b97442 List post duplicates (resolves ). 2022-12-03 01:08:36 -07:00
88bed73e5e Extract Location URL path correctly in client::request. (fixes ) () 2022-11-21 08:58:40 -07:00
3f3d9e9c3b Indicate pinned posts on user profiles (close ) 2022-11-14 18:08:44 -08:00
fade305f90 Blur NSFW posts.
Reimplementation of .

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

Co-authored by: Daniel Valentine <Daniel-Valentine@users.noreply.github.com>
2022-11-08 09:01:12 -07:00
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