ListMemos returns comments; a feed narrows to top-level memos with the filter `parent == null`. A comment is created by CreateMemo with memo.parent, read through Memo.parent, and counted by the new Memo.comment_count. ListMemoComments, CreateMemoComment and MemoRelation.Type.COMMENT are removed, along with the two MCP comment tools. Storage is unchanged: a comment is still one COMMENT row in memo_relation. The memo filter gains `parent` and `name`. User stats count comments unless their filter excludes them. Memo.comment_count takes field 13 and the fields after it move to 14 through 18. Web: memo lists leave comments out unless "Include comments" is on. It and Compact mode move from the Timeline view options to Settings > Preferences > This device and apply to every memo list. A comment shown in a list names its parent on a strip above its card, and the parents of a page of comments are fetched with one request.
Fileserver Package
The fileserver package serves binary content (attachments, avatars) over plain HTTP instead of gRPC, so that HTTP range requests work — required for Safari video/audio playback (RFC 9110 §14). Metadata stays on the gRPC API; only bytes are served here.
Endpoints
GET /file/attachments/:uid[/:filename] # attachment binary
?thumbnail=true # JPEG thumbnail for supported image types
?motion=true # embedded motion-photo video clip
?share_token={uid} # access via a memo share link
GET /file/users/:identifier/avatar # user avatar (by username)
GET /file/users/:identifier/export # Memos export file of that user (administrators only; HEAD = preflight)
Authentication
Handled by server/auth (see authenticator.go and token.go for the constants and token formats). Priority: Authorization: Bearer header (access token or personal access token) first, then the refresh token cookie. See getCurrentUser in fileserver.go.
Authorization
Attachment access follows memo visibility, evaluated by core/access.CheckMemoReadContext:
- Public memo: no auth required (when the instance allows anonymous access)
- Protected memo: any authenticated user
- Private memo: creator only
- Valid
share_token: grants access to that memo's attachments - Unlinked attachment (no memo): creator or admin only
Avatars are public on instances that allow anonymous access; private instances require authentication.
The export route requires an instance administrator and may name any user. It streams the ZIP as core/memoexport
writes it, admits one export at a time (a second request gets 429), and charges the caller's archive_user budget.
HEAD runs the same checks and answers with the headers alone. The archive itself is assembled by server/api, which
the server injects as MemoExporter; without it the route answers 404.
Serving behavior
- Video/audio are streamed with range-request support (
http.ServeFile/http.ServeContentfor local and database storage); S3-backed media is proxied with rangedGetObjectrequests. - Thumbnails are generated at max 600px, cached in
{data_dir}/.thumbnail_cache/, with a semaphore capping concurrent generation. Images with HDR/wide-gamut metadata are served as originals, since re-encoding would strip it. - Motion photos have their embedded video extracted and cached in
{data_dir}/.motion_cache/. - XSS prevention: script-capable MIME types are rewritten to
application/octet-stream, non-media files getContent-Disposition: attachment, and all responses carryX-Content-Type-Options: nosniffplus a restrictiveContent-Security-Policy. - Caching: public attachments get
public, no-cache; private onesprivate, no-store; avatars and thumbnailspublic, max-age=3600.
Testing
Unit tests live in fileserver_test.go, covering permission checks, streaming, thumbnails, and metadata detection. Manual checks:
curl "http://localhost:8081/file/attachments/{uid}/file.jpg"
curl -H "Range: bytes=0-999" "http://localhost:8081/file/attachments/{uid}/video.mp4"