mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-23 00:13:13 +09:00
Merge remote-tracking branch 'upstream/master' into feature/wait-for-plugin
This commit is contained in:
commit
7f688d2ed0
77 files changed
+2006
-693
No files matched your search
@@ -17,7 +17,6 @@ import path from "path";
|
||||
import yargs from "yargs";
|
||||
import packageConfig from "@clusterio/host/package.json" with { type: "json" };
|
||||
import winston from "winston";
|
||||
import "winston-daily-rotate-file";
|
||||
|
||||
// internal libraries
|
||||
// Reduce startup time by lazy compiling schemas.
|
||||
@@ -147,11 +146,10 @@ async function startHost() {
|
||||
.parseSync()
|
||||
;
|
||||
|
||||
logger.add(new winston.transports.DailyRotateFile({
|
||||
logger.add(new lib.DailyFileTransport({
|
||||
format: winston.format.json(),
|
||||
filename: "host-%DATE%.log",
|
||||
utc: true,
|
||||
dirname: path.join(args.logDirectory, "host"),
|
||||
prefix: "host",
|
||||
}));
|
||||
if (args.logLevel !== "none") {
|
||||
logger.add(new ConsoleTransport({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@clusterio/host",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"description": "Implementation of Clusterio host server",
|
||||
"homepage": "https://github.com/clusterio/clusterio#readme",
|
||||
"author": "Hornwitser <github@hornwitser.no>",
|
||||
@@ -49,7 +49,6 @@
|
||||
"semver": "catalog:",
|
||||
"set-blocking": "catalog:",
|
||||
"winston": "catalog:",
|
||||
"winston-daily-rotate-file": "catalog:",
|
||||
"yargs": "catalog:",
|
||||
"yazl": "catalog:"
|
||||
},
|
||||
|
||||
@@ -1054,6 +1054,39 @@ end`.replace(/\r?\n/g, " ");
|
||||
}
|
||||
|
||||
await this.syncMods();
|
||||
this.checkRequiredMods(this.activeModPack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the mod pack has the mods required by the loaded plugins
|
||||
*
|
||||
* @throws {lib.ConflictError} if a required mod is missing, disabled or the wrong version.
|
||||
*/
|
||||
checkRequiredMods(modPack: lib.ModPack) {
|
||||
const problems = [];
|
||||
for (const pluginInfo of this.loadedPlugins) {
|
||||
const unmet = [];
|
||||
for (const dependency of lib.pluginRequiredMods(pluginInfo)) {
|
||||
const mod = modPack.mods.get(dependency.name);
|
||||
if (!mod) {
|
||||
unmet.push(`${dependency.spec} (missing)`);
|
||||
} else if (!mod.enabled) {
|
||||
unmet.push(`${dependency.spec} (disabled)`);
|
||||
} else if (dependency.version && !dependency.version.testVersion(mod.version)) {
|
||||
unmet.push(`${dependency.spec} (found ${mod.version})`);
|
||||
}
|
||||
}
|
||||
if (unmet.length) {
|
||||
problems.push(`Plugin ${pluginInfo.name} requires ${unmet.join(", ")}.`);
|
||||
}
|
||||
}
|
||||
if (problems.length) {
|
||||
throw new lib.ConflictError(
|
||||
`Mod pack ${modPack.name} does not have the mods required by the loaded plugins. ` +
|
||||
`${problems.join(" ")} ` +
|
||||
"Add the mods to the mod pack or set <plugin>.load_plugin to false for this instance."
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user