Commit Graph

4810 Commits

Author SHA1 Message Date
boojack 2b2192d4e1 chore(main): release 0.31.0 (#6331)
Co-authored-by: bluedbird <dev@usememos.com>
v0.31.0
2026-09-20 00:50:44 +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
bluedbird 78b510fb65 chore(release): promote 0.31.0 to stable 2026-09-20 00:15:52 +08:00
bluedbird 2204eceeef fix(i18n): sync translations and remove unused locale keys 2026-09-20 00:09:27 +08:00
bluedbird 7a0586af0d test(store): expand cross-database edge case coverage
Cover transaction rollback, stale state, permissions, cache invalidation, batch deletion, and concurrent writes across all three database drivers.

Reject nil attachment bindings and enforce effective lifecycle policies before memo mutations reach the driver.
2026-09-19 23:59:09 +08:00
bluedbird f4d97fafcd fix: block CGNAT SSRF and restore cross-database CI coverage 2026-09-19 22:54:43 +08:00
bluedbird 7e3d3c6315 fix(web): limit comment menus to relevant actions 2026-09-19 00:33:01 +08:00
Anand Hegde 38584e8d6f feat(cli): accept -V and --version alongside the version subcommand (#6321) 2026-09-19 00:28:14 +08:00
kalelovic fa5e55dfc1 fix(web): toggle numbered task list items correctly (#6346)
Co-authored-by: kalelooz <212041863+kalelooz@users.noreply.github.com>
2026-09-19 00:22:27 +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
Johnny 289ca1ec3d fix(web): render tel: and sms: markdown links (#6341) 2026-09-17 23:01:09 +08:00
johnnyjoygh 6f310ba21b chore: fix broken logo url 2026-09-17 22:06:05 +08:00
qwist1233-cpu f3bec7c735 chore(i18n): complete Turkish translations (#6339)
Co-authored-by: qwist1233-cpu <qwist1233-cpu@users.noreply.github.com>
2026-09-17 19:34:12 +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 14d3c689dd feat(web): highlight search matches in memo content (#6335) 2026-09-16 23:48:00 +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
johnnyjoygh 305310cdd1 fix(map): clean up failed WebGL layers before leaving map 2026-09-16 08:51:41 +08:00
Johnny 2e3db14741 feat(store): add Cloudflare D1 database driver (#6330) 2026-09-16 01:43:17 +08:00
boojack 80c0c3b46e chore(main): release 0.31.0-rc.2 (#6249)
Co-authored-by: bluedbird <dev@usememos.com>
v0.31.0-rc.2
2026-09-15 09:11:47 +08:00
周耕毅(Ryan Chou) 143f224cdd fix(web): keep blurred memo header interactive (#6269) 2026-09-15 09:05:32 +08:00
ABird 2148bf7a21 fix(editor): expand tag autocomplete beyond heading markers (#6327) 2026-09-14 22:39:42 +08:00
ABird ba44a66911 feat: show attachment storage usage in account settings (#6326) 2026-09-14 21:49:48 +08:00
Anand Hegde a69d286735 fix(web): reveal metadata row controls on hover (#6324) 2026-09-14 19:46:50 +08:00
ocfox 49b7ecc583 fix(web): add dark mode theme-color meta tag for PWA status bar (#6320) 2026-09-14 19:43:32 +08:00
Johnny 2e33e7a561 fix(web): normalize memo header author spacing 2026-09-13 23:03:37 +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
bluedbird 73306272f9 chore: tweak heatmap calendar cells
Calendar day cells drop the printed count and carry activity as a
GitHub-style background instead: four primary-tinted levels keyed to the
same all-time ceiling the sidebar heatmap uses, so a day reads alike in
both. Today and the open day share one 22px rounded badge on the
numeral,
primary for today and a quiet foreground wash for the open day, nested
in
a halo when both coincide. The cell type follows the sidebar row
grammar:
13px on 18px lines from the column axis, weight only for the open day,
and a strip of 36px photo marks under the excerpt.

The floating memo panel gets a popover surface and a new float shadow
token in every theme, and its resize trigger becomes a grip pill that
appears only while the pointer is over the edge strip.
2026-09-12 00:51:06 +08:00
boojack 98d8322f14 chore(web): polish the memo card and editor styles
The sidebar was recently tightened onto one grammar: 28px rows on a
shared
rail, two chrome type tokens (13px and 11px), quiet kit controls,
outline
focus, and accent fill reserved for the one thing that is on. The memo
card
and editor still mixed 32px and 24px controls, 12px and 14px chrome
type,
bordered "slab" sections, ring focus, and hand-rolled control looks.

Memo card
- The header is a fixed 24px row; time and creator are 13px, the creator
  collapses to one line with a 20px avatar.
- Attachments are part of the memo, not a labelled section: media
  renders as
  the bare gallery, and audio, files, relations and the location are one
  list
  of 28px rows whose glyphs sit on the memo's text edge and whose
  details sit
  on one trailing rail. A file row reveals its download arrow on hover;
  an
  audio row plays from its slot and opens a small player from its name.
- Relations carry their direction as trailing detail instead of a header
  and
  tabs. Reactions are pills, since they are tokens on the memo rather
  than
  controls; your own reaction and the add control take the accent while
  on.
- The comment strip is a titled row list with a View all action.

Memo editor
- Every toolbar control is 28px: quiet formatting segments with
  aria-pressed,
  an outline insert square matching the sidebar's compose control, a
  quiet
  visibility chip built like the scope pill, a quiet Cancel and a small
  Save.
- Attachment, relation and location rows share the metadata row grammar;
  their controls overlay the trailing edge on hover so the detail rail
  never
  moves. The tag autocomplete matches the small dropdown.

The row grammar lives in MetadataSection.tsx with its own helpers (icon
slot,
detail rail, remove control, list container) and stays deliberately
separate
from the sidebar's. Every Lucide glyph in these views draws at stroke
1.8, and
the last ring-based focus sites move to the outline constant.
2026-09-11 23:21:50 +08:00
johnnyjoygh 8701d93fc0 fix(editor): attach pasted files instead of inlining them
Pasting an image went through the inline-image path and wrote its
markdown
into the text immediately; the file only surfaced in the attachment list
once that markdown was deleted. A paste carries no placement gesture, so
pasted files now join the attachment list like the + menu's upload, and
the list's own Insert action is how a pasted image becomes inline. Drop
keeps inlining images at the drop point.

The CodeMirror handler reports the gesture as an EditorFileOrigin
through
the single onFiles callback, and MemoEditor owns one ingest function
with a
placement argument that the + menu, paste and drop all share.
createBlobUrl
is memoized so the ingest callback's dependencies hold.
2026-09-10 23:25:17 +08:00
Wally 98f9c215c4 fix(web): untrap focus mode in the memo grid and use a dark scrim token for overlays (#6310) 2026-09-10 09:31:05 +08:00
johnnyjoygh c218355b1b refactor(web): share one floating memo panel between calendar and map
The calendar's day panel and the map's location panel were two
implementations of the same surface: a resizable side panel that reads a
selection of memos as ordinary cards and ends with a quiet row that
becomes the editor in place. Fold both into components/MemoPanel.

MemoPanel is the map's floating, non-modal card generalized: a fixed
card at the end edge from md, a bottom sheet below it, with one
persisted
width shared by every host like the sidebar's. It owns the header, close
control, resize rail, internal scroll, busy lock and the exit-animation
snapshot. The width lives in a custom property on the document root so a
resize drag reflows the page beside the card live and commits once on
release; the panel measures its committed size for hosts that need
numbers. The rail stops short of the card's corners.

The calendar drops its docked aside and its modal mid-tier sheet for the
shared card. At xl the grid gives way to it so every column stays
legible; below xl it floats over the trailing columns; the phone tier
stays inline under the compact grid. The hand-rolled Escape listener
goes, since the dialog handles it.

MemoPanelList is the shared content block with the compose row keyed to
the selection, so a half-written memo never moves days or places.

Panel strings move to common keys; the calendar and map copies are
removed from every locale that carried them.
2026-09-10 09:30:40 +08:00
Ruben Pari 3227748a30 fix(scheduler): correct cron calendar day matching (#6306) 2026-09-09 23:50:49 +08:00
johnnyjoygh 88f150502c fix(sidebar): open the navigator label only where the row can afford it
The primary navigator gained a fifth square with the map page, which
left
the current page's label truncated at the default sidebar width. The
label
now opens through a container query on the row instead of eating
whatever
width is left: below a 230px row the current page stays a filled square
with its tooltip, and above it the whole word shows. Tighter gaps and
lead-
in make the default width the threshold.

Sidebar rows also adopt the kit's outline focus treatment in place of
the
last ring-based one.
2026-09-09 23:35:03 +08:00
johnnyjoygh bc89ec0006 feat(map): add a map page for located memos
Replace the profile's map tab with a /map route (also under Spaces) that
shows every located memo on a Positron vector basemap with clustering,
falling back to raster tiles when the vector style cannot load.

Selecting a pin or a cluster opens a side rail (a bottom sheet on
phones)
with the memos at that place; "Write here" expands into the editor in
place, seeded with the location. Selection and viewport live in the URL.

The sidebar's tag counts are scoped to located memos on this route, and
the editor draft cache now remembers a memo's location.
2026-09-09 23:04:06 +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
bluedbird 805e608aa5 chore(seed): organize memos into spaces with custom icons 2026-09-07 23:24:57 +08:00
ABird 34dbb83948 feat(spaces): support custom icons and emoji (#6287) 2026-09-07 23:12:18 +08:00
johnnyjoygh 92a95a262f chore(calendar): display daily snapshots with text and image previews 2026-09-07 21:44:59 +08:00
Johnny 2d75439ecc feat(memos): support moving memos between spaces (#6285) 2026-09-07 20:45:59 +08:00
Abdellatif Anaflous 607dc28413 fix(webhook): block unspecified-address destinations in the SSRF guard (#6284)
Co-authored-by: hktitof <hktitof@users.noreply.github.com>
2026-09-07 20:13:10 +08:00
johnnyjoygh 9da3765b19 refactor(web): drop the memo origin scope
The "all" / "preserve" origin scope existed to decide whether returning
from a memo detail should clear the remembered Space. With the Space now
part of the origin URL itself, nothing branches on it any more; it was only
computed, serialized into router state as fromScope, and threaded through
props as parentScope.

Router state is now just { from }, createMemoNavigationState takes one
argument, and resolveMemoDetailOrigin / resolveMemoParentPage return the
origin page as a string. The archived-memo fallback to /archived stays.
2026-09-07 09:33:47 +08:00
johnnyjoygh af008b2153 feat(web): scope Spaces by URL path instead of a remembered selection
The selected Space used to live in sessionStorage and ride along invisibly
with every collection route. It now lives in the URL: collection pages exist
both globally and beneath /spaces/:spaceUid, and the Space context derives
its scope from the current location.

- Add a Space route branch (Home, Explore, Calendar, Attachments) guarded by
  a SpaceRoute that shows loading, unavailable, and retry states.
- Resolve collection routes through one matchPath-based helper built from the
  route constants; build Space-scoped paths with buildCollectionPath.
- Fetch the route Space directly, seeded from the switcher list so pages are
  not held behind a second round-trip.
- Turn the Space switcher into plain links that preserve the current
  collection view and query.
- Drop the remembered-Space machinery: clearSelectedSpace/selectMemos,
  the compose-placement policy, routeSupportsCollectionScope, and the
  quick-find switchToAll flag are all implied by the URL now.
- Return from memo details to the full origin URL, including its Space.
- Add space.unavailable and space.back-to-memos strings; align the
  Azerbaijani catalog with English.
2026-09-07 09:29:50 +08:00