Feat: Updating Mods button

This commit is contained in:
MCHost
2025-06-19 01:39:33 -04:00
parent 15f4564760
commit d2498c0cf8
4 changed files with 89 additions and 1 deletions

View File

@ -185,4 +185,19 @@ export async function writeServerProperties(docker, containerName, content) {
} catch (error) {
return { error: `Failed to write server.properties: ${error.message}` };
}
}
export async function updateMods(docker, containerName) {
try {
const container = docker.getContainer(containerName);
const inspect = await container.inspect();
if (inspect.State.Status !== 'running') {
return { error: `Container ${containerName} is not running` };
}
const { stdout, stderr } = await execPromise(`docker exec ${containerName} bash -c 'cd /home/mc/minecraft && mod-manager update'`);
if (stderr) return { output: stderr };
return { output: stdout || 'Mod update completed successfully.' };
} catch (error) {
return { error: `Failed to update mods: ${error.message}` };
}
}