diff --git a/packages/controller/src/Controller.ts b/packages/controller/src/Controller.ts index 89214e0f..4ad9e6f0 100644 --- a/packages/controller/src/Controller.ts +++ b/packages/controller/src/Controller.ts @@ -937,6 +937,7 @@ export default class Controller { ); } else { instance.status = "unassigned"; + instance.updatedAt = Date.now(); this.instanceDetailsUpdated([instance]); } } diff --git a/packages/controller/src/HostConnection.ts b/packages/controller/src/HostConnection.ts index f4cf1d84..ec078553 100644 --- a/packages/controller/src/HostConnection.ts +++ b/packages/controller/src/HostConnection.ts @@ -57,6 +57,7 @@ export default class HostConnection extends BaseConnection { } this.connector.on("close", () => { + const now = Date.now(); // Update status to unknown for instances on this host. const instances: InstanceInfo[] = []; for (let instance of this._controller.instances.values()) { @@ -67,6 +68,7 @@ export default class HostConnection extends BaseConnection { instances.push(instance); let prev = instance.status; instance.status = "unknown"; + instance.updatedAt = now; lib.invokeHook(this._controller.plugins, "onInstanceStatusChanged", instance, prev); } this._controller.instanceDetailsUpdated(instances); diff --git a/packages/controller/src/HostInfo.ts b/packages/controller/src/HostInfo.ts index 7a7a105e..93f41fd3 100644 --- a/packages/controller/src/HostInfo.ts +++ b/packages/controller/src/HostInfo.ts @@ -8,7 +8,7 @@ export default class HostInfo { constructor( /** Id of this host */ public id: number, - /** Version this host last connected with */ + /** Name of this host */ public name: string, /** Version this host last connected with */ public version: string, diff --git a/packages/create/create.js b/packages/create/create.js index a50b5dbd..7fcc62bc 100755 --- a/packages/create/create.js +++ b/packages/create/create.js @@ -281,6 +281,14 @@ async function migrateRename(args) { await migrateLogsDir(path.join("logs", "cluster-prerename"), path.join("logs", "cluster")); } + if ( + await fs.pathExists("sharedMods") + && !await fs.pathExists("mods") + ) { + logger.info("Moving sharedMods/ to mods/"); + await fs.rename("sharedMods", "mods"); + } + if (!args.dev) { let pkg = JSON.parse(await fs.readFile("package.json")); if (pkg.dependencies) { @@ -297,9 +305,27 @@ async function migrateRename(args) { await execFile(`npm${scriptExt}`, ["update"]); } + const hasRunMaster = await fs.pathExists("run-master.sh") || await fs.pathExists("run-master.cmd"); + const hasRunSlave = await fs.pathExists("run-slave.sh") || await fs.pathExists("run-slave.cmd"); + if (hasRunMaster || hasRunSlave) { + logger.info("Writing run scripts"); + let mode = "standalone"; + if (!hasRunSlave) { mode = "controller"; } + if (!hasRunMaster) { mode = "host"; } + await writeScripts(mode); + } + logger.info( "Migration complete, you may now delete the following left over files and directories (if present):" + - "\n- config-master.json\n- config-slave.json\n- logs/master\n- logs/slave\n- logs/cluster-prerename" + "\n- config-master.json" + + "\n- config-slave.json" + + "\n- logs/master" + + "\n- logs/slave" + + "\n- logs/cluster-prerename" + + "\n- systemd/clusteriomaster.service" + + "\n- systemd/clusterioslave.service" + + "\n- run-master.sh / run-master.cmd" + + "\n- run-slave.sh / run-slave.cmd" ); } @@ -348,7 +374,7 @@ async function installClusterio(mode, plugins) { for (let plugin of plugins) { if (!pluginList.has(plugin)) { // eslint-disable-next-line node/global-require - let pluginInfo = require(require.resolve(path.posix.join(plugin, "info"), { paths: [process.cwd()] })); + let pluginInfo = require(require.resolve(plugin, { paths: [process.cwd()] })).plugin; pluginList.set(pluginInfo.name, plugin); } } diff --git a/packages/lib/src/data/messages_core.ts b/packages/lib/src/data/messages_core.ts index 4a84e9c4..67ea64a5 100644 --- a/packages/lib/src/data/messages_core.ts +++ b/packages/lib/src/data/messages_core.ts @@ -19,10 +19,10 @@ export type AddressShorthand = export class Address { /** Controller address */ static controller = 0; - /** Instance address */ - static instance = 1; /** Host address */ - static host = 2; + static host = 1; + /** Instance address */ + static instance = 2; /** Control address */ static control = 3; /** Broadcast */ diff --git a/packages/web_ui/src/components/ModDetails.tsx b/packages/web_ui/src/components/ModDetails.tsx index f630f01d..973480fb 100644 --- a/packages/web_ui/src/components/ModDetails.tsx +++ b/packages/web_ui/src/components/ModDetails.tsx @@ -14,7 +14,11 @@ export default function ModDetails(props: let screens = useBreakpoint(); const mod: Partial & Partial = props.mod; - return + return {mod.error && Error} span={2} @@ -29,10 +33,14 @@ export default function ModDetails(props: && {props.actions(props.mod)} } - {mod.title && {mod.title}} - {mod.version && {mod.version}} - {mod.description && {mod.description} } - {mod.author && {mod.author}} + {Boolean(mod.title) && {mod.title}} + {Boolean(mod.version) + && {mod.version} + } + {Boolean(mod.description) + && {mod.description} + } + {Boolean(mod.author) && {mod.author}} @@ -40,17 +48,17 @@ export default function ModDetails(props: - {mod.contact && {mod.contact}} - {mod.homepage && {mod.homepage}} + {Boolean(mod.contact) && {mod.contact}} + {Boolean(mod.homepage) && {mod.homepage}} {mod.name} - {mod.factorioVersion + {Boolean(mod.factorioVersion) && {mod.factorioVersion} } - {mod.filename && {mod.filename}} + {Boolean(mod.filename) && {mod.filename}} {mod.size !== undefined && {lib.formatBytes(mod.size)} } - {mod.sha1 && {mod.sha1}} + {Boolean(mod.sha1) && {mod.sha1}} {mod.dependencies && mod.dependencies.length && {mod.dependencies diff --git a/plugins/player_auth/package.json b/plugins/player_auth/package.json index da721e6c..d3ff154a 100644 --- a/plugins/player_auth/package.json +++ b/plugins/player_auth/package.json @@ -23,7 +23,7 @@ "dependencies": { "@sinclair/typebox": "^0.30.4", "express": "^4.16.2", - "jsonwebtoken": "^8.2.1" + "jsonwebtoken": "^9.0.1" }, "devDependencies": { "@clusterio/lib": "^2.0.0-alpha.13",