Skip to content

emdash@1.7.0

Choose a tag to compare

@emdashbot emdashbot released this 01 Dec 19:35
· 3 commits to main since this release
f01edae

Minor Changes

  • #4686 91dfa31 Thanks @ascorbic! - Adds editorial comments: threads that staff leave on an entry while reviewing it, separate from the public comments visitors post.

    A thread points at the whole entry, a field, a Portable Text block, or a range of text in a block, and holds a conversation that can be resolved and reopened. Threads are private to staff and never appear on the site.

    In the entry editor, select text in any Portable Text field and choose Comment in the formatting toolbar, or press ⌘⌥M (Ctrl+Alt+M), to start a thread beside it. To comment on an image, embed, divider or other non-text block, choose Comment in its block menu (or, without edit access, select the block and choose Comment in the toolbar above it), and to comment on a whole field, use the comment button at the end of the field's label row. The comment button in the editor bar, just before the settings panel toggle, shows or hides the margin and shows how many threads are open. Commenting needs no edit access: Contributors who can't edit an entry, and anyone viewing an entry while someone else holds its edit lock, can still select text and comment. Commented text stays highlighted as you edit, and a thread whose text was deleted is listed as detached with the text it referred to. Links of the form ?thread=<id> open the editor with that thread selected and its text in view, and Go to text on an open thread selects the text it refers to.

    The API lives under each entry, at /_emdash/api/content/{collection}/{id}/threads, with routes to list and start threads, reply, edit and delete comments, resolve and reopen threads, and store anchors after the entry's content changes. Each thread and comment in a response carries can flags that say what the caller may do with it.

    Mentions and email

    Type @ in a comment to mention someone who can take part in threads. A comment body stores each mention as <@USER_ID>, and every thread in a response lists the users it mentions under mentions, with their current names, so a renamed user shows the new name. GET …/threads/mentionable?q= returns up to 10 people to mention, matched by display name, without email addresses. A new comment, or an edit that adds a mention, fails with VALIDATION_ERROR when it mentions a user who doesn't exist or can't take part. Mentions already in a comment don't stop it being edited.

    When the site has an email provider, a new comment emails the people it mentions, the thread's creator and the authors of its earlier comments that weren't deleted, except its own author, anyone who can no longer take part, and users whose email address isn't verified. Editing a comment to mention someone new emails only that person. The email has the entry's title, an excerpt of the comment and a link to the thread. Without an email provider, nothing is sent, and the comment is still saved. See Comment on an entry for mentions and comment emails.

    MCP tools

    AI agents can review entries through five MCP tools: editorial_thread_list, editorial_mentionable_list, editorial_thread_create, editorial_comment_create and editorial_thread_resolve. A token needs the content:read scope for editorial_thread_list and editorial_mentionable_list, and the content:write scope for the other three. editorial_mentionable_list finds the user IDs that comment bodies mention as <@USER_ID>. The user behind the token needs the editorial:comment and content:read_drafts permissions for every tool.

    editorial_thread_create starts a thread on the whole entry, or on one field when you pass field. To comment on specific text, pass field and the exact quote, with optional prefix and suffix to tell repeated text apart. The tool finds the quote in the entry's current draft. Passing prefix or suffix without quote fails with VALIDATION_ERROR.

    Visual editing

    Editors can review threads on the site itself. In edit mode, each element bound with {...entry.edit} or {...entry.edit.field} shows a badge with the number of its open threads; threads on text and blocks in a field count toward that field's badge, and threads on a field the page doesn't show count toward the entry's badge. Hover over or tab to a bound element to show its comment button, which opens a popover where you can reply, resolve a thread you're allowed to resolve, follow Open in admin, and start a new thread on the entry or field.

    A Portable Text field rendered with <PortableText> in edit mode gets a badge of its own even when no element around it is bound with {...entry.edit.field}. Its text and block threads are highlighted in the page editor, and clicking a highlight opens a popover next to it with just the threads on that text while the cursor stays in the text, and the field's badge still lists all of them; press ⌘⌥M (Ctrl+Alt+M) in a highlight to move to its reply box instead. To start a thread on text, select it and choose Comment in the formatting toolbar, or press ⌘⌥M (Ctrl+Alt+M). When you edit text that a thread points at, the thread moves with it on the next save. The page editor now keeps each block's _key when it saves, instead of giving every block a new one, so links to a block from comments and other content survive edits made on the page.

    The toolbar loads threads with one request per entry on the page, at most four at a time, and only for signed-in users in edit mode who can take part in threads. The popover's code loads the first time someone opens it, from the editor-only /_emdash/visual-editing/comments page, which the site's Astro build bundles with @astrojs/react, as it does the inline editor. Pages for logged-out visitors don't change.

    Permissions

    Two permissions are new in @emdash-cms/auth. Every editorial route also needs content:read_drafts.

    • editorial:comment (Contributor and above): read threads, start them, and reply.
    • editorial:manage (Editor and above): resolve, reopen and delete any thread, and delete anyone's comment.

    A thread's creator may also resolve and reopen it, and so may the entry's author when they hold content:edit_own. A creator may delete their own thread until someone else replies, and only a comment's author may edit it. Storing recomputed anchors needs edit access to the entry and its current _rev.

    New playground sessions open with example threads on the "Building for the Long Term" post, from a demo reviewer, so visitors can reply, resolve and add their own.

    Upgrading

    A migration adds two tables, _emdash_editorial_threads and _emdash_editorial_comments. Threads stay while an entry is in the trash, where their comments and threads can still be deleted but not added, edited, resolved or moved, and are deleted with the entry or its collection. Site transfer leaves them out.

