mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35:24 +00:00
feat: namespace plugin permissions and keep them valid when a plugin is off
This commit is contained in:
1 parent
8431570ff7
commit
cc15559ea1
53 files changed
+31442
-351
No files matched your search
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Where a plugin's i18n keys resolve from.
|
||||
*
|
||||
* A manifest writes plugin-relative keys ("permissions.devices.view.title") so
|
||||
* it never has to know where the strings live. Today they live in core
|
||||
* en.json under `plugins.<pluginId>.`, because the frontend does not load
|
||||
* plugin locale bundles yet. When it does, that subtree moves into
|
||||
* plugins/<id>/locales/en.json as the plugin's own namespace and only this
|
||||
* function changes; no manifest is touched.
|
||||
*/
|
||||
export function pluginKey(pluginId: string, key: string): string {
|
||||
return `plugins.${pluginId}.${key}`;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { icons, type LucideProps } from "lucide-react";
|
||||
import { Puzzle } from "lucide-react";
|
||||
|
||||
/**
|
||||
* A manifest names its icon as a Lucide component name ("Sparkles").
|
||||
*
|
||||
* An unknown or missing name falls back to a generic plugin glyph rather than
|
||||
* rendering nothing, so a plugin shipping a typo still gets a row an admin can
|
||||
* read.
|
||||
*/
|
||||
export function PluginIcon({
|
||||
name,
|
||||
...props
|
||||
}: { name?: string } & LucideProps) {
|
||||
const Icon = (name && icons[name as keyof typeof icons]) || Puzzle;
|
||||
return <Icon {...props} />;
|
||||
}
|
||||
Reference in new issue
Block a user