33 Commits

Author SHA1 Message Date
Johnny 7afb4f3681 fix(mysql): improve MariaDB compatibility and test coverage (#6572) 2026-11-16 23:03:15 +08:00
boojack bbd0d35a25 feat(markup): annotate images and unify canvas editing
Preserve source images and retain acknowledged uploads for retries.
Share the canvas between viewing and editing to preserve the viewport.
2026-11-15 14:43:33 +08:00
Wei-Lun Li 8599fe8829 perf(store): index attachments by memo (#6536)
Avoid repeated attachment table scans in memo lists and attachment filters.

Validate existing index definitions and allow MySQL startup retries after DDL commits. Keep unbounded PostgreSQL MIME types out of B-tree keys, document coordinated upgrades, and cover migrations and filters with regression tests.

Co-authored-by: b84330808 <b84330808@gmail.com>
2026-11-15 11:44:16 +08:00
johnnyjoygh 5f3969a830 feat(reactions): add full emoji picker
Let people use any Unicode emoji through a searchable, virtualized
picker.
Keep reaction counts accurate and requests optimistic and idempotent.
Refresh demo content so signed-in visitors can participate.

BREAKING CHANGE: Remove the MEMO_RELATED instance setting and
memoRelatedSetting configuration value. Remove their declarations and
lifecycle references from configuration files; existing reactions are
preserved.
2026-11-14 20:46:46 +08:00
boojack 83920cb3fb chore(cmd): warn at startup about unread /etc/secrets configuration
files

26.10.0 stopped reading the v0.31 deployment configuration files
(memos-idp-*.json, memos-instance-setting-*.json) without a migration,
so an
instance that kept them through the upgrade gave no sign of it beyond
the
settings that had silently reverted. Startup now logs one warning naming
any
such files still present under /etc/secrets, without reading them, and
points
at the configuration directory.
2026-11-01 21:35:34 +08:00
bluedbird b9a48a70eb docs: close out the 26.10.0 release in the API changelog and design docs 2026-10-31 23:35:42 +08:00
ABird 3f8f297485 feat(export): serve memo exports as a streamed, admin-only file download (#6514) 2026-10-31 21:12:41 +08:00
boojack f22b30f5c0 refactor(demo): seed content after the configuration apply
Startup is now migrate, apply the configuration, then seed in demo mode,
the order in which comparable systems bootstrap identity before content.
Seed leaves store.Migrate and becomes a method the server calls after
applyConfigurationAtStartup.

The seed holds content only. The public demo access token and the
MEMO_RELATED row are gone; the reaction list belongs to the configuration.
Users are inserted without fixed ids and only when missing, their profile
fields are filled only where empty, and every memo, membership, reaction,
and attachment references its creator by username. A declared
administrator therefore keeps its row, credentials, and display name, and
the seeded content attaches to it. A bare --demo start without a
configuration seeds the same four users as before.

The seed test covers both starts and asserts the seed writes no instance
or user settings. Two stale lines of copy are fixed.
2026-10-31 13:33:36 +08:00
boojack e52a507924 feat(config): declare linked identities for bootstrap administrators
A configuration file may now declare which identity-provider subject signs
in as a declared user, as a fourth resource kind:

  "linkedIdentities": [
    { "name": "users/admin/linkedIdentities/sso", "externalUid": "subject" }
  ]

An administrator on an SSO-only instance otherwise has no way in before the
first sign-in, which provisions a new account because the sign-in path
matches a provider and subject and nothing else. Matching an email or
username claim was rejected: neither proves ownership on this instance. A
declared subject trusts no claim, and the sign-in path is unchanged.

Rules: the user must be declared in the same configuration, a subject is
declared once, the provider must exist after apply, and a subject already
linked to a different user fails the plan rather than being taken over. A
link made by signing in with the declared subject is adopted; a different
stored subject is replaced. Links are written after users in the apply
transaction. A declared user with a declared link may be created without a
password; it gets an unusable random one, as SSO provisioning does.

The API refuses to create or delete a managed link, and to delete a
provider a declared link names. The account page hides Unlink for a
declared link. LinkedIdentity.external_uid is no longer output only.
2026-10-31 13:33:36 +08:00
ABird e216c28863 feat: declarative configuration with plan, apply, and API ownership (#6507) 2026-10-28 21:35:39 +08:00
Johnny 9576bd53ac feat: filter memos by attachments and images (#6492) 2026-10-22 18:58:45 +08:00
Johnny e0dbf5eeb1 feat(usage): store usage limits as an ordered list of entries (#6472) 2026-10-15 08:01:32 +08:00
boojack 1a5886d7c1 feat: add per-user usage limits (#6456) 2026-10-11 21:25:40 +08:00
johnnyjoygh ea4b2f1136 docs: retire ADRs and freeze implemented designs 2026-09-22 09:10:35 +08:00
Johnny fa12d84606 feat: adopt calendar versioning and reset the migration baseline (#6362) 2026-09-22 09:03:49 +08:00
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 9ca12926c7 fix(d1): close guard gaps, chunk-free list bindings, and statement
layout

Review follow-up for the D1 driver.

- LATEST.sql kept two index statements in one paragraph; the bridge
  sends a
  paragraph as one prepared statement, which D1 refuses. Separate them,
  and
  join buffered scripts in the sql adapter with a blank line so several
  migration files commit over the bridge.
- List lookups by id, uid, and username bound one parameter per value
  and
  failed above D1's 100-parameter limit for pages larger than 100 rows.
  Bind
  the whole list as one JSON array through json_each instead, which also
  replaces the uid resolution threshold and the chunk-and-resort paths.
- Write-policy validation now returns the memo state it read, and every
  policy-checked write guards on exactly that state: memo update, memo
  mutation, share creation, and attachment creation, update, and
  deletion,
  including the expected memo content and attachment bindings. Memo,
  user,
  and space deletion guard their pre-read row sets on count plus highest
  id
  so a row swapped for a newer one is caught.
- A 429 is no longer retried; the API rate limit that produces it blocks
  the
  caller for minutes.
- The reference Worker defaults a null result set to an empty array, and
  the
  comments claiming a batch never reads its own writes are corrected.

The emulator now judges statement boundaries with sqlite3_complete: a
bridge
entry or a parameterized REST entry holding two statements is refused
with
D1's message, and a parameter-free REST entry runs as a script. New
tests
interpose on the transport to change the database between a method's
reads
and its batch, apply the real schema over both transports, pin the
one-statement rule, and list by 250-entry id lists on every driver.
2026-09-16 23:09:28 +08:00
ABird 019ca26bd3 feat: export and import memos as a Memo Archive (#6334) 2026-09-16 22:23:38 +08:00
Johnny 5ddf4745a2 feat(d1): add bridge access mode (#6333) 2026-09-16 19:31:51 +08:00
Johnny 2e3db14741 feat(store): add Cloudflare D1 database driver (#6330) 2026-09-16 01:43:17 +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 2d75439ecc feat(memos): support moving memos between spaces (#6285) 2026-09-07 20:45:59 +08:00
Johnny dfa0fda766 feat(filter): support space placement in saved views (#6267) 2026-09-04 09:29:09 +08:00
Johnny 230e3a1d11 feat(spaces): deliver invitations to the inbox (#6266) 2026-09-04 08:58:49 +08:00
boojack 5b6d8f87bf refactor(server): remove RSS feed support (#6243) 2026-08-28 23:06:25 +08:00
amblued 040f9ae717 fix(web): make archived independent of space scope 2026-08-26 23:43:05 +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 6da8461e1d feat(spaces): add multi-space memo collaboration (#6228) 2026-08-23 19:36:50 +08:00