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:
+12
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user