PhoenixKit 2.58.0: Viewer libraries from your own origin, panorama sizes
PhoenixKit 2.58.0 serves the media viewer’s JavaScript libraries from your own site instead of a CDN, so a strict Content Security Policy keeps working. It also adds a Shape filter, square and panorama sizes, and dates in the site’s time zone.
Viewer libraries from your own origin
Fresco, Tessera, Etcher, Leaf, SortableJS, Panzoom and wavesurfer are now copied into your app’s priv/static/assets/vendor/lib/ by the compiler and by mix phoenix_kit.update. A site with script-src 'self' keeps zoom, the image editor, annotations, sortable lists and the audio waveform, and opening a viewer makes no third-party request. A CDN is tried only if you opt in with config :phoenix_kit, library_cdn_fallback: true. When a library fails to load, Owners and Admins see a notice saying why, such as a CSP violation, and mix phoenix_kit.doctor checks the setup.
Shapes and new sizes
Media’s Filter menu gets a Shape section for wide and tall pictures, and the grid marks panoramas with a badge. The filter, type and sort are kept in the URL. The Default size set gains square sizes cropped around the subject, a 64 px mini_square, and panorama sizes made only for wide pictures; the rendition form has a Made for select. New installs get them; a site that already has files is left alone, and Reset to Defaults adds them.
Dates in the site time zone
The date formatters now show times in the site’s time zone, where they used to print the stored UTC clock.
Fixes
An upload into a second library no longer reuses files from another library. The Media toolbar menus show the chosen entry again, after daisyUI 5 renamed the class, and the Filter button names the type and shape in use. A crafted URL parameter no longer crashes the Media page.
Upgrading
Run mix phoenix_kit.update for V212 to V214. It also copies the viewer libraries into priv/static/assets/vendor/lib/; mix compile with the :phoenix_kit_js_sources compiler does the same. Etcher now needs 0.20.0 or later.
Full release notes: PhoenixKit 2.58.0
2.58.0 · 8 October 2026
Migrations V212, V213 and V214 (run mix phoenix_kit.update). The viewer’s JavaScript libraries now come from
the host’s own origin: run mix phoenix_kit.update (or mix compile with the :phoenix_kit_js_sources compiler)
so they are copied into priv/static/assets/vendor/lib/. Etcher’s floor is now ~> 0.20.0.
Added
- The viewer libraries are served from the host’s own origin (PR #915). Fresco, Tessera, Etcher, Leaf,
SortableJS, Panzoom and wavesurfer are copied into the host’s
priv/static/assets/vendor/lib/as<name>-<version>-<hash>.jsby the compiler (and byphoenix_kit.update/install), so a host withscript-src 'self'keeps zoom, the editor, annotations, sortable lists and the waveform, and no viewer open makes a third-party request.phoenix_kit.jsnames no library URL: the file names come from install facts (window.PHOENIX_KIT_LIBS, written intophoenix_kit_modules.js). A CDN is tried only on the host’s opt-in (config :phoenix_kit, library_cdn_fallback: true, read at compile time). Library URLs carry?vsn=so Plug.Static caches them for good. - One library loader and an admin notice when a viewer library fails to load. Failures are classified from
evidence (CSP violation with its directive, or a plain load failure) and shown to Owners and Admins, with
the console line and a
pk:library-failedevent.mix phoenix_kit.doctorchecks the compiler, the bundle and the install facts. - A file’s aspect ratio and a Shape filter (V212).
phoenix_kit_files.aspect_ratiois a generated column (width / height, Postgres 12+);Storage.Shapereads it (wide from 2:1, tall from 1:2) andlist_files_in_scope/2takesshape: :wide | :tall(pictures only). Media’s Filter menu gets a Shape section, and the grid marks a panorama with a badge. Type, sort and shape live in the URL. - New sizes in the Default set (V213, V214).
thumbnail_squareandsmall_square(cropped around the subject),mini_square(64 px) and the panorama sizesthumbnail_wide,small_wideandmedium_wide, made only for wide pictures. A size has ashape(any, wide or tall; the standard sizes stay for every picture) and the rendition form a “Made for” select. The migrations add them to installs with no files yet; a site with files is left alone, and “Reset to defaults” brings them. Grid cards usesmall_squareand list rowsthumbnail_squarewhen a file has them. - The date formatters show the site time zone (PR #916).
format_datetime_full_with_user_format/1,format_datetime_with_user_format/1,format_date_with_user_format/1,format_time_with_user_format/1,format_short_datetime/1and the*_with_cached_settingsvariants move aDateTime(or aNaiveDateTimeread as UTC) into the site’s time zone, where they printed the stored UTC clock. ADateTimein another zone is brought to UTC first, so no unset zone (“0”, “”, nil) needs a time zone database.
Fixed
- An upload into a second library no longer clones files from another library. The duplicate lookup matched any library placed alike; a donor must now be in the same library.
- The Media toolbar menus show the chosen row (daisyUI 5 renamed
activetomenu-active; also on Activity and Users), and the Filter button names the type and shape in use. - A keyword CSP violation (
inline,eval, empty) no longer reads as the cause of a library failure. Only a violation for an absolute URL is matched against a library. - The library notice no longer logs a missing-Gettext-bindings error on every admin render.
- A cut-short library write is repaired. A vendored library is written to a temporary file and renamed, and rewritten when its size is wrong.
- The wide/tall filter lists pictures only, as the panorama badge does; a wide video is not a panorama.
VariantSets.variant_for/2andstand_in/3skip a size made for another shape.- A URL with
?type[a]=bno longer crashes the Media page on the next navigation. - The date formatters read the time zone through the settings cache (one extra uncached read per formatted value in a list otherwise).
- Stacks follow the Media toolbar’s type, shape and sort. Folder preview counts, expanded stacks and their additional pages use the same options as the main listing.
- An explicit null rendition shape returns a validation error, instead of raising on the database’s NOT NULL constraint. A shape-only change is recorded in the storage history with its actor.
- Relative
PHOENIX_KIT_LIB_BASEvalues resolve against the page for every library, including wavesurfer’s ES module, whoseimport()otherwise resolves against the bundle or rejects a bare path.
Changed
- Etcher’s floor is
~> 0.20.0(it honourssortableUrl/loadSortableFromCdn = false); the lock moves to 0.20.0,phoenix_pubsub2.4.1 andswoosh1.29.0. - The CDN-pin tests (
leaf_bundle_pin_test.exs, most ofvendored_cdn_pins_test.exs) are gone with the CDN pins; the dependency ceilings inmix.exsare now a manual rule, and the comments say so.
Known limits
- A 90°/270° rotation made in the viewer is stored in
metadata["rotation"]only, so such a file keeps the shape of its unrotated size (EXIF orientation is handled). - Renditions of a size whose shape stopped fitting a file (after an edit or a shape change) are kept, not removed; the reconciler does not add the new ones until the set’s revision moves.
phoenix_kit_sortable.js(the host-importable legacy loader) still loads SortableJS from jsDelivr.
i18n
- New strings (library notice, Shape filter, panorama badge, “Made for”) in all seven locales; the
encatalog’s two fuzzy flags are cleared.
PhoenixKit 2.58.0. Install or update: {:phoenix_kit, "~> 2.58"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.