Note sharing: publish notes to zennotes.org#62
Open
adibhanna wants to merge 1 commit into
Open
Conversation
Publish the active note to the ZenNotes website and get a public URL anyone can read. Account-based via a browser connect handoff: the site mints a one-time code, hands it back through the existing zennotes:// deep link (manual paste fallback in Settings), and the app exchanges it for an API token stored in the OS keychain. - :share publishes or updates, :unshare takes down, :sharelink copies the public URL; command-palette + note context-menu equivalents - share_id/share_url live in the note's YAML frontmatter via surgical byte-preserving edits, so shares survive rename/move/vault sync - TikZ pre-rendered to SVG in the main process (browsers can't run node-tikzjax); hash contract sha1(raw fence body) shared with viewer - assets upload as ordered multipart parts zipped with payload asset_refs; SVG assets excluded (script-bearing when served raw) - new apps/share-viewer workspace: renders shared pages with the real app-core Preview pipeline behind a window.zen shim — pixel parity, lazy mermaid/jsxgraph/function-plot chunks; scripts/sync-viewer.mjs copies the bundle into the website repo - status-bar SHARED chip opens a popover with live view count, copy link, open in browser, update, and stop sharing - PUT-404 falls back to a fresh create when a share was revoked from the web dashboard
| async function saveAccountFile(deps: ShareAccountDeps, next: ShareAccountFile): Promise<void> { | ||
| cachedAccount = next | ||
| await fs.mkdir(path.dirname(accountFilePath(deps)), { recursive: true }) | ||
| await fs.writeFile(accountFilePath(deps), JSON.stringify(next, null, 2), 'utf8') |
| private async send(path: string, init: RequestInit): Promise<Response> { | ||
| let response: Response | ||
| try { | ||
| response = await fetch(`${this.baseUrl}${path}`, init) |
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
Share a note from the app and get a public URL anyone can read. Pairs with ZenNotes/website PR (server side: Sanctum auth, shares API, public pages).
:sharepublishes (or updates an existing share),:unsharetakes it down,:sharelinkcopies the URL — plus command palette entries, note context-menu items, and a status-bar SHARED chip whose popover shows live view count / last publish and carries copy / open / update / stop-sharing actionszennotes://deep link with a state nonce; one-time code paste fallback in Settings → Sharing; token in the OS keychain (existing secret-store); server URL overridable for self-hostersshare_id/share_urlwritten with surgical byte-preserving edits (no gray-matter reserialization) so shares survive rename/move/vault syncsha1(raw fence body)— contract pinned bytikz-hash.test.tsapps/share-viewerworkspace: renders public pages with the real app-corePreviewpipeline behind awindow.zenshim (TikZ substituted by hash + DOMPurify-sanitized, assets resolved via the payload map, wikilinks/tags/checkboxes neutralized, light/dark by OS preference).npm run sync -w @zennotes/share-viewercopies the bundle into the website repoTest plan
npm run typecheck+npm run test:rungreen across the monorepo