mirror of
https://github.com/stablyai/orca.git
synced 2026-11-15 18:37:24 +00:00
* feat(plugins): let plugins contribute web fonts to the font pickers Plugins declare font families under contributes.fonts (WOFF/WOFF2 only). Install checks each file's signature against its extension and caps file size, family count and plugin total; main never parses a font. Files are served over the plugin image scheme only while the plugin is enabled, typed and nosniff. The renderer registers each family under a name that carries the plugin key, so a plugin font cannot shadow an installed or built-in font, and it applies only once the user picks it. Disabling or uninstalling removes the faces; uninstalling also resets font settings that named them. Refs #38607 * fix(plugins): harden plugin fonts and re-measure editors when they load - Refuse WOFF/WOFF2-wrapped font collections by checking the flavor bytes. - Check dev folders' font files at discovery, not only at install. - Re-check family, weight and style from the plugin list in the renderer. - Track loaded families (case-insensitively) from document font loads, so the code editor re-measures and terminals, previews, the SSH terminal and the dashboard popout re-apply only when their own font changes. - Register plugin fonts in the dashboard popout window. - Give dev-folder font URLs their change count so edits reload. - Keep monospace fallbacks unless the chosen family is exactly that font. * fix(terminal): keep every fallback only for plugin font families System font choices keep their existing fallback list unchanged. * fix(plugins): leave the dashboard popout's plugin list alone; add the font row string Registering fonts there started the plugin auto-update watcher in a window with no toaster, which could consume update notices. Adds the new contribution-row string to the English catalog and the fonts list to the RPC test manifest.
36 lines
1.5 KiB
TypeScript
36 lines
1.5 KiB
TypeScript
import { pluginThemeSettingsAfterRemoval } from '../../shared/plugin-theme-settings'
|
|
import { pluginFontSettingsAfterRemoval } from '../../shared/plugin-font-settings'
|
|
import { normalizePluginIdList } from '../../shared/plugins/approval/plugin-consent-state'
|
|
import type { Store } from '../persistence/loading-store/store'
|
|
|
|
/**
|
|
* Forgets a removed plugin's consent, disabled flag, allowed external hosts, theme and font choices.
|
|
* `keepDisabled`: Orca republishes a copy it ships on the next launch; that copy comes back off.
|
|
*/
|
|
export function clearRemovedPluginSettings(
|
|
store: Pick<Store, 'getSettings' | 'updateSettings'>,
|
|
pluginKey: string,
|
|
{ keepDisabled = false }: { keepDisabled?: boolean } = {}
|
|
): void {
|
|
const settings = store.getSettings()
|
|
const consents = { ...settings.pluginConsents }
|
|
delete consents[pluginKey]
|
|
const pluginExternalHostGrants = { ...settings.pluginExternalHostGrants }
|
|
delete pluginExternalHostGrants[pluginKey]
|
|
const disabledPlugins = [
|
|
...normalizePluginIdList(settings.disabledPlugins).filter((key) => key !== pluginKey),
|
|
...(keepDisabled ? [pluginKey] : [])
|
|
]
|
|
store.updateSettings(
|
|
{
|
|
pluginConsents: consents,
|
|
disabledPlugins,
|
|
pluginExternalHostGrants,
|
|
...pluginThemeSettingsAfterRemoval(settings, pluginKey),
|
|
...pluginFontSettingsAfterRemoval(settings, pluginKey)
|
|
},
|
|
// Why no origin: the uninstalling window must also drop the plugin's theme and font choices.
|
|
{ notifyListeners: true }
|
|
)
|
|
}
|