Replace Quartz with a read-only SilverBullet for public /notes/

/notes/ is now served by silverbullet-public: the same SilverBullet 2.11.0
image as the /sb/ editor, run with SB_READ_ONLY over a read-only mount of
the vault. Quartz is retired (quartz/ kept with a STATUS header).

Keeping private/ off the public site needs nginx, not just SilverBullet:
SB_SPACE_IGNORE only filters the file listing. Verified with curl that
2.11.0 still serves ignored paths via /.fs/<path>, via server-rendered page
URLs, and exposes the vault's .git through /.fs/.git/. nginx now 404s any
private/ or templates/ segment at any depth and any nested dot-folder under
/notes/. SB_REVISIONS=disabled stops /.revisions serving git history, and
nginx blocks it as a second layer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-09-30 20:37:10 +01:00
co-authored by Claude Opus 5.5
parent 78324bf7a3
commit 7ce86f08ec
8 changed files with 200 additions and 84 deletions
+22 -8
View File
@@ -28,14 +28,14 @@
set $upstream_icecast http://$ICECAST_HOST:$ICECAST_PORT;
set $upstream_gitea http://$GITEA_HOST:$GITEA_PORT;
set $upstream_hasura http://$HASURA_HOST:$HASURA_PORT;
set $upstream_quartz http://$QUARTZ_HOST:$QUARTZ_PORT;
set $upstream_silverbullet http://$SILVERBULLET_HOST:$SILVERBULLET_PORT;
set $upstream_silverbullet_public http://$SILVERBULLET_PUBLIC_HOST:$SILVERBULLET_PUBLIC_PORT;
set $upstream_python http://$PYTHON_HOST:$PYTHON_PORT;
# PRIVATE attachments (admin-only). Attachments on *private* chat
# messages are written by the backend to /backend/uploads/private/ and
# must not be readable by the public, so this subpath is put behind the
# same admin `auth_request` used for /hasura/ and /notes/. nginx picks
# same admin `auth_request` used for /hasura/ and /sb/. nginx picks
# the LONGEST matching prefix location, so this block wins over the
# public /uploads/ block below for /uploads/private/* regardless of
# ordering. Same three hardening headers as the public block, because
@@ -118,7 +118,7 @@
# surface — kick sources, change metadata — protected only by the
# icecast admin password, and it was reachable from the public
# internet through this proxy. Put it behind the same admin
# `auth_request` as /hasura/ and /notes/ so an admin session cookie is
# `auth_request` as /hasura/ and /sb/ so an admin session cookie is
# required before the request ever reaches icecast. Longest-prefix
# matching means this wins over /radio/ below; listener traffic
# (/radio/$ICECAST_MOUNT, /radio/status.xsl) is untouched.
@@ -177,11 +177,25 @@
return 301 /notes/;
}
# PUBLIC notes viewer (read-only SilverBullet). The deny blocks are
# the privacy boundary: SB_SPACE_IGNORE hides files from the list but
# NOT from a direct /.fs/ fetch, a page URL (server-rendered), or
# /.fs/.git/. Full explanation in nginx.conf.template; keep the two in
# step.
location ~* ^/notes/(.*/)?(private|templates)(/|$) {
return 404;
}
location ~ ^/notes/.+/\. {
return 404;
}
location ^~ /notes/.revisions {
return 404;
}
location /notes/ {
auth_request /internal/auth/admin-validate;
error_page 401 403 = @auth_denied;
rewrite ^/notes/(.*)$ /$1 break;
proxy_pass $upstream_quartz;
proxy_pass $upstream_silverbullet_public;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
@@ -195,7 +209,7 @@
return 301 /sb/;
}
# SilverBullet: the editor for the same vault quartz renders at /notes/.
# SilverBullet: the admin-only EDITOR for the vault /notes/ publishes.
# Deliberately NO prefix-strip rewrite, unlike every other proxied app
# here. SilverBullet is a PWA told its own base path via SB_URL_PREFIX=/sb,
# and its service worker scope and asset URLs are built from that. Strip