mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35:24 +00:00
feat: community and custom plugin registries
This commit is contained in:
1 parent
1aa1bde5f7
commit
6a7afa94a0
31 files changed
+2903
-134
No files matched your search
@@ -21,6 +21,7 @@ import {
|
||||
unloadPlugin,
|
||||
} from "../../plugins/index.js";
|
||||
import { getPluginsDir } from "../../plugins/paths.js";
|
||||
import { setSyncedRegistryKeys } from "../../plugins/registries.js";
|
||||
import type { LoadedPlugin } from "../../plugins/loader.js";
|
||||
import {
|
||||
createCurrentPluginPermissionGrantRepository,
|
||||
@@ -283,10 +284,12 @@ async function mirrorOne(link: SyncLink, plugin: RemotePlugin): Promise<void> {
|
||||
}
|
||||
|
||||
export async function mirrorPlugins(link: SyncLink): Promise<void> {
|
||||
const { plugins } = await remoteJson<{ plugins: RemotePlugin[] }>(
|
||||
link,
|
||||
"/sync/v2/plugins",
|
||||
);
|
||||
const { plugins, registryKeys } = await remoteJson<{
|
||||
plugins: RemotePlugin[];
|
||||
registryKeys?: unknown[];
|
||||
}>(link, "/sync/v2/plugins");
|
||||
// Before any download: a plugin from a custom registry needs its key.
|
||||
await setSyncedRegistryKeys(Array.isArray(registryKeys) ? registryKeys : []);
|
||||
lastRemote = plugins;
|
||||
const remoteIds = new Set(plugins.map((plugin) => plugin.id));
|
||||
|
||||
|
||||
@@ -472,7 +472,7 @@ async function listPluginsForDesktop() {
|
||||
* /sync/v2/plugins:
|
||||
* get:
|
||||
* summary: The features this server runs, for a linked desktop to mirror
|
||||
* description: Every installed plugin with its version, where it came from, whether it is on, how a desktop should treat it and which sync entities it owns.
|
||||
* description: Every installed plugin with its version, where it came from, whether it is on, how a desktop should treat it and which sync entities it owns. registryKeys lists the signing keys of the custom registries an admin added, so plugins from them load on the desktop.
|
||||
* tags:
|
||||
* - Sync
|
||||
* responses:
|
||||
@@ -509,7 +509,9 @@ router.get(
|
||||
),
|
||||
});
|
||||
}
|
||||
res.json({ plugins });
|
||||
const { customRegistryKeys } =
|
||||
await import("../../plugins/registries.js");
|
||||
res.json({ plugins, registryKeys: await customRegistryKeys() });
|
||||
} catch (error) {
|
||||
syncLogger.error("Failed to list plugins for sync", error, {
|
||||
operation: "sync_plugins",
|
||||
|
||||
Reference in new issue
Block a user