Commit Graph

591 Commits

Author SHA1 Message Date
Matthew Esposito
70187b7adc fix(tests): update regex list tests 2025-09-09 14:12:31 -04:00
Matthew Esposito
21e14df975 Merge pull request #477 from tchebb/doc-comments
Convert lots of comments to doc comments
2025-09-09 14:07:53 -04:00
Matthew Esposito
d510e1ce06 Merge pull request #480 from tchebb/compress-content-length
Recompute `Content-Length` on compression
2025-09-09 14:04:57 -04:00
Matthew Esposito
cc8e1cd530 Merge pull request #474 from chowder/fix-user-agent
Set User-Agent header in proxied media requests to match currently spoofed device
2025-09-09 13:57:34 -04:00
Thomas Hebb
e09485c000 Recompute Content-Length on compression
Content-Length holds the number of bytes in an HTTP response after
encoding and compression. Our compress_response() function breaks that:
when the response it's compressing already includes a Content-Length
header, it may shorten the body but leave the header unchanged.

I noticed this because of #465, since the textual error message proxied
from Reddit gets compressed but already has Content-Length. The issue is
masked in normal operation because we don't compress the binary image
data that Reddit is supposed to return. In debug builds, hyper catches
the issue[1] and panics, but in release builds we return a nonconformant
HTTP response.

Fix the issue by removing the header if we choose to compress, letting
hyper compute the new value for us.

[1] https://github.com/hyperium/hyper/blob/v0.14.32/src/proto/h1/role.rs#L708-L725
2025-09-04 15:17:45 -04:00
Thomas Hebb
df703251c2 Convert lots of comments to doc comments
This makes the documentation generated with `cargo doc` quite a bit more
readable. Also fix a few typos while we're at it.
2025-09-04 13:24:00 -04:00
chowder
47ef6a06d4 fix: set User-Agent header in proxied media requests to match currently spoofed device 2025-08-29 21:55:04 +01:00
Benjamin A. Beasley
78f8dcc3ac Replace rinja with askama
“New versions of `rinja` will be released under the name `askama`.”

