mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35:24 +00:00
feat: type the plugin host record, move plugin strings out of core and add lint checks
This commit is contained in:
1 parent
bba06f7ff6
commit
b8bbcd2196
626 files changed
+23884
-4590
No files matched your search
@@ -1,10 +1,14 @@
|
||||
import { toast } from "sonner";
|
||||
import type { PluginApiClient, TermixApp } from "@termix/plugin-sdk/frontend";
|
||||
import type {
|
||||
PluginApiClient,
|
||||
PluginHostRecord,
|
||||
TermixApp,
|
||||
} from "@termix/plugin-sdk/frontend";
|
||||
|
||||
export function hasMacAddress(host: Record<string, unknown>): boolean {
|
||||
const settings = host.pluginSettings as
|
||||
Record<string, Record<string, unknown>> | undefined;
|
||||
const macAddress = settings?.["wake-on-lan"]?.macAddress;
|
||||
export function hasMacAddress(
|
||||
host: Pick<PluginHostRecord, "pluginSettings">,
|
||||
): boolean {
|
||||
const macAddress = host.pluginSettings?.["wake-on-lan"]?.macAddress;
|
||||
return typeof macAddress === "string" && macAddress.trim().length > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ export function activate(app: TermixApp): void {
|
||||
icon: Zap,
|
||||
kind: "open",
|
||||
order: 50,
|
||||
when: (host) => hasMacAddress(host as Record<string, unknown>),
|
||||
when: (host) => hasMacAddress(host),
|
||||
run: (host) => wakeHost(app.api, app.t, String(host.id)),
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user