mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-11-04 16:14:07 +00:00
api.host.features.sidePanel now says whether this plugin may offer the app-side-panel (ui:side-panel granted), not only that the webmail has it. A plugin enabled before an update added the permission can then say so instead of offering a switch that does nothing. The host computes the assistant's flags per plugin for a frame's init and for each push. plugin-host-features.test.ts: the host bridge assertions take the assistant's flags as the test plugin sees them (it lacks ui:side-panel, so sidePanel is false there).
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
// Area f of the assistant's host APIs, host side (see README.md).
|
|
//
|
|
// Area f adds no methods: the app-side-panel slot (plugin-slot-catalog.ts,
|
|
// gated by ui:side-panel) and its panel requests (panel-requests.ts) are
|
|
// the whole host side, mounted by components/plugins/app-side-panel.tsx.
|
|
|
|
import type { InstalledPlugin, Permission } from '../../plugin-types';
|
|
import { mayOfferSlot } from '../permissions';
|
|
import { NOT_MINE } from './not-mine';
|
|
import type { AreaHostFeaturesF } from './f.types';
|
|
|
|
/** Method → permission, joined into PERM_PER_METHOD. */
|
|
export const PERMS: Readonly<Record<string, Permission | null>> = {};
|
|
|
|
/** Runs a method of this area; NOT_MINE for any other. */
|
|
export async function dispatch(_plugin: InstalledPlugin, _method: string, _args: unknown[]): Promise<unknown> {
|
|
return NOT_MINE;
|
|
}
|
|
|
|
/**
|
|
* This area's flags in api.host.features, right now. For one plugin,
|
|
* sidePanel says whether it may show the panel (ui:side-panel granted; a
|
|
* plugin enabled before an update that added it lacks it until turned off
|
|
* and on), so it can tell the user instead of offering a switch that does
|
|
* nothing.
|
|
*/
|
|
export function features(plugin?: InstalledPlugin): AreaHostFeaturesF {
|
|
return { sidePanel: plugin ? mayOfferSlot(plugin, 'app-side-panel') : true };
|
|
}
|