diff --git a/package.json b/package.json index 2fb56dfa..67323b9e 100644 --- a/package.json +++ b/package.json @@ -26,16 +26,16 @@ "@clusterio/ctl": "workspace:*", "@clusterio/host": "workspace:*", "@clusterio/lib": "workspace:*", - "eslint": "^8.18.0", + "eslint": "^8.45.0", "eslint-plugin-node": "^11.1.0", - "express": "^4.16.2", + "express": "^4.18.2", "form-data": "^4.0.0", - "fs-extra": "^8.1.0", + "fs-extra": "^11.1.1", "jsdoc": "^4.0.2", - "jsonwebtoken": "^8.2.1", - "jszip": "^3.2.2", - "mocha": "^9.2.2", + "jsonwebtoken": "^9.0.1", + "jszip": "^3.10.0", + "mocha": "^10.2.0", "nyc": "^15.1.0", - "phin": "^3.5.1" + "phin": "^3.7.0" } } diff --git a/packages/controller/package.json b/packages/controller/package.json index 0d2973d7..e78fe6b3 100644 --- a/packages/controller/package.json +++ b/packages/controller/package.json @@ -20,27 +20,27 @@ }, "dependencies": { "@clusterio/lib": "^2.0.0-alpha.13", - "busboy": "^0.3.1", - "compression": "^1.7.2", - "express": "^4.16.2", - "fs-extra": "^8.1.0", - "jsonwebtoken": "^8.2.1", - "jszip": "^3.2.2", + "busboy": "^1.6.0", + "compression": "^1.7.4", + "express": "^4.18.2", + "fs-extra": "^11.1.1", + "jsonwebtoken": "^9.0.1", + "jszip": "^3.10.1", "set-blocking": "^2.0.0", - "webpack-cli": "^4.9.2", - "winston": "^3.3.3", - "winston-daily-rotate-file": "^4.5.5", - "ws": "^7.2.3", - "yargs": "^14.2.0" + "webpack-cli": "^5.1.4", + "winston": "^3.10.0", + "winston-daily-rotate-file": "^4.7.1", + "ws": "^8.13.0", + "yargs": "^17.7.2" }, "devDependencies": { "@clusterio/web_ui": "^2.0.0-alpha.13", "react": "^16.13.1", "react-dom": "^16.13.1", "react-router-dom": "^5.2.0", - "webpack": "^5.73.0", - "webpack-dev-middleware": "^5.3.1", - "webpack-merge": "^5.2.0" + "webpack": "^5.88.2", + "webpack-dev-middleware": "^6.1.1", + "webpack-merge": "^5.9.0" }, "publishConfig": { "access": "public" diff --git a/packages/controller/src/routes.js b/packages/controller/src/routes.js index 04a98bf1..7f6a6ace 100644 --- a/packages/controller/src/routes.js +++ b/packages/controller/src/routes.js @@ -1,5 +1,5 @@ "use strict"; -const Busboy = require("busboy"); +const busboy = require("busboy"); const crypto = require("crypto"); const events = require("events"); const fs = require("fs-extra"); @@ -304,7 +304,7 @@ async function getStream(req, res) { } stream.source.pipe(res); stream.flowing = true; - res.on("finish", () => { + res.on("close", () => { stream.events.emit("close"); }); clearTimeout(stream.timeout); @@ -342,7 +342,7 @@ async function uploadSave(req, res) { res.status(415).json({ request_errors: ["invalid Content-Type"] }); return; } - let mimeType = match[1].toLowerCase(); + let contentMime = match[1].toLowerCase(); let tasks = []; let errors = []; @@ -381,16 +381,16 @@ async function uploadSave(req, res) { } } - if (mimeType === "multipart/form-data") { + if (contentMime === "multipart/form-data") { await new Promise(resolve => { let fields = {}; - let busboy = new Busboy({ headers: req.headers }); - busboy.on("file", (fieldname, stream, filename, transferEncoding, fileMime) => { + let parser = busboy({ headers: req.headers }); + parser.on("file", (name, stream, { filename, mimeType }) => { if (fields.instanceId === undefined) { requestErrors.push("instance_id must come before files uploaded"); } - if (!zipMimes.includes(fileMime)) { + if (!zipMimes.includes(mimeType)) { requestErrors.push("invalid file Content-Type"); } @@ -403,25 +403,25 @@ async function uploadSave(req, res) { return; } - tasks.push(handleFile(fields.instanceId, stream, filename, fileMime)); + tasks.push(handleFile(fields.instanceId, stream, filename, mimeType)); }); - busboy.on("field", (fieldname, value, fieldnameTruncated, valueTruncated, transferEncoding, valueMime) => { - if (fieldname === "instance_id") { + parser.on("field", (name, value, info) => { + if (name === "instance_id") { fields.instanceId = Number.parseInt(value, 10); if (Number.isNaN(fields.instanceId)) { requestErrors.push("invalid instance_id"); } } }); - busboy.on("finish", resolve); - busboy.on("error", (err) => { + parser.on("close", resolve); + parser.on("error", (err) => { logger.error(`Error parsing multipart request in upload-save:\n${err.stack}`); errors.push(err.message); }); - req.pipe(busboy); + req.pipe(parser); }); - } else if (zipMimes.includes(mimeType)) { + } else if (zipMimes.includes(contentMime)) { let filename = req.query.filename; if (typeof filename !== "string") { requestErrors.push("Missing or invalid filename parameter"); @@ -436,7 +436,7 @@ async function uploadSave(req, res) { if (errors.length || requestErrors.length) { req.resume(); } else { - tasks.push(handleFile(instanceId, req, filename, mimeType)); + tasks.push(handleFile(instanceId, req, filename, contentMime)); } } else { @@ -482,7 +482,7 @@ async function uploadMod(req, res) { res.status(415).json({ request_errors: ["invalid Content-Type"] }); return; } - let mimeType = match[1].toLowerCase(); + let contentMime = match[1].toLowerCase(); let tasks = []; let errors = []; @@ -544,11 +544,11 @@ async function uploadMod(req, res) { } } - if (mimeType === "multipart/form-data") { + if (contentMime === "multipart/form-data") { await new Promise(resolve => { - let busboy = new Busboy({ headers: req.headers }); - busboy.on("file", (fieldname, stream, filename, transferEncoding, fileMime) => { - if (!zipMimes.includes(fileMime)) { + let parser = busboy({ headers: req.headers }); + parser.on("file", (name, stream, { filename, mimeType }) => { + if (!zipMimes.includes(mimeType)) { requestErrors.push("invalid file Content-Type"); } @@ -563,15 +563,15 @@ async function uploadMod(req, res) { tasks.push(handleFile(stream, filename)); }); - busboy.on("finish", resolve); - busboy.on("error", (err) => { + parser.on("close", resolve); + parser.on("error", (err) => { logger.error(`Error parsing multipart request in upload-mod:\n${err.stack}`); errors.push(err.message); }); - req.pipe(busboy); + req.pipe(parser); }); - } else if (zipMimes.includes(mimeType)) { + } else if (zipMimes.includes(contentMime)) { let filename = req.query.filename; if (typeof filename !== "string") { requestErrors.push("Missing or invalid filename parameter"); diff --git a/packages/create/package.json b/packages/create/package.json index 6a828ccf..59f53d62 100644 --- a/packages/create/package.json +++ b/packages/create/package.json @@ -16,11 +16,11 @@ "node": ">=18" }, "dependencies": { - "chalk": "^4.1.0", - "fs-extra": "^8.1.0", - "inquirer": "^8.1.0", - "phin": "^3.5.1", - "yargs": "^14.2.0" + "chalk": "^4.1.2", + "fs-extra": "^11.1.1", + "inquirer": "^8.2.4", + "phin": "^3.7.0", + "yargs": "^17.7.2" }, "publishConfig": { "access": "public" diff --git a/packages/ctl/package.json b/packages/ctl/package.json index 880aae1e..de09a5d0 100644 --- a/packages/ctl/package.json +++ b/packages/ctl/package.json @@ -19,12 +19,12 @@ }, "dependencies": { "@clusterio/lib": "^2.0.0-alpha.13", - "as-table": "^1.0.31", - "fs-extra": "^8.1.0", - "phin": "^3.5.1", + "as-table": "^1.0.55", + "fs-extra": "^11.1.1", + "phin": "^3.7.0", "set-blocking": "^2.0.0", - "winston": "^3.3.3", - "yargs": "^14.2.0" + "winston": "^3.10.0", + "yargs": "^17.7.2" }, "publishConfig": { "access": "public" diff --git a/packages/ctl/src/commands.js b/packages/ctl/src/commands.js index c3a437e5..c4c908bb 100644 --- a/packages/ctl/src/commands.js +++ b/packages/ctl/src/commands.js @@ -381,6 +381,9 @@ instanceConfigCommands.add(new libCommand.Command({ // with the all the layers of quote removal at play is difficult. // See the following table for how to pass "That's a \" quote" in // different environments: + // ----------------------- WARNING ------------------------------- + // This table is most likely invalid due a change in yargs parsing + // --------------------------------------------------------------- // cmd : """""That's a \\"" quote""""" // cmd + npx : """""""""""That's a \\\\"""" quote""""""""""" // PowerShell : '"""""That''s a \\"" quote"""""' diff --git a/packages/host/package.json b/packages/host/package.json index 0f47fa28..71337771 100644 --- a/packages/host/package.json +++ b/packages/host/package.json @@ -19,13 +19,13 @@ }, "dependencies": { "@clusterio/lib": "^2.0.0-alpha.13", - "fs-extra": "^8.1.0", - "phin": "^3.5.1", - "pidusage": "^2.0.18", + "fs-extra": "^11.1.1", + "phin": "^3.7.0", + "pidusage": "^3.0.2", "set-blocking": "^2.0.0", - "winston": "^3.3.3", - "winston-daily-rotate-file": "^4.5.5", - "yargs": "^14.2.0" + "winston": "^3.10.0", + "winston-daily-rotate-file": "^4.7.1", + "yargs": "^17.7.2" }, "publishConfig": { "access": "public" diff --git a/packages/lib/link/connectors.js b/packages/lib/link/connectors.js index a083e2c8..1cb8d2ee 100644 --- a/packages/lib/link/connectors.js +++ b/packages/lib/link/connectors.js @@ -432,6 +432,7 @@ class WebSocketClientConnector extends WebSocketBaseConnector { _doConnect() { let url = new URL(this._url); url.pathname += "api/socket"; + url.protocol = url.protocol.replace("http", "ws"); // Open WebSocket to controller logger.verbose(`Connector | connecting to ${url}`); diff --git a/packages/lib/package.json b/packages/lib/package.json index c6e82c8e..ec67bd67 100644 --- a/packages/lib/package.json +++ b/packages/lib/package.json @@ -12,23 +12,23 @@ "node": ">=12" }, "dependencies": { - "ajv": "^6.12.6", - "chalk": "^4.1.0", + "ajv": "^8.12.0", + "chalk": "^4.1.2", "fast-deep-equal": "^3.1.3", - "fs-extra": "^8.1.0", - "isomorphic-ws": "^4.0.1", - "jimp": "^0.12.1", - "jsonwebtoken": "^8.2.1", - "jszip": "^3.2.2", - "klaw": "^3.0.0", - "rcon-client": "^4.2.0", - "semver": "^7.1.1", + "fs-extra": "^11.1.1", + "isomorphic-ws": "^5.0.0", + "jimp": "^0.22.8", + "jsonwebtoken": "^9.0.1", + "jszip": "^3.10.1", + "klaw": "^4.1.0", + "rcon-client": "^4.2.3", + "semver": "^7.5.4", "set-blocking": "^2.0.0", - "triple-beam": "^1.3.0", - "winston": "^3.3.3", - "winston-transport": "^4.4.0", - "ws": "^7.2.3", - "yargs": "^14.2.0" + "triple-beam": "^1.4.1", + "winston": "^3.10.0", + "winston-transport": "^4.5.0", + "ws": "^8.13.0", + "yargs": "^17.7.2" }, "publishConfig": { "access": "public" diff --git a/packages/lib/schema.js b/packages/lib/schema.js index a9e362c7..694bfceb 100644 --- a/packages/lib/schema.js +++ b/packages/lib/schema.js @@ -5,11 +5,9 @@ "use strict"; const Ajv = require("ajv"); const ajv = new Ajv({ + allowUnionTypes: true, + strict: "log", verbose: true, - format: "full", - extendRefs: "fail", - strictDefaults: true, - strictKeywords: true, }); module.exports = { diff --git a/packages/web_ui/package.json b/packages/web_ui/package.json index b8b815c9..59103248 100644 --- a/packages/web_ui/package.json +++ b/packages/web_ui/package.json @@ -39,8 +39,8 @@ "style-loader": "^2.0.0", "terser-webpack-plugin": "^5.3.9", "util": "^0.12.3", - "webpack": "^5.73.0", - "webpack-cli": "^4.9.2", + "webpack": "^5.88.2", + "webpack-cli": "^5.1.4", "webpack-manifest-plugin": "^5.0.0" }, "publishConfig": { diff --git a/packages/web_ui/src/bootstrap.jsx b/packages/web_ui/src/bootstrap.jsx index d07d1ed3..40416a6e 100644 --- a/packages/web_ui/src/bootstrap.jsx +++ b/packages/web_ui/src/bootstrap.jsx @@ -108,8 +108,6 @@ export default async function bootstrap() { let plugins = await loadPlugins(pluginInfos); let wsUrl = new URL(window.webRoot, document.location); - wsUrl.protocol = wsUrl.protocol.replace("http", "ws"); - let controlConnector = new ControlConnector(wsUrl, 120); let control = new Control(controlConnector, plugins); diff --git a/plugins/global_chat/package.json b/plugins/global_chat/package.json index 5f558666..60ecce5f 100644 --- a/plugins/global_chat/package.json +++ b/plugins/global_chat/package.json @@ -22,9 +22,9 @@ "devDependencies": { "@clusterio/lib": "^2.0.0-alpha.13", "@clusterio/web_ui": "^2.0.0-alpha.13", - "webpack": "^5.36.2", - "webpack-cli": "^4.7.0", - "webpack-merge": "^5.2.0" + "webpack": "^5.88.2", + "webpack-cli": "^5.1.4", + "webpack-merge": "^5.9.0" }, "publishConfig": { "access": "public" diff --git a/plugins/inventory_sync/package.json b/plugins/inventory_sync/package.json index 9247f1e4..5c612ed2 100644 --- a/plugins/inventory_sync/package.json +++ b/plugins/inventory_sync/package.json @@ -28,9 +28,9 @@ "antd": "^4.16.0", "react": "^16.13.1", "react-dom": "^16.13.1", - "webpack": "^5.36.2", - "webpack-cli": "^4.7.0", - "webpack-merge": "^5.2.0" + "webpack": "^5.88.2", + "webpack-cli": "^5.1.4", + "webpack-merge": "^5.9.0" }, "publishConfig": { "access": "public" diff --git a/plugins/player_auth/package.json b/plugins/player_auth/package.json index 1973728d..f2324d22 100644 --- a/plugins/player_auth/package.json +++ b/plugins/player_auth/package.json @@ -27,12 +27,12 @@ "@clusterio/lib": "^2.0.0-alpha.13", "@clusterio/web_ui": "^2.0.0-alpha.13", "antd": "^4.16.0", - "phin": "^3.5.1", + "phin": "^3.7.0", "react": "^16.13.1", "react-dom": "^16.13.1", - "webpack": "^5.36.2", - "webpack-cli": "^4.7.0", - "webpack-merge": "^5.2.0" + "webpack": "^5.88.2", + "webpack-cli": "^5.1.4", + "webpack-merge": "^5.9.0" }, "publishConfig": { "access": "public" diff --git a/plugins/research_sync/package.json b/plugins/research_sync/package.json index ff84249d..80f03da6 100644 --- a/plugins/research_sync/package.json +++ b/plugins/research_sync/package.json @@ -25,9 +25,9 @@ "devDependencies": { "@clusterio/lib": "^2.0.0-alpha.13", "@clusterio/web_ui": "^2.0.0-alpha.13", - "webpack": "^5.36.2", - "webpack-cli": "^4.7.0", - "webpack-merge": "^5.2.0" + "webpack": "^5.88.2", + "webpack-cli": "^5.1.4", + "webpack-merge": "^5.9.0" }, "publishConfig": { "access": "public" diff --git a/plugins/statistics_exporter/package.json b/plugins/statistics_exporter/package.json index d945a612..f3076d0a 100644 --- a/plugins/statistics_exporter/package.json +++ b/plugins/statistics_exporter/package.json @@ -22,9 +22,9 @@ "devDependencies": { "@clusterio/lib": "^2.0.0-alpha.13", "@clusterio/web_ui": "^2.0.0-alpha.13", - "webpack": "^5.36.2", - "webpack-cli": "^4.7.0", - "webpack-merge": "^5.2.0" + "webpack": "^5.88.2", + "webpack-cli": "^5.1.4", + "webpack-merge": "^5.9.0" }, "publishConfig": { "access": "public" diff --git a/plugins/subspace_storage/package.json b/plugins/subspace_storage/package.json index 079deb52..23664974 100644 --- a/plugins/subspace_storage/package.json +++ b/plugins/subspace_storage/package.json @@ -28,9 +28,9 @@ "antd": "^4.16.0", "react": "^16.13.1", "react-dom": "^16.13.1", - "webpack": "^5.36.2", - "webpack-cli": "^4.7.0", - "webpack-merge": "^5.2.0" + "webpack": "^5.88.2", + "webpack-cli": "^5.1.4", + "webpack-merge": "^5.9.0" }, "publishConfig": { "access": "public" diff --git a/test/integration/clusterio.js b/test/integration/clusterio.js index 48d62417..cb4f1744 100644 --- a/test/integration/clusterio.js +++ b/test/integration/clusterio.js @@ -246,7 +246,7 @@ describe("Integration of Clusterio", function() { let value = JSON.stringify({ lan: true, public: false }).replace( /"/g, process.platform === "win32" ? '""' : '\\"' ); - await execCtl(`instance config set-prop test factorio.settings visibility "'${value}'"`); + await execCtl(`instance config set-prop test factorio.settings visibility "${value}"`); await execCtl("instance config set-prop test factorio.settings require_user_verification false"); }); }); @@ -442,7 +442,7 @@ describe("Integration of Clusterio", function() { ]; for (let [prop, value] of testConfigs) { - value = `"'${JSON.stringify(value).replace(/"/g, process.platform === "win32" ? '""' : '\\"')}'"`; + value = `"${JSON.stringify(value).replace(/"/g, process.platform === "win32" ? '""' : '\\"')}"`; let args = `test factorio.settings ${prop} ${value}`; await execCtl(`instance config set-prop ${args}`); }