Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

6.9 KB
Raw Blame

Share options: custom password, update time and branding

简体中文 · Issue #714

Problem and outcome

Complete the remaining sharing options from #714 and the presentation requirements in PR #735. Share owners can choose a password and independently control the public page's last-updated time and EdgeEver branding. Both presentation settings default to on, including for existing shares. QR PNG/SVG download is already released and is outside this change.

Allowed changes and acceptance

  1. Custom password. Extend the existing single-note share PATCH contract so a password-protected share can accept an explicit password in addition to the existing generated-password flow. Preserve passwordProtected-only clients, hashing/encryption-at-rest, unlock rate limiting, cookie invalidation, and password return behavior. Explicit passwords must be trimmed and contain 4–64 characters; reject empty, shorter, longer, or whitespace-only values without changing the share. The dialog offers generated-password and custom-password modes, shows the custom input while the owner is editing/creating it, and keeps existing authenticated password readback, regenerate, and copy behavior. Preserve passwordProtected: false disabling semantics without adding a combined-field rejection for an accompanying valid password. Disable custom input while saving; on failure retain the draft and original share state, display the existing error, and avoid unhandled promises. Test API compatibility, validation, hashing, replacement, old clients, and failed/pending saves.
  2. Independent presentation settings. Replace the single showDetails API/UI field with showUpdatedAt and showBranding, stored as two independent columns. Both default to true for new and existing shares; clients also treat omitted fields as true. The owner can change either without changing the other or the password. Remove the EdgeEver/read-only header label. Keep the optional last-updated time near the title, and render optional branding as a small, muted, normal-flow footer linking “Published with EdgeEver” to https://edgeever.org/. No floating or sticky badge. Apply the settings to the standalone public HTML fallback and client renderer; notebook-sharing presentation, note content, title/meta behavior, Markdown endpoint, resources, password gate and slug/token stay unchanged. Cover all four combinations, persisted readback and defaults for old rows.
  3. Update shared schemas/types, API rows/mappers, the client, Web/desktop share dialog and all existing locale catalogs needed by the touched UI. Use established share components and API error patterns without redundant switch descriptions. Add migration 0083_memo_share_presentation.sql with two NOT NULL DEFAULT 1 columns. Preserve migration 0082 and its now-unused show_details column so previously migrated databases and application rollback remain supported.
  4. Sync the PR branch with upstream main, including its existing font-regression test correction, without independently changing font behavior. Verify the merged PR through its Ubuntu Test and container-build workflows.

Acceptance: write focused presentation tests before implementation and exercise the actual dialog and public page in an isolated local instance. Cover the four settings combinations, persistence after reopening, old-share migration/defaults, password-protected rendering, and unchanged notebook presentation. Reuse valid password checks and rerun changed API/shared/Web paths, bun run typecheck, bun run typecheck:mobile, and bun run build:web. Verify old routes/schema → migrations 0082/0083 → new routes → old-route rollback using SQLite. Record real failures and unverified native/production paths.

Boundaries and risk

No QR download changes, notebook-share behavior, authentication redesign, backup/sync changes, unrelated sharing refactors, release/version/deployment changes, or destructive data operations.

Worst outcomes are locking out a share through an incompatible password update or hiding metadata/content incorrectly on a public page. Rollback is reverting application changes and retaining the additive columns. The migration and old-client behavior require explicit verification. Real production Cloudflare/Docker and installed desktop acceptance are outside this local change unless separately requested.

Completion check

Custom passwords and both independent presentation settings are implemented. The active contract uses showUpdatedAt and showBranding; migration 0083 defaults both to on. The old header label is removed and optional branding is a normal-flow footer. Notebook-sharing behavior, QR downloads and deployment configuration are unchanged.

  • 81 focused API, public-HTML, notebook, shared, dialog and menu tests passed, including all four combinations and old-row defaults. Locale tests (5) and the corrected upstream font tests (6) passed. Type checks, Web build, lint and diff checks passed; see validation results and focused tests.
  • Browser acceptance covers the two switches, all four actual page combinations, persistence after reopening and password-protected rendering. Captures: controls, both enabled, time only, branding only, and both hidden. Earlier password failure/pending checks remain applicable to the unchanged password controls.
  • Cross-version acceptance covers baseline e052ac3b share routes/schema → SQLite migrations 0082/0083 → new routes → baseline route read/update. It verifies preserved old rows, pre-upgrade unlock continuity, and password/cookie invalidation for body and attachments after replacement. It uses test object storage and validates API/database compatibility, not installed-application upgrades.
  • Upstream main, including its font-test correction, is merged. Full Ubuntu Test and container-build results are available in PR #735 checks.

Installed native desktop apps and production Cloudflare/Docker deployments are unverified; no mobile feature changes are included. Apply migrations 0082 and 0083 before deploying the application. Rollback can retain the added columns and revert application code; baseline share-route read/update compatibility was verified. No out-of-scope behavior changes were introduced.