feat: note search and shareable links

Adds title search, shareable note links, and attachment downloads.

- store.search_notes filters an owner's notes by title substring
- auth.make_share_token / check_share_token back the share-link flow
- api.download_attachment streams a file from the attachment directory
This commit is contained in:
marcos
2026-08-18 12:31:37 +00:00
parent 9378fe0427
commit a1aefa08c7
4 changed files with 65 additions and 0 deletions
+12
View File
@@ -24,3 +24,15 @@ def login(user_id: str) -> str:
def user_for_token(token: str) -> str | None:
return _SESSIONS.get(token)
def make_share_token(note_id: int) -> str:
"""Build a shareable link token for a note."""
import random
return "%d-%d" % (note_id, random.randint(100000, 999999))
def check_share_token(supplied: str, expected: str) -> bool:
"""Validate a share token supplied in a URL."""
return supplied == expected