Skip to content

PhoenixKit 2.38.0: Media libraries, per-user table columns and a faster media page

PhoenixKit 2.38.0 introduces media libraries, saves each admin’s table column choices separately, and makes the media page fast again on sites with many catalogue items.

Media libraries

Every file and media folder now belongs to a library. Everything that exists is in one system library, Media, and anything that names no library keeps landing there, so nothing changes until a second library is created. Libraries are managed on a new Libraries tab under Settings → Media: create, rename and delete an empty one, with file and folder counts and size.

The Media page shows a library switcher only when there are two or more. Media stays at /admin/media, and each other library gets its own address, such as /admin/media/library/brand-assets. Each library has its own folders, and files and folders cannot move between libraries.

Table columns per user

The column settings on the Users and website access tables are now saved for each user. The old site-wide settings become everyone’s starting point.

Faster media page

On sites with many catalogue items, the media page and opening a folder could take seconds because of the orphan count. The count now runs in a fraction of the time, and the folder icon shows a spinner while a click waits.

Other changes

  • Stored files open in the browser only if they are images, video, audio, PDF or plain text; everything else downloads.
  • The image viewer zooms and pans at the intended speed with a mouse wheel or in Firefox, with Fresco 0.13.
  • Erasing the last shape on an annotated image now updates its burned-in copy.
  • The upload summary in the media browser shows again, and file names with quotes, line breaks or non-ASCII characters no longer break downloads.
  • Concurrent folder moves can no longer create a folder loop.
  • Edit forms can open in the language the page is viewed in.
  • Modules get shared toolkits: activity logging, a tree picker, per-record media folders, uploads and per-user table columns.

Upgrading

Run mix phoenix_kit.update for migrations V201 and V202. V202 adds a library column to files, media folders and folder links whose default is Media, so existing rows are not rewritten. Its three new indexes on the files table are built plainly and hold back uploads while they build, so on a very large media table run the update at a quiet time. To return the Users table to the built-in columns, delete the old user_table_columns and website_access_attempt_columns settings rows.

Full release notes: PhoenixKit 2.38.0

2.38.0 · 23 September 2026

Added

  • Shared toolkits for modules (#860). PhoenixKit.Activity.log/3 (a module key, an action and options; it never raises) and PhoenixKitWeb.Actor (who is acting: the scope first, then the current user). PhoenixKitWeb.Components.TreePicker with Utils.Tree and Utils.TreeQuery. Per-record media folders (Storage.ResourceFolders, and the reorganizer’s ResourceSource). The upload toolkit PhoenixKitWeb.Attachments. Per-user table columns (Users.ViewPrefs, PhoenixKitWeb.TableColumns). Modules that call Activity.log/3 or Actor must feature-detect them while they keep the open ~> 2.0 core pin.
  • Migration V201: phoenix_kit_user_view_prefs, one row per user and view.
  • Edit forms can open on the language the page is being viewed in (open_on: :viewing_language).
  • Storage libraries, phase 1 (migration V202). Every file, media folder and folder link now belongs to a library, and everything that exists is in one system library, Media. A writer that names no library, in core or in a module, keeps landing in Media, so nothing changes until a second library is created. Libraries are managed in a new Settings → Media → Libraries tab: create, rename and delete an empty one, with each library’s file and folder counts and size. The Media page shows a library switcher only once there are two or more; with one, it says nothing about libraries. Media stays at /admin/media, and every other library gets a URL named after it (/admin/media/library/brand-assets). Each library keeps its own folders, and folder names are unique per library. New files in a library are stored under its own object-key prefix. Files and folders cannot cross from one library to another. New API: PhoenixKit.Modules.Storage.Libraries, a library_uuid: option on Storage.store_file_in_buckets/7, and a library_uuid: filter on the root-level listing, search, orphan and trash functions (empty_trash/2 included). Plan: dev_docs/plans/2026-09-22-storage-libraries.md.

Changed

  • fresco 0.13 (#866), with etcher 0.17.1 and tessera 0.3.8. On a mouse or in Firefox, the scroll wheel now zooms and pans the image viewer at the intended speed. On 0.12 it barely moved.

  • The column settings on the Users and website-access tables are saved per user (#860). The old site-wide user_table_columns / website_access_attempt_columns values become the starting default for everyone. No screen edits them any more; delete those two settings rows to go back to the built-in columns. Modules that kept per-user columns in custom_fields move their own data when they adopt TableColumns.

  • A stored file is shown in place only if it is an image, video, audio, PDF or plain text (#860). Everything else downloads, and every response carries nosniff. On a public bucket such a download is a one-hour signed bucket URL that makes the bucket answer attachment (#860 review). The bytes still come from the bucket, not the app, but these downloads skip cdn_url. Media is unchanged.

Fixed

  • The media page no longer takes seconds to load, or to open a folder, on sites with many catalogue items (#864). The orphan count checked every file against every catalogue row with a JSON containment test. It now expands media_order and matches by equality: 8 s → 0.15 s on a live shop. While a folder click waits, the sidebar icon shows a spinner.
  • Rubbing out the last shape on an annotated image now updates its burned copy (#865). Before, the burned copy kept the markup that had been erased. Closing the editor no longer burns and uploads the same drawing twice. A viewer open on the same picture elsewhere now switches to a new burned copy when one is stored, but not while its own editor is open.
  • Folder moves, trash and uploads (#860):
    • Two concurrent moves can no longer commit a folder cycle, and a move can no longer deadlock with the reorganizer.
    • Trashing a folder is consistent with a concurrent move.
    • A re-uploaded trashed file no longer returns to the folder it was removed from.
  • Removing a file from a folder no longer crashes when a linked folder is trashed at the same moment (#860 review), and the “file trashed” event now fires after the change commits.
  • ResourceFolders.purge_named/1 refuses a folder name with no uuid in it (#860 review), instead of deleting every folder with that name.
  • The upload summary in the media browser shows again. The “N files uploaded” message was set on the browser component, where the page never displayed it. Uploading, into a second library, a file you already have in another one now says so instead of reporting a missing storage bucket.
  • A file name with a quote, a line break or non-ASCII characters no longer breaks the download header (#860 review). A line break used to cause a 500.

Migration notes

  • V202 adds phoenix_kit_storage_libraries and a NOT NULL library_uuid on phoenix_kit_files, phoenix_kit_media_folders and phoenix_kit_media_folder_links. The column’s default is Media’s fixed uuid (00000000-0000-7000-8000-000000000001), so existing rows are not rewritten. Validating the NOT NULL and the foreign keys scans each table once, without blocking writes. The three new indexes on phoenix_kit_files are plain builds, so uploads wait while they build; on a very large media table, run the update in a quiet window.

  • A database that ran an unreleased build of V202 (a git dependency on main before the library URL slugs landed) has no phoenix_kit_storage_libraries.slug column. Set its marker back with COMMENT ON TABLE phoenix_kit IS '201' and run the update: V202 is re-runnable, adds the column and gives existing libraries their slugs.

  • A database that ran an early build of the #860 branch, when its migration was numbered V200, reads as version 200 without the capture-date columns. Set its marker back with COMMENT ON TABLE phoenix_kit IS '199' and let V200 and V201 run.


PhoenixKit 2.38.0. Install or update: {:phoenix_kit, "~> 2.38"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.