Add public readonly mode (AUTH_MODE=readonly) - #10
Closed
EthanThatOneKid wants to merge 3 commits into
Closed
Conversation
Three access modes controlled by AUTH_MODE env var:
- full (default): existing behaviour — password protects everything
- readonly: public reads, password-protected writes silently no-oped
- disabled: fully open (same as no password set)
Server changes:
- config.js: add auth.mode field
- index.js: replace blanket requireAuth with mode-aware middleware
- fs.js: quick-return { ok: true } on write mutations when readonlyNoop;
intercept .obsidian/app.json reads to force preview mode
- electron.js, vaults.js: no-op trash/vault-move/vault-remove in readonly
Client changes:
- boot.js: CSS to hide edit UI + keyboard guard for Ctrl+E/Cmd+E
- index.html: add id to sign-out form for CSS targeting
- bootstrap.js: pass authMode through cache build chain for electron values
Docs:
- README: document all three AUTH_MODE values
github-actions Bot
pushed a commit
to AceDuan/obsidian-web
that referenced
this pull request
Jul 29, 2026
…n against the clean bundle Manual verification per brief §5 (DoD#3-MusiCode1#8, MusiCode1#10-MusiCode1#14), against the clean bundle produced by Commit 2 (this is the first honest point to verify — the previous, still-patched bundle would false-green even a broken bridge, per §4's warning). No source changes were needed — the bridge worked correctly on the first real-browser pass. Adds one artifact: src/client-mobile/test/platform-bridge-queue.selftest.html — same-turn candidate-queue ordering (DoD#12's "המקרה שבגללו התור קיים") and the §3.0/DoD#13 missing-__owPlatformOverrides fallback. Both are impossible to reproduce against the real app.js from outside (its own module-level code fires the real defineProperty('Platform', ...) call, so nothing can be injected ahead of it in the same turn) — matches the opfs-store.selftest.html pattern already used in this repo for DOM-only checks. 7/7 pass, run via Playwright/Chrome against the Node server. Environment: Node server + Chrome (Playwright) both run inside the linux-gui container against http://127.0.0.1:4000 — a real secure context (OPFS-safe, brief §6 top testing risk), server vault at user-data/demo-vault opened via POST /api/vaults/open. Verified live (Chrome, real app.js, real webpack Platform export): DoD#3 window.app, vault.getName(), workspaceUp, getFiles().length: 4 DoD#4 desktop layout: no is-mobile on body. mobile layout: is-mobile + is-phone present (screenshots: commit3-desktop-layout.png, commit3-mobile-layout.png) DoD#5 canSplit/canStackTabs/canDisplayRibbon/canPinSidebar consistent with isMobile in both layouts DoD#6 resizing across 600/900px dynamically updates isPhone/isTablet and their derived getters — confirms §3.2's "never lock these" DoD#7 Object.defineProperty and Element.prototype.addClass both native after full load, in every scenario below DoD#8 layout-mode desktop/mobile/auto all correct across reload, vault stays functional (4 files) through every switch DoD#11 EmulateMobile overrides an explicit layout-mode=desktop (§3.5 precedence); is-mobile present, isMobileApp stays true, NO "emulate-mobile" body class (guard stays closed exactly as brief §3.5 predicts), no half-state; emulateMobile(false) reverts cleanly (screenshot: commit3-emulate-mobile.png) DoD#12 re-arm case (brief §5 DoD#12 first bullet) verified against the live app: a fake Platform candidate injected immediately after the bridge installs (before the real webpack export runs) is rejected, and the real Platform is still captured correctly — app loads fully afterward. Same-turn case → see the new selftest. DoD#13 exercised in the new selftest (missing overrides in a live app can't be produced — boot.js always sets them) DoD#14 window.__owPlatform exposed; obsidian-web-layout (main.js:65) correctly detects it and its ribbon/menu work end-to-end (screenshot: commit3-layout-switcher-menu.png) DoD#9 (regression, src/client-mobile): 71/71 green, unchanged by this commit (no source touched). DoD#15 (visual disable of the layout switcher during emulation) is deliberately NOT covered here — that code doesn't exist yet; it's the next commit. Aside (out of scope, noted for awareness, not fixed here): the Node server's fast-boot cache (api/bootstrap.js) doesn't apply system-plugins.js' community-plugins.json merge the way api/fs.js's /read route does, so a freshly-opened server vault needs one manual enablePluginAndSave() call before obsidian-web-layout auto-loads on a cold reload. Unrelated to Platform capture; a pre-existing gap in the bootstrap cache, not introduced by this slice.
MusiCode1
pushed a commit
that referenced
this pull request
Jul 29, 2026
מרדכי עדכן את הבריף ישירות אחרי דוח calev-heavy הסופי (PARTIAL). שלושה פריטים: א. יעד הפתיחה-האוטומטית → /vault/<demoId>/Welcome (היה /vault/<demoId> בלבד) — סוגר את DoD#4 בקוד, לא בריכוך-ניסוח, כהמלצת calev-heavy. ב. כפתור "כספת דמו" → "Demo vault" (שורת textContent בלבד, שום דבר אחר בפונקציה לא נגוע — מיקום/CSS/MutationObserver נושאים היסטוריה של שני סבבי NO-GO). ג. _headers רק בבניית הדמו (build-assets.sh, gated OW_PROFILE=demo) — X-Robots-Tag: index, follow, דורס את ה-noindex האוטומטי של Cloudflare לפריסות branch-alias. טסט חדש (DoD#16). DoD#7 בבריף עודכן לכלול את _headers כהבדל צפוי שלישי. בדיקות: npm test 96/96, bun test 40/40. DoD#7 מלא הורץ מחדש — בדיוק שלושה הבדלים (_headers/index.html/sw.js). ידני (playwright-cli, שני viewports): DoD#4 (Welcome.md מרונדר, אפס לחיצות), DoD#15 (כפתור אנגלי, אין חפיפה), DoD#3/#10 (regression, נבדקו מחדש כי הקוד הצמוד שונה).
MusiCode1
pushed a commit
that referenced
this pull request
Jul 29, 2026
…כון סטטוס דוח: reports/obsidian-web/demo-origin-split-round2-calev.md — GO, 6/6 פריטי-דלתא (DoD#4/#15/#16 + regression DoD#3/#7/#10), 0 regressions, 0 חוסמי-merge. 3 ממצאים (_headers תחת Pages Advanced mode, חפיפת כפתור לבורר-שפה במובייל, ענף resume בלי /Welcome) — כולם מוסרים במפורש להכרעת מרדכי, לא תוקנו כאן (טופולוגיה/עיצוב מחוץ ל-scope של Commit 6).
MusiCode1
pushed a commit
that referenced
this pull request
Jul 29, 2026
…צא 1) דוח: reports/obsidian-web/demo-origin-split-round3-calev.md — GO, 9/9 (DoD#15/#17/#13 + regression DoD#3/#4/#10 + DoD#5/#6/#7 שכלב הוסיף ביוזמתו). מתקן ממצא 1 (מינורי, נובע מ-Commit 7): README.md תיאר בשני מקומות כפתור "כספת דמו" שנמחק כאילו הוא עדיין קיים. עודכן לתאר את זרימת ה-auto-open בפועל (demoVault.autoOpen, /vault/<demoId>/Welcome) ואת מיקום הקישור לראשי אחרי Commit 8. npm test 96/96, bun test 40/40. עדכון סטטוס בבריף: 13 commits, שלושה סבבי calev-heavy runtime-gate.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a third authentication mode — \AUTH_MODE=readonly\ — where anyone can view the vault without signing in, but writes are silently no-oped. Extends the existing binary auth model (on/off) to three modes: \ull,
eadonly, \disabled.
Changes
Server-side
equireAuth\
emove\
Client-side
Docs
How it works
When \AUTH_MODE=readonly\ is set with a password:
Testing
All 15 existing tests pass (7 bootstrap-cache + 8 vaults-api).