Commit Graph

73 Commits

Author SHA1 Message Date
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
Daniel Valentine
88bed73e5e
Extract Location URL path correctly in client::request. (fixes #645) (#646) 2022-11-21 08:58:40 -07:00
Daniel Valentine
465d9b7ba7
Implement 'posts hidden because of NSFW'. (Resolves #159) (#619) 2022-11-07 20:54:49 -07: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
Mario A
90828cc71c
Fix "Post url contains non-ASCII characters" error (#479) 2022-05-21 05:48:59 +00:00
spikecodes
7aeabfc4bc
Rewrite Reddit post links to Libreddit equivalents 2021-12-26 21:18:20 -08:00
spikecodes
0656756d21
Fix #196 2021-11-29 22:29:41 -08:00
spikecodes
4faa9d46d6
Fix HTTPS connector 2021-11-21 22:44:05 -08:00
spikecodes
41b3dc5739
More apt error messages for Reddit outages 2021-08-11 20:49:42 -07:00
spikecodes
4defb58f2a
Optimizations and commenting 2021-05-20 12:24:06 -07:00
curlpipe
8bb247af3b
Added support for quarantined subreddits (#219)
* Added support for quarantined subreddits

* Added confirmation wall for quarantined subreddits

* Added quarantine walls to other routes and fixed case issue

* Correct obsolete use of cookie()

* Refactor param() and quarantine()

Co-authored-by: Spike <19519553+spikecodes@users.noreply.github.com>
2021-05-16 15:53:39 +00:00
Adrian Lebioda
928907086c
HLS video playback (#182)
* HLS video playback

Signed-off-by: Adrian Lebioda <adrianlebioda@gmail.com>

* Add LibreJS compliance

* Locally host hls.js

* Notification about HLS under videos that support it

Signed-off-by: Adrian Lebioda <adrianlebioda@gmail.com>

* Use .contains() instead of .find() == None

* Make list of preferences constant

* Change headers_keys from Vector into Array

* Fix incorrect detecting of # in paths

* Remove trailing-slash-appending if statement

* Change HLS notification styling

Co-authored-by: spikecodes <19519553+spikecodes@users.noreply.github.com>
2021-05-10 01:25:52 +00:00
spikecodes
a18db1e2b7
Properly pass preview queries to media proxy 2021-04-08 22:26:03 -07:00
spikecodes
66ac72beab
Fix clippy errors 2021-03-26 20:00:47 -07:00
spikecodes
0bb1677520
Revert client to HTTP/1.1 2021-03-21 13:56:05 -07:00
spikecodes
da4883db29
Upgrade client to HTTP/2 2021-03-21 11:37:03 -07:00
spikecodes
dc7e087ed0
Truncate negative scores 2021-03-19 22:04:44 -07:00
spikecodes
a81502dde1
Fix wiki routing 2021-03-17 21:40:55 -07:00
spikecodes
0ce2d9054e
Handle non-ASCII post headers 2021-03-17 21:26:06 -07:00
spikecodes
07363e47a9
Request building error handler 2021-03-17 16:53:49 -07:00
spikecodes
fb7faf6477
Handle HeaderValue and Uri parsing errors 2021-03-17 16:32:28 -07:00
spikecodes
b14b4ff551
Rewrite server and client using Hyper 2021-03-17 15:30:33 -07:00