This commit is contained in:
Pierre
2026-01-10 19:15:35 +01:00
parent 2a740d2488
commit b96024ed1e
4 changed files with 1221 additions and 82 deletions
+31
View File
@@ -1,3 +1,29 @@
/**
* MetaMesh Plugin: TMDB
*
* ============================================================================
* PLUGIN MOUNT ARCHITECTURE - DO NOT MODIFY WITHOUT AUTHORIZATION
* ============================================================================
*
* Each plugin container has exactly 3 mounts:
*
* 1. /files (READ-ONLY) - Shared media files, read access only
* 2. /cache (READ-WRITE) - Plugin-specific cache folder
* 3. /files/plugin/<name> (READ-WRITE for this plugin, READ-ONLY for others)
* - Plugin output folder for generated files
*
* SECURITY: Plugins must NEVER write to /files directly.
* - Use /cache for temporary/cache data
* - Use /files/plugin/<name> for output files (e.g., posters, generated assets)
*
* This architecture ensures:
* - Plugins cannot corrupt user's media files
* - Plugins can share generated assets with other plugins (read-only)
* - Each plugin has isolated cache storage
*
* ============================================================================
*/
import Fastify from 'fastify';
import type { HealthResponse, ProcessRequest, ProcessResponse, CallbackPayload, ConfigureRequest, ConfigureResponse } from './types.js';
import { manifest, process as processFile, configure } from './plugin.js';
@@ -16,6 +42,11 @@ app.post<{ Body: ConfigureRequest }>('/configure', async (request): Promise<Conf
return { status: 'error', error: error instanceof Error ? error.message : String(error) };
}
});
app.post('/recompute', async () => {
configure({ forceRecompute: true });
console.log(`[${manifest.id}] Recompute mode enabled`);
return { status: 'ok', message: 'Recompute mode enabled' };
});
app.post<{ Body: ProcessRequest }>('/process', async (request, reply) => {
const { taskId, cid, filePath, callbackUrl, metaCoreUrl } = request.body;
if (!taskId || !cid || !filePath || !callbackUrl || !metaCoreUrl) {