mirror of https://github.com/spikecodes/libreddit
remove all reddit branding (#1)
This commit is contained in:
commit
4a9f405947
|
@ -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 libbacon 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 libbacon
|
||||||
<!--
|
<!--
|
||||||
A clear and concise description of what you want to happen.
|
A clear and concise description of what you want to happen.
|
||||||
-->
|
-->
|
||||||
|
|
|
@ -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 libbacon that is not found in Reddit
|
||||||
title: '💡 Feature request: '
|
title: '💡 Feature request: '
|
||||||
labels: enhancement
|
labels: enhancement
|
||||||
assignees: ''
|
assignees: ''
|
||||||
|
|
|
@ -33,6 +33,6 @@ jobs:
|
||||||
file: ./Dockerfile.arm
|
file: ./Dockerfile.arm
|
||||||
platforms: linux/arm64
|
platforms: linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: spikecodes/libreddit:arm
|
tags: libbacon/libbacon:arm
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
|
@ -36,6 +36,6 @@ jobs:
|
||||||
file: ./Dockerfile.armv7
|
file: ./Dockerfile.armv7
|
||||||
platforms: linux/arm/v7
|
platforms: linux/arm/v7
|
||||||
push: true
|
push: true
|
||||||
tags: spikecodes/libreddit:armv7
|
tags: libbacon/libbacon:armv7
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
|
@ -33,6 +33,6 @@ jobs:
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
platforms: linux/amd64
|
platforms: linux/amd64
|
||||||
push: true
|
push: true
|
||||||
tags: spikecodes/libreddit:latest
|
tags: libbacon/libbacon:latest
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
|
@ -30,8 +30,8 @@ jobs:
|
||||||
- uses: actions/upload-artifact@v2.2.1
|
- uses: actions/upload-artifact@v2.2.1
|
||||||
name: Upload a Build Artifact
|
name: Upload a Build Artifact
|
||||||
with:
|
with:
|
||||||
name: libreddit
|
name: libbacon
|
||||||
path: target/release/libreddit
|
path: target/release/libbacon
|
||||||
|
|
||||||
- name: Versions
|
- name: Versions
|
||||||
id: version
|
id: version
|
||||||
|
@ -40,7 +40,7 @@ jobs:
|
||||||
echo "::set-output name=tag::$(git describe --tags)"
|
echo "::set-output name=tag::$(git describe --tags)"
|
||||||
|
|
||||||
- name: Calculate SHA512 checksum
|
- name: Calculate SHA512 checksum
|
||||||
run: sha512sum target/release/libreddit > libreddit.sha512
|
run: sha512sum target/release/libbacon > libbacon.sha512
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
@ -50,8 +50,8 @@ 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/release/libreddit
|
target/release/libbacon
|
||||||
libreddit.sha512
|
libbacon.sha512
|
||||||
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 true; do wget -O libreddit https://github.com/spikecodes/libreddit/releases/latest/download/libreddit;chmod +x libreddit;./libreddit -H 63115200;sleep 1;done"
|
run = "while true; do wget -O libbacon https://github.com/libbacon/libbacon/releases/latest/download/libbacon;chmod +x libbacon;./libbacon -H 63115200;sleep 1;done"
|
||||||
language = "bash"
|
language = "bash"
|
|
@ -579,14 +579,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libbacon"
|
||||||
version = "0.2.126"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libreddit"
|
|
||||||
version = "0.22.9"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"askama",
|
"askama",
|
||||||
"async-recursion",
|
"async-recursion",
|
||||||
|
@ -607,6 +601,12 @@ dependencies = [
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.126"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lock_api"
|
name = "lock_api"
|
||||||
version = "0.4.7"
|
version = "0.4.7"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libreddit"
|
name = "libbacon"
|
||||||
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/libbacon/libbacon"
|
||||||
version = "0.22.9"
|
version = "0.1.0"
|
||||||
authors = ["spikecodes <19519553+spikecodes@users.noreply.github.com>"]
|
authors = ["Daniel Valentine <Daniel-Valentine@users.noreply.github.com>"]
|
||||||
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 /libbacon
|
||||||
|
|
||||||
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 /libbacon/target/x86_64-unknown-linux-musl/release/libbacon /usr/local/bin/libbacon
|
||||||
|
|
||||||
# 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 libbacon
|
||||||
USER libreddit
|
USER libbacon
|
||||||
|
|
||||||
# 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 libbacon 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 ["libbacon"]
|
||||||
|
|
|
@ -5,7 +5,7 @@ FROM rust:alpine AS builder
|
||||||
|
|
||||||
RUN apk add --no-cache g++
|
RUN apk add --no-cache g++
|
||||||
|
|
||||||
WORKDIR /usr/src/libreddit
|
WORKDIR /usr/src/libbacon
|
||||||
|
|
||||||
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 /usr/local/cargo/bin/libreddit /usr/local/bin/libreddit
|
COPY --from=builder /usr/local/cargo/bin/libbacon /usr/local/bin/libbacon
|
||||||
|
|
||||||
# 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 libbacon
|
||||||
USER libreddit
|
USER libbacon
|
||||||
|
|
||||||
# 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 libbacon 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 ["libbacon"]
|
||||||
|
|
|
@ -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 /libbacon
|
||||||
|
|
||||||
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 /libbacon/target/armv7-unknown-linux-musleabihf/release/libbacon /usr/local/bin/libbacon
|
||||||
|
|
||||||
# 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 libbacon
|
||||||
USER libreddit
|
USER libbacon
|
||||||
|
|
||||||
# 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 libbacon 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 ["libbacon"]
|
||||||
|
|
20
app.json
20
app.json
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "Libreddit",
|
"name": "libbacon",
|
||||||
"description": "Private front-end for Reddit",
|
"description": "Private front-end for Reddit",
|
||||||
"buildpacks": [
|
"buildpacks": [
|
||||||
{
|
{
|
||||||
|
@ -11,31 +11,31 @@
|
||||||
],
|
],
|
||||||
"stack": "container",
|
"stack": "container",
|
||||||
"env": {
|
"env": {
|
||||||
"LIBREDDIT_DEFAULT_THEME": {
|
"LIBBACON_DEFAULT_THEME": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_FRONT_PAGE": {
|
"LIBBACON_DEFAULT_FRONT_PAGE": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_LAYOUT": {
|
"LIBBACON_DEFAULT_LAYOUT": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_WIDE": {
|
"LIBBACON_DEFAULT_WIDE": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_COMMENT_SORT": {
|
"LIBBACON_DEFAULT_COMMENT_SORT": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_POST_SORT": {
|
"LIBBACON_DEFAULT_POST_SORT": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_DEFAULT_SHOW_NSFW": {
|
"LIBBACON_DEFAULT_SHOW_NSFW": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_USE_HLS": {
|
"LIBBACON_USE_HLS": {
|
||||||
"required": false
|
"required": false
|
||||||
},
|
},
|
||||||
"LIBREDDIT_HIDE_HLS_NOTIFICATION": {
|
"LIBBACON_HIDE_HLS_NOTIFICATION": {
|
||||||
"required": false
|
"required": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=libreddit daemon
|
Description=libbacon 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/libbacon.conf
|
||||||
ExecStart=/usr/bin/libreddit -a ${ADDRESS} -p ${PORT}
|
ExecStart=/usr/bin/libbacon -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: "libbacon"
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080
|
- 8080:8080
|
||||||
healthcheck:
|
healthcheck:
|
||||||
|
|
|
@ -73,7 +73,7 @@ fn request(url: String, quarantine: bool) -> Boxed<Result<Response<Body>, String
|
||||||
let builder = Request::builder()
|
let builder = Request::builder()
|
||||||
.method("GET")
|
.method("GET")
|
||||||
.uri(&url)
|
.uri(&url)
|
||||||
.header("User-Agent", format!("web:libreddit:{}", env!("CARGO_PKG_VERSION")))
|
.header("User-Agent", format!("web:libbacon:{}", env!("CARGO_PKG_VERSION")))
|
||||||
.header("Host", "www.reddit.com")
|
.header("Host", "www.reddit.com")
|
||||||
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
|
.header("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8")
|
||||||
.header("Accept-Language", "en-US,en;q=0.5")
|
.header("Accept-Language", "en-US,en;q=0.5")
|
||||||
|
|
|
@ -104,7 +104,7 @@ async fn style() -> Result<Response<Body>, String> {
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let matches = Command::new("Libreddit")
|
let matches = Command::new("libbacon")
|
||||||
.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(
|
||||||
|
@ -149,7 +149,7 @@ async fn main() {
|
||||||
|
|
||||||
let listener = [address, ":", &port].concat();
|
let listener = [address, ":", &port].concat();
|
||||||
|
|
||||||
println!("Starting Libreddit...");
|
println!("Starting libbacon...");
|
||||||
|
|
||||||
// Begin constructing a server
|
// Begin constructing a server
|
||||||
let mut app = server::Server::new();
|
let mut app = server::Server::new();
|
||||||
|
@ -188,7 +188,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 libbacon
|
||||||
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());
|
||||||
|
@ -286,7 +286,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 libbacon v{} on {}!", env!("CARGO_PKG_VERSION"), listener);
|
||||||
|
|
||||||
let server = app.listen(listener);
|
let server = app.listen(listener);
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ fn parse_comments(json: &serde_json::Value, post_link: &str, post_author: &str,
|
||||||
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 libbacon 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";
|
||||||
|
|
|
@ -40,7 +40,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 libbacon 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();
|
||||||
let user = user(&username).await.unwrap_or_default();
|
let user = user(&username).await.unwrap_or_default();
|
||||||
|
|
|
@ -530,7 +530,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 an environment variable
|
// If there is no cookie for this setting, try receiving a default from an environment variable
|
||||||
if let Ok(default) = std::env::var(format!("LIBREDDIT_DEFAULT_{}", name.to_uppercase())) {
|
if let Ok(default) = std::env::var(format!("LIBBACON_DEFAULT_{}", name.to_uppercase())) {
|
||||||
Cookie::new(name, default)
|
Cookie::new(name, default)
|
||||||
} else {
|
} else {
|
||||||
Cookie::named(name)
|
Cookie::named(name)
|
||||||
|
@ -615,7 +615,7 @@ pub fn format_url(url: &str) -> String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rewrite Reddit links to Libreddit in body of text
|
// Rewrite Reddit links to libbacon in body of text
|
||||||
pub fn rewrite_urls(input_text: &str) -> String {
|
pub fn rewrite_urls(input_text: &str) -> String {
|
||||||
let text1 = Regex::new(r#"href="(https|http|)://(www\.|old\.|np\.|amp\.|)(reddit\.com|redd\.it)/"#)
|
let text1 = Regex::new(r#"href="(https|http|)://(www\.|old\.|np\.|amp\.|)(reddit\.com|redd\.it)/"#)
|
||||||
.map_or(String::new(), |re| re.replace_all(input_text, r#"href="/"#).to_string())
|
.map_or(String::new(), |re| re.replace_all(input_text, r#"href="/"#).to_string())
|
||||||
|
@ -623,7 +623,7 @@ pub fn rewrite_urls(input_text: &str) -> String {
|
||||||
.replace("%5C", "")
|
.replace("%5C", "")
|
||||||
.replace('\\', "");
|
.replace('\\', "");
|
||||||
|
|
||||||
// Rewrite external media previews to Libreddit
|
// Rewrite external media previews to libbacon
|
||||||
Regex::new(r"https://external-preview\.redd\.it(.*)[^?]").map_or(String::new(), |re| {
|
Regex::new(r"https://external-preview\.redd\.it(.*)[^?]").map_or(String::new(), |re| {
|
||||||
if re.is_match(&text1) {
|
if re.is_match(&text1) {
|
||||||
re.replace_all(&text1, format_url(re.find(&text1).map(|x| x.as_str()).unwrap_or_default())).to_string()
|
re.replace_all(&text1, format_url(re.find(&text1).map(|x| x.as_str()).unwrap_or_default())).to_string()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Libreddit",
|
"name": "libbacon",
|
||||||
"short_name": "Libreddit",
|
"short_name": "libbacon",
|
||||||
"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",
|
||||||
|
|
|
@ -94,7 +94,7 @@ nav {
|
||||||
}
|
}
|
||||||
|
|
||||||
nav * { color: var(--text); }
|
nav * { color: var(--text); }
|
||||||
nav #reddit, #code > span { color: var(--accent); }
|
nav #bacon, #code > span { color: var(--accent); }
|
||||||
nav #code > svg { stroke: var(--accent); }
|
nav #code > svg { stroke: var(--accent); }
|
||||||
|
|
||||||
nav #logo {
|
nav #logo {
|
||||||
|
@ -119,7 +119,7 @@ nav #version {
|
||||||
margin-right: 10px;
|
margin-right: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav #libreddit {
|
nav #libbacon {
|
||||||
vertical-align: -2px;
|
vertical-align: -2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
{% block head %}
|
{% block head %}
|
||||||
<title>{% block title %}Libreddit{% endblock %}</title>
|
<title>{% block title %}libbacon{% 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 libbacon, 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="libbacon">
|
||||||
<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 -->
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<!-- NAVIGATION BAR -->
|
<!-- NAVIGATION BAR -->
|
||||||
<nav>
|
<nav>
|
||||||
<div id="logo">
|
<div id="logo">
|
||||||
<a id="libreddit" href="/"><span id="lib">lib</span><span id="reddit">reddit.</span></a>
|
<a id="libbacon" href="/"><span id="lib">lib</span><span id="reddit">bacon.</span></a>
|
||||||
<span id="version">v{{ env!("CARGO_PKG_VERSION") }}</span>
|
<span id="version">v{{ env!("CARGO_PKG_VERSION") }}</span>
|
||||||
{% block subscriptions %}{% endblock %}
|
{% block subscriptions %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -38,8 +38,12 @@
|
||||||
<a id="reddit_link" href="https://www.reddit.com{{ url }}" rel="nofollow">
|
<a id="reddit_link" href="https://www.reddit.com{{ url }}" rel="nofollow">
|
||||||
<span>reddit</span>
|
<span>reddit</span>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<path d="M23 12.0737C23 10.7308 21.9222 9.64226 20.5926 9.64226C19.9435 9.64226 19.3557 9.90274 18.923 10.3244C17.2772 9.12492 15.0099 8.35046 12.4849 8.26135L13.5814 3.05002L17.1643 3.8195C17.2081 4.73947 17.9539 5.47368 18.8757 5.47368C19.8254 5.47368 20.5951 4.69626 20.5951 3.73684C20.5951 2.77769 19.8254 2 18.8758 2C18.2001 2 17.6214 2.39712 17.3404 2.96952L13.3393 2.11066C13.2279 2.08679 13.1116 2.10858 13.016 2.17125C12.9204 2.23393 12.8533 2.33235 12.8295 2.44491L11.6051 8.25987C9.04278 8.33175 6.73904 9.10729 5.07224 10.3201C4.63988 9.90099 4.05398 9.64226 3.40757 9.64226C2.0781 9.64226 1 10.7308 1 12.0737C1 13.0618 1.58457 13.9105 2.4225 14.2909C2.38466 14.5342 2.36545 14.78 2.36505 15.0263C2.36505 18.7673 6.67626 21.8 11.9945 21.8C17.3131 21.8 21.6243 18.7673 21.6243 15.0263C21.6243 14.7794 21.6043 14.5359 21.5678 14.2957C22.4109 13.9175 23 13.0657 23 12.0737Z"/>
|
<title>reddit</title>
|
||||||
</svg>
|
<g transform="scale(1.1181998,0.89429456)" style="fill:currentColor;fill-opacity:1;stroke:none;stroke-width:2">
|
||||||
|
<path d="M 10.460443,8.6904786 Q 9.9661229,8.4034541 9.3761283,8.2758877 8.8020794,8.1323755 8.1004641,8.1323755 q -2.487545,0 -3.8269923,1.6264718 -1.3235016,1.6105257 -1.3235016,4.6402277 v 9.408023 H -3.0361116e-6 V 5.9478007 H 2.9499702 v 2.7745695 q 0.9248565,-1.6264718 2.4078161,-2.4078161 1.4829595,-0.79729 3.6037511,-0.79729 0.3029702,0 0.6697237,0.047837 0.3667534,0.031892 0.8132359,0.1116206 z"/>
|
||||||
|
<path d="m 18.75226,1.6732141e-5 h 2.710786 L 13.171229,26.836801 h -2.710786 z"/>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
<a id="settings_link" href="/settings">
|
<a id="settings_link" href="/settings">
|
||||||
<span>settings</span>
|
<span>settings</span>
|
||||||
|
@ -48,7 +52,7 @@
|
||||||
<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
|
<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
<a id="code" href="https://github.com/spikecodes/libreddit">
|
<a id="code" href="https://github.com/libbacon/libbacon">
|
||||||
<span>code</span>
|
<span>code</span>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<title>code</title>
|
<title>code</title>
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
<meta property="og:type" content="website">
|
<meta property="og:type" content="website">
|
||||||
<meta property="og:url" content="{{ post.permalink }}">
|
<meta property="og:url" content="{{ post.permalink }}">
|
||||||
<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 libbacon, an alternative private front-end to Reddit.">
|
||||||
<meta property="og:image" content="{{ post.thumbnail.url }}">
|
<meta property="og:image" content="{{ post.thumbnail.url }}">
|
||||||
<meta property="twitter:card" content="summary_large_image">
|
<meta property="twitter:card" content="summary_large_image">
|
||||||
<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 libbacon, an alternative private front-end to Reddit.">
|
||||||
<meta property="twitter:image" content="{{ post.thumbnail.url }}">
|
<meta property="twitter:image" content="{{ post.thumbnail.url }}">
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -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 %}libbacon: 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 }}" title="Search libreddit">
|
<input id="search" type="text" name="q" placeholder="Search" value="{{ params.q }}" title="Search libbacon">
|
||||||
{% 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 %}libbacon Settings{% endblock %}
|
||||||
|
|
||||||
{% block search %}
|
{% block search %}
|
||||||
{% call utils::search("".to_owned(), "", "") %}
|
{% call utils::search("".to_owned(), "", "") %}
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
<label for="use_hls">Use HLS for videos
|
<label for="use_hls">Use HLS for videos
|
||||||
<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 libbacon JS-free or utilize this feature.</div>
|
||||||
</details>
|
</details>
|
||||||
</label>
|
</label>
|
||||||
<input type="hidden" value="off" name="use_hls">
|
<input type="hidden" value="off" name="use_hls">
|
||||||
|
|
|
@ -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 %}libbacon{% 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 }}) - libbacon{% 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 libbacon" 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>
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{% if sub != "" %}{{ page }} - {{ sub }}
|
{% if sub != "" %}{{ page }} - {{ sub }}
|
||||||
{% else %}Libreddit{% endif %}
|
{% else %}libbacon{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block search %}
|
{% block search %}
|
||||||
|
|
Loading…
Reference in New Issue