0
0

Added Cloudflare Warp for Teddit and Libreddit

This commit is contained in:
Opnxng 2023-12-15 05:33:49 +08:00
parent f275a579cf
commit 9bf1ef764b
9 changed files with 138 additions and 58 deletions

15
config-tasks/teddit.yaml Normal file
View File

@ -0,0 +1,15 @@
- name: Copy topbar.pug
copy:
src: "teddit/topbar.pug"
dest: "{{ docker_dir }}/teddit/topbar.pug"
owner: 1000
group: 1000
mode: 0755
- name: Copy about.pug
copy:
src: "teddit/about.pug"
dest: "{{ docker_dir }}/teddit/about.pug"
owner: 1000
group: 1000
mode: 0755

35
files/teddit/about.pug Normal file
View File

@ -0,0 +1,35 @@
doctype html
html
head
title about - teddit
meta(property='og:title', content='about - teddit')
include includes/meta_default.pug
include includes/meta_description.pug
include includes/head.pug
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug
.container
.content
h1 About
p Teddit is a free and open source alternative Reddit front-end focused on privacy. Teddit doesn't require you to have JavaScript enabled in your browser. The source is available on Codeberg at <a href="https://codeberg.org/teddit/teddit">https://codeberg.org/teddit/teddit</a>. <a href="https://github.com/libreddit/libreddit/issues/871#issuecomment-1856544584", target="_blank", style="color:#fbad41" >This instance utilizes Cloudflare Warp to avoid rate limiting. Please be aware of the privacy implications.</a> The instance is hosted only to mitigate bad experiences on a bad platform. Seek greener pastures!
ul
li No JavaScript or ads
li All requests go through the backend, client never talks to Reddit
li Prevents Reddit from tracking your IP or JavaScript fingerprint
li Lightweight (teddit frontpage: ~30 HTTP requests with ~270 KB of data downloaded vs. Reddit frontpage: ~190 HTTP requests with ~24 MB)
br
a(href="/privacy") Privacy policy
h2 Opnxng.com
ul
li Other services: <a href="https://about.opnxng.com/">https://about.opnxng.com/</a>
li Donating: <a href="https://liberapay.com/Opnxng/">https://liberapay.com/Opnxng/</a>
li Links to donate to the developer of Teddit can be found down below.
h2 Donating
p(class="word-break") XMR: 832ogRwuoSs2JGYg7wJTqshidK7dErgNdfpenQ9dzMghNXQTJRby1xGbqC3gW3GAifRM9E84J91VdMZRjoSJ32nkAZnaCEj
h2 Legal
p Teddit does not host any content. All content shown on any Teddit instances is from Reddit™. Reddit is a trademark of Reddit Inc. Teddit is not affiliated with Reddit Inc. Any issues with content shown on any Teddit instances need to be reported to Reddit, not the instance host's internet provider or domain provider.
.bottom
a(href="https://en.wikipedia.org/wiki/Piratbyr%C3%A5n#Kopimi", target="_blank")
img(src="kopimi.gif")
p.version v.0.4.9
include includes/footer.pug

25
files/teddit/topbar.pug Normal file
View File

@ -0,0 +1,25 @@
div#topbar
nav
.nav-item.left
a(href="/")
img(src="/favicon.png", alt="")
| teddit
.settings
.icon-container
a(href="/about", style={'color': '#fbad41'}) [about]
.icon-container
a(href="/preferences") [preferences]
.top-links
if user_preferences.subbed_subreddits && Array.isArray(user_preferences.subbed_subreddits)
a(href="/r/popular") Popular
a(href="/r/all") All
a(href="/saved") Saved
each subreddit in user_preferences.subbed_subreddits
a(href="/r/" + subreddit) #{subreddit}
else if instance_config.suggested_subreddits && Array.isArray(instance_config.suggested_subreddits)
each subreddit in instance_config.suggested_subreddits
if subreddit.toLowerCase() === 'saved'
a(href="/saved") Saved
else
a(href="/r/" + subreddit) #{subreddit}
a(href="/subreddits", id="sr-more-link") more »

View File

