Skip to content

OpenGraph 0.2.0: Translations, safer rendering and a cache that cleans up

OpenGraph 0.2.0 translates the admin into seven languages, makes rendering safe against crafted templates, keeps the image cache from growing forever, and stops previews from freezing the editor.

Translations and a working editor after navigation

The module now has its own translations for its common admin texts in German, Spanish, Estonian, French, Italian, Polish and Russian. Rarer editor texts still show in English.

The editor’s drag, resize and keyboard code used to be a script inside the page, which only ran on a full page load. Coming to the editor from the templates list left dragging and resizing dead. The code now ships as a bundle that PhoenixKit loads with the rest of the admin.

Safer rendering

Several holes in rendering are closed. Values placed into the SVG are now escaped, so a crafted canvas can no longer inject markup. Canvas width and height are capped at 4000 pixels, so an oversized canvas cannot make the renderer allocate an unbounded image. Image addresses that point to file:// are dropped, since with a command-line renderer they could read local files. Served images now carry X-Content-Type-Options: nosniff.

Previews that do not block

The previews in the editor and in the assignment modal now render in the background with a loading state. Before, one slow render could hold up the whole modal for up to five seconds. A preview that crashes or is replaced by a newer one no longer puts an internal error code into the flash message. Saving the same assignment twice at once now returns a form error instead of crashing the page.

A cache that cleans itself

Rendered PNGs on disk are now pruned: files older than 30 days go, and the oldest are removed above 5,000 files. Both limits and how often pruning runs can be set with :cache_ttl_seconds, :cache_max_files and :cache_prune_probability under config :phoenix_kit_og.

Better audit trail

Failed creates, updates and deletes now write an activity row marked as failed, not only successful ones. A failed update or delete still records which record it was aimed at.

Upgrading

OpenGraph 0.2 needs PhoenixKit 1.7.189 or later. No migration. On a live site the cache starts deleting old images; they are rendered again when next requested.

Full release notes: OpenGraph 0.2.0

0.2.0 · 20 July 2026

Added

  • Own PhoenixKitOG.Gettext backend + priv/gettext translations across 7 locales for the common UI string set (editor long-tail strings ride as English fallback pending a translation pass)
  • Editor JS hooks (drag/resize + keyboard) now ship via js_sources/0 as a prebuilt bundle (priv/static/assets/phoenix_kit_og.js) instead of an inline <script> — the inline script only ran on a hard page load, so navigating into the editor from the Templates list left drag/resize unregistered
  • On-disk render cache eviction — TTL + count cap, configurable via :cache_ttl_seconds / :cache_max_files / :cache_prune_probability
  • Variables.global_label/1 and Variables.global_description/1 — the canonical translated label/description for each OG-owned global variable
  • Failed create/update/delete actions now log a failed: true activity row (previously only successes were audited); a failed update/delete keeps its resource_uuid so the row still points at which record was targeted

Changed

  • Preview rendering (editor + assignments modal) now runs off the LiveView process via start_async/cancel_async, with a loading state — a synchronous rasterize could block the whole modal for up to the 5s backend timeout

Fixed

  • SVG injection — every interpolated geometry attribute and the glow-filter id are now escaped/sanitized; a crafted canvas can no longer break out of an attribute or inject markup
  • Canvas width/height are clamped (@max_dim 4000) on both the SVG viewBox and the rasterizer’s output buffer, preventing an oversized canvas from making the rasterizer allocate an unbounded pixel buffer
  • Image hrefs resolving to file:// are dropped instead of passed through — was a local-file-read primitive via a CLI rasterizer backend
  • Schemas.Assignment now declares unique_constraint/3 on its two partial unique indexes, so a concurrent double-save returns {:error, changeset} instead of raising Ecto.ConstraintError and crashing the LiveView
  • Served OG images now send X-Content-Type-Options: nosniff
  • A preview render that crashes or is superseded mid-flight no longer leaks an internal error tag into the flash message text

OpenGraph 0.2.0. Install or update: {:phoenix_kit_og, "~> 0.2"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.