diff --git a/config-tasks/teddit.yaml b/config-tasks/teddit.yaml new file mode 100644 index 0000000..88c1ed6 --- /dev/null +++ b/config-tasks/teddit.yaml @@ -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 \ No newline at end of file diff --git a/files/teddit/about.pug b/files/teddit/about.pug new file mode 100644 index 0000000..6ed13ef --- /dev/null +++ b/files/teddit/about.pug @@ -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 https://codeberg.org/teddit/teddit. This instance utilizes Cloudflare Warp to avoid rate limiting. Please be aware of the privacy implications. 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: https://about.opnxng.com/ + li Donating: https://liberapay.com/Opnxng/ + 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 diff --git a/files/teddit/topbar.pug b/files/teddit/topbar.pug new file mode 100644 index 0000000..a8aebd4 --- /dev/null +++ b/files/teddit/topbar.pug @@ -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 » \ No newline at end of file diff --git a/templates/compose/libreddit.yaml.j2 b/templates/compose/libreddit.yaml.j2 index 8045a0c..2304c01 100644 --- a/templates/compose/libreddit.yaml.j2 +++ b/templates/compose/libreddit.yaml.j2 @@ -1,9 +1,28 @@ # {{ ansible_managed }} version: '3.7' 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: container_name: libreddit - image: libreddit/libreddit:latest +# image: libreddit/libreddit:latest + image: git.opnxng.com/opnxng/libreddit:latest security_opt: - no-new-privileges environment: @@ -17,10 +36,7 @@ services: test: ["CMD", "wget", "--spider", "-q", "--tries=1", "http://localhost:8080/settings"] interval: 5m timeout: 3s - ports: - - 8882:8080 - networks: - - libreddit + network_mode: "service:libreddit-warp" networks: libreddit: diff --git a/templates/compose/libredditarm.yaml.j2 b/templates/compose/libredditarm.yaml.j2 index ecc714b..8481e63 100644 --- a/templates/compose/libredditarm.yaml.j2 +++ b/templates/compose/libredditarm.yaml.j2 @@ -12,7 +12,7 @@ services: - TZ=Asia/Singapore - LIBREDDIT_DEFAULT_THEME=black - LIBREDDIT_DEFAULT_SHOW_NSFW=on - restart: unless-stopped + restart: unless-stopped healthcheck: test: ["CMD", "wget", "--spider", "-q", "--tries=1", "http://localhost:8080/settings"] interval: 5m @@ -24,4 +24,4 @@ services: networks: libreddit: - name: libreddit \ No newline at end of file + name: libreddit diff --git a/templates/compose/teddit.yaml.j2 b/templates/compose/teddit.yaml.j2 index c49c5eb..0065740 100644 --- a/templates/compose/teddit.yaml.j2 +++ b/templates/compose/teddit.yaml.j2 @@ -1,6 +1,24 @@ # {{ ansible_managed }} version: '3.7' 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: container_name: teddit @@ -15,25 +33,26 @@ services: - USE_HELMET=true - USE_HELMET_HSTS=true - TRUST_PROXY=true - - REDIS_HOST=teddit-redis + - REDIS_HOST=localhost +# - REDIS_HOST=teddit-redis - THEME=dark - FLAIRS_ENABLED=false - API_ENABLED=false - SUGGESTED_SUBREDDITS=["Saved", "Selfhosted", "Linux", "Privacy", "DataHoarder"] - DOMAIN_REPLACEMENTS=[["twitter.com","n.opnxng.com"],["quora.com","q.opnxng.com."],["imgur.com","r.opnxng.com"]] - restart: unless-stopped + restart: unless-stopped healthcheck: test: ["CMD", "wget" ,"--no-verbose", "--tries=1", "--spider", "http://localhost:8080/about"] interval: 1m timeout: 3s - ports: - - 8881:8080 depends_on: - teddit-redis logging: driver: none - networks: - - teddit + volumes: + - {{ 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: container_name: teddit-redis @@ -45,9 +64,8 @@ services: - TZ=Asia/Singapore - REDIS_REPLICATION_MODE=master restart: unless-stopped - networks: - - teddit + network_mode: "service:teddit-warp" networks: teddit: - name: teddit \ No newline at end of file + name: teddit diff --git a/templates/conf/Caddyfile.j2 b/templates/conf/Caddyfile.j2 index 15ed663..dcc65ab 100755 --- a/templates/conf/Caddyfile.j2 +++ b/templates/conf/Caddyfile.j2 @@ -135,18 +135,7 @@ @i host i.{$HOSTNAME} handle @i { encode zstd gzip - reverse_proxy { - 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 - } + reverse_proxy {{ vultr_private_ip }}:8881 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" X-Robots-Tag "noindex, noimageindex, nosnippet, notranslate, noarchive, nofollow" @@ -156,18 +145,7 @@ @l host l.{$HOSTNAME} handle @l { encode zstd gzip - reverse_proxy { - 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 - } + reverse_proxy {{ vultr_private_ip }}:8882 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" X-Robots-Tag "noindex, noimageindex, nosnippet, notranslate, noarchive, nofollow" diff --git a/templates/conf/settings.yml.j2 b/templates/conf/settings.yml.j2 index e3e424a..dc560d5 100755 --- a/templates/conf/settings.yml.j2 +++ b/templates/conf/settings.yml.j2 @@ -217,11 +217,11 @@ hostname_replace: '(.*\.)?youtube\.com$': 'invidious.fdn.fr' '(.*\.)?youtu\.be$': 'invidious.fdn.fr' '(.*\.)?youtube-noocookie\.com$': 'invidious.fdn.fr' -# '(.*\.)?reddit\.com$': 'i.opnxng.com' -# '(.*\.)?redd\.it$': 'i.opnxng.com' -# '(.*\.)?libi.opnxng\.com$': 'l.opnxng.com' - '(.*\.)?reddit\.com$': 'old.reddit.com' - '(.*\.)?redd\.it$': 'old.reddit.com' + '(.*\.)?reddit\.com$': 'i.opnxng.com' + '(.*\.)?redd\.it$': 'i.opnxng.com' + '(.*\.)?libi.opnxng\.com$': 'l.opnxng.com' +# '(.*\.)?reddit\.com$': 'old.reddit.com' +# '(.*\.)?redd\.it$': 'old.reddit.com' '(.*\.)?medium\.com$': 'm.opnxng.com' 'fandom\.com$': 'z.opnxng.com' 'dic\.academic\.ru$': 'akademik.bloat.cat' diff --git a/vars/services.yaml b/vars/services.yaml index fbdff0c..78f15ea 100644 --- a/vars/services.yaml +++ b/vars/services.yaml @@ -1,15 +1,15 @@ -compose: - oracle3: - - gitea +config: + vultr: + - teddit # ---------------------------------------------------------------------------------------------------- deployed-compose: vultr: - - cloudtube - - teddit - libreddit + - teddit + - cloudtube - imgin - rat-aint-tieba - watchtower @@ -26,8 +26,6 @@ deployed-compose: - gothub - anonymousoverflow - scribe - - teddit - - libredditarm - proxitok - proxigram - it-tools @@ -50,8 +48,6 @@ deployed-compose: - gothub - anonymousoverflow - scribe - - teddit - - libredditarm - proxitok - proxigram - it-tools @@ -77,8 +73,6 @@ deployed-compose: - gothub - anonymousoverflow - scribe - - teddit - - libredditarm - proxitok - proxigram - it-tools @@ -104,8 +98,6 @@ deployed-compose: - gothub - anonymousoverflow - scribe - - teddit - - libredditarm - proxitok - proxigram - it-tools @@ -122,6 +114,7 @@ deployed-compose: deployed-config: vultr: - cloudtube + - teddit oracle1: - anonymousoverflow - scribe