Skip to content

OpenStation Integration

Nick Hamze edited this page Sep 5, 2026 · 2 revisions

OpenStation integration

Relay is an actual App Framework app, not an iframe dressed as a native window.

Registration

relay.php appends its apps directory through openstation_apps_directories. OpenStation discovers apps/relay/relay.os.php, which returns OpenStation\App::define('relay').

The app declares:

  • Relay title, envelope icon, 880×680 initial size, 320×360 minimum, and dock placement.
  • manage_options capability gate. Network-admin and user-admin requests are excluded; individual multisite sites remain supported.
  • Typed local state for folders, search, filters, selection, snooze, and settings.
  • Shared actions for bulk archive, Undo, snooze, restore, read/unread, pin/unpin, retention, sender rules, history deletion, and source-page visits.
  • A shared-runtime Refresh title-bar button, plus refresh on focus and restore.
  • Data computed from the acting administrator's current-site records and an unread-active badge effect.

The collector still runs on ordinary WordPress admin pages, including admin pages inside OpenStation. No background crawl impersonates a user or executes plugin admin callbacks off-screen.

Client and components

relay-client.js registers via the documented openStationAppsPending queue. It receives defineApp, html, and formatDate from the shared runtime. OpenStation loads it using App::client() and loads the app stylesheet through App::style().

Folder selection, search, and notice-type filtering run locally over already-fetched records. Persistence goes through framework dispatch. The view uses <os-button>, <os-text-field>, <os-select>, <os-option>, and <os-badge>. Escaping comes from the framework's html tag, and styling reads the shared --os-ui-* and --os-app-tone tokens.

The source-page action accepts only a stored notice id. The server looks up its sanitized admin URL and calls $os->open_url(); a caller cannot supply an arbitrary destination.

Shared behavior

Both views call the same atomic store. The native app watches a user/site-scoped content-change type. Native dispatch effects announce updates; the shared transport invalidates other browser contexts without sending notice text. A successful server response updates the dock, side dock, and desktop-icon badge where those surfaces are available.

The transport registers Relay's admin URL using wp.os.registerNativeUrlRemap() after OpenStation is ready. Menu links, dock items, and shortcuts that use that URL resolve through the same native registry. Without the framework, the WordPress page remains available.

Framework reference

Verified against the official WordPress/openstation source at commit a48d37b8bfdc6453056eb9345ff610c396a71e15 (plugin version 1.1.6). The App Framework remains experimental upstream.

Clone this wiki locally