Libreddit -> Redlib
This commit is contained in:
parent
dac059573d
commit
b0f985c687
@ -6,7 +6,7 @@
|
|||||||
},
|
},
|
||||||
"portsAttributes": {
|
"portsAttributes": {
|
||||||
"8080": {
|
"8080": {
|
||||||
"label": "libreddit",
|
"label": "redlib",
|
||||||
"onAutoForward": "notify"
|
"onAutoForward": "notify"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
4
.github/ISSUE_TEMPLATE/feature_parity.md
vendored
4
.github/ISSUE_TEMPLATE/feature_parity.md
vendored
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: ✨ Feature parity
|
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: '
|
title: '✨ Feature parity: '
|
||||||
labels: feature parity
|
labels: feature parity
|
||||||
assignees: ''
|
assignees: ''
|
||||||
@ -12,7 +12,7 @@ assignees: ''
|
|||||||
A clear and concise description of what the feature is.
|
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
|
||||||
<!--
|
<!--
|
||||||
A clear and concise description of what you want to happen.
|
A clear and concise description of what you want to happen.
|
||||||
-->
|
-->
|
||||||
|
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
2
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: 💡 Feature request
|
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: '
|
title: '💡 Feature request: '
|
||||||
labels: enhancement
|
labels: enhancement
|
||||||
assignees: ''
|
assignees: ''
|
||||||
|
22
.github/workflows/main-docker.yml
vendored
22
.github/workflows/main-docker.yml
vendored
@ -32,19 +32,21 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
|
|
||||||
- name: Login to DockerHub
|
- name: Login to Quay.io
|
||||||
uses: docker/login-action@v2
|
uses: docker/login-action@v2
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
registry: quay.io
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
username: ${{ secrets.QUAY_USERNAME }}
|
||||||
|
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
|
||||||
|
|
||||||
- name: Docker Hub Description
|
- name: push README to Quay.io
|
||||||
uses: peter-evans/dockerhub-description@v3
|
uses: christian-korneck/update-container-description-action@v1
|
||||||
if: matrix.config.platform == 'linux/amd64'
|
env:
|
||||||
|
DOCKER_APIKEY: ${{ secrets.APIKEY__QUAY_IO }}
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
destination_container_repo: quay.io/redlib/redlib
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
provider: quay
|
||||||
repository: libreddit/libreddit
|
readme_file: 'README.md'
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
@ -53,6 +55,6 @@ jobs:
|
|||||||
file: ./${{ matrix.config.dockerfile }}
|
file: ./${{ matrix.config.dockerfile }}
|
||||||
platforms: ${{ matrix.config.platform }}
|
platforms: ${{ matrix.config.platform }}
|
||||||
push: true
|
push: true
|
||||||
tags: libreddit/libreddit:${{ matrix.config.tag }}
|
tags: redlib/redlib:${{ matrix.config.tag }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
18
.github/workflows/main-rust.yml
vendored
18
.github/workflows/main-rust.yml
vendored
@ -36,19 +36,19 @@ jobs:
|
|||||||
run: RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target x86_64-unknown-linux-gnu
|
run: RUSTFLAGS='-C target-feature=+crt-static' cargo build --release --target x86_64-unknown-linux-gnu
|
||||||
|
|
||||||
- name: Calculate SHA512 checksum
|
- 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
|
- 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
|
- uses: actions/upload-artifact@v3
|
||||||
name: Upload a Build Artifact
|
name: Upload a Build Artifact
|
||||||
with:
|
with:
|
||||||
name: libreddit
|
name: redlib
|
||||||
path: |
|
path: |
|
||||||
target/x86_64-unknown-linux-gnu/release/libreddit
|
target/x86_64-unknown-linux-gnu/release/redlib
|
||||||
libreddit.sha512
|
redlib.sha512
|
||||||
libreddit.sha256
|
redlib.sha256
|
||||||
|
|
||||||
- name: Versions
|
- name: Versions
|
||||||
id: version
|
id: version
|
||||||
@ -68,9 +68,9 @@ jobs:
|
|||||||
name: ${{ steps.version.outputs.VERSION }} - ${{ github.event.head_commit.message }}
|
name: ${{ steps.version.outputs.VERSION }} - ${{ github.event.head_commit.message }}
|
||||||
draft: true
|
draft: true
|
||||||
files: |
|
files: |
|
||||||
target/x86_64-unknown-linux-gnu/release/libreddit
|
target/x86_64-unknown-linux-gnu/release/redlib
|
||||||
libreddit.sha512
|
redlib.sha512
|
||||||
libreddit.sha256
|
redlib.sha256
|
||||||
body: |
|
body: |
|
||||||
- ${{ github.event.head_commit.message }} ${{ github.sha }}
|
- ${{ github.event.head_commit.message }} ${{ github.sha }}
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
2
.replit
2
.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"
|
language = "bash"
|
||||||
|
72
Cargo.lock
generated
72
Cargo.lock
generated
@ -808,42 +808,6 @@ dependencies = [
|
|||||||
"rle-decode-fast",
|
"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]]
|
[[package]]
|
||||||
name = "linux-raw-sys"
|
name = "linux-raw-sys"
|
||||||
version = "0.4.12"
|
version = "0.4.12"
|
||||||
@ -1092,6 +1056,42 @@ version = "0.6.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
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]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "libreddit"
|
name = "redlib"
|
||||||
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/redlib-org/redlib"
|
||||||
version = "0.30.1"
|
version = "0.30.1"
|
||||||
authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"]
|
authors = ["Matthew Esposito <matt+cargo@matthew.science>"]
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
12
Dockerfile
12
Dockerfile
@ -5,7 +5,7 @@ FROM rust:alpine AS builder
|
|||||||
|
|
||||||
RUN apk add --no-cache musl-dev
|
RUN apk add --no-cache musl-dev
|
||||||
|
|
||||||
WORKDIR /libreddit
|
WORKDIR /redlib
|
||||||
|
|
||||||
COPY . .
|
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 --from=builder /etc/ssl/certs /etc/ssl/certs
|
||||||
|
|
||||||
# Copy our build
|
# 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.
|
# Use an unprivileged user.
|
||||||
RUN adduser --home /nonexistent --no-create-home --disabled-password libreddit
|
RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
|
||||||
USER libreddit
|
USER redlib
|
||||||
|
|
||||||
# Tell Docker to expose port 8080
|
# Tell Docker to expose port 8080
|
||||||
EXPOSE 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
|
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1
|
||||||
|
|
||||||
CMD ["libreddit"]
|
CMD ["redlib"]
|
@ -5,7 +5,7 @@ FROM rust:alpine AS builder
|
|||||||
|
|
||||||
RUN apk add --no-cache g++ git
|
RUN apk add --no-cache g++ git
|
||||||
|
|
||||||
WORKDIR /usr/src/libreddit
|
WORKDIR /usr/src/redlib
|
||||||
|
|
||||||
# cache dependencies in their own layer
|
# cache dependencies in their own layer
|
||||||
COPY Cargo.lock Cargo.toml .
|
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 --from=builder /etc/ssl/certs /etc/ssl/certs
|
||||||
|
|
||||||
# Copy our build
|
# 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.
|
# Use an unprivileged user.
|
||||||
RUN adduser --home /nonexistent --no-create-home --disabled-password libreddit
|
RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
|
||||||
USER libreddit
|
USER redlib
|
||||||
|
|
||||||
# Tell Docker to expose port 8080
|
# Tell Docker to expose port 8080
|
||||||
EXPOSE 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
|
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1
|
||||||
|
|
||||||
CMD ["libreddit"]
|
CMD ["redlib"]
|
||||||
|
@ -12,7 +12,7 @@ RUN apt-get update && apt-get -y install gcc-arm-linux-gnueabihf \
|
|||||||
|
|
||||||
RUN rustup target add armv7-unknown-linux-musleabihf
|
RUN rustup target add armv7-unknown-linux-musleabihf
|
||||||
|
|
||||||
WORKDIR /libreddit
|
WORKDIR /redlib
|
||||||
|
|
||||||
COPY . .
|
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 --from=builder /etc/ssl/certs /etc/ssl/certs
|
||||||
|
|
||||||
# Copy our build
|
# 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.
|
# Use an unprivileged user.
|
||||||
RUN adduser --home /nonexistent --no-create-home --disabled-password libreddit
|
RUN adduser --home /nonexistent --no-create-home --disabled-password redlib
|
||||||
USER libreddit
|
USER redlib
|
||||||
|
|
||||||
# Tell Docker to expose port 8080
|
# Tell Docker to expose port 8080
|
||||||
EXPOSE 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
|
HEALTHCHECK --interval=1m --timeout=3s CMD wget --spider --q http://localhost:8080/settings || exit 1
|
||||||
|
|
||||||
CMD ["libreddit"]
|
CMD ["redlib"]
|
||||||
|
63
README.md
63
README.md
@ -1,16 +1,15 @@
|
|||||||
# Libreddit
|
# Redlib
|
||||||
|
|
||||||
> An alternative private front-end to Reddit
|
> An alternative private front-end to Reddit
|
||||||
|
|
||||||
# ⚠️ Why do I get TOO MANY REQUESTS errors? ⚠️
|
# ⚠️ 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)
|
#### 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)
|
||||||
## One of the project maintainers is working towards keeping this project alive to some extent: https://github.com/libreddit/libreddit/issues/836
|
|
||||||
|
|
||||||
![screenshot](https://i.ibb.co/QYbqTQt/libreddit-rust.png)
|
![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
|
- 🚀 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
|
||||||
@ -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.
|
||||||
|
|
||||||
<a href="https://www.buymeacoffee.com/spikecodes" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 40px" ></a>
|
<a href="https://www.buymeacoffee.com/spikecodes" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 40px" ></a>
|
||||||
<a href="https://liberapay.com/spike/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg" style="height: 40px"></a>
|
<a href="https://liberapay.com/spike/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg" style="height: 40px"></a>
|
||||||
@ -33,7 +32,7 @@ I appreciate any donations! Your support allows me to continue developing Libred
|
|||||||
|
|
||||||
# Instances
|
# 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).
|
[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
|
# 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
|
## 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
|
- [Rustls](https://github.com/ctz/rustls) - TLS library
|
||||||
|
|
||||||
## Info
|
## 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?
|
## 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:
|
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.
|
- 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.
|
||||||
- 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 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
|
# Comparison
|
||||||
|
|
||||||
This section outlines how Libreddit compares to Reddit.
|
This section outlines how Redlib compares to Reddit.
|
||||||
|
|
||||||
## Speed
|
## Speed
|
||||||
|
|
||||||
Lasted tested Nov 11, 2022.
|
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 |
|
| Requests | 60 | 83 |
|
||||||
| Speed Index | 2.0s | 10.4s |
|
| 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 Cookies
|
||||||
- Third-Party Site
|
- 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
|
#### 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)
|
#### Official instance (libreddit.spike.codes)
|
||||||
|
|
||||||
@ -148,7 +147,7 @@ cargo install libreddit
|
|||||||
|
|
||||||
## 2) Docker
|
## 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 pull libreddit/libreddit
|
||||||
docker run -d --name libreddit -p 8080:8080 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
|
## 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
|
yay -S libreddit-git
|
||||||
```
|
```
|
||||||
## 4) NetBSD/pkgsrc
|
## 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
|
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
|
# 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
|
libreddit
|
||||||
@ -211,7 +210,7 @@ libreddit
|
|||||||
|
|
||||||
## Instance settings
|
## 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 |
|
| 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
|
## 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 |
|
| 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` |
|
| `HIDE_SCORE` | `["on", "off"]` | `off` |
|
||||||
| `FIXED_NAVBAR` | `["on", "off"]` | `on` |
|
| `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
|
```toml
|
||||||
LIBREDDIT_DEFAULT_WIDE = "on"
|
REDLIB_DEFAULT_WIDE = "on"
|
||||||
LIBREDDIT_DEFAULT_USE_HLS = "on"
|
REDLIB_DEFAULT_USE_HLS = "on"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
LIBREDDIT_DEFAULT_SHOW_NSFW=on libreddit
|
REDLIB_DEFAULT_SHOW_NSFW=on libreddit
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
LIBREDDIT_DEFAULT_WIDE=on LIBREDDIT_DEFAULT_THEME=dark libreddit -r
|
REDLIB_DEFAULT_WIDE=on REDLIB_DEFAULT_THEME=dark libreddit -r
|
||||||
```
|
```
|
||||||
|
|
||||||
## Proxying using NGINX
|
## Proxying using NGINX
|
||||||
|
|
||||||
> **Note**
|
> **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
|
> ```nginx
|
||||||
> proxy_http_version 1.1;
|
> 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
|
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
|
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.
|
above.
|
||||||
|
|
||||||
When "Proxying using NGINX" where the proxy is on the same machine, you should
|
When "Proxying using NGINX" where the proxy is on the same machine, you should
|
||||||
|
40
app.json
40
app.json
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "Libreddit",
|
"name": "Redlib",
|
||||||
"description": "Private front-end for Reddit",
|
"description": "Private front-end for Reddit",
|
||||||
"buildpacks": [
|
"buildpacks": [
|
||||||
{
|
{
|
||||||
@ -11,61 +11,61 @@
|
|||||||
],
|
],
|
||||||
"stack": "container",
|
"stack": "container",
|
||||||
"env": {
|
"env": {
|
||||||
"LIBREDDIT_DEFAULT_THEME": {
|
"REDLIB_DEFAULT_THEME": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_FRONT_PAGE": {
|
"REDLIB_DEFAULT_FRONT_PAGE": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_LAYOUT": {
|
"REDLIB_DEFAULT_LAYOUT": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_WIDE": {
|
"REDLIB_DEFAULT_WIDE": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_COMMENT_SORT": {
|
"REDLIB_DEFAULT_COMMENT_SORT": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_POST_SORT": {
|
"REDLIB_DEFAULT_POST_SORT": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_SHOW_NSFW": {
|
"REDLIB_DEFAULT_SHOW_NSFW": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_BLUR_NSFW": {
|
"REDLIB_DEFAULT_BLUR_NSFW": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_USE_HLS": {
|
"REDLIB_USE_HLS": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_HIDE_HLS_NOTIFICATION": {
|
"REDLIB_HIDE_HLS_NOTIFICATION": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_SFW_ONLY": {
|
"REDLIB_SFW_ONLY": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_HIDE_AWARDS": {
|
"REDLIB_DEFAULT_HIDE_AWARDS": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_HIDE_SCORE": {
|
"REDLIB_DEFAULT_HIDE_SCORE": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_BANNER": {
|
"REDLIB_BANNER": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_ROBOTS_DISABLE_INDEXING": {
|
"REDLIB_ROBOTS_DISABLE_INDEXING": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_SUBSCRIPTIONS": {
|
"REDLIB_DEFAULT_SUBSCRIPTIONS": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION": {
|
"REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_PUSHSHIFT_FRONTEND": {
|
"REDLIB_PUSHSHIFT_FRONTEND": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DISABLE_STATS_COLLECTION": {
|
"REDLIB_DISABLE_STATS_COLLECTION": {
|
||||||
"required": false
|
"required": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
ADDRESS=0.0.0.0
|
ADDRESS=0.0.0.0
|
||||||
PORT=12345
|
PORT=12345
|
||||||
#LIBREDDIT_DEFAULT_THEME=default
|
#REDLIB_DEFAULT_THEME=default
|
||||||
#LIBREDDIT_DEFAULT_FRONT_PAGE=default
|
#REDLIB_DEFAULT_FRONT_PAGE=default
|
||||||
#LIBREDDIT_DEFAULT_LAYOUT=card
|
#REDLIB_DEFAULT_LAYOUT=card
|
||||||
#LIBREDDIT_DEFAULT_WIDE=off
|
#REDLIB_DEFAULT_WIDE=off
|
||||||
#LIBREDDIT_DEFAULT_POST_SORT=hot
|
#REDLIB_DEFAULT_POST_SORT=hot
|
||||||
#LIBREDDIT_DEFAULT_COMMENT_SORT=confidence
|
#REDLIB_DEFAULT_COMMENT_SORT=confidence
|
||||||
#LIBREDDIT_DEFAULT_SHOW_NSFW=off
|
#REDLIB_DEFAULT_SHOW_NSFW=off
|
||||||
#LIBREDDIT_DEFAULT_BLUR_NSFW=off
|
#REDLIB_DEFAULT_BLUR_NSFW=off
|
||||||
#LIBREDDIT_DEFAULT_USE_HLS=off
|
#REDLIB_DEFAULT_USE_HLS=off
|
||||||
#LIBREDDIT_DEFAULT_HIDE_HLS_NOTIFICATION=off
|
#REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION=off
|
||||||
#LIBREDDIT_DEFAULT_AUTOPLAY_VIDEOS=off
|
#REDLIB_DEFAULT_AUTOPLAY_VIDEOS=off
|
||||||
#LIBREDDIT_DEFAULT_SUBSCRIPTIONS=off (sub1+sub2+sub3)
|
#REDLIB_DEFAULT_SUBSCRIPTIONS=off (sub1+sub2+sub3)
|
||||||
#LIBREDDIT_DEFAULT_HIDE_AWARDS=off
|
#REDLIB_DEFAULT_HIDE_AWARDS=off
|
||||||
#LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION=off
|
#REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION=off
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>Label</key>
|
<key>Label</key>
|
||||||
<string>libreddit</string>
|
<string>redlib</string>
|
||||||
|
|
||||||
<key>Program</key>
|
<key>Program</key>
|
||||||
<string>libreddit</string>
|
<string>redlib</string>
|
||||||
|
|
||||||
<key>KeepAlive</key>
|
<key>KeepAlive</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=libreddit daemon
|
Description=redlib daemon
|
||||||
After=network.service
|
After=network.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
@ -8,8 +8,8 @@ DynamicUser=yes
|
|||||||
#Environment=ADDRESS=0.0.0.0
|
#Environment=ADDRESS=0.0.0.0
|
||||||
#Environment=PORT=8080
|
#Environment=PORT=8080
|
||||||
# Optional Override
|
# Optional Override
|
||||||
EnvironmentFile=-/etc/libreddit.conf
|
EnvironmentFile=-/etc/redlib.conf
|
||||||
ExecStart=/usr/bin/libreddit -a ${ADDRESS} -p ${PORT}
|
ExecStart=/usr/bin/redlib -a ${ADDRESS} -p ${PORT}
|
||||||
|
|
||||||
# Hardening
|
# Hardening
|
||||||
DeviceAllow=
|
DeviceAllow=
|
||||||
|
@ -4,7 +4,7 @@ services:
|
|||||||
web:
|
web:
|
||||||
build: .
|
build: .
|
||||||
restart: always
|
restart: always
|
||||||
container_name: "libreddit"
|
container_name: "redlib"
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080
|
- 8080:8080
|
||||||
user: nobody
|
user: nobody
|
||||||
@ -14,13 +14,13 @@ services:
|
|||||||
cap_drop:
|
cap_drop:
|
||||||
- ALL
|
- ALL
|
||||||
networks:
|
networks:
|
||||||
- libreddit
|
- redlib
|
||||||
security_opt:
|
security_opt:
|
||||||
- seccomp="seccomp-libreddit.json"
|
- seccomp="seccomp-redlib.json"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "--spider", "-q", "--tries=1", "http://localhost:8080/settings"]
|
test: ["CMD", "wget", "--spider", "-q", "--tries=1", "http://localhost:8080/settings"]
|
||||||
interval: 5m
|
interval: 5m
|
||||||
timeout: 3s
|
timeout: 3s
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
libreddit:
|
redlib:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# This scripts generates the CREDITS file in the repository root, which
|
# 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,
|
# 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.
|
# and grep will filter any automated commits due to GitHub.
|
||||||
|
@ -137,7 +137,7 @@ fn reddit_head(path: String, quarantine: bool) -> Boxed<Result<Response<Body>, S
|
|||||||
/// in its response.
|
/// in its response.
|
||||||
fn request(method: &'static Method, path: String, redirect: bool, quarantine: bool) -> Boxed<Result<Response<Body>, String>> {
|
fn request(method: &'static Method, path: String, redirect: bool, quarantine: bool) -> Boxed<Result<Response<Body>, String>> {
|
||||||
// Increment reddit request count. This will include head requests.
|
// 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);
|
INSTANCE_INFO.reddit_requests.fetch_add(1, SeqCst);
|
||||||
}
|
}
|
||||||
// Build Reddit URL from path.
|
// Build Reddit URL from path.
|
||||||
|
156
src/config.rs
156
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.
|
/// instance_info::InstanceInfo.to_string(), README.md and app.json.
|
||||||
#[derive(Default, Serialize, Deserialize, Clone, Debug)]
|
#[derive(Default, Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
#[serde(rename = "LIBREDDIT_SFW_ONLY")]
|
#[serde(rename = "REDLIB_SFW_ONLY")]
|
||||||
pub(crate) sfw_only: Option<String>,
|
pub(crate) sfw_only: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_THEME")]
|
#[serde(rename = "REDLIB_DEFAULT_THEME")]
|
||||||
pub(crate) default_theme: Option<String>,
|
pub(crate) default_theme: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_FRONT_PAGE")]
|
#[serde(rename = "REDLIB_DEFAULT_FRONT_PAGE")]
|
||||||
pub(crate) default_front_page: Option<String>,
|
pub(crate) default_front_page: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_LAYOUT")]
|
#[serde(rename = "REDLIB_DEFAULT_LAYOUT")]
|
||||||
pub(crate) default_layout: Option<String>,
|
pub(crate) default_layout: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_WIDE")]
|
#[serde(rename = "REDLIB_DEFAULT_WIDE")]
|
||||||
pub(crate) default_wide: Option<String>,
|
pub(crate) default_wide: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_COMMENT_SORT")]
|
#[serde(rename = "REDLIB_DEFAULT_COMMENT_SORT")]
|
||||||
pub(crate) default_comment_sort: Option<String>,
|
pub(crate) default_comment_sort: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_POST_SORT")]
|
#[serde(rename = "REDLIB_DEFAULT_POST_SORT")]
|
||||||
pub(crate) default_post_sort: Option<String>,
|
pub(crate) default_post_sort: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_SHOW_NSFW")]
|
#[serde(rename = "REDLIB_DEFAULT_SHOW_NSFW")]
|
||||||
pub(crate) default_show_nsfw: Option<String>,
|
pub(crate) default_show_nsfw: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_BLUR_NSFW")]
|
#[serde(rename = "REDLIB_DEFAULT_BLUR_NSFW")]
|
||||||
pub(crate) default_blur_nsfw: Option<String>,
|
pub(crate) default_blur_nsfw: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_USE_HLS")]
|
#[serde(rename = "REDLIB_DEFAULT_USE_HLS")]
|
||||||
pub(crate) default_use_hls: Option<String>,
|
pub(crate) default_use_hls: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_HIDE_HLS_NOTIFICATION")]
|
#[serde(rename = "REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION")]
|
||||||
pub(crate) default_hide_hls_notification: Option<String>,
|
pub(crate) default_hide_hls_notification: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_HIDE_AWARDS")]
|
#[serde(rename = "REDLIB_DEFAULT_HIDE_AWARDS")]
|
||||||
pub(crate) default_hide_awards: Option<String>,
|
pub(crate) default_hide_awards: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_HIDE_SCORE")]
|
#[serde(rename = "REDLIB_DEFAULT_HIDE_SCORE")]
|
||||||
pub(crate) default_hide_score: Option<String>,
|
pub(crate) default_hide_score: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_SUBSCRIPTIONS")]
|
#[serde(rename = "REDLIB_DEFAULT_SUBSCRIPTIONS")]
|
||||||
pub(crate) default_subscriptions: Option<String>,
|
pub(crate) default_subscriptions: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION")]
|
#[serde(rename = "REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION")]
|
||||||
pub(crate) default_disable_visit_reddit_confirmation: Option<String>,
|
pub(crate) default_disable_visit_reddit_confirmation: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_BANNER")]
|
#[serde(rename = "REDLIB_BANNER")]
|
||||||
pub(crate) banner: Option<String>,
|
pub(crate) banner: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_ROBOTS_DISABLE_INDEXING")]
|
#[serde(rename = "REDLIB_ROBOTS_DISABLE_INDEXING")]
|
||||||
pub(crate) robots_disable_indexing: Option<String>,
|
pub(crate) robots_disable_indexing: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_DISABLE_STATS_COLLECTION")]
|
#[serde(rename = "REDLIB_DISABLE_STATS_COLLECTION")]
|
||||||
pub(crate) disable_stats_collection: Option<String>,
|
pub(crate) disable_stats_collection: Option<String>,
|
||||||
|
|
||||||
#[serde(rename = "LIBREDDIT_PUSHSHIFT_FRONTEND")]
|
#[serde(rename = "REDLIB_PUSHSHIFT_FRONTEND")]
|
||||||
pub(crate) pushshift: Option<String>,
|
pub(crate) pushshift: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,59 +83,59 @@ impl Config {
|
|||||||
/// In the case that there are no environment variables set and there is no
|
/// 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.
|
/// config file, this function returns a Config that contains all None values.
|
||||||
pub fn load() -> Self {
|
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)
|
// 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
|
// 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
|
// both are `None`, return a `None` via the `map_or_else` function
|
||||||
let parse = |key: &str| -> Option<String> { var(key).ok().map_or_else(|| get_setting_from_config(key, &config), Some) };
|
let parse = |key: &str| -> Option<String> { var(key).ok().map_or_else(|| get_setting_from_config(key, &config), Some) };
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
sfw_only: parse("LIBREDDIT_SFW_ONLY"),
|
sfw_only: parse("REDLIB_SFW_ONLY"),
|
||||||
default_theme: parse("LIBREDDIT_DEFAULT_THEME"),
|
default_theme: parse("REDLIB_DEFAULT_THEME"),
|
||||||
default_front_page: parse("LIBREDDIT_DEFAULT_FRONT_PAGE"),
|
default_front_page: parse("REDLIB_DEFAULT_FRONT_PAGE"),
|
||||||
default_layout: parse("LIBREDDIT_DEFAULT_LAYOUT"),
|
default_layout: parse("REDLIB_DEFAULT_LAYOUT"),
|
||||||
default_post_sort: parse("LIBREDDIT_DEFAULT_POST_SORT"),
|
default_post_sort: parse("REDLIB_DEFAULT_POST_SORT"),
|
||||||
default_wide: parse("LIBREDDIT_DEFAULT_WIDE"),
|
default_wide: parse("REDLIB_DEFAULT_WIDE"),
|
||||||
default_comment_sort: parse("LIBREDDIT_DEFAULT_COMMENT_SORT"),
|
default_comment_sort: parse("REDLIB_DEFAULT_COMMENT_SORT"),
|
||||||
default_show_nsfw: parse("LIBREDDIT_DEFAULT_SHOW_NSFW"),
|
default_show_nsfw: parse("REDLIB_DEFAULT_SHOW_NSFW"),
|
||||||
default_blur_nsfw: parse("LIBREDDIT_DEFAULT_BLUR_NSFW"),
|
default_blur_nsfw: parse("REDLIB_DEFAULT_BLUR_NSFW"),
|
||||||
default_use_hls: parse("LIBREDDIT_DEFAULT_USE_HLS"),
|
default_use_hls: parse("REDLIB_DEFAULT_USE_HLS"),
|
||||||
default_hide_hls_notification: parse("LIBREDDIT_DEFAULT_HIDE_HLS"),
|
default_hide_hls_notification: parse("REDLIB_DEFAULT_HIDE_HLS"),
|
||||||
default_hide_awards: parse("LIBREDDIT_DEFAULT_HIDE_AWARDS"),
|
default_hide_awards: parse("REDLIB_DEFAULT_HIDE_AWARDS"),
|
||||||
default_hide_score: parse("LIBREDDIT_DEFAULT_HIDE_SCORE"),
|
default_hide_score: parse("REDLIB_DEFAULT_HIDE_SCORE"),
|
||||||
default_subscriptions: parse("LIBREDDIT_DEFAULT_SUBSCRIPTIONS"),
|
default_subscriptions: parse("REDLIB_DEFAULT_SUBSCRIPTIONS"),
|
||||||
default_disable_visit_reddit_confirmation: parse("LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION"),
|
default_disable_visit_reddit_confirmation: parse("REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION"),
|
||||||
banner: parse("LIBREDDIT_BANNER"),
|
banner: parse("REDLIB_BANNER"),
|
||||||
robots_disable_indexing: parse("LIBREDDIT_ROBOTS_DISABLE_INDEXING"),
|
robots_disable_indexing: parse("REDLIB_ROBOTS_DISABLE_INDEXING"),
|
||||||
disable_stats_collection: parse("LIBREDDIT_DISABLE_STATS_COLLECTION"),
|
disable_stats_collection: parse("REDLIB_DISABLE_STATS_COLLECTION"),
|
||||||
pushshift: parse("LIBREDDIT_PUSHSHIFT_FRONTEND"),
|
pushshift: parse("REDLIB_PUSHSHIFT_FRONTEND"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_setting_from_config(name: &str, config: &Config) -> Option<String> {
|
fn get_setting_from_config(name: &str, config: &Config) -> Option<String> {
|
||||||
match name {
|
match name {
|
||||||
"LIBREDDIT_SFW_ONLY" => config.sfw_only.clone(),
|
"REDLIB_SFW_ONLY" => config.sfw_only.clone(),
|
||||||
"LIBREDDIT_DEFAULT_THEME" => config.default_theme.clone(),
|
"REDLIB_DEFAULT_THEME" => config.default_theme.clone(),
|
||||||
"LIBREDDIT_DEFAULT_FRONT_PAGE" => config.default_front_page.clone(),
|
"REDLIB_DEFAULT_FRONT_PAGE" => config.default_front_page.clone(),
|
||||||
"LIBREDDIT_DEFAULT_LAYOUT" => config.default_layout.clone(),
|
"REDLIB_DEFAULT_LAYOUT" => config.default_layout.clone(),
|
||||||
"LIBREDDIT_DEFAULT_COMMENT_SORT" => config.default_comment_sort.clone(),
|
"REDLIB_DEFAULT_COMMENT_SORT" => config.default_comment_sort.clone(),
|
||||||
"LIBREDDIT_DEFAULT_POST_SORT" => config.default_post_sort.clone(),
|
"REDLIB_DEFAULT_POST_SORT" => config.default_post_sort.clone(),
|
||||||
"LIBREDDIT_DEFAULT_SHOW_NSFW" => config.default_show_nsfw.clone(),
|
"REDLIB_DEFAULT_SHOW_NSFW" => config.default_show_nsfw.clone(),
|
||||||
"LIBREDDIT_DEFAULT_BLUR_NSFW" => config.default_blur_nsfw.clone(),
|
"REDLIB_DEFAULT_BLUR_NSFW" => config.default_blur_nsfw.clone(),
|
||||||
"LIBREDDIT_DEFAULT_USE_HLS" => config.default_use_hls.clone(),
|
"REDLIB_DEFAULT_USE_HLS" => config.default_use_hls.clone(),
|
||||||
"LIBREDDIT_DEFAULT_HIDE_HLS_NOTIFICATION" => config.default_hide_hls_notification.clone(),
|
"REDLIB_DEFAULT_HIDE_HLS_NOTIFICATION" => config.default_hide_hls_notification.clone(),
|
||||||
"LIBREDDIT_DEFAULT_WIDE" => config.default_wide.clone(),
|
"REDLIB_DEFAULT_WIDE" => config.default_wide.clone(),
|
||||||
"LIBREDDIT_DEFAULT_HIDE_AWARDS" => config.default_hide_awards.clone(),
|
"REDLIB_DEFAULT_HIDE_AWARDS" => config.default_hide_awards.clone(),
|
||||||
"LIBREDDIT_DEFAULT_HIDE_SCORE" => config.default_hide_score.clone(),
|
"REDLIB_DEFAULT_HIDE_SCORE" => config.default_hide_score.clone(),
|
||||||
"LIBREDDIT_DEFAULT_SUBSCRIPTIONS" => config.default_subscriptions.clone(),
|
"REDLIB_DEFAULT_SUBSCRIPTIONS" => config.default_subscriptions.clone(),
|
||||||
"LIBREDDIT_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION" => config.default_disable_visit_reddit_confirmation.clone(),
|
"REDLIB_DEFAULT_DISABLE_VISIT_REDDIT_CONFIRMATION" => config.default_disable_visit_reddit_confirmation.clone(),
|
||||||
"LIBREDDIT_BANNER" => config.banner.clone(),
|
"REDLIB_BANNER" => config.banner.clone(),
|
||||||
"LIBREDDIT_ROBOTS_DISABLE_INDEXING" => config.robots_disable_indexing.clone(),
|
"REDLIB_ROBOTS_DISABLE_INDEXING" => config.robots_disable_indexing.clone(),
|
||||||
"LIBREDDIT_DISABLE_STATS_COLLECTION" => config.disable_stats_collection.clone(),
|
"REDLIB_DISABLE_STATS_COLLECTION" => config.disable_stats_collection.clone(),
|
||||||
"LIBREDDIT_PUSHSHIFT_FRONTEND" => config.pushshift.clone(),
|
"REDLIB_PUSHSHIFT_FRONTEND" => config.pushshift.clone(),
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ fn test_deserialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[sealed_test(env = [("LIBREDDIT_SFW_ONLY", "on")])]
|
#[sealed_test(env = [("REDLIB_SFW_ONLY", "on")])]
|
||||||
fn test_env_var() {
|
fn test_env_var() {
|
||||||
assert!(crate::utils::sfw_only())
|
assert!(crate::utils::sfw_only())
|
||||||
}
|
}
|
||||||
@ -164,41 +164,41 @@ fn test_env_var() {
|
|||||||
#[test]
|
#[test]
|
||||||
#[sealed_test]
|
#[sealed_test]
|
||||||
fn test_config() {
|
fn test_config() {
|
||||||
let config_to_write = r#"LIBREDDIT_DEFAULT_COMMENT_SORT = "best""#;
|
let config_to_write = r#"REDLIB_DEFAULT_COMMENT_SORT = "best""#;
|
||||||
write("libreddit.toml", config_to_write).unwrap();
|
write("redlib.toml", config_to_write).unwrap();
|
||||||
assert_eq!(get_setting("LIBREDDIT_DEFAULT_COMMENT_SORT"), Some("best".into()));
|
assert_eq!(get_setting("REDLIB_DEFAULT_COMMENT_SORT"), Some("best".into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[sealed_test(env = [("LIBREDDIT_DEFAULT_COMMENT_SORT", "top")])]
|
#[sealed_test(env = [("REDLIB_DEFAULT_COMMENT_SORT", "top")])]
|
||||||
fn test_env_config_precedence() {
|
fn test_env_config_precedence() {
|
||||||
let config_to_write = r#"LIBREDDIT_DEFAULT_COMMENT_SORT = "best""#;
|
let config_to_write = r#"REDLIB_DEFAULT_COMMENT_SORT = "best""#;
|
||||||
write("libreddit.toml", config_to_write).unwrap();
|
write("redlib.toml", config_to_write).unwrap();
|
||||||
assert_eq!(get_setting("LIBREDDIT_DEFAULT_COMMENT_SORT"), Some("top".into()))
|
assert_eq!(get_setting("REDLIB_DEFAULT_COMMENT_SORT"), Some("top".into()))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[sealed_test(env = [("LIBREDDIT_DEFAULT_COMMENT_SORT", "top")])]
|
#[sealed_test(env = [("REDLIB_DEFAULT_COMMENT_SORT", "top")])]
|
||||||
fn test_alt_env_config_precedence() {
|
fn test_alt_env_config_precedence() {
|
||||||
let config_to_write = r#"LIBREDDIT_DEFAULT_COMMENT_SORT = "best""#;
|
let config_to_write = r#"REDLIB_DEFAULT_COMMENT_SORT = "best""#;
|
||||||
write("libreddit.toml", config_to_write).unwrap();
|
write("redlib.toml", config_to_write).unwrap();
|
||||||
assert_eq!(get_setting("LIBREDDIT_DEFAULT_COMMENT_SORT"), Some("top".into()))
|
assert_eq!(get_setting("REDLIB_DEFAULT_COMMENT_SORT"), Some("top".into()))
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
#[sealed_test(env = [("LIBREDDIT_DEFAULT_SUBSCRIPTIONS", "news+bestof")])]
|
#[sealed_test(env = [("REDLIB_DEFAULT_SUBSCRIPTIONS", "news+bestof")])]
|
||||||
fn test_default_subscriptions() {
|
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]
|
#[test]
|
||||||
fn test_stats_collection_empty() {
|
fn test_stats_collection_empty() {
|
||||||
assert_eq!(get_setting("LIBREDDIT_DISABLE_STATS_COLLECTION"), None);
|
assert_eq!(get_setting("REDLIB_DISABLE_STATS_COLLECTION"), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[sealed_test]
|
#[sealed_test]
|
||||||
fn test_stats_collection_true() {
|
fn test_stats_collection_true() {
|
||||||
let config_to_write = r#"LIBREDDIT_DISABLE_STATS_COLLECTION = "1""#;
|
let config_to_write = r#"REDLIB_DISABLE_STATS_COLLECTION = "1""#;
|
||||||
write("libreddit.toml", config_to_write).unwrap();
|
write("redlib.toml", config_to_write).unwrap();
|
||||||
assert!(get_setting("LIBREDDIT_DISABLE_STATS_COLLECTION").is_some());
|
assert!(get_setting("REDLIB_DISABLE_STATS_COLLECTION").is_some());
|
||||||
}
|
}
|
||||||
|
10
src/main.rs
10
src/main.rs
@ -118,7 +118,7 @@ async fn main() {
|
|||||||
// Initialize logger
|
// Initialize logger
|
||||||
pretty_env_logger::init();
|
pretty_env_logger::init();
|
||||||
|
|
||||||
let matches = Command::new("Libreddit")
|
let matches = Command::new("Redlib")
|
||||||
.version(env!("CARGO_PKG_VERSION"))
|
.version(env!("CARGO_PKG_VERSION"))
|
||||||
.about("Private front-end for Reddit written in Rust ")
|
.about("Private front-end for Reddit written in Rust ")
|
||||||
.arg(
|
.arg(
|
||||||
@ -165,7 +165,7 @@ async fn main() {
|
|||||||
|
|
||||||
let listener = [address, ":", port].concat();
|
let listener = [address, ":", port].concat();
|
||||||
|
|
||||||
println!("Starting Libreddit...");
|
println!("Starting Redlib...");
|
||||||
|
|
||||||
// Begin constructing a server
|
// Begin constructing a server
|
||||||
let mut app = server::Server::new();
|
let mut app = server::Server::new();
|
||||||
@ -204,7 +204,7 @@ async fn main() {
|
|||||||
.get(|_| resource(include_str!("../static/manifest.json"), "application/json", false).boxed());
|
.get(|_| resource(include_str!("../static/manifest.json"), "application/json", false).boxed());
|
||||||
app.at("/robots.txt").get(|_| {
|
app.at("/robots.txt").get(|_| {
|
||||||
resource(
|
resource(
|
||||||
if match config::get_setting("LIBREDDIT_ROBOTS_DISABLE_INDEXING") {
|
if match config::get_setting("REDLIB_ROBOTS_DISABLE_INDEXING") {
|
||||||
Some(val) => val == "on",
|
Some(val) => val == "on",
|
||||||
None => false,
|
None => false,
|
||||||
} {
|
} {
|
||||||
@ -229,7 +229,7 @@ async fn main() {
|
|||||||
.at("/hls.min.js")
|
.at("/hls.min.js")
|
||||||
.get(|_| resource(include_str!("../static/hls.min.js"), "text/javascript", false).boxed());
|
.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("/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("/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());
|
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
|
// Default service in case no routes match
|
||||||
app.at("/*").get(|req| error(req, "Nothing here".to_string()).boxed());
|
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);
|
let server = app.listen(listener);
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ fn build_comment(
|
|||||||
let body = if (val(comment, "author") == "[deleted]" && val(comment, "body") == "[removed]") || val(comment, "body") == "[ Removed by Reddit ]" {
|
let body = if (val(comment, "author") == "[deleted]" && val(comment, "body") == "[removed]") || val(comment, "body") == "[ Removed by Reddit ]" {
|
||||||
format!(
|
format!(
|
||||||
"<div class=\"md\"><p>[removed] — <a href=\"https://{}{}{}\">view removed comment</a></p></div>",
|
"<div class=\"md\"><p>[removed] — <a href=\"https://{}{}{}\">view removed comment</a></p></div>",
|
||||||
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,
|
post_link,
|
||||||
id
|
id
|
||||||
)
|
)
|
||||||
@ -218,7 +218,7 @@ fn build_comment(
|
|||||||
let is_filtered = filters.contains(&["u_", author.name.as_str()].concat());
|
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 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
|
// Reddit does not tell us which users are "bots", so a good heuristic is to
|
||||||
// collapse stickied moderator comments.
|
// collapse stickied moderator comments.
|
||||||
let is_moderator_comment = data["distinguished"].as_str().unwrap_or_default() == "moderator";
|
let is_moderator_comment = data["distinguished"].as_str().unwrap_or_default() == "moderator";
|
||||||
|
@ -235,7 +235,7 @@ impl Server {
|
|||||||
match router.recognize(&format!("/{}{}", req.method().as_str(), path)) {
|
match router.recognize(&format!("/{}{}", req.method().as_str(), path)) {
|
||||||
// If a route was configured for this path
|
// If a route was configured for this path
|
||||||
Ok(found) => {
|
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
|
// Add to total_requests count
|
||||||
INSTANCE_INFO.total_requests.fetch_add(1, SeqCst);
|
INSTANCE_INFO.total_requests.fetch_add(1, SeqCst);
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ pub async fn profile(req: Request<Body>) -> Result<Response<Body>, String> {
|
|||||||
let url = String::from(req.uri().path_and_query().map_or("", |val| val.as_str()));
|
let url = String::from(req.uri().path_and_query().map_or("", |val| val.as_str()));
|
||||||
let redirect_url = url[1..].replace('?', "%3F").replace('&', "%26");
|
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 sort = param(&path, "sort").unwrap_or_default();
|
||||||
let username = req.param("name").unwrap_or_default();
|
let username = req.param("name").unwrap_or_default();
|
||||||
|
|
||||||
|
14
src/utils.rs
14
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" {
|
let body = if val(post, "removed_by_category") == "moderator" {
|
||||||
format!(
|
format!(
|
||||||
"<div class=\"md\"><p>[removed] — <a href=\"https://{}{}\">view removed post</a></p></div>",
|
"<div class=\"md\"><p>[removed] — <a href=\"https://{}{}\">view removed post</a></p></div>",
|
||||||
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)),
|
||||||
permalink
|
permalink
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
@ -766,7 +766,7 @@ pub fn setting(req: &Request<Body>, name: &str) -> String {
|
|||||||
.cookie(name)
|
.cookie(name)
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
// If there is no cookie for this setting, try receiving a default from the config
|
// If there is no cookie for this setting, try receiving a default from the config
|
||||||
if let Some(default) = crate::config::get_setting(&format!("LIBREDDIT_DEFAULT_{}", name.to_uppercase())) {
|
if let Some(default) = crate::config::get_setting(&format!("REDLIB_DEFAULT_{}", name.to_uppercase())) {
|
||||||
Cookie::new(name, default)
|
Cookie::new(name, default)
|
||||||
} else {
|
} else {
|
||||||
Cookie::from(name)
|
Cookie::from(name)
|
||||||
@ -874,17 +874,17 @@ pub fn format_url(url: &str) -> String {
|
|||||||
static REDDIT_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r#"href="(https|http|)://(www\.|old\.|np\.|amp\.|new\.|)(reddit\.com|redd\.it)/"#).unwrap());
|
static REDDIT_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r#"href="(https|http|)://(www\.|old\.|np\.|amp\.|new\.|)(reddit\.com|redd\.it)/"#).unwrap());
|
||||||
static REDDIT_PREVIEW_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"https?://external-preview\.redd\.it(.*)[^?]").unwrap());
|
static REDDIT_PREVIEW_REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"https?://external-preview\.redd\.it(.*)[^?]").unwrap());
|
||||||
|
|
||||||
// Rewrite Reddit links to Libreddit in body of text
|
// Rewrite Reddit links to Redlib in body of text
|
||||||
pub fn rewrite_urls(input_text: &str) -> String {
|
pub fn rewrite_urls(input_text: &str) -> String {
|
||||||
let text1 =
|
let text1 =
|
||||||
// Rewrite Reddit links to Libreddit
|
// Rewrite Reddit links to Redlib
|
||||||
REDDIT_REGEX.replace_all(input_text, r#"href="/"#)
|
REDDIT_REGEX.replace_all(input_text, r#"href="/"#)
|
||||||
.to_string()
|
.to_string()
|
||||||
// Remove (html-encoded) "\" from URLs.
|
// Remove (html-encoded) "\" from URLs.
|
||||||
.replace("%5C", "")
|
.replace("%5C", "")
|
||||||
.replace("\\_", "_");
|
.replace("\\_", "_");
|
||||||
|
|
||||||
// Rewrite external media previews to Libreddit
|
// Rewrite external media previews to Redlib
|
||||||
if REDDIT_PREVIEW_REGEX.is_match(&text1) {
|
if REDDIT_PREVIEW_REGEX.is_match(&text1) {
|
||||||
REDDIT_PREVIEW_REGEX
|
REDDIT_PREVIEW_REGEX
|
||||||
.replace_all(&text1, format_url(REDDIT_PREVIEW_REGEX.find(&text1).map(|x| x.as_str()).unwrap_or_default()))
|
.replace_all(&text1, format_url(REDDIT_PREVIEW_REGEX.find(&text1).map(|x| x.as_str()).unwrap_or_default()))
|
||||||
@ -987,7 +987,7 @@ pub async fn error(req: Request<Body>, msg: impl ToString) -> Result<Response<Bo
|
|||||||
Ok(Response::builder().status(404).header("content-type", "text/html").body(body.into()).unwrap_or_default())
|
Ok(Response::builder().status(404).header("content-type", "text/html").body(body.into()).unwrap_or_default())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if the config/env variable `LIBREDDIT_SFW_ONLY` carries the
|
/// Returns true if the config/env variable `REDLIB_SFW_ONLY` carries the
|
||||||
/// value `on`.
|
/// value `on`.
|
||||||
///
|
///
|
||||||
/// If this variable is set as such, the instance will operate in SFW-only
|
/// If this variable is set as such, the instance will operate in SFW-only
|
||||||
@ -995,7 +995,7 @@ pub async fn error(req: Request<Body>, msg: impl ToString) -> Result<Response<Bo
|
|||||||
/// subreddits or posts or userpages for users Reddit has deemed NSFW will
|
/// subreddits or posts or userpages for users Reddit has deemed NSFW will
|
||||||
/// be denied.
|
/// be denied.
|
||||||
pub fn sfw_only() -> bool {
|
pub fn sfw_only() -> bool {
|
||||||
match crate::config::get_setting("LIBREDDIT_SFW_ONLY") {
|
match crate::config::get_setting("REDLIB_SFW_ONLY") {
|
||||||
Some(val) => val == "on",
|
Some(val) => val == "on",
|
||||||
None => false,
|
None => false,
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Libreddit",
|
"name": "Redlib",
|
||||||
"short_name": "Libreddit",
|
"short_name": "Redlib",
|
||||||
"display": "standalone",
|
"display": "standalone",
|
||||||
"background_color": "#1f1f1f",
|
"background_color": "#1f1f1f",
|
||||||
"description": "An alternative private front-end to Reddit",
|
"description": "An alternative private front-end to Reddit",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
|
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
|
||||||
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
|
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
|
||||||
<ShortName>Search Libreddit</ShortName>
|
<ShortName>Search Redlib</ShortName>
|
||||||
<Description>Search for whatever you want on Libreddit, awesome Reddit frontend</Description>
|
<Description>Search for whatever you want on Redlib, awesome Reddit frontend</Description>
|
||||||
<InputEncoding>UTF-8</InputEncoding>
|
<InputEncoding>UTF-8</InputEncoding>
|
||||||
<Image width="32" height="32" type="image/x-icon">/favicon.ico</Image>
|
<Image width="32" height="32" type="image/x-icon">/favicon.ico</Image>
|
||||||
<Url type="text/html" template="/search">
|
<Url type="text/html" template="/search">
|
||||||
|
@ -169,7 +169,7 @@ nav #links svg {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav #libreddit {
|
nav #redlib {
|
||||||
vertical-align: -2px;
|
vertical-align: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<title>{% block title %}Libreddit{% endblock %}</title>
|
<title>{% block title %}Redlib{% endblock %}</title>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||||
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit.">
|
<meta name="description" content="View on Redlib, an alternative private front-end to Reddit.">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<!-- General PWA -->
|
<!-- General PWA -->
|
||||||
<meta name="theme-color" content="#1F1F1F">
|
<meta name="theme-color" content="#1F1F1F">
|
||||||
<!-- iOS Application -->
|
<!-- iOS Application -->
|
||||||
<meta name="apple-mobile-web-app-title" content="Libreddit">
|
<meta name="apple-mobile-web-app-title" content="Redlib">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
||||||
<!-- Android -->
|
<!-- Android -->
|
||||||
@ -19,7 +19,7 @@
|
|||||||
<!-- iOS Logo -->
|
<!-- iOS Logo -->
|
||||||
<link href="/touch-icon-iphone.png" rel="apple-touch-icon">
|
<link href="/touch-icon-iphone.png" rel="apple-touch-icon">
|
||||||
<!-- OpenSearch description file -->
|
<!-- OpenSearch description file -->
|
||||||
<link rel="search" type="application/opensearchdescription+xml" title="Search Libreddit" href="/opensearch.xml">
|
<link rel="search" type="application/opensearchdescription+xml" title="Search Redlib" href="/opensearch.xml">
|
||||||
<!-- PWA Manifest -->
|
<!-- PWA Manifest -->
|
||||||
<link rel="manifest" type="application/json" href="/manifest.json">
|
<link rel="manifest" type="application/json" href="/manifest.json">
|
||||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<nav class="
|
<nav class="
|
||||||
{% if prefs.fixed_navbar == "on" %} fixed_navbar{% endif %}">
|
{% if prefs.fixed_navbar == "on" %} fixed_navbar{% endif %}">
|
||||||
<div id="logo">
|
<div id="logo">
|
||||||
<a id="libreddit" href="/"><span id="lib">lib</span><span id="reddit">reddit.</span></a>
|
<a id="redlib" href="/"><span id="lib">red</span><span id="reddit">lib.</span></a>
|
||||||
{% block subscriptions %}{% endblock %}
|
{% block subscriptions %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
{% block search %}{% endblock %}
|
{% block search %}{% endblock %}
|
||||||
@ -76,7 +76,7 @@
|
|||||||
<a href="/info" title="View instance information">ⓘ View instance info</a>
|
<a href="/info" title="View instance information">ⓘ View instance info</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="footer-button">
|
<div class="footer-button">
|
||||||
<a href="https://github.com/libreddit/libreddit" title="View code on GitHub"><> Code</a>
|
<a href="https://github.com/redlib-org/redlib" title="View code on GitHub"><> Code</a>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
{% if crate::utils::sfw_only() %}
|
{% if crate::utils::sfw_only() %}
|
||||||
This instance of Libreddit is SFW-only.</p>
|
This instance of Redlib is SFW-only.</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
Enable "Show NSFW posts" in <a href="/settings">settings</a> to view this {% if res_type == crate::utils::ResourceType::Subreddit %}subreddit{% else if res_type == crate::utils::ResourceType::User %}user's posts or comments{% else if res_type == crate::utils::ResourceType::Post %}post{% endif %}. <br>
|
Enable "Show NSFW posts" in <a href="/settings">settings</a> to view this {% if res_type == crate::utils::ResourceType::Subreddit %}subreddit{% else if res_type == crate::utils::ResourceType::User %}user's posts or comments{% else if res_type == crate::utils::ResourceType::Post %}post{% endif %}. <br>
|
||||||
{% if res_type == crate::utils::ResourceType::Post %} You can also temporarily bypass this gate and view the post by clicking on this <a href="{{url}}&bypass_nsfw_landing">link</a>.{% endif %}
|
{% if res_type == crate::utils::ResourceType::Post %} You can also temporarily bypass this gate and view the post by clicking on this <a href="{{url}}&bypass_nsfw_landing">link</a>.{% endif %}
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
<meta name="author" content="u/{{ post.author.name }}">
|
<meta name="author" content="u/{{ post.author.name }}">
|
||||||
<meta name="title" content="{{ post.title }} - r/{{ post.community }}">
|
<meta name="title" content="{{ post.title }} - r/{{ post.community }}">
|
||||||
<meta property="og:title" content="{{ post.title }} - r/{{ post.community }}">
|
<meta property="og:title" content="{{ post.title }} - r/{{ post.community }}">
|
||||||
<meta property="og:description" content="View on Libreddit, an alternative private front-end to Reddit.">
|
<meta property="og:description" content="View on Redlib, an alternative private front-end to Reddit.">
|
||||||
<meta property="og:url" content="{{ post.permalink }}">
|
<meta property="og:url" content="{{ post.permalink }}">
|
||||||
<meta property="twitter:url" content="{{ post.permalink }}">
|
<meta property="twitter:url" content="{{ post.permalink }}">
|
||||||
<meta property="twitter:title" content="{{ post.title }} - r/{{ post.community }}">
|
<meta property="twitter:title" content="{{ post.title }} - r/{{ post.community }}">
|
||||||
<meta property="twitter:description" content="View on Libreddit, an alternative private front-end to Reddit.">
|
<meta property="twitter:description" content="View on Redlib, an alternative private front-end to Reddit.">
|
||||||
{% if post.post_type == "image" %}
|
{% if post.post_type == "image" %}
|
||||||
<meta property="og:type" content="image">
|
<meta property="og:type" content="image">
|
||||||
<meta property="og:image" content="{{ post.thumbnail.url }}">
|
<meta property="og:image" content="{{ post.thumbnail.url }}">
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% import "utils.html" as utils %}
|
{% import "utils.html" as utils %}
|
||||||
|
|
||||||
{% block title %}Libreddit: search results - {{ params.q }}{% endblock %}
|
{% block title %}Redlib: search results - {{ params.q }}{% endblock %}
|
||||||
|
|
||||||
{% block subscriptions %}
|
{% block subscriptions %}
|
||||||
{% call utils::sub_list("") %}
|
{% call utils::sub_list("") %}
|
||||||
@ -10,7 +10,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div id="column_one">
|
<div id="column_one">
|
||||||
<form id="search_sort">
|
<form id="search_sort">
|
||||||
<input id="search" type="text" name="q" placeholder="Search" value="{{ params.q|safe }}" title="Search libreddit">
|
<input id="search" type="text" name="q" placeholder="Search" value="{{ params.q|safe }}" title="Search redlib">
|
||||||
{% if sub != "" %}
|
{% if sub != "" %}
|
||||||
<div id="inside">
|
<div id="inside">
|
||||||
<input type="checkbox" name="restrict_sr" id="restrict_sr" {% if params.restrict_sr != "" %}checked{% endif %}>
|
<input type="checkbox" name="restrict_sr" id="restrict_sr" {% if params.restrict_sr != "" %}checked{% endif %}>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% import "utils.html" as utils %}
|
{% import "utils.html" as utils %}
|
||||||
|
|
||||||
{% block title %}Libreddit Settings{% endblock %}
|
{% block title %}Redlib Settings{% endblock %}
|
||||||
|
|
||||||
{% block search %}
|
{% block search %}
|
||||||
{% call utils::search("".to_owned(), "") %}
|
{% call utils::search("".to_owned(), "") %}
|
||||||
@ -135,7 +135,7 @@
|
|||||||
<label for="use_hls">Use HLS for videos</label>
|
<label for="use_hls">Use HLS for videos</label>
|
||||||
<details id="feeds">
|
<details id="feeds">
|
||||||
<summary>Why?</summary>
|
<summary>Why?</summary>
|
||||||
<div id="feed_list" class="helper">Reddit videos require JavaScript (via HLS.js) to be enabled to be played with audio. Therefore, this toggle lets you either use Libreddit JS-free or utilize this feature.</div>
|
<div id="feed_list" class="helper">Reddit videos require JavaScript (via HLS.js) to be enabled to be played with audio. Therefore, this toggle lets you either use Redlib JS-free or utilize this feature.</div>
|
||||||
</details>
|
</details>
|
||||||
<input type="hidden" value="off" name="use_hls">
|
<input type="hidden" value="off" name="use_hls">
|
||||||
<input type="checkbox" name="use_hls" id="use_hls" {% if prefs.use_hls == "on" %}checked{% endif %}>
|
<input type="checkbox" name="use_hls" id="use_hls" {% if prefs.use_hls == "on" %}checked{% endif %}>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
{% block title %}
|
{% block title %}
|
||||||
{% if sub.title != "" %}{{ sub.title }}
|
{% if sub.title != "" %}{{ sub.title }}
|
||||||
{% else if sub.name != "" %}{{ sub.name }}
|
{% else if sub.name != "" %}{{ sub.name }}
|
||||||
{% else %}Libreddit{% endif %}
|
{% else %}Redlib{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block search %}
|
{% block search %}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{% call utils::search("".to_owned(), "") %}
|
{% call utils::search("".to_owned(), "") %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block title %}{{ user.name.replace("u/", "") }} (u/{{ user.name }}) - Libreddit{% endblock %}
|
{% block title %}{{ user.name.replace("u/", "") }} (u/{{ user.name }}) - Redlib{% endblock %}
|
||||||
|
|
||||||
{% block subscriptions %}
|
{% block subscriptions %}
|
||||||
{% call utils::sub_list("") %}
|
{% call utils::sub_list("") %}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
{% macro search(root, search) -%}
|
{% macro search(root, search) -%}
|
||||||
<form action="{% if root != "/r/" && !root.is_empty() %}{{ root }}{% endif %}/search" id="searchbox">
|
<form action="{% if root != "/r/" && !root.is_empty() %}{{ root }}{% endif %}/search" id="searchbox">
|
||||||
<input id="search" type="text" name="q" placeholder="Search" title="Search libreddit" value="{{ search }}">
|
<input id="search" type="text" name="q" placeholder="Search" title="Search redlib" value="{{ search }}">
|
||||||
{% if root != "/r/" && !root.is_empty() %}
|
{% if root != "/r/" && !root.is_empty() %}
|
||||||
<div id="inside">
|
<div id="inside">
|
||||||
<input type="checkbox" name="restrict_sr" id="restrict_sr" checked>
|
<input type="checkbox" name="restrict_sr" id="restrict_sr" checked>
|
||||||
@ -305,7 +305,7 @@
|
|||||||
{% macro visit_reddit_confirmation(url) -%}
|
{% macro visit_reddit_confirmation(url) -%}
|
||||||
<div class="popup" id="popup">
|
<div class="popup" id="popup">
|
||||||
<div class="popup-inner">
|
<div class="popup-inner">
|
||||||
<h1>You are about to leave Libreddit</h1>
|
<h1>You are about to leave Redlib</h1>
|
||||||
<p>Do you want to continue?</p>
|
<p>Do you want to continue?</p>
|
||||||
<p id="reddit_url">https://www.reddit.com{{ url }}</p>
|
<p id="reddit_url">https://www.reddit.com{{ url }}</p>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 639.24 563">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 639.24 563">
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% if sub != "" %}{{ page }} - {{ sub }}
|
{% if sub != "" %}{{ page }} - {{ sub }}
|
||||||
{% else %}Libreddit{% endif %}
|
{% else %}Redlib{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block search %}
|
{% block search %}
|
||||||
|
Loading…
Reference in New Issue
Block a user