Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 105 additions & 94 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ arc-swap = "1.7.1"
serde_json_path = "0.7.1"
async-recursion = "1.1.1"
pulldown-cmark = { version = "0.12.0", features = ["simd", "html"], default-features = false }
hyper-rustls = { version = "0.24.2", features = [ "http2" ] }
hyper-tls = { version = "0.5.0" }
openssl = { version = "0.10", features = ["vendored"] }
tegen = "0.1.4"
serde_urlencoded = "0.7.1"
chrono = { version = "0.4.39", default-features = false, features = [ "std" ] }
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# supported versions here: https://hub.docker.com/_/rust
ARG ALPINE_VERSION=3.20
ARG ALPINE_VERSION=3.22

########################
## builder image
########################
FROM rust:alpine${ALPINE_VERSION} AS builder

RUN apk add --no-cache musl-dev
RUN apk add --no-cache musl-dev perl make git

WORKDIR /redlib

Expand All @@ -26,6 +26,9 @@ RUN echo "finished building redlib!"
########################
FROM alpine:${ALPINE_VERSION} AS release

# Install runtime dependencies for OpenSSL
RUN apk add --no-cache ca-certificates

# Import redlib binary from builder
COPY --from=builder /redlib/target/release/redlib /usr/local/bin/redlib

Expand Down
2 changes: 2 additions & 0 deletions Dockerfile.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ ARG UBUNTU_RELEASE_VERSION=noble
########################
FROM rust:${RUST_BUILDER_VERSION} AS builder

RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*

WORKDIR /redlib

# download (most) dependencies in their own layer
Expand Down
5 changes: 2 additions & 3 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use futures_lite::{future::Boxed, FutureExt};
use hyper::client::HttpConnector;
use hyper::header::HeaderValue;
use hyper::{body, body::Buf, header, Body, Client, Method, Request, Response, Uri};
use hyper_rustls::HttpsConnector;
use hyper_tls::HttpsConnector;
use libflate::gzip;
use log::{error, trace, warn};
use percent_encoding::{percent_encode, CONTROLS};
Expand All @@ -30,8 +30,7 @@ const REDDIT_SHORT_URL_BASE_HOST: &str = "redd.it";
const ALTERNATIVE_REDDIT_URL_BASE: &str = "https://www.reddit.com";
const ALTERNATIVE_REDDIT_URL_BASE_HOST: &str = "www.reddit.com";

pub static HTTPS_CONNECTOR: LazyLock<HttpsConnector<HttpConnector>> =
LazyLock::new(|| hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_only().enable_http2().build());
pub static HTTPS_CONNECTOR: LazyLock<HttpsConnector<HttpConnector>> = LazyLock::new(HttpsConnector::new);

pub static CLIENT: LazyLock<Client<HttpsConnector<HttpConnector>>> = LazyLock::new(|| Client::builder().build::<_, Body>(HTTPS_CONNECTOR.clone()));

Expand Down