Feat: Updating Mods button
This commit is contained in:
@ -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}` };
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user