Commit Graph

1078 Commits

Author SHA1 Message Date
bluedbird eab07d8081 refactor(export): rename Memo Archive to Memos Export Format
Avoid confusion with archived memos while preserving legacy ZIP imports. Move Export & Import to the end of basic settings.
2026-09-20 00:37:50 +08:00
boojack 619eb8d6b8 chore(mcp): expose spaces, forward the client address, re-pin evals
The MCP catalog survived the recent API changes because it is derived
from OpenAPI, but three things drifted around it, and fixing them
surfaced a fourth.

- mcp: the adapter built each in-process API request with httptest,
  whose fixed peer address (192.0.2.1) overrode the caller's resolved
  address on the client-address middleware's second pass. Every
  anonymous MCP caller shared one rate-limit bucket. The adapter now
  presents the address resolved for the /mcp request as the peer.
- mcp: the full SpaceService is curated as space_* tools. Space and
  member updates drop path-bound fields and rely on the gateway's
  update-mask inference; accepting and declining an invitation no
  longer require an empty body for a body: "*" binding whose only
  field comes from the path.
- mcp/evals: answers re-pinned to the current seed (four users,
  22 top-level memos, 35 reactions, four spaces) and extended with
  space questions.
- store/sqlite: transactions begin IMMEDIATE. Token authentication
  records the token's last-used time asynchronously on every request,
  and the space drivers read before they write in a deferred
  transaction; when the background commit landed in between, SQLite
  refused the upgrade with SQLITE_BUSY without consulting the busy
  timeout. Roughly half of space creates over MCP failed. Taking the
  write lock up front keeps the parent-delete serialization the design
  relies on, so the SQLite stale-snapshot test now asserts that a
  concurrent delete waits for the open transaction instead.
2026-09-18 07:21:38 +08:00
boojack 4f46523758 chore: unify user permissions
An active application ADMIN now passes every memo-local authorization
check on named operations: authorship, audience, Space membership and
participation, attachment and reaction ownership. Structural validity
still applies, an archived admin holds no privilege, and collection
listings keep the audience predicate so feeds never surface other users'
private memos.

- core/access: admin bypass in the read policy; CanManageMemo and
  CanManageAttachment as the shared author-level predicates.
- store: drivers read the actor's role alongside its lifecycle state in
  the mutation transaction; validators accept an admin where they
  required the author or a member; shared attachment binding and
  removal predicates.
- api: handlers use the shared predicates; admins may place memos in
  any existing Space and see a memo's Space by name.
- web: one canManageMemo helper replaces the ad hoc creator checks.
- docs: multi-spaces design revised in place; share RPC comments
  updated.
2026-09-17 23:28:19 +08:00
johnnyjoygh f32d367c7f chore: update database drivers
Drop the D1 store driver, its migrations, emulator, design doc, filter
dialect, and test-harness wiring. Memos supports SQLite, MySQL, and
PostgreSQL only.
2026-09-17 09:31:42 +08:00
bluedbird 471745b431 fix: harden attachment, auth, and import paths for public deployment
Bound work an anonymous or low-privilege caller can force:

- Bound thumbnail decoding by declared pixel count before decoding and
  remember images that cannot be thumbnailed (over the bound or not
  decodable), so a small image declaring billions of pixels is served
  as-is instead of decoded on every request. Transient storage read
  errors are not remembered. The bound lives in internal/imagelimit and
  is shared with EXIF stripping.
- Cap request bodies at 16 MiB for procedures that carry no file bytes;
  only inline attachment creation, transcription, and chunked uploads
  keep their larger caps.
- Digest over-long submitted usernames before using them as sign-in
  limiter keys, add header and idle timeouts to the HTTP server, limit
  filter expression size, and cap the SQLite regexp cache.

Close correctness gaps:

- Delete the thumbnail the file server actually writes (.v2.jpeg), its
  failure marker, and the legacy name when an attachment is removed.
- Decide EXIF stripping from the sniffed content as well as the declared
  type, so a mislabeled JPEG keeps no metadata.
- Revoke every other session when a password changes; an admin reset
  revokes all of the target's sessions. Prune expired refresh tokens.
- Enforce the 2 MiB avatar limit the web client already applies.
- Keep S3 object keys unique when the path template has no {uuid}.
- Reject negative attachment page tokens.
- Charge memo archive imports against the write and upload budgets,
  charge repeated validate-only plans, discard only attachments an
  import actually stored, and refuse archives that declare far more
  bytes than they hold.
