diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
index 1c0405f6..3a941de8 100644
--- a/.devcontainer/devcontainer.json
+++ b/.devcontainer/devcontainer.json
@@ -6,7 +6,7 @@
},
"portsAttributes": {
"8080": {
- "label": "libreddit",
+ "label": "redlib",
"onAutoForward": "notify"
}
},
diff --git a/.github/ISSUE_TEMPLATE/feature_parity.md b/.github/ISSUE_TEMPLATE/feature_parity.md
index 22b9bd85..fc0a2f05 100644
--- a/.github/ISSUE_TEMPLATE/feature_parity.md
+++ b/.github/ISSUE_TEMPLATE/feature_parity.md
@@ -1,6 +1,6 @@
---
name: ✨ Feature parity
-about: Suggest implementing a feature into Libreddit that is found in Reddit.com
+about: Suggest implementing a feature into Redlib that is found in Reddit.com
title: '✨ Feature parity: '
labels: feature parity
assignees: ''
@@ -12,7 +12,7 @@ assignees: ''
A clear and concise description of what the feature is.
-->
-## Describe how this could be implemented into Libreddit
+## Describe how this could be implemented into Redlib
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index e9e6d317..e670476e 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -1,6 +1,6 @@
---
name: 💡 Feature request
-about: Suggest a feature for Libreddit that is not found in Reddit
+about: Suggest a feature for Redlib that is not found in Reddit
title: '💡 Feature request: '
labels: enhancement
assignees: ''
diff --git a/.github/workflows/main-docker.yml b/.github/workflows/main-docker.yml
index 94389450..09591caf 100644
--- a/.github/workflows/main-docker.yml
+++ b/.github/workflows/main-docker.yml
@@ -32,19 +32,21 @@ jobs:
with:
version: latest
- - name: Login to DockerHub
+ - name: Login to Quay.io
uses: docker/login-action@v2
with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
+ registry: quay.io
+ username: ${{ secrets.QUAY_USERNAME }}
+ password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- - name: Docker Hub Description
- uses: peter-evans/dockerhub-description@v3
- if: matrix.config.platform == 'linux/amd64'
+ - name: push README to Quay.io
+ uses: christian-korneck/update-container-description-action@v1
+ env:
+ DOCKER_APIKEY: ${{ secrets.APIKEY__QUAY_IO }}
with:
- username: ${{ secrets.DOCKER_USERNAME }}
- password: ${{ secrets.DOCKER_PASSWORD }}
- repository: libreddit/libreddit
+ destination_container_repo: quay.io/redlib/redlib
+ provider: quay
+ readme_file: 'README.md'
- name: Build and push
uses: docker/build-push-action@v4
@@ -53,6 +55,6 @@ jobs:
file: ./${{ matrix.config.dockerfile }}
platforms: ${{ matrix.config.platform }}
push: true
- tags: libreddit/libreddit:${{ matrix.config.tag }}
+ tags: redlib/redlib:${{ matrix.config.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
diff --git a/.github/workflows/main-rust.yml b/.github/workflows/main-rust.yml
index 69714fbc..54f8a30e 100644
--- a/.github/workflows/main-rust.yml
+++ b/.github/workflows/main-rust.yml
@@ -36,19 +36,19 @@ jobs:
run: RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target x86_64-unknown-linux-gnu
- name: Calculate SHA512 checksum
- run: sha512sum target/x86_64-unknown-linux-gnu/release/libreddit > libreddit.sha512
+ run: sha512sum target/x86_64-unknown-linux-gnu/release/redlib > redlib.sha512
- name: Calculate SHA256 checksum
- run: sha256sum target/x86_64-unknown-linux-gnu/release/libreddit > libreddit.sha256
+ run: sha256sum target/x86_64-unknown-linux-gnu/release/redlib > redlib.sha256
- uses: actions/upload-artifact@v3
name: Upload a Build Artifact
with:
- name: libreddit
+ name: redlib
path: |
- target/x86_64-unknown-linux-gnu/release/libreddit
- libreddit.sha512
- libreddit.sha256
+ target/x86_64-unknown-linux-gnu/release/redlib
+ redlib.sha512
+ redlib.sha256
- name: Versions
id: version
@@ -68,9 +68,9 @@ jobs:
name: ${{ steps.version.outputs.VERSION }} - ${{ github.event.head_commit.message }}
draft: true
files: |
- target/x86_64-unknown-linux-gnu/release/libreddit
- libreddit.sha512
- libreddit.sha256
+ target/x86_64-unknown-linux-gnu/release/redlib
+ redlib.sha512
+ redlib.sha256
body: |
- ${{ github.event.head_commit.message }} ${{ github.sha }}
generate_release_notes: true
diff --git a/.replit b/.replit
index 0b7966c1..fb83ea7d 100644
--- a/.replit
+++ b/.replit
@@ -1,2 +1,2 @@
-run = "while :; do set -ex; nix-env -iA nixpkgs.unzip; curl -o./libreddit.zip -fsSL -- https://nightly.link/libreddit/libreddit/workflows/main-rust/master/libreddit.zip; unzip -n libreddit.zip; mv target/x86_64-unknown-linux-gnu/release/libreddit .; chmod +x libreddit; set +e; ./libreddit -H 63115200; sleep 1; done"
+run = "while :; do set -ex; nix-env -iA nixpkgs.unzip; curl -o./redlib.zip -fsSL -- https://nightly.link/redlib-org/redlib/workflows/main-rust/master/redlib.zip; unzip -n redlib.zip; mv target/x86_64-unknown-linux-gnu/release/redlib .; chmod +x redlib; set +e; ./redlib -H 63115200; sleep 1; done"
language = "bash"
diff --git a/Cargo.lock b/Cargo.lock
index 5055c347..0cb655e7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -808,42 +808,6 @@ dependencies = [
"rle-decode-fast",
]
-[[package]]
-name = "libreddit"
-version = "0.30.1"
-dependencies = [
- "askama",
- "base64",
- "brotli",
- "build_html",
- "cached",
- "clap",
- "cookie",
- "dotenvy",
- "fastrand 2.0.1",
- "futures-lite",
- "hyper",
- "hyper-rustls",
- "libflate",
- "lipsum",
- "log",
- "once_cell",
- "percent-encoding",
- "pretty_env_logger",
- "regex",
- "route-recognizer",
- "rust-embed",
- "sealed_test",
- "serde",
- "serde_json",
- "serde_yaml",
- "time",
- "tokio",
- "toml",
- "url",
- "uuid",
-]
-
[[package]]
name = "linux-raw-sys"
version = "0.4.12"
@@ -1092,6 +1056,42 @@ version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
+[[package]]
+name = "redlib"
+version = "0.30.1"
+dependencies = [
+ "askama",
+ "base64",
+ "brotli",
+ "build_html",
+ "cached",
+ "clap",
+ "cookie",
+ "dotenvy",
+ "fastrand 2.0.1",
+ "futures-lite",
+ "hyper",
+ "hyper-rustls",
+ "libflate",
+ "lipsum",
+ "log",
+ "once_cell",
+ "percent-encoding",
+ "pretty_env_logger",
+ "regex",
+ "route-recognizer",
+ "rust-embed",
+ "sealed_test",
+ "serde",
+ "serde_json",
+ "serde_yaml",
+ "time",
+ "tokio",
+ "toml",
+ "url",
+ "uuid",
+]
+
[[package]]
name = "redox_syscall"
version = "0.4.1"
diff --git a/Cargo.toml b/Cargo.toml
index 7a6fad05..8e8f0d29 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,10 +1,10 @@
[package]
-name = "libreddit"
+name = "redlib"
description = " Alternative private front-end to Reddit"
license = "AGPL-3.0"
-repository = "https://github.com/spikecodes/libreddit"
+repository = "https://github.com/redlib-org/redlib"
version = "0.30.1"
-authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"]
+authors = ["Matthew Esposito "]
edition = "2021"
[dependencies]
diff --git a/Dockerfile b/Dockerfile
index 0820de46..e1ee914c 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -5,7 +5,7 @@ FROM rust:alpine AS builder
RUN apk add --no-cache musl-dev
-WORKDIR /libreddit
+WORKDIR /redlib
COPY . .
@@ -21,16 +21,16 @@ COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
# Copy our build
-COPY --from=builder /libreddit/target/x86_64-unknown-linux-musl/release/libreddit /usr/local/bin/libreddit
+COPY --from=builder /redlib/target/x86_64-unknown-linux-musl/release/redlib /usr/local/bin/redlib
# Use an unprivileged user.
-RUN adduser --home /nonexistent --no-create-home --disabled-password libreddit
-USER libreddit
+RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
+USER redlib
# Tell Docker to expose port 8080
EXPOSE 8080
-# Run a healthcheck every minute to make sure Libreddit is functional
+# Run a healthcheck every minute to make sure redlib is functional
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1
-CMD ["libreddit"]
\ No newline at end of file
+CMD ["redlib"]
\ No newline at end of file
diff --git a/Dockerfile.arm b/Dockerfile.arm
index ea849b4c..fd10a633 100644
--- a/Dockerfile.arm
+++ b/Dockerfile.arm
@@ -5,7 +5,7 @@ FROM rust:alpine AS builder
RUN apk add --no-cache g++ git
-WORKDIR /usr/src/libreddit
+WORKDIR /usr/src/redlib
# cache dependencies in their own layer
COPY Cargo.lock Cargo.toml .
@@ -30,16 +30,16 @@ COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
# Copy our build
-COPY --from=builder /usr/local/cargo/bin/libreddit /usr/local/bin/libreddit
+COPY --from=builder /usr/local/cargo/bin/redlib /usr/local/bin/redlib
# Use an unprivileged user.
-RUN adduser --home /nonexistent --no-create-home --disabled-password libreddit
-USER libreddit
+RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
+USER redlib
# Tell Docker to expose port 8080
EXPOSE 8080
-# Run a healthcheck every minute to make sure Libreddit is functional
+# Run a healthcheck every minute to make sure redlib is functional
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1
-CMD ["libreddit"]
+CMD ["redlib"]
diff --git a/Dockerfile.armv7 b/Dockerfile.armv7
index d28141c1..782750e2 100644
--- a/Dockerfile.armv7
+++ b/Dockerfile.armv7
@@ -12,7 +12,7 @@ RUN apt-get update && apt-get -y install gcc-arm-linux-gnueabihf \
RUN rustup target add armv7-unknown-linux-musleabihf
-WORKDIR /libreddit
+WORKDIR /redlib
COPY . .
@@ -28,16 +28,16 @@ COPY --from=builder /usr/share/ca-certificates /usr/share/ca-certificates
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
# Copy our build
-COPY --from=builder /libreddit/target/armv7-unknown-linux-musleabihf/release/libreddit /usr/local/bin/libreddit
+COPY --from=builder /redlib/target/armv7-unknown-linux-musleabihf/release/redlib /usr/local/bin/redlib
# Use an unprivileged user.
-RUN adduser --home /nonexistent --no-create-home --disabled-password libreddit
-USER libreddit
+RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
+USER redlib
# Tell Docker to expose port 8080
EXPOSE 8080
-# Run a healthcheck every minute to make sure Libreddit is functional
+# Run a healthcheck every minute to make sure redlib is functional
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1
-CMD ["libreddit"]
+CMD ["redlib"]
diff --git a/README.md b/README.md
index 4bb7a3a1..b288abcb 100644
--- a/README.md
+++ b/README.md
@@ -1,16 +1,15 @@
-# Libreddit
+# Redlib
> An alternative private front-end to Reddit
# ⚠️ Why do I get TOO MANY REQUESTS errors? ⚠️
-## As of July 12th, 2023, Libreddit is currently not operational as Reddit's API changes, that were designed to kill third-party apps and content scrapers who don't pay [large fees](https://www.theverge.com/2023/5/31/23743993/reddit-apollo-client-api-cost), went into effect. [Read the full announcement here.](https://github.com/libreddit/libreddit/issues/840)
-## One of the project maintainers is working towards keeping this project alive to some extent: https://github.com/libreddit/libreddit/issues/836
+#### As of July 12th, 2023, Redlib is currently not operational as Reddit's API changes, that were designed to kill third-party apps and content scrapers who don't pay [large fees](https://www.theverge.com/2023/5/31/23743993/reddit-apollo-client-api-cost), went into effect. [Read the full announcement here.](https://github.com/libreddit/libreddit/issues/840)
![screenshot](https://i.ibb.co/QYbqTQt/libreddit-rust.png)
---
-**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).
+**10-second pitch:** Redlib 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
- ☁️ Light: no JavaScript, no ads, no tracking, no bloat
@@ -19,7 +18,7 @@
---
-I appreciate any donations! Your support allows me to continue developing Libreddit.
+I appreciate any donations! Your support allows me to continue developing Redlib.
@@ -33,7 +32,7 @@ I appreciate any donations! Your support allows me to continue developing Libred
# Instances
-🔗 **Want to automatically redirect Reddit links to Libreddit? Use [LibRedirect](https://github.com/libredirect/libredirect) or [Privacy Redirect](https://github.com/SimonBrazell/privacy-redirect)!**
+🔗 **Want to automatically redirect Reddit links to Redlib? Use [LibRedirect](https://github.com/libredirect/libredirect) or [Privacy Redirect](https://github.com/SimonBrazell/privacy-redirect)!**
[Follow this link](https://github.com/libreddit/libreddit-instances/blob/master/instances.md) for an up-to-date table of instances in Markdown format. This list is also available as [a machine-readable JSON](https://github.com/libreddit/libreddit-instances/blob/master/instances.json).
@@ -43,7 +42,7 @@ Both files are part of the [libreddit-instances](https://github.com/libreddit/li
# About
-Find Libreddit on 💬 [Matrix](https://matrix.to/#/#libreddit:kde.org), 🐋 [Docker](https://hub.docker.com/r/libreddit/libreddit), :octocat: [GitHub](https://github.com/libreddit/libreddit), and 🦊 [GitLab](https://gitlab.com/libreddit/libreddit).
+Find Redlib on 💬 [Matrix](https://matrix.to/#/#libreddit:kde.org), 🐋 [Docker](https://hub.docker.com/r/libreddit/libreddit), :octocat: [GitHub](https://github.com/libreddit/libreddit), and 🦊 [GitLab](https://gitlab.com/libreddit/libreddit).
## Built with
@@ -53,31 +52,31 @@ Find Libreddit on 💬 [Matrix](https://matrix.to/#/#libreddit:kde.org), 🐋 [D
- [Rustls](https://github.com/ctz/rustls) - TLS library
## Info
-Libreddit hopes to provide an easier way to browse Reddit, without the ads, trackers, and bloat. Libreddit was inspired by other alternative front-ends to popular services such as [Invidious](https://github.com/iv-org/invidious) for YouTube, [Nitter](https://github.com/zedeus/nitter) for Twitter, and [Bibliogram](https://sr.ht/~cadence/bibliogram/) for Instagram.
+Redlib hopes to provide an easier way to browse Reddit, without the ads, trackers, and bloat. Redlib was inspired by other alternative front-ends to popular services such as [Invidious](https://github.com/iv-org/invidious) for YouTube, [Nitter](https://github.com/zedeus/nitter) for Twitter, and [Bibliogram](https://sr.ht/~cadence/bibliogram/) for Instagram.
-Libreddit currently implements most of Reddit's (signed-out) functionalities but still lacks [a few features](https://github.com/libreddit/libreddit/issues).
+Redlib currently implements most of Reddit's (signed-out) functionalities but still lacks [a few features](https://github.com/libreddit/libreddit/issues).
## How does it compare to Teddit?
-Teddit is another awesome open source project designed to provide an alternative frontend to Reddit. There is no connection between the two, and you're welcome to use whichever one you favor. Competition fosters innovation and Teddit's release has motivated me to build Libreddit into an even more polished product.
+Teddit is another awesome open source project designed to provide an alternative frontend to Reddit. There is no connection between the two, and you're welcome to use whichever one you favor. Competition fosters innovation and Teddit's release has motivated me to build Redlib into an even more polished product.
If you are looking to compare, the biggest differences I have noticed are:
-- Libreddit is themed around Reddit's redesign whereas Teddit appears to stick much closer to Reddit's old design. This may suit some users better as design is always subjective.
-- Libreddit is written in [Rust](https://www.rust-lang.org) for speed and memory safety. It uses [Hyper](https://hyper.rs), a speedy and lightweight HTTP server/client implementation.
+- Redlib is themed around Reddit's redesign whereas Teddit appears to stick much closer to Reddit's old design. This may suit some users better as design is always subjective.
+- Redlib is written in [Rust](https://www.rust-lang.org) for speed and memory safety. It uses [Hyper](https://hyper.rs), a speedy and lightweight HTTP server/client implementation.
---
# Comparison
-This section outlines how Libreddit compares to Reddit.
+This section outlines how Redlib compares to Reddit.
## Speed
Lasted tested Nov 11, 2022.
-Results from Google PageSpeed Insights ([Libreddit Report](https://pagespeed.web.dev/report?url=https%3A%2F%2Flibreddit.spike.codes%2F), [Reddit Report](https://pagespeed.web.dev/report?url=https://www.reddit.com)).
+Results from Google PageSpeed Insights ([Redlib Report](https://pagespeed.web.dev/report?url=https%3A%2F%2Flibreddit.spike.codes%2F), [Reddit Report](https://pagespeed.web.dev/report?url=https://www.reddit.com)).
-| | Libreddit | Reddit |
+| | Redlib | Reddit |
|------------------------|-------------|-----------|
| Requests | 60 | 83 |
| Speed Index | 2.0s | 10.4s |
@@ -114,15 +113,15 @@ Results from Google PageSpeed Insights ([Libreddit Report](https://pagespeed.web
- Third-Party Cookies
- Third-Party Site
-### Libreddit
+### Redlib
-For transparency, I hope to describe all the ways Libreddit handles user privacy.
+For transparency, I hope to describe all the ways Redlib handles user privacy.
#### Server
-* **Logging:** In production (when running the binary, hosting with docker, or using the official instances), Libreddit logs nothing. When debugging (running from source without `--release`), Libreddit logs post IDs fetched to aid with troubleshooting.
+* **Logging:** In production (when running the binary, hosting with docker, or using the official instances), Redlib logs nothing. When debugging (running from source without `--release`), Redlib logs post IDs fetched to aid with troubleshooting.
-* **Cookies:** Libreddit uses optional cookies to store any configured settings in [the settings menu](https://libreddit.spike.codes/settings). These are not cross-site cookies and the cookies hold no personal data.
+* **Cookies:** Redlib uses optional cookies to store any configured settings in [the settings menu](https://libreddit.spike.codes/settings). These are not cross-site cookies and the cookies hold no personal data.
#### Official instance (libreddit.spike.codes)
@@ -148,7 +147,7 @@ cargo install libreddit
## 2) Docker
-Deploy the [Docker image](https://hub.docker.com/r/libreddit/libreddit) of Libreddit:
+Deploy the [Docker image](https://hub.docker.com/r/libreddit/libreddit) of Redlib:
```
docker pull libreddit/libreddit
docker run -d --name libreddit -p 8080:8080 libreddit/libreddit
@@ -166,14 +165,14 @@ To deploy on `armv7` platforms, simply replace `libreddit/libreddit` in the comm
## 3) AUR
-For ArchLinux users, Libreddit is available from the AUR as [`libreddit-git`](https://aur.archlinux.org/packages/libreddit-git).
+For ArchLinux users, Redlib is available from the AUR as [`libreddit-git`](https://aur.archlinux.org/packages/libreddit-git).
```
yay -S libreddit-git
```
## 4) NetBSD/pkgsrc
-For NetBSD users, Libreddit is available from the official repositories.
+For NetBSD users, Redlib is available from the official repositories.
```
pkgin install libreddit
@@ -203,7 +202,7 @@ If you're on Linux and none of these methods work for you, you can grab a Linux
# Deployment
-Once installed, deploy Libreddit to `0.0.0.0:8080` by running:
+Once installed, deploy Redlib to `0.0.0.0:8080` by running:
```
libreddit
@@ -211,7 +210,7 @@ libreddit
## Instance settings
-Assign a default value for each instance-specific setting by passing environment variables to Libreddit in the format `LIBREDDIT_{X}`. Replace `{X}` with the setting name (see list below) in capital letters.
+Assign a default value for each instance-specific setting by passing environment variables to Redlib in the format `REDLIB_{X}`. Replace `{X}` with the setting name (see list below) in capital letters.
| Name | Possible values | Default value | Description |
|---------------------------|-----------------|------------------|-----------------------------------------------------------------------------------------------------------|
@@ -222,7 +221,7 @@ Assign a default value for each instance-specific setting by passing environment
## Default User Settings
-Assign a default value for each user-modifiable setting by passing environment variables to Libreddit in the format `LIBREDDIT_DEFAULT_{Y}`. Replace `{Y}` with the setting name (see list below) in capital letters.
+Assign a default value for each user-modifiable setting by passing environment variables to Redlib in the format `REDLIB_DEFAULT_{Y}`. Replace `{Y}` with the setting name (see list below) in capital letters.
| Name | Possible values | Default value |
|-------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|---------------|
@@ -244,27 +243,27 @@ Assign a default value for each user-modifiable setting by passing environment v
| `HIDE_SCORE` | `["on", "off"]` | `off` |
| `FIXED_NAVBAR` | `["on", "off"]` | `on` |
-You can also configure Libreddit with a configuration file. An example `libreddit.toml` can be found below:
+You can also configure Redlib with a configuration file. An example `libreddit.toml` can be found below:
```toml
-LIBREDDIT_DEFAULT_WIDE = "on"
-LIBREDDIT_DEFAULT_USE_HLS = "on"
+REDLIB_DEFAULT_WIDE = "on"
+REDLIB_DEFAULT_USE_HLS = "on"
```
### Examples
```bash
-LIBREDDIT_DEFAULT_SHOW_NSFW=on libreddit
+REDLIB_DEFAULT_SHOW_NSFW=on libreddit
```
```bash
-LIBREDDIT_DEFAULT_WIDE=on LIBREDDIT_DEFAULT_THEME=dark libreddit -r
+REDLIB_DEFAULT_WIDE=on REDLIB_DEFAULT_THEME=dark libreddit -r
```
## Proxying using NGINX
> **Note**
-> If you're [proxying Libreddit through an NGINX Reverse Proxy](https://github.com/libreddit/libreddit/issues/122#issuecomment-782226853), add
+> If you're [proxying Redlib through an NGINX Reverse Proxy](https://github.com/libreddit/libreddit/issues/122#issuecomment-782226853), add
> ```nginx
> proxy_http_version 1.1;
> ```
@@ -277,7 +276,7 @@ You can use the systemd service available in `contrib/libreddit.service`
That service can be optionally configured in terms of environment variables by
creating a file in `/etc/libreddit.conf`. Use the `contrib/libreddit.conf` as a
-template. You can also add the `LIBREDDIT_DEFAULT__{X}` settings explained
+template. You can also add the `REDLIB_DEFAULT__{X}` settings explained
above.
When "Proxying using NGINX" where the proxy is on the same machine, you should
diff --git a/app.json b/app.json
index 8fc48fa9..29982c09 100644
--- a/app.json
+++ b/app.json
@@ -1,5 +1,5 @@
{
- "name": "Libreddit",
+ "name": "Redlib",
"description": "Private front-end for Reddit",
"buildpacks": [
{
@@ -11,61 +11,61 @@
],
"stack": "container",
"env": {
- "LIBREDDIT_DEFAULT_THEME": {
+ "REDLIB_DEFAULT_THEME": {
"required": false
},
- "LIBREDDIT_DEFAULT_FRONT_PAGE": {
+ "REDLIB_DEFAULT_FRONT_PAGE": {
"required": false
},
- "LIBREDDIT_DEFAULT_LAYOUT": {
+ "REDLIB_DEFAULT_LAYOUT": {
"required": false
},
- "LIBREDDIT_DEFAULT_WIDE": {
+ "REDLIB_DEFAULT_WIDE": {
"required": false
},
- "LIBREDDIT_DEFAULT_COMMENT_SORT": {
+ "REDLIB_DEFAULT_COMMENT_SORT": {
"required": false
},
- "LIBREDDIT_DEFAULT_POST_SORT": {
+ "REDLIB_DEFAULT_POST_SORT": {
"required": false
},
- "LIBREDDIT_DEFAULT_SHOW_NSFW": {
+ "REDLIB_DEFAULT_SHOW_NSFW": {
"required": false
},
- "LIBREDDIT_DEFAULT_BLUR_NSFW": {
+ "REDLIB_DEFAULT_BLUR_NSFW": {
"required": false
},
- "LIBREDDIT_USE_HLS": {
+ "REDLIB_USE_HLS": {
"required": false
},
- "LIBREDDIT_HIDE_HLS_NOTIFICATION": {
+ "REDLIB_HIDE_HLS_NOTIFICATION": {
"required": false
},
- "LIBREDDIT_SFW_ONLY": {
+ "REDLIB_SFW_ONLY": {
"required": false
},
- "LIBREDDIT_DEFAULT_HIDE_AWARDS": {
+ "REDLIB_DEFAULT_HIDE_AWARDS": {
"required": false
},
- "LIBREDDIT_DEFAULT_HIDE_SCORE": {
+ "REDLIB_DEFAULT_HIDE_SCORE": {
"required": false
},
- "LIBREDDIT_BANNER": {
+ "REDLIB_BANNER": {
"required": false
},
- "LIBREDDIT_ROBOTS_DISABLE_INDEXING": {
+ "REDLIB_ROBOTS_DISABLE_INDEXING": {
"required": false
},
- "LIBREDDIT_DEFAULT_SUBSCRIPTIONS": {
+ "REDLIB_DEFAULT_SUBSCRIPTIONS": {
"required": false
},
- "LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION": {
+ "REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION": {
"required": false
},
- "LIBREDDIT_PUSHSHIFT_FRONTEND": {
+ "REDLIB_PUSHSHIFT_FRONTEND": {
"required": false
},
- "LIBREDDIT_DISABLE_STATS_COLLECTION": {
+ "REDLIB_DISABLE_STATS_COLLECTION": {
"required": false
}
}
diff --git a/contrib/libreddit.conf b/contrib/libreddit.conf
index e1bb5e7a..880bc7a3 100644
--- a/contrib/libreddit.conf
+++ b/contrib/libreddit.conf
@@ -1,16 +1,16 @@
ADDRESS=0.0.0.0
PORT=12345
-#LIBREDDIT_DEFAULT_THEME=default
-#LIBREDDIT_DEFAULT_FRONT_PAGE=default
-#LIBREDDIT_DEFAULT_LAYOUT=card
-#LIBREDDIT_DEFAULT_WIDE=off
-#LIBREDDIT_DEFAULT_POST_SORT=hot
-#LIBREDDIT_DEFAULT_COMMENT_SORT=confidence
-#LIBREDDIT_DEFAULT_SHOW_NSFW=off
-#LIBREDDIT_DEFAULT_BLUR_NSFW=off
-#LIBREDDIT_DEFAULT_USE_HLS=off
-#LIBREDDIT_DEFAULT_HIDE_HLS_NOTIFICATION=off
-#LIBREDDIT_DEFAULT_AUTOPLAY_VIDEOS=off
-#LIBREDDIT_DEFAULT_SUBSCRIPTIONS=off (sub1+sub2+sub3)
-#LIBREDDIT_DEFAULT_HIDE_AWARDS=off
-#LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION=off
+#REDLIB_DEFAULT_THEME=default
+#REDLIB_DEFAULT_FRONT_PAGE=default
+#REDLIB_DEFAULT_LAYOUT=card
+#REDLIB_DEFAULT_WIDE=off
+#REDLIB_DEFAULT_POST_SORT=hot
+#REDLIB_DEFAULT_COMMENT_SORT=confidence
+#REDLIB_DEFAULT_SHOW_NSFW=off
+#REDLIB_DEFAULT_BLUR_NSFW=off
+#REDLIB_DEFAULT_USE_HLS=off
+#REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION=off
+#REDLIB_DEFAULT_AUTOPLAY_VIDEOS=off
+#REDLIB_DEFAULT_SUBSCRIPTIONS=off (sub1+sub2+sub3)
+#REDLIB_DEFAULT_HIDE_AWARDS=off
+#REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION=off
diff --git a/contrib/libreddit.plist b/contrib/libreddit.plist
index f88a034d..1fff8e9f 100644
--- a/contrib/libreddit.plist
+++ b/contrib/libreddit.plist
@@ -3,10 +3,10 @@
Label
- libreddit
+ redlibProgram
- libreddit
+ redlibKeepAlive
diff --git a/contrib/libreddit.service b/contrib/libreddit.service
index 494971b5..c43ef498 100644
--- a/contrib/libreddit.service
+++ b/contrib/libreddit.service
@@ -1,5 +1,5 @@
[Unit]
-Description=libreddit daemon
+Description=redlib daemon
After=network.service
[Service]
@@ -8,8 +8,8 @@ DynamicUser=yes
#Environment=ADDRESS=0.0.0.0
#Environment=PORT=8080
# Optional Override
-EnvironmentFile=-/etc/libreddit.conf
-ExecStart=/usr/bin/libreddit -a ${ADDRESS} -p ${PORT}
+EnvironmentFile=-/etc/redlib.conf
+ExecStart=/usr/bin/redlib -a ${ADDRESS} -p ${PORT}
# Hardening
DeviceAllow=
diff --git a/docker-compose.yml b/docker-compose.yml
index 2a5e69d5..9bc02bd8 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -4,7 +4,7 @@ services:
web:
build: .
restart: always
- container_name: "libreddit"
+ container_name: "redlib"
ports:
- 8080:8080
user: nobody
@@ -14,13 +14,13 @@ services:
cap_drop:
- ALL
networks:
- - libreddit
+ - redlib
security_opt:
- - seccomp="seccomp-libreddit.json"
+ - seccomp="seccomp-redlib.json"
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "--tries=1", "http://localhost:8080/settings"]
interval: 5m
timeout: 3s
networks:
- libreddit:
+ redlib:
diff --git a/scripts/gen-credits.sh b/scripts/gen-credits.sh
index 33ce9f46..24534a4e 100755
--- a/scripts/gen-credits.sh
+++ b/scripts/gen-credits.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# This scripts generates the CREDITS file in the repository root, which
-# contains a list of all contributors ot the Libreddit project.
+# contains a list of all contributors ot the Redlib project.
#
# We use git-log to surface the names and emails of all authors and committers,
# and grep will filter any automated commits due to GitHub.
diff --git a/seccomp-libreddit.json b/seccomp-redlib.json
similarity index 100%
rename from seccomp-libreddit.json
rename to seccomp-redlib.json
diff --git a/src/client.rs b/src/client.rs
index 80ed1532..cc704d6d 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -137,7 +137,7 @@ fn reddit_head(path: String, quarantine: bool) -> Boxed, S
/// in its response.
fn request(method: &'static Method, path: String, redirect: bool, quarantine: bool) -> Boxed, String>> {
// Increment reddit request count. This will include head requests.
- if config::get_setting("LIBREDDIT_DISABLE_STATS_COLLECTION").is_none() {
+ if config::get_setting("REDLIB_DISABLE_STATS_COLLECTION").is_none() {
INSTANCE_INFO.reddit_requests.fetch_add(1, SeqCst);
}
// Build Reddit URL from path.
diff --git a/src/config.rs b/src/config.rs
index f4f58ee4..f712bdeb 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -20,61 +20,61 @@ pub(crate) const DEFAULT_PUSHSHIFT_FRONTEND: &str = "www.unddit.com";
/// instance_info::InstanceInfo.to_string(), README.md and app.json.
#[derive(Default, Serialize, Deserialize, Clone, Debug)]
pub struct Config {
- #[serde(rename = "LIBREDDIT_SFW_ONLY")]
+ #[serde(rename = "REDLIB_SFW_ONLY")]
pub(crate) sfw_only: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_THEME")]
+ #[serde(rename = "REDLIB_DEFAULT_THEME")]
pub(crate) default_theme: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_FRONT_PAGE")]
+ #[serde(rename = "REDLIB_DEFAULT_FRONT_PAGE")]
pub(crate) default_front_page: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_LAYOUT")]
+ #[serde(rename = "REDLIB_DEFAULT_LAYOUT")]
pub(crate) default_layout: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_WIDE")]
+ #[serde(rename = "REDLIB_DEFAULT_WIDE")]
pub(crate) default_wide: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_COMMENT_SORT")]
+ #[serde(rename = "REDLIB_DEFAULT_COMMENT_SORT")]
pub(crate) default_comment_sort: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_POST_SORT")]
+ #[serde(rename = "REDLIB_DEFAULT_POST_SORT")]
pub(crate) default_post_sort: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_SHOW_NSFW")]
+ #[serde(rename = "REDLIB_DEFAULT_SHOW_NSFW")]
pub(crate) default_show_nsfw: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_BLUR_NSFW")]
+ #[serde(rename = "REDLIB_DEFAULT_BLUR_NSFW")]
pub(crate) default_blur_nsfw: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_USE_HLS")]
+ #[serde(rename = "REDLIB_DEFAULT_USE_HLS")]
pub(crate) default_use_hls: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_HIDE_HLS_NOTIFICATION")]
+ #[serde(rename = "REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION")]
pub(crate) default_hide_hls_notification: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_HIDE_AWARDS")]
+ #[serde(rename = "REDLIB_DEFAULT_HIDE_AWARDS")]
pub(crate) default_hide_awards: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_HIDE_SCORE")]
+ #[serde(rename = "REDLIB_DEFAULT_HIDE_SCORE")]
pub(crate) default_hide_score: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_SUBSCRIPTIONS")]
+ #[serde(rename = "REDLIB_DEFAULT_SUBSCRIPTIONS")]
pub(crate) default_subscriptions: Option,
- #[serde(rename = "LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION")]
+ #[serde(rename = "REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION")]
pub(crate) default_disable_visit_reddit_confirmation: Option,
- #[serde(rename = "LIBREDDIT_BANNER")]
+ #[serde(rename = "REDLIB_BANNER")]
pub(crate) banner: Option,
- #[serde(rename = "LIBREDDIT_ROBOTS_DISABLE_INDEXING")]
+ #[serde(rename = "REDLIB_ROBOTS_DISABLE_INDEXING")]
pub(crate) robots_disable_indexing: Option,
- #[serde(rename = "LIBREDDIT_DISABLE_STATS_COLLECTION")]
+ #[serde(rename = "REDLIB_DISABLE_STATS_COLLECTION")]
pub(crate) disable_stats_collection: Option,
- #[serde(rename = "LIBREDDIT_PUSHSHIFT_FRONTEND")]
+ #[serde(rename = "REDLIB_PUSHSHIFT_FRONTEND")]
pub(crate) pushshift: Option,
}
@@ -83,59 +83,59 @@ impl Config {
/// In the case that there are no environment variables set and there is no
/// config file, this function returns a Config that contains all None values.
pub fn load() -> Self {
- // Read from libreddit.toml config file. If for any reason, it fails, the
+ // Read from redlib.toml config file. If for any reason, it fails, the
// default `Config` is used (all None values)
- let config: Config = toml::from_str(&read_to_string("libreddit.toml").unwrap_or_default()).unwrap_or_default();
+ let config: Config = toml::from_str(&read_to_string("redlib.toml").unwrap_or_default()).unwrap_or_default();
// This function defines the order of preference - first check for
- // environment variables with "LIBREDDIT", then check the config, then if
+ // environment variables with "REDLIB", then check the config, then if
// both are `None`, return a `None` via the `map_or_else` function
let parse = |key: &str| -> Option { var(key).ok().map_or_else(|| get_setting_from_config(key, &config), Some) };
Self {
- sfw_only: parse("LIBREDDIT_SFW_ONLY"),
- default_theme: parse("LIBREDDIT_DEFAULT_THEME"),
- default_front_page: parse("LIBREDDIT_DEFAULT_FRONT_PAGE"),
- default_layout: parse("LIBREDDIT_DEFAULT_LAYOUT"),
- default_post_sort: parse("LIBREDDIT_DEFAULT_POST_SORT"),
- default_wide: parse("LIBREDDIT_DEFAULT_WIDE"),
- default_comment_sort: parse("LIBREDDIT_DEFAULT_COMMENT_SORT"),
- default_show_nsfw: parse("LIBREDDIT_DEFAULT_SHOW_NSFW"),
- default_blur_nsfw: parse("LIBREDDIT_DEFAULT_BLUR_NSFW"),
- default_use_hls: parse("LIBREDDIT_DEFAULT_USE_HLS"),
- default_hide_hls_notification: parse("LIBREDDIT_DEFAULT_HIDE_HLS"),
- default_hide_awards: parse("LIBREDDIT_DEFAULT_HIDE_AWARDS"),
- default_hide_score: parse("LIBREDDIT_DEFAULT_HIDE_SCORE"),
- default_subscriptions: parse("LIBREDDIT_DEFAULT_SUBSCRIPTIONS"),
- default_disable_visit_reddit_confirmation: parse("LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION"),
- banner: parse("LIBREDDIT_BANNER"),
- robots_disable_indexing: parse("LIBREDDIT_ROBOTS_DISABLE_INDEXING"),
- disable_stats_collection: parse("LIBREDDIT_DISABLE_STATS_COLLECTION"),
- pushshift: parse("LIBREDDIT_PUSHSHIFT_FRONTEND"),
+ sfw_only: parse("REDLIB_SFW_ONLY"),
+ default_theme: parse("REDLIB_DEFAULT_THEME"),
+ default_front_page: parse("REDLIB_DEFAULT_FRONT_PAGE"),
+ default_layout: parse("REDLIB_DEFAULT_LAYOUT"),
+ default_post_sort: parse("REDLIB_DEFAULT_POST_SORT"),
+ default_wide: parse("REDLIB_DEFAULT_WIDE"),
+ default_comment_sort: parse("REDLIB_DEFAULT_COMMENT_SORT"),
+ default_show_nsfw: parse("REDLIB_DEFAULT_SHOW_NSFW"),
+ default_blur_nsfw: parse("REDLIB_DEFAULT_BLUR_NSFW"),
+ default_use_hls: parse("REDLIB_DEFAULT_USE_HLS"),
+ default_hide_hls_notification: parse("REDLIB_DEFAULT_HIDE_HLS"),
+ default_hide_awards: parse("REDLIB_DEFAULT_HIDE_AWARDS"),
+ default_hide_score: parse("REDLIB_DEFAULT_HIDE_SCORE"),
+ default_subscriptions: parse("REDLIB_DEFAULT_SUBSCRIPTIONS"),
+ default_disable_visit_reddit_confirmation: parse("REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION"),
+ banner: parse("REDLIB_BANNER"),
+ robots_disable_indexing: parse("REDLIB_ROBOTS_DISABLE_INDEXING"),
+ disable_stats_collection: parse("REDLIB_DISABLE_STATS_COLLECTION"),
+ pushshift: parse("REDLIB_PUSHSHIFT_FRONTEND"),
}
}
}
fn get_setting_from_config(name: &str, config: &Config) -> Option {
match name {
- "LIBREDDIT_SFW_ONLY" => config.sfw_only.clone(),
- "LIBREDDIT_DEFAULT_THEME" => config.default_theme.clone(),
- "LIBREDDIT_DEFAULT_FRONT_PAGE" => config.default_front_page.clone(),
- "LIBREDDIT_DEFAULT_LAYOUT" => config.default_layout.clone(),
- "LIBREDDIT_DEFAULT_COMMENT_SORT" => config.default_comment_sort.clone(),
- "LIBREDDIT_DEFAULT_POST_SORT" => config.default_post_sort.clone(),
- "LIBREDDIT_DEFAULT_SHOW_NSFW" => config.default_show_nsfw.clone(),
- "LIBREDDIT_DEFAULT_BLUR_NSFW" => config.default_blur_nsfw.clone(),
- "LIBREDDIT_DEFAULT_USE_HLS" => config.default_use_hls.clone(),
- "LIBREDDIT_DEFAULT_HIDE_HLS_NOTIFICATION" => config.default_hide_hls_notification.clone(),
- "LIBREDDIT_DEFAULT_WIDE" => config.default_wide.clone(),
- "LIBREDDIT_DEFAULT_HIDE_AWARDS" => config.default_hide_awards.clone(),
- "LIBREDDIT_DEFAULT_HIDE_SCORE" => config.default_hide_score.clone(),
- "LIBREDDIT_DEFAULT_SUBSCRIPTIONS" => config.default_subscriptions.clone(),
- "LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION" => config.default_disable_visit_reddit_confirmation.clone(),
- "LIBREDDIT_BANNER" => config.banner.clone(),
- "LIBREDDIT_ROBOTS_DISABLE_INDEXING" => config.robots_disable_indexing.clone(),
- "LIBREDDIT_DISABLE_STATS_COLLECTION" => config.disable_stats_collection.clone(),
- "LIBREDDIT_PUSHSHIFT_FRONTEND" => config.pushshift.clone(),
+ "REDLIB_SFW_ONLY" => config.sfw_only.clone(),
+ "REDLIB_DEFAULT_THEME" => config.default_theme.clone(),
+ "REDLIB_DEFAULT_FRONT_PAGE" => config.default_front_page.clone(),
+ "REDLIB_DEFAULT_LAYOUT" => config.default_layout.clone(),
+ "REDLIB_DEFAULT_COMMENT_SORT" => config.default_comment_sort.clone(),
+ "REDLIB_DEFAULT_POST_SORT" => config.default_post_sort.clone(),
+ "REDLIB_DEFAULT_SHOW_NSFW" => config.default_show_nsfw.clone(),
+ "REDLIB_DEFAULT_BLUR_NSFW" => config.default_blur_nsfw.clone(),
+ "REDLIB_DEFAULT_USE_HLS" => config.default_use_hls.clone(),
+ "REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION" => config.default_hide_hls_notification.clone(),
+ "REDLIB_DEFAULT_WIDE" => config.default_wide.clone(),
+ "REDLIB_DEFAULT_HIDE_AWARDS" => config.default_hide_awards.clone(),
+ "REDLIB_DEFAULT_HIDE_SCORE" => config.default_hide_score.clone(),
+ "REDLIB_DEFAULT_SUBSCRIPTIONS" => config.default_subscriptions.clone(),
+ "REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION" => config.default_disable_visit_reddit_confirmation.clone(),
+ "REDLIB_BANNER" => config.banner.clone(),
+ "REDLIB_ROBOTS_DISABLE_INDEXING" => config.robots_disable_indexing.clone(),
+ "REDLIB_DISABLE_STATS_COLLECTION" => config.disable_stats_collection.clone(),
+ "REDLIB_PUSHSHIFT_FRONTEND" => config.pushshift.clone(),
_ => None,
}
}
@@ -156,7 +156,7 @@ fn test_deserialize() {
}
#[test]
-#[sealed_test(env = [("LIBREDDIT_SFW_ONLY", "on")])]
+#[sealed_test(env = [("REDLIB_SFW_ONLY", "on")])]
fn test_env_var() {
assert!(crate::utils::sfw_only())
}
@@ -164,41 +164,41 @@ fn test_env_var() {
#[test]
#[sealed_test]
fn test_config() {
- let config_to_write = r#"LIBREDDIT_DEFAULT_COMMENT_SORT = "best""#;
- write("libreddit.toml", config_to_write).unwrap();
- assert_eq!(get_setting("LIBREDDIT_DEFAULT_COMMENT_SORT"), Some("best".into()));
+ let config_to_write = r#"REDLIB_DEFAULT_COMMENT_SORT = "best""#;
+ write("redlib.toml", config_to_write).unwrap();
+ assert_eq!(get_setting("REDLIB_DEFAULT_COMMENT_SORT"), Some("best".into()));
}
#[test]
-#[sealed_test(env = [("LIBREDDIT_DEFAULT_COMMENT_SORT", "top")])]
+#[sealed_test(env = [("REDLIB_DEFAULT_COMMENT_SORT", "top")])]
fn test_env_config_precedence() {
- let config_to_write = r#"LIBREDDIT_DEFAULT_COMMENT_SORT = "best""#;
- write("libreddit.toml", config_to_write).unwrap();
- assert_eq!(get_setting("LIBREDDIT_DEFAULT_COMMENT_SORT"), Some("top".into()))
+ let config_to_write = r#"REDLIB_DEFAULT_COMMENT_SORT = "best""#;
+ write("redlib.toml", config_to_write).unwrap();
+ assert_eq!(get_setting("REDLIB_DEFAULT_COMMENT_SORT"), Some("top".into()))
}
#[test]
-#[sealed_test(env = [("LIBREDDIT_DEFAULT_COMMENT_SORT", "top")])]
+#[sealed_test(env = [("REDLIB_DEFAULT_COMMENT_SORT", "top")])]
fn test_alt_env_config_precedence() {
- let config_to_write = r#"LIBREDDIT_DEFAULT_COMMENT_SORT = "best""#;
- write("libreddit.toml", config_to_write).unwrap();
- assert_eq!(get_setting("LIBREDDIT_DEFAULT_COMMENT_SORT"), Some("top".into()))
+ let config_to_write = r#"REDLIB_DEFAULT_COMMENT_SORT = "best""#;
+ write("redlib.toml", config_to_write).unwrap();
+ assert_eq!(get_setting("REDLIB_DEFAULT_COMMENT_SORT"), Some("top".into()))
}
#[test]
-#[sealed_test(env = [("LIBREDDIT_DEFAULT_SUBSCRIPTIONS", "news+bestof")])]
+#[sealed_test(env = [("REDLIB_DEFAULT_SUBSCRIPTIONS", "news+bestof")])]
fn test_default_subscriptions() {
- assert_eq!(get_setting("LIBREDDIT_DEFAULT_SUBSCRIPTIONS"), Some("news+bestof".into()));
+ assert_eq!(get_setting("REDLIB_DEFAULT_SUBSCRIPTIONS"), Some("news+bestof".into()));
}
#[test]
fn test_stats_collection_empty() {
- assert_eq!(get_setting("LIBREDDIT_DISABLE_STATS_COLLECTION"), None);
+ assert_eq!(get_setting("REDLIB_DISABLE_STATS_COLLECTION"), None);
}
#[test]
#[sealed_test]
fn test_stats_collection_true() {
- let config_to_write = r#"LIBREDDIT_DISABLE_STATS_COLLECTION = "1""#;
- write("libreddit.toml", config_to_write).unwrap();
- assert!(get_setting("LIBREDDIT_DISABLE_STATS_COLLECTION").is_some());
+ let config_to_write = r#"REDLIB_DISABLE_STATS_COLLECTION = "1""#;
+ write("redlib.toml", config_to_write).unwrap();
+ assert!(get_setting("REDLIB_DISABLE_STATS_COLLECTION").is_some());
}
diff --git a/src/main.rs b/src/main.rs
index 7d0d61ac..8a24fbed 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -118,7 +118,7 @@ async fn main() {
// Initialize logger
pretty_env_logger::init();
- let matches = Command::new("Libreddit")
+ let matches = Command::new("Redlib")
.version(env!("CARGO_PKG_VERSION"))
.about("Private front-end for Reddit written in Rust ")
.arg(
@@ -165,7 +165,7 @@ async fn main() {
let listener = [address, ":", port].concat();
- println!("Starting Libreddit...");
+ println!("Starting Redlib...");
// Begin constructing a server
let mut app = server::Server::new();
@@ -204,7 +204,7 @@ async fn main() {
.get(|_| resource(include_str!("../static/manifest.json"), "application/json", false).boxed());
app.at("/robots.txt").get(|_| {
resource(
- if match config::get_setting("LIBREDDIT_ROBOTS_DISABLE_INDEXING") {
+ if match config::get_setting("REDLIB_ROBOTS_DISABLE_INDEXING") {
Some(val) => val == "on",
None => false,
} {
@@ -229,7 +229,7 @@ async fn main() {
.at("/hls.min.js")
.get(|_| resource(include_str!("../static/hls.min.js"), "text/javascript", false).boxed());
- // Proxy media through Libreddit
+ // Proxy media through Redlib
app.at("/vid/:id/:size").get(|r| proxy(r, "https://v.redd.it/{id}/DASH_{size}").boxed());
app.at("/hls/:id/*path").get(|r| proxy(r, "https://v.redd.it/{id}/{path}").boxed());
app.at("/img/*path").get(|r| proxy(r, "https://i.redd.it/{path}").boxed());
@@ -370,7 +370,7 @@ async fn main() {
// Default service in case no routes match
app.at("/*").get(|req| error(req, "Nothing here".to_string()).boxed());
- println!("Running Libreddit v{} on {}!", env!("CARGO_PKG_VERSION"), listener);
+ println!("Running Redlib v{} on {}!", env!("CARGO_PKG_VERSION"), listener);
let server = app.listen(listener);
diff --git a/src/post.rs b/src/post.rs
index 98dcac33..5cac715d 100644
--- a/src/post.rs
+++ b/src/post.rs
@@ -171,7 +171,7 @@ fn build_comment(
let body = if (val(comment, "author") == "[deleted]" && val(comment, "body") == "[removed]") || val(comment, "body") == "[ Removed by Reddit ]" {
format!(
"
",
- get_setting("LIBREDDIT_PUSHSHIFT_FRONTEND").unwrap_or(String::from(crate::config::DEFAULT_PUSHSHIFT_FRONTEND)),
+ get_setting("REDLIB_PUSHSHIFT_FRONTEND").unwrap_or(String::from(crate::config::DEFAULT_PUSHSHIFT_FRONTEND)),
post_link,
id
)
@@ -218,7 +218,7 @@ fn build_comment(
let is_filtered = filters.contains(&["u_", author.name.as_str()].concat());
// Many subreddits have a default comment posted about the sub's rules etc.
- // Many libreddit users do not wish to see this kind of comment by default.
+ // Many Redlib users do not wish to see this kind of comment by default.
// Reddit does not tell us which users are "bots", so a good heuristic is to
// collapse stickied moderator comments.
let is_moderator_comment = data["distinguished"].as_str().unwrap_or_default() == "moderator";
diff --git a/src/server.rs b/src/server.rs
index 20e48eab..f376f33e 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -235,7 +235,7 @@ impl Server {
match router.recognize(&format!("/{}{}", req.method().as_str(), path)) {
// If a route was configured for this path
Ok(found) => {
- if config::get_setting("LIBREDDIT_DISABLE_STATS_COLLECTION").is_none() {
+ if config::get_setting("REDLIB_DISABLE_STATS_COLLECTION").is_none() {
// Add to total_requests count
INSTANCE_INFO.total_requests.fetch_add(1, SeqCst);
}
diff --git a/src/user.rs b/src/user.rs
index a5b8d977..8ffc3666 100644
--- a/src/user.rs
+++ b/src/user.rs
@@ -43,7 +43,7 @@ pub async fn profile(req: Request) -> Result, String> {
let url = String::from(req.uri().path_and_query().map_or("", |val| val.as_str()));
let redirect_url = url[1..].replace('?', "%3F").replace('&', "%26");
- // Retrieve other variables from Libreddit request
+ // Retrieve other variables from Redlib request
let sort = param(&path, "sort").unwrap_or_default();
let username = req.param("name").unwrap_or_default();
diff --git a/src/utils.rs b/src/utils.rs
index 84556362..1b052ba9 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -673,7 +673,7 @@ pub async fn parse_post(post: &serde_json::Value) -> Post {
let body = if val(post, "removed_by_category") == "moderator" {
format!(
"