From abedf7a789e5e300627c3c2e85efc6ffa223c981 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Sun, 26 Jul 2026 21:37:07 +0200 Subject: [PATCH 1/3] trying HS --- config/tor/torrc | 9 +++++++++ docker-compose.yml | 3 +++ 2 files changed, 12 insertions(+) create mode 100644 config/tor/torrc diff --git a/config/tor/torrc b/config/tor/torrc new file mode 100644 index 0000000..1333b25 --- /dev/null +++ b/config/tor/torrc @@ -0,0 +1,9 @@ +# Tor configuration for f0ckm + +# Enable SOCKS proxy for internal container & external connections +SocksPort 0.0.0.0:9050 + +# Tor Hidden Service (v3 Onion Service) configuration +# Tor will automatically generate private keys and hostnames in /var/lib/tor/f0ckm_hs/ +HiddenServiceDir /var/lib/tor/f0ckm_hs/ +HiddenServicePort 80 f0ckm:1337 diff --git a/docker-compose.yml b/docker-compose.yml index 720ef65..2f9e161 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -52,6 +52,9 @@ services: ports: - "9050:9050" - "8118:8118" + volumes: + - ./config/tor:/etc/tor:ro + - ./f0ckm-data/tor:/var/lib/tor:Z networks: - f0ckm-net restart: always -- 2.50.1 From a3148848f2072100009e2fd5c1ed958583618993 Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Sun, 26 Jul 2026 21:43:39 +0200 Subject: [PATCH 2/3] option to advertise onion url --- config_example.json | 1 + src/index.mjs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/config_example.json b/config_example.json index 21ad32c..62b7b13 100644 --- a/config_example.json +++ b/config_example.json @@ -5,6 +5,7 @@ "domain": "example.com", "regex": "example\\.com" }, + "onion": "http://your-onion-address.onion", "socks": "socks5://127.0.0.1:9050", "mail": "admin@example.com", "maxfilesize": 104857600, diff --git a/src/index.mjs b/src/index.mjs index 87b405c..51a3d86 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -456,6 +456,15 @@ process.on('uncaughtException', err => { res.setHeader('Permissions-Policy', 'geolocation=(), microphone=(), camera=()'); // Encourage connection reuse — helps external tools like ShareX avoid repeated TCP/TLS handshakes res.setHeader('Connection', 'keep-alive'); + + // Tor Onion-Location header: advertises .onion service counterpart to Tor Browser users + if (cfg.main.onion && !req.headers['host']?.endsWith('.onion')) { + const p = req.url?.pathname || '/'; + const s = req.url?.search || ''; + const onionHost = cfg.main.onion.replace(/\/+$/, ''); + res.setHeader('Onion-Location', `${onionHost}${p}${s}`); + } + if (isSecure) { res.setHeader('Strict-Transport-Security', 'max-age=31536000; includeSubDomains'); } -- 2.50.1 From 8518e87c8dcea0a87dc06924dae1a5cecd9e9bed Mon Sep 17 00:00:00 2001 From: Kibi Kelburton Date: Sun, 26 Jul 2026 22:09:44 +0200 Subject: [PATCH 3/3] fix pagination --- public/s/css/f0ckm.css | 11 ++++++----- src/index.mjs | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/public/s/css/f0ckm.css b/public/s/css/f0ckm.css index 60c9d2a..e1c5e40 100644 --- a/public/s/css/f0ckm.css +++ b/public/s/css/f0ckm.css @@ -4623,16 +4623,17 @@ span.placeholder { transition: right 0.3s ease-in-out; } -/* Sidebar hidden — reclaim the full width */ -body.sidebar-right-hidden .pagination-container-fluid { - right: 0; -} - /* Modern layout: wider sidebar needs wider offset */ body.layout-modern .pagination-container-fluid { right: 400px; } +/* Sidebar hidden — reclaim the full width */ +body.sidebar-right-hidden .pagination-container-fluid, +body.layout-modern.sidebar-right-hidden .pagination-container-fluid { + right: 0; +} + .bottom-pagination.fixed-pagination { margin: 10px auto; pointer-events: auto; diff --git a/src/index.mjs b/src/index.mjs index 51a3d86..9f17528 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -457,8 +457,8 @@ process.on('uncaughtException', err => { // Encourage connection reuse — helps external tools like ShareX avoid repeated TCP/TLS handshakes res.setHeader('Connection', 'keep-alive'); - // Tor Onion-Location header: advertises .onion service counterpart to Tor Browser users - if (cfg.main.onion && !req.headers['host']?.endsWith('.onion')) { + // Tor Onion-Location header: advertises .onion service counterpart to Tor Browser users when enabled + if (cfg.websrv?.enable_tor_hs !== false && cfg.main?.onion && !req.headers['host']?.endsWith('.onion')) { const p = req.url?.pathname || '/'; const s = req.url?.search || ''; const onionHost = cfg.main.onion.replace(/\/+$/, ''); -- 2.50.1