- Load database-stored attachment bytes only after authorization.
- Remove the unused, unguarded linkmeta.GetImage fetcher.

Frontend: send no referrer when loading external images in memos and
link previews, and drop picture/source from the sanitizer so every
remote image goes through the https-only src rule.

Dependencies: grpc 1.83.1 and x/crypto 0.56.0 for reported advisories.
2026-09-17 08:47:44 +08:00
ABird 019ca26bd3 feat: export and import memos as a Memo Archive (#6334) 2026-09-16 22:23:38 +08:00
Johnny 2e3db14741 feat(store): add Cloudflare D1 database driver (#6330) 2026-09-16 01:43:17 +08:00
ABird ba44a66911 feat: show attachment storage usage in account settings (#6326) 2026-09-14 21:49:48 +08:00
ABird 45519accd3 refactor: name packages by role and enforce import direction (#6317) 2026-09-13 18:22:54 +08:00
boojack c506f67d22 feat(server): rate limit sign-in, signup, fetches, uploads, and writes (#6315) 2026-09-13 11:58:26 +08:00
boojack 751005bc19 feat(user): make email an optional, canonical, instance-unique attribute (#6314) 2026-09-12 12:21:41 +08:00
Johnny 51b434d3b5 feat(views): support custom icons for saved memo views (#6305) 2026-09-08 22:10:02 +08:00
boojack e02899e514 chore: move saved memo views into UserService 2026-09-08 21:40:50 +08:00
boojack b3e67399b8 feat(attachment): upload files in resumable chunks
Add UploadAttachment, a unary RPC that accepts a file in bounded chunks
and streams it to a temp file instead of holding the whole blob in one
request body and in memory. A call carrying a spec starts an upload and
returns an opaque upload_id; later calls carry that id with
write_offset,
data, and finish_write, following the Cloud Storage WriteObject shape.
Retrying the last chunk after a lost response is idempotent, uploads are
bound to their owner, and they expire after 30 minutes of inactivity.

CreateAttachment and the chunked finalize now share one processing
pipeline for motion-photo detection, EXIF stripping, and storage. The
motion-photo detector works over an io.ReaderAt so large JPEGs are never
loaded whole, and the request body cap is a single per-procedure lookup.

The web editor uploads through the new RPC in 2 MiB chunks with bounded
concurrency under the server's per-user limit.
2026-09-08 21:07:06 +08:00
ABird 34dbb83948 feat(spaces): support custom icons and emoji (#6287) 2026-09-07 23:12:18 +08:00
Johnny 2d75439ecc feat(memos): support moving memos between spaces (#6285) 2026-09-07 20:45:59 +08:00
johnnyjoygh 0716eaac2c fix(editor): preserve memo timestamp edits when closing popover 2026-09-07 09:25:51 +08:00
Johnny 230e3a1d11 feat(spaces): deliver invitations to the inbox (#6266) 2026-09-04 08:58:49 +08:00
johnnyjoygh e963d326ab chore(mcp): satisfy revive lint rules 2026-09-04 08:19:44 +08:00
johnnyjoygh 652957c0f9 fix(mcp): expose standard JSON Schema formats in tool schemas
The gnostic OpenAPI generator hardcodes `format: enum`, `format: bytes`,
and `format: field-mask` on string properties. These are OpenAPI-only
markers; MCP clients treat tool schemas as JSON Schema 2020-12 and warn
or fail on them (zod-based parsers log "unknown format" for every tool
on every load, ajv strict mode rejects the definitions).

Normalize schemas as they leave the resolver and when parameter schemas
are cloned: drop `format: enum` (the `enum` keyword is already present),
rewrite `format: bytes` to `contentEncoding: base64`, and drop
`format: field-mask`. The generated openapi.yaml is unchanged.

A catalog test now walks every curated tool's input and output schema
and fails on any format outside the registered allowlist.

Fixes #6262
2026-09-03 21:53:03 +08:00
Abdellatif Anaflous d5849bdf52 fix(attachment): detect heic/heif mime type from filename extension (#6246)
Signed-off-by: Abdel <hktitof@gmail.com>
2026-08-30 09:09:53 +08:00
boojack 5b6d8f87bf refactor(server): remove RSS feed support (#6243) 2026-08-28 23:06:25 +08:00
amblued 9d2b77ced8 feat(space): add client-defined UIDs and identity cues
- Generate UUID v4 values in the client with validated custom UID
  support.\n- Show immutable UIDs where Space titles need
  disambiguation.\n- Standardize Space surfaces on the Lucide Astroid
  icon.
2026-08-28 00:33:09 +08:00
ABird 854d893fc6 feat(spaces): add settings management (#6234) 2026-08-26 22:20:40 +08:00
ABird 05f882e43a feat(spaces): add consent-based member invitations (#6232) 2026-08-25 23:21:19 +08:00
amblued 45c3a79b12 fix(settings): validate memo content length limit 2026-08-24 23:35:32 +08:00
ABird 66b9cb49c1 feat(spaces): add space-aware UI and filtering (#6230) 2026-08-24 23:13:55 +08:00
amblued 6da8461e1d feat(spaces): add multi-space memo collaboration (#6228) 2026-08-23 19:36:50 +08:00
amblued 76a7629243 feat(instance): persist access mode independently of URL (#6225) 2026-08-22 14:15:31 +08:00
amblued fe9a9bdf64 refactor(reaction): link reactions to memo IDs (#6221) 2026-08-22 00:12:35 +08:00
amblued 57a4b7aee6 chore(go): upgrade to Go 1.27 (#6217) 2026-08-20 23:37:02 +08:00
amblued 38412eb75a fix(storage): proxy S3 attachments through authenticated routes (#6210) 2026-08-18 23:38:35 +08:00
amblued cf1be15f3e refactor(fileserver): fix stale README and simplify file serving (#6208) 2026-08-18 21:22:26 +08:00
Johnny 16cd3107bf feat(link-preview): support standards-based metadata (#6206) 2026-08-18 09:16:04 +08:00
questfever 011a0e8360 refactor: replace Split in loops with more efficient SplitSeq (#6187)
Signed-off-by: questfever <questfever@outlook.com>
2026-08-16 21:46:16 +08:00
Johnny 7d971b1c61 feat(storage): add named attachment storage drivers (#6184) 2026-08-13 22:37:11 +08:00
Johnny da81b6b48f feat: persist and display client media metadata (#6180) 2026-08-11 23:47:21 +08:00
Johnny bd636a4365 feat: support memo-scoped Markdown attachment images (#6169) 2026-08-09 23:27:18 +08:00
Johnny 4e8b262d6d refactor(memo-views): replace shortcuts with saved views (#6167) 2026-08-09 20:27:27 +08:00
Johnny bdf87e8699 fix(api): omit unset message fields from gateway JSON (#6156) 2026-08-06 23:21:21 +08:00
Johnny 8648b97b9e feat(user): define username format and mention syntax (#6134) 2026-08-02 19:57:16 +08:00
johnnyjoygh 464e45b447 chore: update demo data 2026-08-02 16:31:24 +08:00
Johnny c68e3d5bf9 feat(markdown): unify tag syntax and recognition (#6132) 2026-08-02 14:46:04 +08:00
boojack dd18002b12 perf(sse): reduce redundant connections and fanout overhead
- Share one visible-tab connection across a browser and harden retries.\n- Preframe hub events, disconnect slow clients, and reset idle heartbeats.\n- Add cross-tab, concurrency, race, and fanout benchmark coverage.
2026-07-29 21:47:54 +08:00
johnnyjoygh c536434b81 test(release): cover 0.30.0 changelog promises 2026-07-26 22:21:19 +08:00
johnnyjoygh 1236d9ba94 test(ci): add upgrade and startup smoke coverage
Exercise real server startup on backend test runs and gate releases on fresh-install, previous-stable upgrade, and entrypoint smoke checks across supported databases.
2026-07-26 21:21:15 +08:00
johnnyjoygh 415a3ec73d fix(auth): enforce private instance access boundaries
- Resolve Gateway procedures from matched HTTP bindings before authorization.\n- Disable anonymous RSS on private instances.\n- Limit share-token access to the shared memo and its attachments.
2026-07-26 21:13:21 +08:00
johnnyjoygh 0d2cbd4f5a refactor: expose shared memo as memo resource
Rename GetMemoByShare to GetSharedMemo and move REST resolution to /api/v1/shares/{share_token}/memo.\n\nBREAKING CHANGE: remove GET /api/v1/shares/{share_id} and the GetMemoByShare RPC.
2026-07-26 21:13:18 +08:00
Johnny 390126f1cd fix(mcp): harden tool schemas and request routing (#6115) 2026-07-25 09:54:12 +08:00
Johnny 019f4f9adc fix(auth): provision SSO users atomically (#6114) 2026-07-25 09:47:16 +08:00