From 51b9585fba1ff92cf3f676de3fc35ffd5ec0de43 Mon Sep 17 00:00:00 2001 From: KingKDot Date: Thu, 19 Mar 2026 20:05:45 -0500 Subject: [PATCH] don't require binaries to be present for super basic plugins --- Overlord-Server/src/server/plugin-state-bundle.ts | 14 ++++++++------ Overlord-Server/src/server/routes/plugin-routes.ts | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Overlord-Server/src/server/plugin-state-bundle.ts b/Overlord-Server/src/server/plugin-state-bundle.ts index 4474998..91d6748 100644 --- a/Overlord-Server/src/server/plugin-state-bundle.ts +++ b/Overlord-Server/src/server/plugin-state-bundle.ts @@ -92,10 +92,6 @@ export async function ensurePluginExtracted( } } - const hasNative = nativeBinaries.size > 0; - if (!hasNative) { - throw new Error(`Invalid plugin bundle: ${safeId} (no native binaries found)`); - } if (!htmlEntry || !cssEntry || !jsEntry) { throw new Error(`Invalid plugin bundle: ${safeId} (missing .html, .css, or .js)`); } @@ -183,7 +179,7 @@ export async function loadPluginBundle( ensureExtracted: (pluginId: string) => Promise, clientOS?: string, clientArch?: string, -): Promise<{ manifest: PluginManifest; binary: Uint8Array }> { +): Promise<{ manifest: PluginManifest; binary: Uint8Array | null }> { await ensureExtracted(pluginId); const dir = path.join(pluginRoot, pluginId); const manifestPath = path.join(dir, "manifest.json"); @@ -192,6 +188,11 @@ export async function loadPluginBundle( manifest.id = manifest.id || pluginId; manifest.name = manifest.name || pluginId; + const hasBinaries = manifest.binaries && Object.keys(manifest.binaries).length > 0; + if (!hasBinaries) { + return { manifest, binary: null }; + } + let binaryPath: string | null = null; if (manifest.binaries && clientOS && clientArch) { @@ -224,8 +225,9 @@ export async function loadPluginBundle( export function sendPluginBundle( target: ClientInfo, - bundle: { manifest: PluginManifest; binary: Uint8Array }, + bundle: { manifest: PluginManifest; binary: Uint8Array | null }, ): void { + if (!bundle.binary) return; const chunkSize = 16 * 1024; const data = bundle.binary; const totalChunks = Math.ceil(data.length / chunkSize); diff --git a/Overlord-Server/src/server/routes/plugin-routes.ts b/Overlord-Server/src/server/routes/plugin-routes.ts index ce96216..1756739 100644 --- a/Overlord-Server/src/server/routes/plugin-routes.ts +++ b/Overlord-Server/src/server/routes/plugin-routes.ts @@ -14,7 +14,7 @@ type PluginManifest = { type PluginBundle = { manifest: PluginManifest; - binary: Uint8Array; + binary: Uint8Array | null; }; type PluginState = {