A private YouTube client: self-hosted web version (one docker compose) and native apps for Android, Windows, macOS, Linux and iPad/iPhone. No Google account, no tracking. Not affiliated with YouTube or Google.
JavaScript alternative-frontendandroidandroid-tvcompose-multiplatformdegoogledockerinnertubeinvidiousiosipadkotlinmpvprivacypwaself-hostedselfhostedwhisper-cppyoutubeyoutube-clientyoutube-frontend
# Used by docker-compose.yml. The site address comes from TUBEHAUS_SITE in .env
# (a domain gets HTTPS automatically; ":8080", the default, serves plain HTTP on a LAN).
# The tubehaus-web image has this file and the web app built in; TUBEHAUS_SERVER points it at the
# TubeHaus server container when it is not called tubehaus.
#
# Who may come in is the TubeHaus server's to say (its settings page: no sign-in, accounts, public),
# so every request asks it first (auth-auto). To fix it in .env instead:
# TUBEHAUS_AUTH=none nobody is asked (everyone who opens the address shares one library)
# TUBEHAUS_AUTH=basic one shared password:
# TUBEHAUS_USER=me
# TUBEHAUS_PASSWORD_HASH=<from: docker compose run --rm caddy caddy hash-password> (write every $ as $)
# TUBEHAUS_AUTH=accounts everyone signs up with a name and password and gets a library of their own
# (TUBEHAUS_MAX_ACCOUNTS=4 closes sign-ups once the household has its accounts)
# or put Authelia / Authentik / a passkey gate in front with forward_auth instead.
{
# TUBEHAUS_AUTH=basic: the wrong-password limit (forward_auth) is asked before the password (basic_auth)
order forward_auth before basic_auth
}
(auth-none) {
}
(auth-basic) {
# basic_auth has no limit on wrong passwords of its own: the TubeHaus server counts them. A request
# that carries a password asks it first (429 after 10 wrong ones from that address in 10 minutes),
# and every password basic_auth refuses is reported to it.
@tried header Authorization *
forward_auth @tried {$TUBEHAUS_SERVER:tubehaus:3010} {
uri /api/p/auth/basic-gate
}
basic_auth {
{$TUBEHAUS_USER} {$TUBEHAUS_PASSWORD_HASH}
}
handle_errors 401 {
rewrite * /api/p/auth/basic-fail
reverse_proxy {$TUBEHAUS_SERVER:tubehaus:3010}
}
}
(auth-accounts) {
import auth-auto
}
(auth-auto) {
# the sign-up / sign-in pages and their API stay open; everything else asks the server, which lets everyone
# in when the server has no accounts (or takes guests) and wants an account when it has them
@member not path /signup /login /y/* /api/p/auth/* /api/p/health /robots.txt
forward_auth @member {$TUBEHAUS_SERVER:tubehaus:3010} {
uri /api/p/auth/check
@unauth status 401
handle_response @unauth {
@htmlreq header Accept *text/html*
redir @htmlreq /login?r={uri} 302
respond 401
}
}
handle /signup {
root * /srv/web
header Cache-Control "no-cache"
rewrite * /y/auth.html
file_server
}
handle /login {
root * /srv/web
header Cache-Control "no-cache"
rewrite * /y/auth.html
file_server
}
}
{$TUBEHAUS_SITE::8080} {
encode zstd gzip
import auth-{$TUBEHAUS_AUTH:auto}
# privacy and hardening: no referrer to other sites, no FLoC/Topics, no MIME sniffing,
# no framing by other sites, and keep search engines out of a private instance
header {
Referrer-Policy same-origin
X-Content-Type-Options nosniff
X-Frame-Options SAMEORIGIN
Permissions-Policy "interest-cohort=(), browsing-topics=()"
-Server
}
handle /robots.txt {
respond <<TXT
User-agent: *
Disallow: /
TXT 200
}
handle /y/* {
root * /srv/web
header Cache-Control "no-cache"
file_server
}
@page {
method GET HEAD
path / /watch /results /shorts /shorts/* /channel/* /c/* /user/* /@* /playlist /feed/* /settings /hashtag/*
header Accept *text/html*
not path /feed/channel/* /feed/playlist/* /feed/private* /feed/webhook/*
not query classic=*
}
handle @page {
root * /srv/web
header Cache-Control "no-cache"
rewrite * /index.html
file_server
}
# everything else: the TubeHaus server (its API, YouTube's answers, the video streams, captions and pictures)
handle {
reverse_proxy {$TUBEHAUS_SERVER:tubehaus:3010} {
flush_interval -1
}
}
}