PhoenixKit 2.64.0: Dates by country, public libraries and a neutral machine API
PhoenixKit 2.64.0 shows dates in each viewer’s country format, lets chosen users publish a library, moves the public machine API to module-neutral paths, and fixes HDR phone videos. It must be installed together with AI 0.26.0 or later.
Dates follow the viewer’s country
Users and company accounts get a country, editable on the profile page and the admin user form. Where a date is shown in the user’s format, the country now decides: 09.11.2026 for a German viewer, 09/11/2026 for a British one, 11/9/2026 for an American. A new setting, Default Country for Formats under Settings → General, covers visitors and accounts without one. It is empty by default, and anyone without a country keeps the Date Format setting, so nothing changes on upgrade. Existing accounts are not given a country automatically.
Libraries: public, backed up, rebuilt
A user with the new storage.public_library permission, given to nobody by default, can create a Public library that anyone can read, signed in or not. Owners and Admins can suspend one from the admin list. A library can also use up to three of a user’s own integrations, the first as main storage and the others as copies. The profile’s Media tab is rebuilt as a table with a row menu, and the create form asks only for an integration and a bucket, with a List buckets button.
The machine API
The public API moves to /api/public/v1 and /mcp/public. The old /api/shop/v1 and /mcp/shop still answer, with deprecation headers. Settings → API is split into tabs: Switches and modules, Keys and service users, Approvals and limits and API guide, with per-module switches. API tools can act for a signed-in person with their own rights, and for modules ticked Agent may act, writes wait for confirmation. A key marked Needs approval now holds every write, not only dangerous ones. Anthropic and Z.ai are new integration providers.
Video and photo fixes
HDR videos from phones were encoded into renditions most browsers refuse, with washed-out posters. HDR sources are now tone-mapped to ordinary video for every rendition and the poster, and an iPhone video’s poster can be an HDR photo. Clips about one second long, such as a Live Photo’s, get a thumbnail. iPhone HEIC photos zoom to full resolution, and large files are no longer read whole into memory to be hashed. <.time_ago> reads in the user’s language.
Upgrading
Run mix phoenix_kit.update for V221 to V223, and upgrade phoenix_kit_ai to 0.26.0 or later at the same time: V223 renames the AI cost column, and an older AI release fails on every usage insert. V223 rewrites the AI request journal under an exclusive lock, so allow a maintenance window on a large one. Behind a proxy, set config :phoenix_kit, :trusted_proxies to its ranges; unset, any loopback or private peer is trusted as before. On the machine API, a query parameter ending in _token is now refused with 400 token_in_url.
Full release notes: PhoenixKit 2.64.0
2.64.0 · 24 October 2026
Migrations V221–V223. Run mix phoenix_kit.update after upgrading.
Upgrade notes
phoenix_kit_aimust be upgraded together with core, to 0.26.0 or later. V223 renamesphoenix_kit_ai_requests.cost_centstocost; an older AI release writes the removed column and every usage insert fails. V223 rewrites the request journal under anACCESS EXCLUSIVElock and drops the unused legacyphoenix_kit_ai_accountstable (its rows are not restored by a rollback); allow a maintenance window for a large journal.- The public machine API moved to
/api/public/v1and/mcp/public(#953)./api/shop/v1and/mcp/shopstill answer, withDeprecationandLink: rel="successor-version"headers, until 3.0.0.PhoenixKit.API.Actor.cart_token_hashis renamed toclient_token_hash(no alias); theapi_public_cart_*limits becomeapi_public_token_rate_per_min,api_public_new_rows_per_ip_hourandapi_public_new_rows_global_hour, the old keys read as a fallback. - Forwarded headers follow
config :phoenix_kit, :trusted_proxies(#943, #955). Unset, any loopback or private peer is trusted as before. Set it to your proxy’s ranges to stop another container on the network from choosing the client IP (APIallowed_ips, rate limits, audit) or the scheme (X-Forwarded-Protofor the API context and the OAuth callback —EnsureOAuthSchemeused to believe it from any peer). - A key marked “Needs approval” now holds every write (#961), not only dangerous ones; reads and dry runs are unchanged.
- A query parameter ending in
_tokenanswers400 token_in_urlon the machine API (#953), e.g.?page_token=.
Changed
-
AI request costs are stored as dollars (V223, #981).
cost_cents(anintegerthat held millionths of a dollar, so a cheap call was stored as0) becomescost,numeric(28,18)US dollars, with existing costs converted. The requests’modelwidens tovarchar(150)(the endpoints’ width; a longer id failed the usage insert). The pre-V34phoenix_kit_ai_accountstable andphoenix_kit_ai_requests.account_uuidare dropped, and the uniqueuuidindexes beside the AI tables’ primary keys are removed, the foreign keys bound to them re-added on the primary keys. A rollback restores the V222 shape with an empty accounts table. -
The public machine API is module-neutral (#953). Core no longer names a shop: a tool names the input carrying its anonymous caller’s token with
Tool.client_tokenand its secret output fields withTool.credentials(core’s rule: a known name or any name ending in_token), a module adds error codes with the optionalapi_problems/0callback, andRateLimit.check_new_rows/1is the shared new-rows quota. Every deprecated name lives inPhoenixKit.API.Legacy, deleted in 3.0.0. The guide is renameddev_docs/guides/2026-10-11-machine-api.md. -
Settings → API is built from core’s components and split into URL-held tabs (#976, #979): Access, Keys, Approvals and the API guide (
?tab=…), the guide moving in from its own page. Module rows show each tool’s availability to an agent. -
Template usage counts delivered messages only (#972), including a provider’s queue handoff; failed, blocked and development-suppressed messages no longer increment it.
-
integration_encryption_warn_on_boot: falsesilences only encryption switched off on purpose (#954). A missing key (:disabled_no_key) is reported regardless, andEncryption.encrypt_value/1’s plaintext warning is logged once per VM instead of on every save. -
MCP echoes of client text are clipped by code points, not graphemes (#963, #980) — “Method not found”, the protocol-version echo and approval reasons — so one letter with thousands of combining marks is no longer echoed whole.
-
Dates follow the viewer’s country (
PhoenixKit.Users.FormatCountry). Where a date is shown in “the user’s format” (Utils.Date.format_date_with_user_format/1,format_datetime_with_user_format/1,format_datetime_full_with_user_format/1,format_date_with_cached_settings/2,format_datetime_with_cached_settings/2, and the*_with_user_timezone/*_with_user_timezone_cachedones for the user they are given) a country now wins over the site-widedate_format:09.11.2026for a German viewer,09/11/2026for a British one,11/9/2026for an American. It is written byBeamLabCountries.Formats.format_date/2(beamlab_countries~> 2.1). Anyone without a country, and no site default country, seesdate_formatexactly as before, so nothing changes on upgrade until users get a country. The viewer is set when the scope is mounted (thefetch_phoenix_kit_current_*plugs and themount_phoenix_kit_current_*hooks) and resolved on first use. The time format and the date picker (<.date_input>, which parses what is typed) still follow the settings.Utils.Date.format_date/2also accepts{:country, "DE"}as a format. -
The profile’s Media tab is rebuilt on core’s own components. The libraries are a
table_default(name with its Default badge, where it is stored, visibility: Public or Private) with the usual toolbar (count, Create library) and a ⋮ row menu (Open, Rename, Make default, Members, Renditions, Trash; Leave for a shared one), as the Integrations tab. Rename, members, renditions and the new-library form are<.modal>dialogs with<.input>/<.select>; an empty list is an<.empty_state>with the create button; the trash is a small table with Restore. With own storage the form asks for what the integration does not already know: an integration (the word is used throughout; the form said “connection”) and a bucket. The provider, region and endpoint fields are gone: the bucket takes them from the integration, and the integration’s service and endpoint are shown under its select. With one integration it is already chosen; with none the form sends the user to add one (new tab) and picks the list up again when the window regains focus. -
Libraries.create_user_library/3/probe_own_storage/3: the"storage"map takes"targets"(a list, or thetargets[0]map a form posts); a single bucket given flat (integration_uuid,bucket_name, …) still works, and a provider, region or endpoint sent anyway wins over the integration’s. -
Profiles.user_storage_for/1addsbuckets(every one of the user’s buckets, main first) besidebucket;modeis:onlywhen one of them is the primary.Profiles.create_user_profile/3takes a bucket or a list. -
The admin menu offers Approvals only while the site uses them (
AdminTabs.approvals_visible?/1,Approvals.in_use?/0): a key that is not revoked or expired (a revocation or expiry still in the future does not count as one) is marked “requires approval”, or an approval of any status is still kept. A site where no key asks for approval no longer shows an empty entry;/admin/approvalsitself and the link on Settings -> API answer as before.
Added
-
API tools run on behalf of a live session (#948, #974, V222).
Executor.visible_for/3/execute_as/5take aSessionRef(Users.Auth.SessionRef.from_session/1) and act with that person’s current rights (actor kind:user). Reads run directly; withallow: :all, for modules an admin ticks under Settings → API (“Agent may act”,api_session_write_modules), a write is held in a confirmation row bound to the person (phoenix_kit_api_confirmations.actor_user_uuid, V222) and runs once throughExecutor.redeem_as/6, which repeats the whole request path. -
Public API discovery (#944): a guide at
GET /mcp(HTML, or Markdown forAccept: text/markdown), an RFC 9727 catalog at/.well-known/api-catalog,Linkheaders and an API section in/llms.txt, all shown only while the public API is on and has a tool, and none naming the admin API. -
An admin guide to the machine API (#945), generated from this installation’s tools and error codes, with connection snippets for Claude Code, Claude Desktop, VS Code and a generic client (now a Settings → API tab).
-
An Approvals menu entry and a readable approvals page (#946) at
/admin/approvals, forapiholders, with a per-viewer badge and previews rendered as fields instead of JSON; offered only while a key requires approval or an approval is kept (#970). -
Per-module API switches (#940) on Settings → API (
api_disabled_modules, empty = all on) and an API badge on the Modules page; a switched-off module’s tools are withheld everywhere, core’ssystem.*tools never. -
replay: falseon aPhoenixKit.API.Tool(#941) for a write whose answer always carries a credential: it stops advertisingidempotency_keyin MCP and OpenAPI and refuses one with422. -
Per-language public URLs through the canonical host resolver (#939): new
PhoenixKit.Utils.Routeshelpers, so modules stop calling:canonical_host_resolverthemselves. -
Header widgets for modules and an optional dock column (#950). The optional
header_widgets/0callback returns sticky nested LiveViews rendered before the notifications bell;dock: trueadds a third admin-layout column (--pk-dock-width). Without a widget the layout is unchanged. -
Module-supplied connection checks (#962): a module contributing an integration provider names a
PhoenixKit.Integrations.Validator(validate_connection/1, or the owner-aware/2), run under a deadline with credential-safe crash logging. -
Anthropic (#958) and Z.ai (#967) integration providers (
:ai_completions, site-wide and personal connections, a key check). -
An opt-in address policy for personal SMTP integrations (#956):
config :phoenix_kit, :personal_smtp_policy, :restrictedrefuses a user’s SMTP host on a non-public address at Test Connection and before every send. Off by default; site-wide connections are never checked. -
Storage.direct_urls/1(#964) resolves many file variants at once to the public bucket’s object URL, with a fixed number of queries; private and ineligible files keep the app URL. -
Hidden system libraries (#949):
Libraries.create_system_library(attrs, hidden: true)for a module’s own files — private, time-window URLs only, absent from Media, settings lists and pickers. -
dedup: falseonStorage.store_file_in_buckets/7(#938): each call gets its own file row, for a host storing files of independent records under one owner (form attachments). The checksum backfill keeps the opt-out. -
A gallery mode for the media viewer (#965): Photos-style swiping between neighbours (Fresco 0.15), steady controls and a picture that stays put.
-
<.date_input>(#936): a date in the site format with a clear button and a calendar in the UI language, submitting an ISO date (and working before the socket connects). -
Boot-time Admin permission grants retry and report failures (#973). The grants return
{:error, _}instead of:ok, a supervisedPermissions.AdminGrantsretries failed keys, and a host can wait withPermissions.await_admin_grants/1. -
Docs: core’s admin building blocks in
usage-rules.md(#947), host application API tools (#952), host-neutral examples (#966). -
Tabs of your own on the profile settings strip (
PhoenixKit.ProfileSettingsTab). A host lists them inconfig :phoenix_kit, :profile_settings_tabs, a module returns them from the new optionalc:PhoenixKit.Module.profile_settings_tabs/0(offered only while the module is enabled). Each has anid(its URL,/profile/settings/<id>; core’s ids are refused), alabel(a string, or an{m, f, a}/ function called on render, so it can be the host’s owngettext), anicon,after:(the tab it follows; the end otherwise), and an optionalpermission:andvisible:check of the scope (a check that raises hides the tab). Withlive_view:core declares the page’s route in its authenticatedlive_session, in both the locale-prefixed and plain URL shapes, ahead of/profile/settings/:tab; the router recompiles when the config changes. Without it the host routes the page itself, beforephoenix_kit_routes(). The page renders<ProfileSettingsTabs.profile_tabs active="<id>">itself; from there every tab navigates.tab_ids/1,tab_label/1andtab_icon/1read the registry; an id that is not routed still lands on the first tab. -
A country on the user (V221,
phoenix_kit_users.country). The ISO 3166-1 alpha-2 code of a person’s or a company account’s country, checked againstBeamLabCountriesand stored upper-case. Editable on the profile page and on the admin user form, shown on the user details page. A new account starts with itsregistration_countrywhen that is a known code; nothing is backfilled for existing accounts (the resolver falls back toregistration_countryat read time).countryis deliberately not inAuth.updatable_profile_fields/0, so a host’s custom field namedcountrystays a custom field. -
FormatCountry.resolve/1: the country whose formats a user reads: their owncountry, else their company’s (organization_uuid), elseregistration_country, else the site default; a source holding an unknown code is skipped.for_user/1,viewer/0andput_viewer/1serve the date helpers; a host rendering for someone other than the process’s viewer (an email) callsfor_user/1. -
Settings -> General -> “Default Country for Formats” (
format_country). The country used for visitors and accounts with none of their own. Empty by default: they keep the Date Format setting. -
A library can use several of the user’s integrations (V206 storage). In “only here” the first is the main storage and the others hold a copy of every file (never served); in “the site’s storage, backed up here” each is a backup. Up to
Profiles.max_user_buckets/0(3), five copies in all. The library row saysYour bucket: a (+1 copy); purge and the object clean-up already covered every bucket of a library’s profile. -
Public user libraries (phase 1 of
dev_docs/plans/2026-10-18-public-user-libraries.md). A user with the newstorage.public_librarysub-permission (granted to nobody by default) can create a library as Public (a Private or Public choice in the create dialog, with a warning; final once made). Anyone, signed in or not, can read what is in it (Libraries.can?/3with anilscope,can_read_library?/2,public?/1); editing is unchanged. Its files get ordinary links; it never appears in site media (Libraries.exclude_user_libraries/1replacesexclude_private/1, which still works, in the media browser, the pickers, the folder listing and the orphan cleanup). An Owner or Admin can suspend one (suspend_library/3,unsuspend_library/2, a Suspend/Restore button in the admin list): it answers as private until restored. Publishing and suspending are in the history. Nothing is public unless a user with the permission makes it so. -
Libraries.ensure_personal_library/2andbackfill_personal_libraries/1— for a host that wants every account to have a private library of its own. The system makes it (no permission, no room under the per-user limit), marked so a user who trashed theirs is not given another. Nothing in PhoenixKit calls them, they make nothing while “Allow user libraries” is off ({:error, :user_libraries_off}), and registration is unchanged; the host decides whether, when and what to call it. -
A “List buckets” button on the create form:
Libraries.list_own_buckets/3asks the integration’s key for its buckets (S3ListBuckets, under the integration check’s deadline, viaS3.list_remote_buckets/1) and the bucket field becomes a dropdown. A key limited to one bucket is usually refused; the text field stays and the message says to type the name. -
Libraries.integration_summary/2: what a user’s integration says about itself (service, bucket provider, region, endpoint), never a secret. -
A module can keep its own settings for a library (
Libraries.module_setting/3,put_module_setting/5). A package that is not core has settings of its own for a library (the photos package’s choice of viewer, say), and core should not have to name them.put_module_setting(library, "photos", "viewer", "classic")keeps the value under the module’s namespace in the library’ssettings(settings["modules"]["photos"]["viewer"]), nil removes it (and the namespace when it was the last key). Core keeps the namespacing, the update of only that key, the lock and the history (photos.viewer, from and to); it knows no key and checks no value beyond a boolean, a number or a string of at most 255 bytes. The namespace and key are lowercase words ({:error, :invalid_namespace | :invalid_key | :invalid_value}otherwise). Needs no migration. -
The poster of an HDR video is an HDR photo. For an HLG video (every iPhone recording) whose
video_thumbnailsize keeps HDR, the poster is a JPEG with a gain map (Ultra HDR, ISO 21496-1): an HDR screen shows the highlights above white, any other shows the ordinary picture.VideoHdrPostermakes it with libvips’uhdrsave(in the libraryvixships; nothing to install): ffmpeg writes the frame as linear-light floats, scaled so SDR white (203 nits) is 1.0, and libvips computes the map. The switches are the photos’ own: the size’skeep_hdroption (now on by default forvideo_thumbnail, and offered in the size form for a video JPEG size) andconfig :phoenix_kit, hdr_renditions. Withoutvix, with a libvips older than 8.17, or if anything fails, the ordinary tone-mapped poster is made and a warning logged. PQ sources and Dolby Vision profile 5 keep the ordinary poster. Existing sites keep what their size says untilkeep_hdris turned on; videos already made are remade by regenerating them.
Fixed
-
Integration secrets stay out of logs, and key rotation re-encrypts bucket secrets (#942). Settings and bucket writes run with
log: false,Setting.value/value_jsonareredact: true, and a failed save logs the changeset’s errors only.KeyRotation.rotate/2now re-encrypts buckets’ ownsecret_access_keyin the same transaction — before, every such bucket failed to decrypt its secret after a rotation and a restart. -
An object storage key limited to buckets passes Test Connection (#977) with the note “not allowed to list buckets — bucket access was not verified”; invalid keys still fail.
-
Storage endpoint checks refuse IPv6 forms that reach non-public addresses (#957): IPv4-compatible
::a.b.c.d, 6to4, the local-use NAT64 prefix, site-local, Teredo and documentation ranges passed a personal endpoint’s check. -
A base language’s own dialect URL redirects to the base code (#968): with
en-USthe only English,/en-US/…goes to/en/…instead of serving a duplicate page (Languages.url_locale_segment/1). -
EnsureOAuthSchemeno longer forceshttpson port 443 whenoauth_base_urlis unset (#971): the endpoint’surl:config applies again, its port read whether it is an integer, a string or an environment tuple. -
The integration picker lit every card’s check (#975): glued CSS classes are separated. Dashboard overview grids size by their container (#978), not the window.
-
Storage.direct_urls/1skips a malformed uuid or variant instead of failing the whole batch. -
Switching back to a remembered account works again, and the country select’s type-ahead matches names (the flag now follows the name).
-
Country format preferences stay current. Viewers without a personal country follow changes to the site default in an open LiveView; embedded identity mounts and scope refreshes also set the viewer’s country. The default-country setting trims and uppercases its saved code, and a successful profile save redraws the country select from the saved values. V221’s regression test now applies the migration to an existing account to verify that GeoIP data is not backfilled.
-
An HDR video no longer makes renditions a browser cannot play, nor a washed-out poster. A phone records HDR as 10-bit HEVC (HLG or PQ, BT.2020). Its renditions were encoded as 10-bit H.264 (“High 10”), which most browsers refuse, and its poster was a raw frame grab with the HDR signal squeezed into an SDR picture (flat colours, blown highlights).
VideoSource.probe/1reads the source once withffprobe; an HDR source is tone-mapped to SDR (zscale/tonemap, Hable, 203 nit reference white, BT.709, 8-bit) after the resize, for every rendition and the poster. Every H.264 and VP9 rendition is nowyuv420pwhatever the source (a 10-bit video that is not HDR no longer comes out as High 10). If the tone-mapping fails the ordinary rendition is made and a warning logged. The original is stored untouched. SDR sources are unchanged apart fromyuv420p. Keeping the HDR in a rendition (10-bit HEVC) is not done. -
A video thumbnail of a clip about a second long is made. The poster was always taken at 1.000 s; a clip of exactly one second (a Live Photo’s) has no frame there, and FFmpeg answered success without writing a file, so the variant failed later as a bare
:enoent. It is taken one second in, or halfway for a clip under two seconds, and an FFmpeg run that wrote no file is now an error that says so. -
Large files are no longer read into memory to be hashed. Every checksum of a file on disk (the original’s SHA-256 and MD5 at upload, each rendition’s, a URL import, the dedup backfill,
POST /api/upload) read the whole file withFile.read!/1and held it, twice over, while it hashed; a video of a few gigabytes cost a few gigabytes. They go through the newPhoenixKit.Utils.FileHash(1 MiB chunks, several digests in one pass), so what a hash costs in memory is the chunk. A test stores a 160 MiB file and fails if binary memory rises by more than 64 MiB (the old code rose by 293 MiB). -
An iPhone’s HEIC (and HEIF, AVIF) zooms to the last pixel. libvips as shipped with
vixreads a HEIC’s size but has no HEVC decoder, so no deep-zoom tile could be cut from one and the viewer stopped at the 1920 px rendition. The first tile request now makes one full-resolution JPEG of the original with ImageMagick (ImageProcessor.full_jpeg/3), keeps it beside the tiles (TileSource), and cuts every tile from it. -
POST /api/uploadtakes HEIC, HEIF, AVIF, TIFF and BMP (it turned them away as “not allowed”), and its size cap follows thestorage_max_upload_size_mbsetting (default 500) instead of a fixed 100 MB. -
<.time_ago>reads in the user’s language (#969). ItsTimeAgoclient hook rewrote the text in English once the page was live; the component now has no hook and is rendered by the server alone, withngettextplural forms (“1 день назад”, “2 дня назад”, “5 дней назад”; “1 päev tagasi”, “3 päeva tagasi”). The tooltip is the moment in the site time zone asYYYY-MM-DD HH:MMinstead of an English date in UTC. A moment ahead of the clock reads “0s ago”. The text no longer ticks in the browser; it is what it was at the last render. The hook stays inphoenix_kit.jsfor host markup that usesphx-hook="TimeAgo"directly. i18n:"%{count}s ago"is a plural entry in every catalogue; the day forms in et, ru, uk and pl are full words with their plural forms.
PhoenixKit 2.64.0. Install or update: {:phoenix_kit, "~> 2.64"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.