Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
4b1195f221 | |||
a472461ee8 | |||
baf5e3d7ee | |||
f209757ed6 |
@ -3,7 +3,7 @@ name = "libreddit"
|
|||||||
description = " Alternative private front-end to Reddit"
|
description = " Alternative private front-end to Reddit"
|
||||||
license = "AGPL-3.0"
|
license = "AGPL-3.0"
|
||||||
repository = "https://github.com/spikecodes/libreddit"
|
repository = "https://github.com/spikecodes/libreddit"
|
||||||
version = "0.4.1"
|
version = "0.4.2"
|
||||||
authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"]
|
authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
18
README.md
18
README.md
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**10 second pitch:** Libreddit is a portmanteau of "libre" (meaning freedom) and "Reddit". It is a private front-end like [Invidious](https://github.com/iv-org/invidious) but for Reddit. Browse the coldest takes of [r/unpopularopinion](https://libredd.it/r/unpopularopinion) without being [tracked](#reddit).
|
**10 second pitch:** Libreddit is a portmanteau of "libre" (meaning freedom) and "Reddit". It is a private front-end like [Invidious](https://github.com/iv-org/invidious) but for Reddit. Browse the coldest takes of [r/unpopularopinion](https://libreddit.spike.codes/r/unpopularopinion) without being [tracked](#reddit).
|
||||||
|
|
||||||
- 🚀 Fast: written in Rust for blazing fast speeds and memory safety
|
- 🚀 Fast: written in Rust for blazing fast speeds and memory safety
|
||||||
- ☁️ Light: no JavaScript, no ads, no tracking, no bloat
|
- ☁️ Light: no JavaScript, no ads, no tracking, no bloat
|
||||||
@ -30,7 +30,7 @@
|
|||||||
- [Docker](#2-docker)
|
- [Docker](#2-docker)
|
||||||
- [AUR](#3-aur)
|
- [AUR](#3-aur)
|
||||||
- [GitHub Releases](#4-github-releases)
|
- [GitHub Releases](#4-github-releases)
|
||||||
- [Repl.it](#5-replit)
|
- [Replit](#5-replit)
|
||||||
- [Deployment](#deployment)
|
- [Deployment](#deployment)
|
||||||
|
|
||||||
---
|
---
|
||||||
@ -137,9 +137,9 @@ For transparency, I hope to describe all the ways Libreddit handles user privacy
|
|||||||
|
|
||||||
**DNS:** Both official domains (`libredd.it` and `libreddit.spike.codes`) use Cloudflare as the DNS resolver. Though, the sites are not proxied through Cloudflare meaning Cloudflare doesn't have access to user traffic.
|
**DNS:** Both official domains (`libredd.it` and `libreddit.spike.codes`) use Cloudflare as the DNS resolver. Though, the sites are not proxied through Cloudflare meaning Cloudflare doesn't have access to user traffic.
|
||||||
|
|
||||||
**Cookies:** Libreddit uses optional cookies to store any configured settings in [the settings menu](https://libredd.it/settings). This is not a cross-site cookie and the cookie holds no personal data, only a value of the possible layout.
|
**Cookies:** Libreddit uses optional cookies to store any configured settings in [the settings menu](https://libreddit.spike.codes/settings). This is not a cross-site cookie and the cookie holds no personal data, only a value of the possible layout.
|
||||||
|
|
||||||
**Hosting:** The official instances are hosted on [Repl.it](https://repl.it/) which monitors usage to prevent abuse. I can understand if this invalidates certain users' threat models and therefore, selfhosting and browsing through Tor are welcomed.
|
**Hosting:** The official instances are hosted on [Replit](https://replit.com/) which monitors usage to prevent abuse. I can understand if this invalidates certain users' threat models and therefore, selfhosting and browsing through Tor are welcomed.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -177,15 +177,15 @@ yay -S libreddit-git
|
|||||||
|
|
||||||
If you're on Linux and none of these methods work for you, you can grab a Linux binary from [the newest release](https://github.com/spikecodes/libreddit/releases/latest).
|
If you're on Linux and none of these methods work for you, you can grab a Linux binary from [the newest release](https://github.com/spikecodes/libreddit/releases/latest).
|
||||||
|
|
||||||
## 5) Repl.it
|
## 5) Replit
|
||||||
|
|
||||||
**Note:** Repl.it is a free option but they are *not* private and will monitor server usage to prevent abuse. If you need a free and easy setup, this method may work best for you.
|
**Note:** Replit is a free option but they are *not* private and will monitor server usage to prevent abuse. If you need a free and easy setup, this method may work best for you.
|
||||||
|
|
||||||
1. Create a Repl.it account (see note above)
|
1. Create a Replit account (see note above)
|
||||||
2. Visit [the official Repl](https://repl.it/@spikethecoder/libreddit) and fork it
|
2. Visit [the official Repl](https://replit.com/@spikethecoder/libreddit) and fork it
|
||||||
3. Hit the run button to download the latest Libreddit version and start it
|
3. Hit the run button to download the latest Libreddit version and start it
|
||||||
|
|
||||||
In the web preview (defaults to top right), you should see your instance hosted where you can assign a [custom domain](https://docs.repl.it/repls/web-hosting#custom-domains).
|
In the web preview (defaults to top right), you should see your instance hosted where you can assign a [custom domain](https://docs.replit.com/repls/web-hosting#custom-domains).
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
12
src/proxy.rs
12
src/proxy.rs
@ -19,8 +19,8 @@ pub async fn handler(req: Request<()>, format: &str, params: Vec<&str>) -> tide:
|
|||||||
/// Relays the `Content-Length` and `Content-Type` header.
|
/// Relays the `Content-Length` and `Content-Type` header.
|
||||||
async fn request(url: String) -> tide::Result {
|
async fn request(url: String) -> tide::Result {
|
||||||
// Parse url into parts
|
// Parse url into parts
|
||||||
let parts = Url::parse(&url).unwrap();
|
let parts = Url::parse(&url)?;
|
||||||
let host = parts.host().unwrap().to_string();
|
let host = parts.host().map(|host| host.to_string()).unwrap_or_default();
|
||||||
let domain = parts.domain().unwrap_or_default();
|
let domain = parts.domain().unwrap_or_default();
|
||||||
let path = format!("{}?{}", parts.path(), parts.query().unwrap_or_default());
|
let path = format!("{}?{}", parts.path(), parts.query().unwrap_or_default());
|
||||||
// Build reddit-compliant user agent for Libreddit
|
// Build reddit-compliant user agent for Libreddit
|
||||||
@ -36,17 +36,17 @@ async fn request(url: String) -> tide::Result {
|
|||||||
let connector = TlsConnector::default();
|
let connector = TlsConnector::default();
|
||||||
|
|
||||||
// Open a TCP connection
|
// Open a TCP connection
|
||||||
let tcp_stream = TcpStream::connect(format!("{}:443", domain)).await.unwrap();
|
let tcp_stream = TcpStream::connect(format!("{}:443", domain)).await?;
|
||||||
|
|
||||||
// Use the connector to start the handshake process
|
// Use the connector to start the handshake process
|
||||||
let mut tls_stream = connector.connect(domain, tcp_stream).await.unwrap();
|
let mut tls_stream = connector.connect(domain, tcp_stream).await?;
|
||||||
|
|
||||||
// Write the aforementioned HTTP request to the stream
|
// Write the aforementioned HTTP request to the stream
|
||||||
tls_stream.write_all(req.as_bytes()).await.unwrap();
|
tls_stream.write_all(req.as_bytes()).await?;
|
||||||
|
|
||||||
// And read the response
|
// And read the response
|
||||||
let mut writer = Vec::new();
|
let mut writer = Vec::new();
|
||||||
io::copy(&mut tls_stream, &mut writer).await.unwrap();
|
io::copy(&mut tls_stream, &mut writer).await?;
|
||||||
|
|
||||||
// Find the delimiter which separates the body and headers
|
// Find the delimiter which separates the body and headers
|
||||||
match (0..writer.len()).find(|i| writer[i.to_owned()] == 10_u8 && writer[i - 2] == 10_u8) {
|
match (0..writer.len()).find(|i| writer[i.to_owned()] == 10_u8 && writer[i - 2] == 10_u8) {
|
||||||
|
Reference in New Issue
Block a user