https://crates.io/crates/rinja
2025-08-17 08:34:07 -04:00
Matthew Esposito
407a6c00c3 fix: update landing page 2025-08-02 07:01:54 -04:00
Matthew Esposito
628fbf86cc chore(clippy) 2025-06-29 16:37:00 -04:00
Matthew Esposito
11e68ea2e8 fix(rss): fallback on html decode
fixes #448
2025-06-29 16:33:40 -04:00
Matthew Esposito
d18df92840 feat(server): ban disrespectful user agents
seriously, just run your own instance.
2025-06-29 16:26:22 -04:00
Matthew Esposito
dcb507d567 feat: Improve OAuth error handling with custom AuthError type and better timeout management 2025-04-21 14:17:27 -04:00
Matthew Esposito
15147cea8e fix: add resource limits on encoded prefs route 2025-03-19 22:58:51 -04:00
Matthew Esposito
c9e6ffd33c clippy fix 2025-03-07 17:08:58 -05:00
Matthew Esposito
526c0d0797 fix: opensearch.xml route 2025-03-07 17:08:27 -05:00
Matthew Esposito
d097495a41 fix: handle case insensitivity for subs 2025-02-27 20:10:01 -05:00
Matthew Esposito
f3ca7bb7d1 feat: allow for case-insensitive search redirects (fix #389) 2025-02-27 14:35:09 -05:00
Matthew Esposito
35688e4af7 fix: update default setting for removing default feeds 2025-02-26 13:17:08 -05:00
Matthew Esposito
9afe886c2c chore(clippy) 2025-02-13 21:42:29 -05:00
Matthew Esposito
c9dbd7a3cc fix: debug string 2025-02-13 21:42:09 -05:00
Matthew Esposito
bb20190555 fix: control rendering behavior based on routing 2025-02-09 17:10:12 -05:00
Matthew Esposito
2e95e1fc6e feat: smaller imports and exports (#373)
* feat: smaller imports and exports

* test(prefs): extend tests

* style(clippy)

* style: bubble up error

* style: update some wording
2025-02-06 20:34:12 -05:00
Matthew Esposito
5265ccb033 feat: hide default feeds option (#370) 2025-02-06 13:03:42 -05:00
Matthew Esposito
85329c96a7 fix: remove stray trace 2025-02-06 09:02:55 -05:00
Matthew Esposito
a732f18143 chore: remove scraper cli 2025-02-03 14:25:16 -05:00
freedit-dev
7770c57856 fix Code blocks err #227 (#323)
* fix Code blocks https://github.com/redlib-org/redlib/issues/227

* add pulldown-cmark

* add pulldown-cmark

* fix Code blocks err #227

* add pre style for post codeblock

* Update style.css (fix Code blocks err #227 )

---------

Co-authored-by: Matthew Esposito <matt@matthew.science>
2025-02-03 00:58:14 -05:00
Matthew Esposito
c7f55c146a fix(clippy): minor clippy changes 2025-02-03 00:53:13 -05:00
Integral
ef2cc01bf7 refactor(utils): avoid redundant String conversions & use match (#347)
* refactor(utils): avoid redundant String conversions & use match

* ci: fix clippy lint
2025-02-03 00:51:54 -05:00
Matthew Esposito
7930b19809 fix: fix clippy + tests 2025-02-03 00:47:25 -05:00
Matthew Esposito
257871b56c fix(tests) 2025-02-03 00:30:48 -05:00
internationalcrisis
bbe5f81914 fix: gracefully shutdown on CTRL+C and SIGTERM (#273)
Fixes #205
2025-02-02 23:40:19 -05:00
Butter Cat
51386671d3 Fix embedded images sometimes having gaps around them (#295)
* Fix images embedded by rewrite_urls() having an empty <p></p> above and below them that caused weird gaps in some scenarios

* Fix test for new embedding behavior

* fix: remove println

---------

Co-authored-by: Matthew Esposito <matt@matthew.science>
2025-02-02 23:38:52 -05:00
Butter Cat
2e0e1a1aaa Fix crossposted galleries not working (#293) 2025-02-02 23:31:37 -05:00
Matthew Esposito
23cda23d01 feat: add environment variables and dedicated flags for ipv4/6 only (#307)
* feat: add environment variables and dedicated flags for ipv4/6 only

* fix(readme): mention all flags on README
2025-02-02 23:30:33 -05:00
mooons
96ad7bf163 feat: render bullet lists (#321)
* feat: render bullet lists

* tests: add tests

---------

Co-authored-by: Matthew Esposito <matt@matthew.science>
2025-02-02 23:26:36 -05:00
Martin Lindhe
cb659cc8a3 rss: proxy links in users and subreddit feeds, fixes #359 (#361) 2025-02-02 22:00:58 -05:00
Martin Lindhe
fd1c32f555 rss: add <pubDate> field, fixes #356 (#358)
* rss: add <pubDate> field, fixes #356

* rss: also add pub_date on user feed

* fix(fmt)

---------

Co-authored-by: Matthew Esposito <matt@matthew.science>
2025-02-02 22:00:44 -05:00
Martin Lindhe
adf25cb15b unescape selftext_html from json api, fixes #354 (#357)
* unescape selftext_html from json api, fixes #354

* fix(fmt)

---------

Co-authored-by: Matthew Esposito <matt@matthew.science>
2025-02-02 21:56:47 -05:00
Kot C
9e47bc37c7 Support HEAD requests (resolves #292) (#363)
* Support HEAD requests

* Remove body from error responses too
2025-02-02 21:49:46 -05:00
Butter Cat
5c1e15c359 Make subscription and filter cookies split into multiple cookies if they're too large (#288)
* Split subscriptions and filters cookies into multiple cookies and make old cookies properly delete

* Cleanup

* Fix mispelling for removing subscription cookies

* Fix many subscription misspellings

* Fix subreddits and filters that were at the end and beginning of the cookies getting merged

* Make join_until_size_limit take the +'s into account when calculating length

* Start cookies without number to be backwards compatible

* Fix old split cookies not being removed and subreddits/filters between cookies occasionally getting merged

* Make updating subscription/filters cookies safer

* Small cleanup

* Make restore properly add new subscriptions/filters cookies and delete old unused subscriptions/filters cookies

* Fix misspellings on variable name
2025-02-02 21:48:46 -05:00
Jeidnx
d7ec07cd0d Implement a serializer for user preferences (#336) 2024-12-02 11:29:57 -05:00
Integral
e4fc22cf90 refactor: replace static with const for global constants (#340) 2024-12-02 11:28:31 -05:00
Matthew Esposito
9f6b08cbb2 fix(main): reduce rate limit check fail to warned error 2024-11-26 22:55:48 -05:00
Matthew Esposito
a4f511f67e fix(client): update rate limit self-check (fix #335) 2024-11-24 10:50:21 -05:00
Matthew Esposito
7fe109df22 style(clippy) 2024-11-23 21:41:30 -05:00
Matthew Esposito
100a7b65a6 fix(client): update headers management, add self check (fix #334, fix #318) 2024-11-23 21:36:46 -05:00
Matthew Esposito
6be6f892a4 feat(oauth): better oauth client matching 2024-11-20 19:19:29 -05:00
Matthew Esposito
95ab6c5385 fix(oauth): update oauth resources and script 2024-11-20 18:50:06 -05:00
Matthew Esposito
d3ba5f3efb feat(error): add new instance buttom 2024-11-19 16:30:37 -05:00