Patch Changes

  • #5104 7ed8e09 Thanks @ascorbic! - Fixes Cloudflare Access sign-in for people whose Access email contains capital letters. New accounts are now stored with a lowercase email, so these sign-ins no longer fail with "Failed to provision user", and simultaneous first sign-ins no longer create a second account for the same person.

  • #5106 db3aa05 Thanks @ascorbic! - Fixes work deferred with after() possibly being dropped on Vercel and Netlify once the response is sent. after() now hands the task to the host's waitUntil: Netlify's request context, Vercel's request context, or locals.waitUntil when the site's own middleware sets one. Cloudflare keeps using its own waitUntil, and @astrojs/node still runs deferred work in the long-lived process.

  • #5106 db3aa05 Thanks @ascorbic! - Updates production responses from /_emdash/api routes to omit the Server-Timing header, so query counts and durations no longer vary between API requests that otherwise get the same answer. Pages and the admin still send the header, and astro dev still sends it on API responses.

  • #5116 723784e Thanks @ascorbic! - Fixes Atmosphere sign-in leaving records in the database that were never removed. An OAuth state now stops working 10 minutes after the sign-in starts, as intended, and scheduled cleanup deletes the states of sign-ins that were started and never finished. Before, every abandoned attempt left a row in _plugin_storage that stayed there.

    Atmosphere sign-in also no longer stores the access and refresh tokens it receives from an account's provider. They were written for every completed callback, including accounts the site then refused, and never used again. Scheduled cleanup deletes the token sets stored by earlier versions.

    The cleanup of existing rows needs emdash upgraded, and the 10-minute state expiry and the end of token storage need @emdash-cms/auth-atproto upgraded.

    Also fixes /.well-known/atproto-client-metadata.json using the host of the incoming request for client_id and redirect_uris. It now uses siteUrl (or EMDASH_SITE_URL), the same origin the login route sends to the account's provider, so sign-in no longer fails behind reverse proxies that forward a different Host.

  • #5106 db3aa05 Thanks @ascorbic! - Updates POST /_emdash/api/auth/magic-link/send and POST /_emdash/api/auth/signup/request to respond before looking up the account and sending the email, so the response time is the same for every address and no longer depends on the email provider's speed. This applies on Cloudflare, @astrojs/node, Vercel and Netlify, and on sites whose own middleware sets locals.waitUntil. On other hosts the email is still sent before responding, as before. Delivery errors are still logged on the server.

  • 822ac68 Thanks @ascorbic! - On sites with an Astro base, admin and API requests under the base path, such as /blog/_emdash/api/..., now get the same authentication and request checks as the unprefixed paths. This includes the external auth provider, the X-EmDash-Request header, the admin Content-Security-Policy, the setup redirect and the write checks that run during a site transfer. Redirect rules, 404 logging and the visual editing toolbar no longer apply to these paths. This also covers a base with spaces or non-ASCII characters, such as /my blog or /über, whose requests arrive percent-encoded.

    API tokens sent to paths under the base were previously ignored. They are now accepted and scope-checked as on the unprefixed paths.

    In @emdash-cms/cloudflare, preview mode and playground mode now apply their route restrictions to paths under the base, and Hyperdrive no longer serves _emdash reads under the base from the cached binding.

  • #5106 db3aa05 Thanks @ascorbic! - Fixes the D1 and Durable Object read-replica bookmark cookies (__em_d1_bookmark, __em_do_bookmark) being set on requests that carry an Authorization: Bearer header the site never verified. The cookie is now set only for a signed-in session or a token the site has accepted, so a valid token sent to a public page no longer receives one. Requests with a Bearer header are still routed to the primary database.

  • #5145 5c9b00d Thanks @emdash-autofix! - Fixes admin content list and list API searches failing on Cloudflare D1 with long or multibyte search terms, whether collection search is enabled or disabled.

  • #5077 4dd5dba Thanks @emdash-autofix! - Fixes plugin routes on Cloudflare staying broken with the error "This promise was created by a request that has since ended, so it can never settle" after cancellation during storage index checks or creation. Later requests can recover, and requests that wait too long for synchronization receive a 503 STORAGE_INDEXES_NOT_READY response instead of hanging.

    If cancellation interrupts an index removal whose outcome remains unknown, state-changing plugin routes stay blocked with 503. If its response never settles, this block lasts for the runtime's lifetime and a restart is required to clear it. Automatic recovery from an abandoned destructive schema operation is not included.

  • 69a77ad Thanks @ascorbic! - Updates how EmDash decides that it is running in development. The development-only endpoints (auth/dev-bypass, setup/dev-bypass, setup/dev-reset, dev/emails, dev/scheduled-tasks, and typegen), the passkey sign-in fallback for external auth, the console email provider, the relaxed admin Content-Security-Policy, Server-Timing on /_emdash/api responses, and OAuth credentials read from build-time environment variables now apply only under the astro dev command. Before, a site built with astro build and NODE_ENV set to anything other than production also got them.

  • #5015 8092274 Thanks @Yusaku01! - Fixes emdash content get --published returning draft values when an entry has a pending draft. It now returns the published values. EmDashClient.get() also accepts a published: true option.

  • #5088 7b97204 Thanks @ascorbic! - emdash login and emdash-plugin login now open the sign-in page in your browser only when its address is an http: or https: URL. Any other address is still printed, so you can open it yourself. On Windows, emdash-plugin login now passes the full authorization URL to the browser, including the part after the first &.

  • #5172 ba1eb52 Thanks @ricardosantisinc! - Fixes emdash login giving up with "Token exchange failed: [object Object]" while it waits for approval. When the token endpoint's rate limit answers with 429, for example because a second login is polling from the same IP address, the command now waits for Retry-After and keeps polling. Other API errors are reported with their message.

  • #5042 5030c20 Thanks @ascorbic! - Fixes Cloudflare dev servers reloading the worker several times on the first page an editor visits, which could make that request take ten seconds or more. The inline editor's dependencies are now optimized when the dev server starts, whether or not co-editing is enabled.

  • #5152 17401f3 Thanks @emdash-autofix! - Fixes scheduled Workers Cache purges by adding the named EmDashWorker entrypoint for sites that re-export it as their default Worker export.

    To enable the fix on an existing site, replace the object-style default export in src/worker.ts with this re-export:

    export {
    	EmDashWorker as default,
    	EmDashRoom,
    	EmDashRoomSite,
    	PluginBridge,
    } from "@emdash-cms/cloudflare/worker";

    Sites with custom fetch or scheduled handling should extend EmDashWorker; see the Cloudflare deployment documentation for the handleRoomUpgrade and createScheduledHandler() delegation points. Custom scheduled handlers must pass invalidateViaDefaultEntrypoint: true to opt into RPC invalidation. The legacy object default export and direct createScheduledHandler() usage remain compatible, but scheduled Workers Cache purges require EmDashWorker as the site's default. emdash doctor recognizes the subclass form and adds a migration hint for legacy object-style entrypoints while continuing to accept their scheduler wiring. Cache invalidation from co-editing rooms and the plugin bridge is unchanged.

  • #5119 7e693aa Thanks @ascorbic! - Updates comment:beforeCreate so that only the authorName, authorEmail, body, and metadata a handler returns are used. Changes a handler makes to collection, contentId, parentId, authorUserId, ipHash, or userAgent are now ignored, and the comment keeps the values from the submission. A plugin that rewrote those fields from this hook no longer can.

  • #5096 a853fe3 Thanks @ascorbic! - Limits the length of two values stored from public requests:

    • The public comment endpoint now rejects an author email address longer than 254 characters with a 400 validation error, as it already does for over-long names and comment bodies. The <CommentForm> email input has a matching maxlength. Comments stored before upgrading are not changed.
    • The 404 log no longer records requests whose path is longer than 2,048 characters. Visitors still get the same 404 response.
  • #5090 a0fe5c9 Thanks @ascorbic! - Fixes the public comment endpoints returning comments for entries that are drafts, unpublished, or in the trash. GET /_emdash/api/comments/:collection/:contentId now answers 404 Content not found for such an entry, as submitting a comment to it already did. The reactions endpoint on the same path returns no counts for such an entry and no longer accepts reactions on its comments.

  • 00367c1 Thanks @ascorbic! - Changes GET /_emdash/api/content/{collection}/authors so it includes each author's email only for callers who hold users:read (admins), and for API tokens only when they also carry the admin scope. Contributors, authors, editors and narrower tokens receive id, name and avatarUrl. The content list's author filter labels an author with no name "Unnamed user".

    If you call the exported handleContentAuthors directly, it now omits email unless you pass { includeEmail: true }.

  • #5115 a895695 Thanks @ascorbic! - Applies link scheme checks to more of the places content stores a URL.

    • The src, url, and previewUrl of image and file values, including a darkVariant and image sub-fields of repeaters, now accept only http: and https: URLs and paths without a scheme. The content API, MCP tools, seeds, and plugin content writes reject other schemes, such as javascript:, data:, and blob:, with a validation error. Seeds and plugin content writes check these values outside blocks fields, and also reject a URL that is not text.
    • Seeds, plugin content updates, and site imports reject a url field value that is not text, or text that starts with [ or {. Queries return stored text that looks like JSON as an array or object, so such a value did not read back as the text that was checked.
    • Site import analysis reports a dangling_reference blocker for a block in an entry or revision whose block type or version is not in the package. Previously the URL fields of such a block were not checked.
    • getEmDashEntry() and getEmDashCollection() drop a __proto__ key in stored content instead of turning it into the prototype of the returned object, so a repeater row no longer exposes values that were stored under that key as its own fields. Search indexing ignores the key as well.

    Existing entries are not changed. A stored value that the new checks reject is still returned by queries, but saving or duplicating that entry fails until the field is corrected. To render older values safely, pass the URL through sanitizeHref() before putting it in an href.

  • #5098 e574cae Thanks @ascorbic! - Fixes the single-entry content API answering differently for missing and existing entries when the caller's role can never perform the action. Updating, deleting, locking, publishing, unpublishing, scheduling, restoring or discarding the draft of an entry, restoring a revision, saving a recovery revision, joining an entry's co-editing room, and calling a plugin's editor panel or action now answer 403 to such a caller whether or not the entry exists. Previously a missing entry answered 404 and an existing one 403. Roles that can perform the action still get 404 for a missing entry.

  • #5013 c94f442 Thanks @swissky! - Fixes decodeSlug() so a slug containing a NUL byte (for example /posts/%00) returns undefined. On PostgreSQL, routes that decode their slug with it now show their 404 for such URLs instead of failing the content query with a 500.

  • #5091 16cb80f Thanks @ascorbic! - Fixes feeds, JSON endpoints and other responses that are not full HTML pages keeping their route's Cache-Control header when rendered for an editor with the toolbar's edit mode on. These responses include unpublished revisions, so a CDN or caching reverse proxy in front of the site could store one and serve it to visitors. Every edit-mode response is now sent with Cache-Control: private, no-store, as pages showing the toolbar already were. This also applies to pages on sites that set toolbar: false. Stored media served through the image endpoint stays cacheable.

  • #5212 060e7e7 Thanks @khoinguyenpham04! - Updates the editorial comments UI so the page editor and the admin match. Each comment shows the person's photo or generated avatar with their name and time on one line, long threads collapse their middle replies, and the reply box keeps its send button in place. Opened from highlighted text, the page editor's comments popover no longer repeats the field name or the quoted text, and it fits short screens and long names.

  • #4828 35d40a3 Thanks @danielmlr! - Fixes emdash types typing blocks fields as unknown[]. The generated .emdash/types.ts now types each blocks field as the union of its block types, with every retained version, matching the emdash-env.d.ts the dev server writes. The site that emdash types connects to generates the types, so a site you reach with --url needs this release before the output changes.

  • #5104 7ed8e09 Thanks @ascorbic! - Fixes setup getting stuck when the first admin is created through GitHub, Google, Microsoft, or AT Protocol sign-in but linking the sign-in account fails partway through. Signing in again with the same account now finishes setup; any other account is still refused.

    canSelfSignup's createUser function in @emdash-cms/auth now also receives the account being linked, as createUser(user, account), and may return an existing user for findOrCreateOAuthUser() to link that account to.

  • #4306 0917f1b Thanks @iNerdStack! - Fixes the WordPress plugin import review screen so it lists the source site's navigation menus, letting you see which menus will be imported before running the import. Reports skipped menus when a same-named menu already exists, so the import result shows how many were created vs. skipped instead of silently dropping them.

  • #5143 628ea8d Thanks @Yusaku01! - Fixes the visual editing toolbar and Cloudflare preview toolbar overflowing on narrow screens. Both toolbars now wrap to fit the viewport, keeping the visual editing toolbar's Publish button, close buttons, and long status or error messages visible on mobile and in languages with longer labels.

  • #5118 3c64f9b Thanks @ascorbic! - Fixes isolated HTML blocks seeing the full address of the page they are on, including its query string and fragment, when the block's JavaScript removes the frame's <base> element. document.baseURI in an isolated block is now always the site's root address, in the admin preview as well as on the site.

    The block's document now sits in a second sandboxed frame inside the block's frame. Blocks render, resize and open links as before. A few details change:

    • Block JavaScript: parent is now the outer frame, so it is no longer the same as top, and document.referrer is empty. Send messages to the page with parent.postMessage(), not top.postMessage(): the outer frame passes them on, and the site only accepts messages from it. Messages from the page arrive with the outer frame as event.source and an origin of "null".
    • Sites with a content security policy: if the policy blocks the block's styles, the block's content stays 150 pixels tall even if your site's styles make the frame taller. If the policy sets base-uri 'none', isolated blocks don't load; allow 'self' in base-uri to show them.
    • Browser tests: a test that looks inside an isolated block needs one more frame step, such as page.frameLocator("iframe[data-emdash-html-block]").frameLocator("iframe").
    • buildHtmlBlockFrame() from @emdash-cms/admin/html-block accepts an optional title for the inner frame.
  • #5053 405dbef Thanks @danielmlr! - Fixes WordPress imports dropping the alt text and caption of every media item. Media imported from a WXR file or through the EmDash Exporter now keeps the alt text and caption set in the WordPress media library. Media imported before this release keeps its empty alt text and caption, even if you rerun the media step, because the import reuses files it has already stored; add them in the media library. parseWxr() and parseWxrString() return each attachment's caption as caption, and parseWxrString() now fills each attachment's meta, as parseWxr() already did.

  • #5056 5684ca8 Thanks @danielmlr! - Fixes WordPress imports placing every category and hierarchical term at the top level. Categories and terms imported from a WXR file or through the EmDash Exporter now keep their WordPress parent when the EmDash taxonomy is hierarchical. Terms that already exist in EmDash keep their current parent, so importing again does not rearrange the categories of an earlier import. To nest those, edit each term in the admin and choose its parent.

  • #5153 4874deb Thanks @ascorbic! - The visual editor now reads and saves rich text with the admin editor's schema and converter, so a Portable Text field saves the same way from either editor. When you edit on the page, spans and link definitions keep their _keys (as blocks already did). Tables, galleries, embeds, videos and plugin blocks still show as placeholders to edit in the admin, and they save the way the admin editor saves them. If a field contains a table the admin editor can't open, the visual editor says so instead of loading the field.

    Both editors now keep the _key, dimensions, display size, alignment, link and blur placeholder (blurhash and dominantColor) of an image block stored with only a url and no asset, such as imported content. Before, the admin editor dropped them on save.

  • #5114 9369192 Thanks @ascorbic! - Fixes the Image, Gallery, Cover and Columns Portable Text blocks and the Image component so they render stored color and size values only when each is a single valid CSS value.

    dominantColor and overlayColor must be a color, a keyword or a var() reference. minHeight and a column's width must be a length, a percentage, a keyword such as auto, a calc(), min(), max() or clamp() of numbers and units, or a var() reference. A var() fallback must itself be one of these values. overlayOpacity can be a number, a numeric string or a percentage, and a gallery's columns must be a positive integer. Any other value is ignored and the block uses its default: a 300px minimum height, a black overlay at the block's opacity, an automatic column width, or three gallery columns. When an image block's own dominantColor is ignored, the color stored with the media is used.

  • #5090 a0fe5c9 Thanks @ascorbic! - Fixes comment reactions and per-client rate limits treating each address in an IPv6 /64 network as a separate visitor. IPv6 clients are now counted by their /64 network for comment reactions and for the comment, sign-in, signup, and OAuth rate limits; IPv4 clients are still counted by address. Reactions already stored by IPv6 visitors keep counting, but each of those visitors can react to the same comment once more. For IPv6 commenters, the comment ipHash passed to comment hooks and returned by the admin comments API now identifies the /64 network, and differs from hashes stored before the upgrade, so plugins that match comments on ipHash should expect older and newer hashes of the same visitor not to match.

  • #5094 0c9dd87 Thanks @ascorbic! - Fixes several behaviours of the legacy marketplace option. Sites that do not set marketplace are unaffected.

    • Plugin and theme search and detail lookups, update checks, installs, and updates follow redirects only while they stay on the marketplace origin. A redirect to another host is refused: installs and updates fail with MARKETPLACE_REDIRECT_UNTRUSTED, search and detail lookups fail with their usual error, and update checks skip the affected plugin. The install statistics request follows no redirects.
    • The plugin icon and theme thumbnail proxies relay only PNG, JPEG, and WebP images, served as downloads. Other responses, including the marketplace's generated SVG fallback avatars, return 502 PROXY_ERROR; an upstream 404 returns 404 NOT_FOUND. Rejected upstream response bodies are no longer passed through.
    • Installing a marketplace plugin fails with PLUGIN_ID_CONFLICT when the ID is already used by a sandboxed: [] plugin or by a plugin installed from another source.
    • Plugin bundles whose file names repeat, including package/backend.js next to backend.js, are refused with INVALID_BUNDLE.
  • #5099 736af38 Thanks @ascorbic! - Fixes PUT /_emdash/api/media/{id}/replace storing a file for a media item that was deleted while the replacement was still uploading. The route now checks the item again once the upload has arrived and responds with 404 if it is gone. If the item is deleted while the new file is being written, the route removes that file.

  • #5099 736af38 Thanks @ascorbic! - Fixes S3 signed media uploads so a confirmed file can no longer change afterwards. The upload URL from POST /_emdash/api/media/upload-url stays valid for an hour, and confirming the upload kept the file at the key that URL writes, so a later upload to the same URL replaced the confirmed file. Confirming a signed upload, through POST /_emdash/api/media/{id}/confirm or the MCP media_create tool, now copies the file to a new storage key and makes the item ready under that key.

    The confirmed item's storageKey and url therefore differ from the storageKey in the upload URL response, as they already did for uploads sent through EmDash. Clients should use the values from the confirm response. Storage adapters can implement the new optional copy() method to copy files inside the storage service, as the S3 adapter does; adapters without it download and re-upload the file.

  • 0f67ed9 Thanks @ascorbic! - On sites that use an external auth provider such as Cloudflare Access, the OAuth consent page (/_emdash/oauth/authorize) now checks the provider on every request, as the admin and API routes do, including on sites with a non-root Astro base. With syncRoles: true, role changes from the provider apply before the page grants scopes. A request without a valid provider identity now gets a 401 instead of being identified by the EmDash session alone.

  • #5100 1705671 Thanks @ascorbic! - Fixes GitHub, Google, and Microsoft sign-in so the callback only signs in the browser that started the sign-in. Opening a callback link that was started in another browser now returns to the login page with invalid_state and leaves the current session unchanged.

    Starting a sign-in now sets a short-lived HttpOnly cookie named emdash_oauth_state_ followed by part of the sign-in's state, which the callback checks. Sign-ins started in several tabs of one browser can each finish. A sign-in that is in progress during the upgrade has to be started again. If you set a site URL, start sign-in from that host name: a sign-in started on another host name, such as www. instead of the bare domain, fails with invalid_state.

  • #4701 1981c17 Thanks @swissky! - Fixes media served through EmDash's media route (R2 or local storage without a public bucket URL) being served as full-size originals in production when siteUrl isn't set in astro.config.mjs and neither EMDASH_SITE_URL nor SITE_URL is set at build time, as in the Cloudflare templates. On pages rendered on demand, the Image and Gallery components from emdash/ui now get resized WebP renditions and a responsive srcset without extra configuration, through the Cloudflare Images binding with the Cloudflare adapter's default image service, or through sharp on Node. Prerendered pages still need siteUrl, EMDASH_SITE_URL or SITE_URL when astro build runs. These images are served as the original file instead of failing when the Cloudflare Images binding returns an error, for example after the plan's monthly transformations run out, or on Node without sharp installed.

  • ef0e581 Thanks @ascorbic! - Updates the OAuth consent page at /_emdash/oauth/authorize and the device authorization page in the admin. The Approve and Authorize buttons now respond only after the page has been visible and in focus for one second; a bar fills the button while it waits, and Deny works at once. On the consent page, the delay comes from a script served by the site at /_emdash/oauth/authorize-guard, and the page's Content-Security-Policy allows only same-origin scripts. If that script cannot run, Approve stays disabled and the page says the script is needed. A consent form opened before a different user signs in on the same browser is rejected; reload the page to get a fresh one. The consent page can no longer be displayed inside a frame, and its form is accepted only when the browser submits it from the consent page on the same site. A script that posts the consent form directly must send the site's Origin header. A site behind a proxy that terminates HTTPS must set siteUrl (or EMDASH_SITE_URL) to its public address, or the form is rejected as cross-origin.

  • #5101 246eacf Thanks @ascorbic! - Fixes ctx.content.restore() in plugins so restoring an entry that is not in the trash fails with NOT_FOUND, the same error a missing entry gets, instead of CONFLICT. Restoring trashed entries is unchanged.

  • #5102 3f9d7fd Thanks @ascorbic! - Fixes updating a disabled marketplace or registry plugin so it stays disabled. The update installs the new version, and the plugin's hooks and routes stay off until an admin enables it again.

  • #4648 285c949 Thanks @dmythro! - Fixes WordPress imports from sites translated with Polylang. Posts in a WordPress export of All content are linked to their translations, and translated categories, tags, and other terms arrive in their own language, under their own names, linked to their translations. Previously each post arrived unlinked, and every term was created in the default locale and copied into the others under its slug, so posts outside the default locale showed slugs such as past instead of category names, and each locale listed the terms of every other. An export of Posts leaves out the translations of categories and tags, so its posts still arrive unlinked. Polylang's internal taxonomies are no longer reported as missing.

    Imported terms join their translations that already exist on the site. When a term's existing translations sit in different translation groups, the import stops with a conflict that names them, because existing terms can't be linked. This happens when you import a Polylang site again after importing it with an earlier version: delete the entries, terms, and menus the earlier import created, empty those entries from the trash, then import again.

  • #5092 5e24aa2 Thanks @ascorbic! - Fixes several gaps in preview links and the published-only snapshot:

    • POST /_emdash/api/content/{collection}/{id}/preview-url now requires an API or OAuth token to hold content:read as well as content:write. A token without content:read gets 403 INSUFFICIENT_SCOPE. Signed-in admin sessions are unaffected.
    • The same endpoint now accepts an expiresIn of at most seven days and responds with 400 VALIDATION_ERROR for a longer, zero, negative, or unrecognized value instead of signing it. The admin uses the one-hour default and is unaffected; API clients that request longer links must ask for "7d" or less.
    • Links from that endpoint are now always signed for the entry's database ID, so a link requested by slug no longer opens a different entry that later takes the same slug.
    • The published-only snapshot (GET /_emdash/api/snapshot with a preview signature, or without ?drafts=true) no longer includes SEO metadata or the social image of an unpublished entry whose translation is published, and exports draft_revision_id and scheduled_at as NULL on content rows. Snapshots with ?drafts=true and backups are unchanged.

    Preview links issued before upgrading stay valid until they expire. To end them sooner, rotate the preview secret, then restart or redeploy every serving instance so none keeps using the old secret. When EMDASH_PREVIEW_SECRET is set, change it; deleting the emdash:preview_secret option has an effect only when no environment override is set. See Preview secret for the rotation steps.

  • #5069 31bc35b Thanks @emdash-autofix! - Fixes image fields losing alt text and other media metadata when saving legacy values that contain a URL in src without an ID or provider, including images inside repeaters.

  • #5158 a397efc Thanks @khoinguyenpham04! - Fixes links into the public site on sites that set Astro's base (for example /blog). These links now include the base instead of 404ing:

    • Preview links from the admin and the preview URL API, when they come from the collection's URL pattern or the default /{collection}/{id} path. A pathPattern in the request or EMDASH_PREVIEW_PATH_PATTERN is still used exactly as given.
    • Menu items that point to content, taxonomy terms, and collection archives. Custom menu URLs are unchanged.
    • The admin's View Site, Live View, View published, and calendar View live links.
    • Links you insert with the editor's link picker from now on. Links already saved in your content keep their old paths.
    • URLs returned by the plugin content API's getPublicUrl(), for trusted and sandboxed plugins.

    If you worked around this, remove the workaround after upgrading, or the base will appear twice:

    • A base written into a collection's URL pattern.
    • A template that puts the base in front of item.url from getMenu().
    • A plugin that adds the base to what getPublicUrl() returns.
  • #5122 e2bbd0d Thanks @ascorbic! - Fixes redirects from public raw plugin routes on sites behind a TLS-terminating proxy. The host now checks a plugin's Location against the site's public origin from siteUrl or EMDASH_SITE_URL, not the internal request URL, and treats a value with a scheme, such as http:other.example/path, as an absolute URL. As a result, an absolute redirect to the site's public https:// address is accepted, and one to another host or to the same host over http:// is refused. When siteUrl or EMDASH_SITE_URL is set, absolute redirects must use that origin, so use a relative path such as /thanks to stay on whichever host served the request. Relative redirects are unaffected.

  • #5120 af2abf7 Thanks @ascorbic! - Fixes PUT /_emdash/api/content/{collection}/{id} with status: "draft" so it unpublishes a published or scheduled entry the same way POST .../unpublish and the content_update MCP tool do. The request now needs content:publish_own or content:publish_any, a content:beforeUnpublish hook can reject it, content:afterUnpublish hooks run, and the live revision and any pending schedule are cleared. Other fields in the same request are saved first. If the unpublish then fails, the error says the fields were saved, and its details._rev is the _rev of that save. A draft that still has a live revision or pending schedule from an earlier version is unpublished the same way. On any other draft, status is ignored.

  • 46f8a08 Thanks @ascorbic! - Updates how /_image handles requests on Node.js:

    • Images that are not EmDash media go to the image endpoint your adapter configured, so @astrojs/node reads bundled images from the build output.
    • Images from other sites are fetched by EmDash itself, without the visitor's request headers, and only from hosts allowed by image.domains or image.remotePatterns. Every redirect must lead to an allowed host too, and never to an EmDash media route. A fetch that takes longer than 10 seconds answers 504.
    • With an adapter that does not read images from disk, a bundled image is fetched from your configured siteUrl (or EMDASH_SITE_URL). Without one, /_image answers 404 for it, so set siteUrl if you use such an adapter.
    • An SVG opened directly at its /_image URL downloads instead of displaying; SVGs in <img> tags still render. A cached SVG is only confirmed as current by its ETag, not by date.
    • The endpoint processes a limited number of images at once, with separate limits for images fetched from other sites and images read locally. Other requests wait, and when too many are waiting it answers 503 with Retry-After.
    • A width or height above 4000 pixels returns the original image for media read from storage, and is scaled down to fit 4000 pixels for other images. For images that are not EmDash media, a width or height that is not a positive number answers 400.
    • AVIF renditions are served as image/avif.
    • With images: false or a custom image endpoint, a configured site URL no longer adds the media route to image.remotePatterns, so EmDash media renders as a plain <img> there.
  • #5060 afdf4c3 Thanks @emdash-autofix! - Fixes extending a saved link over adjacent text producing separate links on the rendered page. Saving now joins adjacent link spans with equivalent options while preserving stored link keys where possible. Existing split links are repaired the next time the content is edited and saved; links separated by unlinked text or with different options remain distinct.

  • c5877be Thanks @ascorbic! - Changes which redirects plugin routes declared with response: "raw" can return. A redirect can no longer make the browser repeat a request other than GET or HEAD: EmDash now answers 500 when a raw route returns 307 or 308 with a Location header for such a request, or 301 or 302 for a request other than POST.

    If a raw route redirects after a form submission or other write, return 303 See Other instead. The browser follows it with GET. Redirects in response to GET and HEAD requests are unchanged.

    The Portable Text block editor no longer follows redirects when it loads select options from a plugin's optionsRoute. The route must answer with the options directly. The editor also requests options only when optionsRoute is a valid plugin route name, such as forms/list, that stays inside the plugin's own routes, and when the plugin ID contains only lowercase letters, digits, _ and -. Otherwise it sends no request and shows the field's static options.

  • #5123 29caf9c Thanks @ascorbic! - Fixes redirect loop detection never finishing when a pattern redirect's destination is matched again by a pattern redirect, such as /[...path] → /moved/[...path] or /[...path] → /[...path]/[...path]. Listing redirects, saving a redirect, or analyzing a site package with such a rule ran until the server ran out of memory. Such a chain now counts as a loop: the Redirects page flags the rule, a site import writes it disabled, and a new redirect that leads into the chain is refused. A chain through more than 20 pattern redirects, or one that grows a path past 8,192 characters, is treated the same way.

    Saving a redirect whose source has percent-encoded brackets, such as /posts/%5Bslug%5D, is no longer refused as a loop when its destination leads through other redirects to a path that the source would match as a pattern.

  • #5117 13bedc5 Thanks @ascorbic! - Fixes two problems with how registry plugin requests handle unusual responses:

    • Registry plugin verification, install, update, update checks, and the registry image proxy no longer follow HTTP redirects from the aggregator. A redirect is now reported as an aggregator error. If your registry option points at a URL that redirects, change it to the final URL.
    • On Node.js, a registry plugin's icon, banner, screenshot, or bundle host that answers with an HTTP status outside 200–599 no longer stops the server process. The download now fails like any other unavailable artifact.
  • 52d7880 Thanks @ascorbic! - Fixes images on sites that use Astro route caching with a route rule covering /_image or the media file route. A 304 Not Modified answer to one browser's revalidation could be stored by the route cache and served to every visitor until the rule's maxAge expired, which broke the image for them. The route cache no longer stores 304 responses on any route, or any response other than 200 from the image endpoint route (/_image or your image.endpoint.route), such as a 404 for a missing file or an error. This applies whichever image endpoint serves the route, including a custom one.

  • #5164 54ee891 Thanks @emdash-autofix! - Makes emdash media repair-usage stop safely before exhausting D1's per-request query allowance on Workers Paid, leaving queries available to release write leases and save status. Repair returns CONTENT_USAGE_QUERY_LIMIT and preserves its indexed-source count instead of returning a generic failure. This does not enable large collections to finish: resumable batches are not yet supported, and repeated runs restart at the first entry. Use --json and check the returned status rather than treating exit code 0 as complete coverage. The lower query allowance on Workers Free is not covered by this safeguard.

  • #5093 801bdac Thanks @ascorbic! - Fixes sign-in keeping the session ID the browser already had. Signing in with a passkey, magic link, OAuth, Atmosphere, an invite, signup, first-admin setup or external authentication now starts the session under a new ID and removes the previous one from the session store.

  • #5104 7ed8e09 Thanks @ascorbic! - Fixes first-admin creation so only one person becomes admin when several first sign-ins happen at the same moment.

    • GitHub, Google, Microsoft, and AT Protocol sign-in during setup: the first sign-in becomes admin. A sign-in that finishes at the same time is now refused with signup_not_allowed instead of creating a second admin. With AT Protocol, only the account that becomes admin receives the email entered in the setup wizard, so another account can no longer be linked to the admin by that email.
    • Cloudflare Access: when several people sign in to a new site at once, one becomes admin and the others get the role from their Access groups.

    While setup is still open, a sign-in from a new identity is refused once any user exists, matching the passkey setup step.

    @emdash-cms/auth adds an optional createUser(user) function to canSelfSignup results. When present, findOrCreateOAuthUser() calls it instead of adapter.createUser(). If it returns null, the sign-in is refused with signup_not_allowed.

    @emdash-cms/auth-atproto now requires emdash 1.7.0 or later.

  • #5107 31625c7 Thanks @ascorbic! - Fixes slug lookups that name no locale picking an arbitrary or lowest-code entry when entries in several locales share the slug.

    • getEmDashEntry without a locale returns the default locale's published entry. An entry whose ID matches comes before one whose slug equals that ID, and a draft no longer hides a published entry with the same slug.
    • Reads by slug through the REST API, CLI, EmDashClient and MCP return the default locale's entry, falling back to the lowest locale code only when the default locale has none.
    • Changes addressed by a slug that exists in more than one locale now fail with AMBIGUOUS_LOCALE (400) unless the request names a locale. This covers update, delete, permanent delete, restore, publish, unpublish, schedule, unschedule, discard-draft, duplicate, edit locks, term assignment and plugin editor actions, through REST, the CLI, EmDashClient and MCP. Scripts that act on shared slugs without a locale must pass one or use the entry's ID. Changes addressed by ID are unaffected.
    • Restore and permanent delete by slug prefer a trashed entry over a live entry with the same slug.

    To name a locale, emdash content delete, publish, unpublish, schedule and restore now accept --locale. The matching EmDashClient methods accept a locale option, the restore and permanent-delete endpoints accept ?locale=, and the MCP tools content_delete, content_restore, content_permanent_delete, content_publish, content_unpublish, content_schedule, content_unschedule and content_discard_draft accept a locale argument.

  • a14daef Thanks @ascorbic! - Updates the setup and sign-in APIs on sites that sign in through an external auth provider such as Cloudflare Access. Outside astro dev, POST /_emdash/api/setup/admin, /_emdash/api/setup/admin/verify, and the OAuth and auth-provider sign-in routes under /_emdash/api/auth/ now answer 400 NOT_SUPPORTED on those sites, because users are created by signing in through the external provider. The setup wizard never showed the passkey step in this mode, so only scripts that called these routes directly are affected. If the provider is configured with autoProvision: false, turn it on for the first sign-in so that the first admin can be created.

  • #5089 83bb981 Thanks @ascorbic! - Fixes read-only API responses showing users without content:read_drafts, such as subscribers, details of unpublished content:

    • GET /_emdash/api/menus/:name, GET /_emdash/api/menus, and the menu_get and menu_list MCP tools now leave out menu items that link to draft, scheduled or trashed entries, along with the items nested under them, and count only the remaining items in itemCount. Subscribers now get the same items the site renders for visitors.
    • GET /_emdash/api/content/:collection/:id/terms/:taxonomy now returns an empty unresolved list to these users, because those assignments can come from an unpublished translation. terms is unchanged.
    • The content list and single-entry reads, over REST and through the content_list and content_get MCP tools, no longer return draftRevisionId, version or _rev to these users. Saving or discarding a draft changes these values while the published entry stays the same. These users cannot edit content, so they have no use for _rev.

    Contributors and above still get the full responses.

  • #5001 fe7c634 Thanks @emdash-autofix! - Fixes the visual editor placing the caret at the start of an image-first body instead of where you first click in the text.

  • #5161 ff2a923 Thanks @emdash-autofix! - Fixes LiveSearch result links ignoring the collection's urlPattern, which sent root-level pages to URLs such as /pages/my-page instead of /my-page. Search and autocomplete results now include a resolved url with date tokens and locale prefixes. Explicit routeMap entries still override the default links. WebMcpSearch also uses the resolved URLs, and default search result URLs honor Astro's trailingSlash setting.

  • #4889 e4c9baa Thanks @emdash-autofix! - Fixes stale route caches on Node after scheduled publishing or plugin content actions from hooks and cron tasks. Background purges become available once a non-prerendered request with route caching enabled accesses the EmDash runtime in that process. With memoryCache(), publishing invalidates the collection and entry tags so cached listings and articles refresh on the next request rather than waiting for expiry; other server processes retain their own caches until they expire.

    With a compatible media cache provider, Node hook/cron media deletes and hourly cleanup also purge removed images once a route-cache-enabled request has accessed the EmDash runtime in that process. This does not enable automatic media caching with memoryCache().

  • #4850 4301fcd Thanks @Antonio-Bennett! - Fixes creating a translation when the collection has a non-translatable reference field. The create failed, and on PostgreSQL the API reported the collection as missing.

  • #5103 302f950 Thanks @ascorbic! - Fixes creating a translation and restoring a revision so the permission check uses the same entry the action changes. Both now look up the entry by ID only:

    • Creating a translation with translationOf (REST and the MCP content_create tool) checks edit permission on the entry with that ID. Previously, when that ID was also another entry's slug, the permission was checked against the other entry.
    • Restoring a revision (POST /_emdash/api/revisions/{id}/restore and the MCP revision_restore tool) checks ownership of the revision's own entry, with the same correction.
  • #4888 fe34a65 Thanks @emdash-autofix! - Fixes emdash seed --validate accepting unsupported repeater sub-field types. Invalid or missing types and non-object sub-field entries now produce an error identifying the sub-field instead of reporting the seed as valid. These errors also prevent the seed from being applied.

  • #4828 35d40a3 Thanks @danielmlr! - Fixes emdash-env.d.ts declaring the same type name twice when a name generated for a blocks field or one of its block types matched a collection's interface name, another generated block name, or a type imported from emdash. For example, a content blocks field on pages next to a page_content_blocks collection declared PageContentBlock twice, and one of the two silently took the other's type. The clashing declaration now gets a number suffix, such as PageContentBlock2, and .emdash/types.ts uses the same names. Collection interface names, and generated block names that don't clash, stay the same.

  • #5097 c78cc4b Thanks @ascorbic! - Fixes the WordPress import wizard accepting a "Connect with WordPress" approval that it did not start. The wizard now sends a one-time value through WordPress, and GET /_emdash/api/import/wordpress-plugin/callback sends the admin back to the wizard without connecting unless that value returns within ten minutes. The callback also requires the import:execute permission, like the other import routes. When WordPress does not approve the connection, or the approval expires, the wizard now shows a message and its starting screen so the admin can reconnect.

  • #5097 c78cc4b Thanks @ascorbic! - Fixes the exported wxrSource import source treating password-protected WordPress posts as published. Such posts now have the status private, so they import as drafts, as they do in the admin and CLI WordPress importers, and they are left out when includeDrafts is false.

  • #4927 390f8b1 Thanks @emdash-autofix! - Fixes MCP schema tools to accept URL and repeater fields, widget configuration and field sort order on creation, and collection admin settings, visibility and sidebar order on update. Adds schema_reorder_fields to reorder a collection's fields in one call.

    schema_create_field now creates reference fields the same way as the REST API: set validation.targetCollection to create a relation, or validation.relation to bind an existing one. The older options.collection target remains accepted and now also creates a relation. A reference field with neither a target collection nor an existing relation is now rejected with VALIDATION_ERROR instead of being created without a relation.

  • Updated dependencies [1168a73, 7954e27, 6396118, 64df16d, 368b3e8, db3aa05, d717fd6, c78e210, 6eb4bd6, acff8d2, 58c4c33, 00367c1, 1bdcfa8, 45b3873, c0dd209, 92e81a8, 060e7e7, 91dfa31, e138e21, 933e2ee, 4b6bcbe, 7afb693, 5030c20, 7ed8e09, 0917f1b, 83c764e, 0503743, bb86431, 3c64f9b, 9b494e0, e33afbe, 4874deb, af15970, 17b2b2d, ef0e581, b843b56, 96a63c9, a397efc, afdf4c3, facf797, 2072b22, c5877be, 29caf9c, 7ed8e09, 5409819, 87b8b0d, 35ffffb, dcc6bc1, c78cc4b, eb02dbd]:

    • @emdash-cms/admin@1.7.0
    • @emdash-cms/auth@1.7.0
    • @emdash-cms/blocks@1.7.0
    • @emdash-cms/gutenberg-to-portable-text@1.7.0