From 449c4efbb7d2b54d8dbfb641cf15644a672ed741 Mon Sep 17 00:00:00 2001 From: neru Date: Wed, 14 Jan 2026 22:52:02 -0300 Subject: [PATCH] fix: mod import validation --- src/modules/tts.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/modules/tts.ts b/src/modules/tts.ts index 39554f4..35ab4e8 100644 --- a/src/modules/tts.ts +++ b/src/modules/tts.ts @@ -49,13 +49,16 @@ export class TTSManager { if (!isModule(filePath)) return; const modRaw = await import(`file://${filePath}`); - - if (!modRaw || !modRaw.default) { - this.log.warning('Invalid module format in %s', filePath); + if (!modRaw) { + this.log.warning('Mod import failed for %s', filePath); return; } - const mod = modRaw.default as TTSModule; + const mod = (modRaw.default?.default || modRaw.default || modRaw) as TTSModule; + if (!mod.name || typeof mod.generate !== 'function') { + this.log.warning('Invalid module format in %s', filePath); + return; + } this.log.verbose(`Loaded TTS mode: ${mod.name}`); this.modules.push(mod);