36 Commits

Author SHA1 Message Date
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 509e41bd1a style(go): remove trailing blank lines from blocks 2026-11-14 20:52:33 +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
Johnny 9a08a7334f feat: add drawings with @usememos/canvas (#6533) 2026-11-09 08:25:09 +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 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
boojack c48897b5c1 feat: save Markdown mode to the account as an EDITOR user setting (#6512) 2026-10-30 07:16:38 +08:00
ABird e216c28863 feat: declarative configuration with plan, apply, and API ownership (#6507) 2026-10-28 21:35:39 +08:00
manuaudio e0b336ce0b fix(api): return JSON media type for authorization errors (#6504)
Co-authored-by: manuaudio <manu@freshydeli.com>
2026-10-26 21:13:08 +08:00
Johnny 9576bd53ac feat: filter memos by attachments and images (#6492) 2026-10-22 18:58:45 +08:00
Johnny 5cdb9ee399 fix(api): hide the instance admin from anonymous profile requests (#6491) 2026-10-22 08:26:33 +08:00
johnnyjoygh ccc1f82393 refactor: keep link preview and double-click edit as device preferences
Link preview was a Timeline view option, so it reset to on everywhere else.
Double-click to edit was an instance setting an admin chose for everyone.
Both are presentation choices for one browser, so they now live in a single
localStorage-backed store shared by every memo view and are toggled from
Settings > Preferences under "This device".

MemoRelatedSetting.enable_double_click_edit is removed from the API and
storage protos and reactions becomes field 1; stored rows that still carry
the old key load unchanged. The admin Memo page keeps only reactions.
2026-10-21 07:34:33 +08:00
Johnny 1511fd125d refactor(server): replace Echo with net/http (#6475) 2026-10-15 09:32:02 +08:00
Johnny e0dbf5eeb1 feat(usage): store usage limits as an ordered list of entries (#6472) 2026-10-15 08:01:32 +08:00
Johnny 2487db7c77 fix(auth): surface PAT store failures instead of a silent 401 (#6461) 2026-10-13 06:52:58 +08:00
johnnyjoygh 6c6c5b79ad fix(auth): invalidate access tokens after password changes 2026-10-12 23:36:58 +08:00
johnnyjoygh 9e3a164dff feat(usage): add default limits and explicit rule targets
Move memo content size into usage limits, with 8 KiB content and 32 MiB
upload defaults when settings are absent. Represent stored rule targets
with all_users or a positive user_id, and use that same schema for
deployment configuration.

Rename the memo count metric, remove reserved proto declarations, and
renumber fields and enums for the unreleased schema. Synchronize
enforcement, settings UI, generated clients, and tests.
2026-10-12 22:35:39 +08:00
boojack 7cb288864b refactor: move the upload size limit to usage limits
The instance-wide maximum upload size in the storage setting and the
per-user UPLOAD_BYTES usage limit were two caps on the same thing, with
a
rule that the per-user value could only lower the instance value. The
storage setting field is removed, and the all-users UPLOAD_BYTES usage
limit is the only per-file cap. A user's own limit replaces the default
in either direction, and no limit means any file size.

- Remove upload_size_limit_mb from the API and store storage settings,
  the 32 MiB store default, and the deployment config check.
- Drop the FILE_TOO_LARGE error; every refusal is QUOTA_EXCEEDED with
  metric UPLOAD_BYTES.
- Split usagelimit.CheckFileSize out of CheckUpload and call it from
  memo import, so import is no longer a bypass.
- Remove the Maximum upload size field from the Storage section and the
  instance-limit warning from the usage limits dialog.

The old value is not carried over. Instances that relied on the default
accept any file size until an admin sets a limit.
2026-10-11 22:08:13 +08:00
boojack 1a5886d7c1 feat: add per-user usage limits (#6456) 2026-10-11 21:25:40 +08:00
Johnny d775160283 fix: harden instance admin, health, and mail header handling (#6454) 2026-10-11 10:52:03 +08:00
johnnyjoygh 92ff239988 fix(api): use opaque page token in ListAttachments
ListAttachments was the only list RPC whose page token was a bare decimal
offset. Switch it to the shared PageToken format used by every other
paginated handler so the token also carries the page size and stays
consistent across the API.
2026-10-11 09:06:07 +08:00
kediyalua 91d4a93ec8 fix(api): return attachment page token only when more results exist (#6452)
Signed-off-by: kediyalua <kediyalua@outlook.com>
2026-10-11 08:58:23 +08:00
johnnyjoygh a316e7935b chore(go): modernize source and enforce go fix in CI 2026-10-09 22:07:23 +08:00
ABird af38e75e2d refactor(api)!: drop the v1 version marker (#6447) 2026-10-08 21:49:37 +08:00
Hussnain Ahmad 5d1649bec6 fix: delete comment subtree when a memo is deleted (#6424)
Co-authored-by: boojack <stevenlgtm@gmail.com>
2026-10-07 07:08:20 +08:00
boojack 26be2a9663 feat(navigation): unify creator and space browsing scopes (#6378) 2026-09-26 11:36:31 +08:00
boojack 989aad73ca test: use an unregistered extension in MIME sniffing test (#6353) 2026-09-20 21:19:48 +08:00
Bobby John a1c3061c6c chore: minor code refactor (#6348) 2026-09-20 19:09:41 +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 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