Published presentations: two fixed links (public + private) instead of a toggle
Build and Deploy Verso / deploy (push) Successful in 7m30s

Replace the single token + visibility toggle with two stable tokens per project
pointing at the same snapshot:
  - publicToken  → anyone with the link
  - privateToken → any logged-in Verso user

This fixes both reported issues: changing visibility no longer mutates a link
(there's no toggle — both links always exist), and a public link can never
become private by accident. It also fixes public links redirecting to login:
access is now decided purely by which token was used (public token = open),
not a per-record flag.

- Model: storageId (snapshot dir) + publicToken + privateToken; drop token/
  visibility.
- Manager.publish: mints both tokens once and reuses them on re-publish; serve
  resolves a token to its record and treats the public token as open.
- Controller: returns { publicUrl, privateUrl }.
- Share dialog: shows the private and public links side by side, each with its
  own copy button; Publish refreshes, Unpublish removes. Preview button opens
  the private link.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
claude
2026-06-01 16:07:37 +00:00
co-authored by Claude Opus 4.8
parent 2cb81bd246
commit 4d3ac2b9ea
5 changed files with 85 additions and 110 deletions
@@ -18,14 +18,13 @@ export default function PresentationPreviewButton() {
// Open the tab synchronously inside the click handler to avoid popup
// blockers, then redirect it once we have the published URL.
const win = window.open('', '_blank')
postJSON(`/project/${projectId}/publish-presentation`, {
body: { visibility: 'private' },
})
.then((data: { url?: string }) => {
if (data?.url && win) {
win.location.href = data.url
} else if (data?.url) {
window.open(data.url, '_blank')
postJSON(`/project/${projectId}/publish-presentation`)
.then((data: { privateUrl?: string }) => {
const url = data?.privateUrl
if (url && win) {
win.location.href = url
} else if (url) {
window.open(url, '_blank')
} else if (win) {
win.close()
}