daybook/artifacts/migrations
peter 91ea19d26b Add per-artifact public sharing
Any artifact can now be made publicly viewable via a share link, no login
required - opt-in per artifact, toggled from the feed UI next to Keep.

- Artifact.share_token: nullable, unique, high-entropy (secrets.token_urlsafe(32)).
  NULL = not shared; SQL treats each NULL as distinct so uniqueness still
  holds for the many not-shared rows.
- New public route GET /s/<token> (shared_artifact_view), completely
  unauthenticated, serving the same rendered/raw content as the owner
  route via a shared serve_artifact_file() helper.
- toggle_artifact_share: generates/clears the token: mirrors
  toggle_artifact_keep's pattern.
- Fixed a real gap this surfaced: embedded images in a shared artifact's
  content would otherwise break for an anonymous visitor, since asset_view
  was owner-only. It now also allows access when the asset's parent
  artifact is currently shared - unattached (orphaned) assets stay private
  regardless.
- serialize_artifact now reports is_shared/share_url so the API reflects
  sharing status (read-only for now; toggling stays UI-only).
- Feed UI: Share button (mirrors Keep's toggle interaction), a copyable
  share-link box that appears when shared, and a "shared" badge on the
  artifact row - distinct blue accent from Keep's green so both can be
  visible on the same row without confusion.

Verified live end-to-end (toggle on/off, public access, fake-token 404,
old-link-dies-on-unshare, embedded-asset access before/after sharing)
before writing the 12 automated tests in tests/views/test_sharing.py.
Also fixed two unrelated stale spots noticed in docs/api.md while adding
the Sharing section: the example response was missing is_kept/size_bytes,
and the raw-content table didn't list json/csv (added earlier this
session but never documented there).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-02 16:00:39 +01:00
..
0001_initial.py Initial public commit 2026-09-01 21:55:02 +01:00
0002_artifact_metadata_artifact_source_id_and_more.py Initial public commit 2026-09-01 21:55:02 +01:00
0003_tagcolor.py Initial public commit 2026-09-01 21:55:02 +01:00
0004_rename_persona_to_source.py Initial public commit 2026-09-01 21:55:02 +01:00
0005_add_owner_nullable.py Initial public commit 2026-09-01 21:55:02 +01:00
0006_backfill_owner.py Initial public commit 2026-09-01 21:55:02 +01:00
0007_owner_required.py Initial public commit 2026-09-01 21:55:02 +01:00
0008_artifact_read_at.py Initial public commit 2026-09-01 21:55:02 +01:00
0009_quota_and_keep.py Initial public commit 2026-09-01 21:55:02 +01:00
0010_backfill_sizes_and_profiles.py Initial public commit 2026-09-01 21:55:02 +01:00
0011_add_asset.py Initial public commit 2026-09-01 21:55:02 +01:00
0012_alter_artifact_kind.py Add json and csv artifact kinds with interactive viewers 2026-09-02 14:56:20 +01:00
0013_artifact_share_token.py Add per-artifact public sharing 2026-09-02 16:00:39 +01:00
__init__.py Initial public commit 2026-09-01 21:55:02 +01:00