diff --git a/.gitignore b/.gitignore index 69d608b..15771a7 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ bibliogram/ nitter/ omgur/ invidious/ +libreddit/ config/ diff --git a/build.sh b/build.sh index 3bb5e01..7ea188c 100755 --- a/build.sh +++ b/build.sh @@ -10,4 +10,6 @@ echo "Updating omgur..." ./build.updaterepo.sh https://git.geraldwu.com/gerald/omgur.git omgur echo "Updating invidious..." ./build.updaterepo.sh https://github.com/iv-org/invidious.git invidious +echo "Updating libreddit..." +./build.updaterepo.sh https://github.com/spikecodes/libreddit.git libreddit echo "Done." diff --git a/docker-compose.yml b/docker-compose.yml index 2645537..e4ac8c4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -100,6 +100,18 @@ services: depends_on: - invidious-postgres + libreddit: + build: + context: libreddit/ + container_name: ${LRT_CONTAINER_NAME:-libreddit} + restart: ${LRT_RESTART:-unless-stopped} + env_file: + - libreddit.env + expose: + - 8080 + networks: + - socials + volumes: nginx-cache: bibliogram-db: diff --git a/libreddit.env.example b/libreddit.env.example new file mode 100644 index 0000000..f85f792 --- /dev/null +++ b/libreddit.env.example @@ -0,0 +1,11 @@ +# See: https://github.com/spikecodes/libreddit/blob/master/README.md + +#LIBREDDIT_DEFAULT_THEME= +#LIBREDDIT_DEFAULT_FRONT_PAGE= +#LIBREDDIT_DEFAULT_LAYOUT= +#LIBREDDIT_DEFAULT_WIDE= +#LIBREDDIT_DEFAULT_COMMENT_SORT= +#LIBREDDIT_DEFAULT_POST_SORT= +#LIBREDDIT_DEFAULT_SHOW_NSFW= +#LIBREDDIT_DEFAULT_USE_HLS= +#LIBREDDIT_DEFAULT_HIDE_HLS_NOTIFICATION= diff --git a/nginx/root/etc/nginx/conf.d/default.template b/nginx/root/etc/nginx/conf.d/default.template index c299cae..ab23549 100644 --- a/nginx/root/etc/nginx/conf.d/default.template +++ b/nginx/root/etc/nginx/conf.d/default.template @@ -34,6 +34,13 @@ upstream invidious { server ${INV_ADDR}:${INV_PORT}; } +upstream libreddit { + # Cannot connect to network of this container + server 127.0.0.1 down; + ## Can be connected with the network + server ${LRT_ADDR}:${LRT_PORT}; +} + server { # This is a catch-all hostname (it will never trigger on a real hostname). # If an access by IP or by an unhandled domain linking to this IP is tried, @@ -78,7 +85,6 @@ server { add_header Content-Type text/plain; return 200 "User-agent: *\nDisallow: /\n"; } - } server { @@ -96,7 +102,6 @@ server { add_header Content-Type text/plain; return 200 "User-agent: *\nDisallow: /\n"; } - } server { @@ -114,7 +119,6 @@ server { add_header Content-Type text/plain; return 200 "User-agent: *\nDisallow: /\n"; } - } server { @@ -158,5 +162,21 @@ server { proxy_cache_valid 200 31d; # Used for /videoplayback responses proxy_cache_valid 302 31d; # Used for /latest_version responses } +} + +server { + listen ${NGINX_LISTEN_PORT}; + server_name ${LRT_HOSTNAME}; + + # Disable do not add the server version in the header + server_tokens off; + + location / { + proxy_pass http://libreddit; + } + location = /robots.txt { + add_header Content-Type text/plain; + return 200 "User-agent: *\nDisallow: /\n"; + } }