@ -1,9 +1,28 @@
# {{ ansible_managed }} # {{ ansible_managed }}
version: '3.7' version: '3.7'
services: services:
libreddit-warp:
image: caomingjun/warp
container_name: libreddit-warp
restart: always
environment:
- WARP_SLEEP=2
cap_add:
- NET_ADMIN
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
- net.ipv4.conf.all.src_valid_mark=1
volumes:
- {{ docker_dir }}/libreddit:/var/lib/cloudflare-warp
ports:
- 8882:8080
networks:
- libreddit
libreddit: libreddit:
container_name: libreddit container_name: libreddit
image: libreddit/libreddit:latest # image: libreddit/libreddit:latest
image: git.opnxng.com/opnxng/libreddit:latest
security_opt: security_opt:
- no-new-privileges - no-new-privileges
environment: environment:
@ -17,10 +36,7 @@ services:
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
ports: network_mode: "service:libreddit-warp"
- 8882:8080
networks:
- libreddit
networks: networks:
libreddit: libreddit:

View File

@ -1,6 +1,24 @@
# {{ ansible_managed }} # {{ ansible_managed }}
version: '3.7' version: '3.7'
services: services:
teddit-warp:
image: caomingjun/warp
container_name: teddit-warp
restart: always
environment:
- WARP_SLEEP=2
cap_add:
- NET_ADMIN
sysctls:
- net.ipv6.conf.all.disable_ipv6=0
- net.ipv4.conf.all.src_valid_mark=1
volumes:
- {{ docker_dir }}/teddit:/var/lib/cloudflare-warp
ports:
- 8881:8080
- 6379:6379
networks:
- teddit
teddit: teddit:
container_name: teddit container_name: teddit
@ -15,7 +33,8 @@ services:
- USE_HELMET=true - USE_HELMET=true
- USE_HELMET_HSTS=true - USE_HELMET_HSTS=true
- TRUST_PROXY=true - TRUST_PROXY=true
- REDIS_HOST=teddit-redis - REDIS_HOST=localhost
# - REDIS_HOST=teddit-redis
- THEME=dark - THEME=dark
- FLAIRS_ENABLED=false - FLAIRS_ENABLED=false
- API_ENABLED=false - API_ENABLED=false
@ -26,14 +45,14 @@ services:
test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost:8080/about"] test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost:8080/about"]
interval: 1m interval: 1m
timeout: 3s timeout: 3s
ports:
- 8881:8080
depends_on: depends_on:
- teddit-redis - teddit-redis
logging: logging:
driver: none driver: none
networks: volumes:
- teddit - {{ docker_dir }}/teddit/topbar.pug:/teddit/views/includes/topbar.pug
- {{ docker_dir }}/teddit/about.pug:/teddit/views/about.pug
network_mode: "service:teddit-warp"
teddit-redis: teddit-redis:
container_name: teddit-redis container_name: teddit-redis
@ -45,8 +64,7 @@ services:
- TZ=Asia/Singapore - TZ=Asia/Singapore
- REDIS_REPLICATION_MODE=master - REDIS_REPLICATION_MODE=master
restart: unless-stopped restart: unless-stopped
networks: network_mode: "service:teddit-warp"
- teddit
networks: networks:
teddit: teddit:

View File

@ -135,18 +135,7 @@
@i host i.{$HOSTNAME} @i host i.{$HOSTNAME}
handle @i { handle @i {
encode zstd gzip encode zstd gzip
reverse_proxy { reverse_proxy {{ vultr_private_ip }}:8881
to {{ vultr_private_ip }}:8881
to {{ oracle1_private_ip }}:8881
to {{ oracle2_private_ip }}:8881
to {{ oracle3_private_ip }}:8881
to {{ oracle4_private_ip }}:8881
lb_policy ip_hash
lb_try_duration 5s
lb_try_interval 1s
fail_duration 30s
max_fails 3
}
header { header {
Content-Security-Policy "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" Content-Security-Policy "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests"
X-Robots-Tag "noindex, noimageindex, nosnippet, notranslate, noarchive, nofollow" X-Robots-Tag "noindex, noimageindex, nosnippet, notranslate, noarchive, nofollow"
@ -156,18 +145,7 @@
@l host l.{$HOSTNAME} @l host l.{$HOSTNAME}
handle @l { handle @l {
encode zstd gzip encode zstd gzip
reverse_proxy { reverse_proxy {{ vultr_private_ip }}:8882
to {{ vultr_private_ip }}:8882
to {{ oracle1_private_ip }}:8882
to {{ oracle2_private_ip }}:8882
to {{ oracle3_private_ip }}:8882
to {{ oracle4_private_ip }}:8882
lb_policy ip_hash
lb_try_duration 5s
lb_try_interval 1s
fail_duration 30s
max_fails 3
}
header { header {
Content-Security-Policy "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests" Content-Security-Policy "default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests"
X-Robots-Tag "noindex, noimageindex, nosnippet, notranslate, noarchive, nofollow" X-Robots-Tag "noindex, noimageindex, nosnippet, notranslate, noarchive, nofollow"

View File

@ -217,11 +217,11 @@ hostname_replace:
'(.*\.)?youtube\.com$': 'invidious.fdn.fr' '(.*\.)?youtube\.com$': 'invidious.fdn.fr'
'(.*\.)?youtu\.be$': 'invidious.fdn.fr' '(.*\.)?youtu\.be$': 'invidious.fdn.fr'
'(.*\.)?youtube-noocookie\.com$': 'invidious.fdn.fr' '(.*\.)?youtube-noocookie\.com$': 'invidious.fdn.fr'
# '(.*\.)?reddit\.com$': 'i.opnxng.com' '(.*\.)?reddit\.com$': 'i.opnxng.com'
# '(.*\.)?redd\.it$': 'i.opnxng.com' '(.*\.)?redd\.it$': 'i.opnxng.com'
# '(.*\.)?libi.opnxng\.com$': 'l.opnxng.com' '(.*\.)?libi.opnxng\.com$': 'l.opnxng.com'
'(.*\.)?reddit\.com$': 'old.reddit.com' # '(.*\.)?reddit\.com$': 'old.reddit.com'
'(.*\.)?redd\.it$': 'old.reddit.com' # '(.*\.)?redd\.it$': 'old.reddit.com'
'(.*\.)?medium\.com$': 'm.opnxng.com' '(.*\.)?medium\.com$': 'm.opnxng.com'
'fandom\.com$': 'z.opnxng.com' 'fandom\.com$': 'z.opnxng.com'
'dic\.academic\.ru$': 'akademik.bloat.cat' 'dic\.academic\.ru$': 'akademik.bloat.cat'

View File

@ -1,15 +1,15 @@
compose: config:
oracle3: vultr:
- gitea - teddit
# ---------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------
deployed-compose: deployed-compose:
vultr: vultr:
- cloudtube
- teddit
- libreddit - libreddit
- teddit
- cloudtube
- imgin - imgin
- rat-aint-tieba - rat-aint-tieba
- watchtower - watchtower
@ -26,8 +26,6 @@ deployed-compose:
- gothub - gothub
- anonymousoverflow - anonymousoverflow
- scribe - scribe
- teddit
- libredditarm
- proxitok - proxitok
- proxigram - proxigram
- it-tools - it-tools
@ -50,8 +48,6 @@ deployed-compose:
- gothub - gothub
- anonymousoverflow - anonymousoverflow
- scribe - scribe
- teddit
- libredditarm
- proxitok - proxitok
- proxigram - proxigram
- it-tools - it-tools
@ -77,8 +73,6 @@ deployed-compose:
- gothub - gothub
- anonymousoverflow - anonymousoverflow
- scribe - scribe
- teddit
- libredditarm
- proxitok - proxitok
- proxigram - proxigram
- it-tools - it-tools
@ -104,8 +98,6 @@ deployed-compose:
- gothub - gothub
- anonymousoverflow - anonymousoverflow
- scribe - scribe
- teddit
- libredditarm
- proxitok - proxitok
- proxigram - proxigram
- it-tools - it-tools
@ -122,6 +114,7 @@ deployed-compose:
deployed-config: deployed-config:
vultr: vultr:
- cloudtube - cloudtube
- teddit
oracle1: oracle1:
- anonymousoverflow - anonymousoverflow
- scribe - scribe