mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 16:13:12 +09:00
33 files changed
+180
-74
No files matched your search
+83
-10
@@ -1,5 +1,8 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
"plugins": [
|
||||||
|
"node",
|
||||||
|
],
|
||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
"commonjs": true,
|
"commonjs": true,
|
||||||
@@ -18,6 +21,8 @@ module.exports = {
|
|||||||
"rules": {
|
"rules": {
|
||||||
"prefer-arrow-callback": "off",
|
"prefer-arrow-callback": "off",
|
||||||
"no-invalid-this": "off",
|
"no-invalid-this": "off",
|
||||||
|
"node/no-unpublished-import": "off",
|
||||||
|
"node/no-unpublished-require": "off",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -31,6 +36,44 @@ module.exports = {
|
|||||||
"jsx": true,
|
"jsx": true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"rules": {
|
||||||
|
"node/callback-return": "off",
|
||||||
|
"node/exports-style": "off",
|
||||||
|
"node/file-extension-in-import": "off",
|
||||||
|
"node/global-require": "off",
|
||||||
|
"node/handle-callback-err": "off",
|
||||||
|
"node/no-callback-literal": "off",
|
||||||
|
"node/no-deprecated-api": "off",
|
||||||
|
"node/no-exports-assign": "off",
|
||||||
|
"node/no-extraneous-import": "off",
|
||||||
|
"node/no-extraneous-require": "off",
|
||||||
|
"node/no-missing-import": "off",
|
||||||
|
"node/no-missing-require": "off",
|
||||||
|
"node/no-mixed-requires": "off",
|
||||||
|
"node/no-new-require": "off",
|
||||||
|
"node/no-path-concat": "off",
|
||||||
|
"node/no-process-env": "off",
|
||||||
|
"node/no-process-exit": "off",
|
||||||
|
"node/no-restricted-require": "off",
|
||||||
|
"node/no-sync": "off",
|
||||||
|
"node/no-unpublished-bin": "off",
|
||||||
|
"node/no-unpublished-import": "off",
|
||||||
|
"node/no-unpublished-require": "off",
|
||||||
|
"node/no-unsupported-features/es-builtins": "off",
|
||||||
|
"node/no-unsupported-features/es-syntax": "off",
|
||||||
|
"node/no-unsupported-features/node-builtins": "off",
|
||||||
|
"node/prefer-global/buffer": "off",
|
||||||
|
"node/prefer-global/console": "off",
|
||||||
|
"node/prefer-global/process": "off",
|
||||||
|
"node/prefer-global/text-decoder": "off",
|
||||||
|
"node/prefer-global/text-encoder": "off",
|
||||||
|
"node/prefer-global/url-search-params": "off",
|
||||||
|
"node/prefer-global/url": "off",
|
||||||
|
"node/prefer-promises/dns": "off",
|
||||||
|
"node/prefer-promises/fs": "off",
|
||||||
|
"node/process-exit-as-throw": "off",
|
||||||
|
"node/shebang": "off",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -46,7 +89,6 @@ module.exports = {
|
|||||||
"block-scoped-var": "error",
|
"block-scoped-var": "error",
|
||||||
"block-spacing": "error",
|
"block-spacing": "error",
|
||||||
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
|
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
|
||||||
"callback-return": "off",
|
|
||||||
"camelcase": "off",
|
"camelcase": "off",
|
||||||
"capitalized-comments": "off",
|
"capitalized-comments": "off",
|
||||||
"class-methods-use-this": "off",
|
"class-methods-use-this": "off",
|
||||||
@@ -81,10 +123,8 @@ module.exports = {
|
|||||||
"function-call-argument-newline": "off",
|
"function-call-argument-newline": "off",
|
||||||
"function-paren-newline": "off",
|
"function-paren-newline": "off",
|
||||||
"generator-star-spacing": ["error", { "before": false, "after": true }],
|
"generator-star-spacing": ["error", { "before": false, "after": true }],
|
||||||
"global-require": "error",
|
|
||||||
"grouped-accessor-pairs": "error",
|
"grouped-accessor-pairs": "error",
|
||||||
"guard-for-in": "error",
|
"guard-for-in": "error",
|
||||||
"handle-callback-err": "error",
|
|
||||||
"id-blacklist": "error",
|
"id-blacklist": "error",
|
||||||
"id-length": "off",
|
"id-length": "off",
|
||||||
"id-match": "error",
|
"id-match": "error",
|
||||||
@@ -160,7 +200,6 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"no-mixed-requires": "error",
|
|
||||||
"no-multi-assign": "error",
|
"no-multi-assign": "error",
|
||||||
"no-multi-spaces": "error",
|
"no-multi-spaces": "error",
|
||||||
"no-multi-str": "error",
|
"no-multi-str": "error",
|
||||||
@@ -172,19 +211,14 @@ module.exports = {
|
|||||||
"no-new": "error",
|
"no-new": "error",
|
||||||
"no-new-func": "error",
|
"no-new-func": "error",
|
||||||
"no-new-object": "error",
|
"no-new-object": "error",
|
||||||
"no-new-require": "error",
|
|
||||||
"no-new-wrappers": "error",
|
"no-new-wrappers": "error",
|
||||||
"no-octal-escape": "error",
|
"no-octal-escape": "error",
|
||||||
"no-param-reassign": "off",
|
"no-param-reassign": "off",
|
||||||
"no-path-concat": "error",
|
|
||||||
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
|
"no-plusplus": ["error", { "allowForLoopAfterthoughts": true }],
|
||||||
"no-process-env": "error",
|
|
||||||
"no-process-exit": "error",
|
|
||||||
"no-proto": "error",
|
"no-proto": "error",
|
||||||
"no-restricted-exports": "error",
|
"no-restricted-exports": "error",
|
||||||
"no-restricted-globals": "error",
|
"no-restricted-globals": "error",
|
||||||
"no-restricted-imports": "error",
|
"no-restricted-imports": "error",
|
||||||
"no-restricted-modules": "error",
|
|
||||||
"no-restricted-properties": "error",
|
"no-restricted-properties": "error",
|
||||||
"no-restricted-syntax": "error",
|
"no-restricted-syntax": "error",
|
||||||
"no-return-assign": "error",
|
"no-return-assign": "error",
|
||||||
@@ -194,7 +228,6 @@ module.exports = {
|
|||||||
"no-sequences": "error",
|
"no-sequences": "error",
|
||||||
"no-shadow": ["error", { "allow": ["yargs"] }],
|
"no-shadow": ["error", { "allow": ["yargs"] }],
|
||||||
"no-spaced-func": "error",
|
"no-spaced-func": "error",
|
||||||
"no-sync": "error",
|
|
||||||
"no-tabs": ["error", { "allowIndentationTabs": true }],
|
"no-tabs": ["error", { "allowIndentationTabs": true }],
|
||||||
"no-template-curly-in-string": "error",
|
"no-template-curly-in-string": "error",
|
||||||
"no-ternary": "off",
|
"no-ternary": "off",
|
||||||
@@ -279,5 +312,45 @@ module.exports = {
|
|||||||
"wrap-regex": "off",
|
"wrap-regex": "off",
|
||||||
"yield-star-spacing": "error",
|
"yield-star-spacing": "error",
|
||||||
"yoda": ["error", "never", { "exceptRange": true }],
|
"yoda": ["error", "never", { "exceptRange": true }],
|
||||||
|
|
||||||
|
"node/callback-return": "off",
|
||||||
|
"node/exports-style": "off",
|
||||||
|
"node/file-extension-in-import": "off",
|
||||||
|
"node/global-require": "error",
|
||||||
|
"node/handle-callback-err": "error",
|
||||||
|
"node/no-callback-literal": "error",
|
||||||
|
"node/no-deprecated-api": "error",
|
||||||
|
"node/no-exports-assign": "error",
|
||||||
|
"node/no-extraneous-import": "error",
|
||||||
|
"node/no-extraneous-require": "error",
|
||||||
|
"node/no-missing-import": "error",
|
||||||
|
"node/no-missing-require": "error",
|
||||||
|
"node/no-mixed-requires": "error",
|
||||||
|
"node/no-new-require": "error",
|
||||||
|
"node/no-path-concat": "error",
|
||||||
|
"node/no-process-env": "error",
|
||||||
|
"node/no-process-exit": "error",
|
||||||
|
"node/no-restricted-require": "off",
|
||||||
|
"node/no-sync": "error",
|
||||||
|
"node/no-unpublished-bin": "error",
|
||||||
|
"node/no-unpublished-import": "error",
|
||||||
|
"node/no-unpublished-require": [
|
||||||
|
"error",
|
||||||
|
{ "allowModules": ["webpack", "webpack-merge", "webpack-dev-middleware"] },
|
||||||
|
],
|
||||||
|
"node/no-unsupported-features/es-builtins": "error",
|
||||||
|
"node/no-unsupported-features/es-syntax": "error",
|
||||||
|
"node/no-unsupported-features/node-builtins": "error",
|
||||||
|
"node/prefer-global/buffer": "error",
|
||||||
|
"node/prefer-global/console": "error",
|
||||||
|
"node/prefer-global/process": "error",
|
||||||
|
"node/prefer-global/text-decoder": "error",
|
||||||
|
"node/prefer-global/text-encoder": "error",
|
||||||
|
"node/prefer-global/url-search-params": "error",
|
||||||
|
"node/prefer-global/url": "error",
|
||||||
|
"node/prefer-promises/dns": "off",
|
||||||
|
"node/prefer-promises/fs": "off",
|
||||||
|
"node/process-exit-as-throw": "error",
|
||||||
|
"node/shebang": "error",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -76,6 +76,7 @@
|
|||||||
UPS statistics is exported by the statistics exporter plugin.
|
UPS statistics is exported by the statistics exporter plugin.
|
||||||
- Master server now defaults to hosting on https on port 8443.
|
- Master server now defaults to hosting on https on port 8443.
|
||||||
- Renamed client to slave.
|
- Renamed client to slave.
|
||||||
|
- Removed rotation of factorio-current.log files.
|
||||||
|
|
||||||
### Breaking Changes
|
### Breaking Changes
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.25.0",
|
"eslint": "^7.25.0",
|
||||||
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"jsdoc": "^3.6.6",
|
"jsdoc": "^3.6.6",
|
||||||
"lerna": "^4.0.0",
|
"lerna": "^4.0.0",
|
||||||
"mocha": "^8.4.0",
|
"mocha": "^8.4.0",
|
||||||
|
|||||||
+1
-1
@@ -962,7 +962,7 @@ async function startControl() {
|
|||||||
control.shutdown().catch(err => {
|
control.shutdown().catch(err => {
|
||||||
setBlocking(true);
|
setBlocking(true);
|
||||||
logger.error(err.stack);
|
logger.error(err.stack);
|
||||||
// eslint-disable-next-line no-process-exit
|
// eslint-disable-next-line node/no-process-exit
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
"as-table": "^1.0.31",
|
"as-table": "^1.0.31",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"phin": "^3.5.1",
|
"phin": "^3.5.1",
|
||||||
|
"set-blocking": "^2.0.0",
|
||||||
"winston": "^3.3.3",
|
"winston": "^3.3.3",
|
||||||
"yargs": "^14.2.0"
|
"yargs": "^14.2.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
/* eslint-disable global-require */
|
|
||||||
/**
|
/**
|
||||||
* Configuration System
|
* Configuration System
|
||||||
* @author Hornwitser
|
* @author Hornwitser
|
||||||
* @module lib/config
|
* @module lib/config
|
||||||
*/
|
*/
|
||||||
"use strict";
|
"use strict";
|
||||||
|
const classes = require("./classes");
|
||||||
|
const definitions = require("./definitions");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
...require("./classes"),
|
...classes,
|
||||||
...require("./definitions"),
|
...definitions,
|
||||||
};
|
};
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
/* eslint-disable global-require */
|
|
||||||
/**
|
/**
|
||||||
* Library for interfacing with Factorio Servers and saves.
|
* Library for interfacing with Factorio Servers and saves.
|
||||||
* @module lib/factorio
|
* @module lib/factorio
|
||||||
* @author Hornwitser
|
* @author Hornwitser
|
||||||
*/
|
*/
|
||||||
"use strict";
|
"use strict";
|
||||||
|
const export_ = require("./export");
|
||||||
|
const patch = require("./patch");
|
||||||
|
const server = require("./server");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
...require("./export"),
|
...export_,
|
||||||
...require("./patch"),
|
...patch,
|
||||||
...require("./server"),
|
...server,
|
||||||
};
|
};
|
||||||
@@ -375,7 +375,7 @@ const outputHeuristics = [
|
|||||||
|
|
||||||
// Message indicating the server is done starting up
|
// Message indicating the server is done starting up
|
||||||
{
|
{
|
||||||
filter: { type: "log", message: /^updateTick\(\d+\) changing state from\(CreatingGame\) to\(InGame\)$/ },
|
filter: { type: "log", message: /^(update|map)Tick\(\d+\) changing state from\(CreatingGame\) to\(InGame\)$/ },
|
||||||
action: function() {
|
action: function() {
|
||||||
this._notifyGameReady().catch((err) => { this.emit("error", err); });
|
this._notifyGameReady().catch((err) => { this.emit("error", err); });
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
/* eslint-disable global-require */
|
/* eslint-disable node/global-require */
|
||||||
"use strict";
|
"use strict";
|
||||||
// eslint-disable-next-line no-process-env
|
// eslint-disable-next-line node/no-process-env
|
||||||
if (process.env.APP_ENV === "browser") {
|
if (process.env.APP_ENV === "browser") {
|
||||||
|
// eslint-disable-next-line node/no-extraneous-require
|
||||||
module.exports = require("fast-deep-equal/es6");
|
module.exports = require("fast-deep-equal/es6");
|
||||||
} else {
|
} else {
|
||||||
module.exports = require("util").isDeepStrictEqual;
|
module.exports = require("util").isDeepStrictEqual;
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ class WebSocketClientConnector extends WebSocketBaseConnector {
|
|||||||
// Open WebSocket to master
|
// Open WebSocket to master
|
||||||
logger.verbose(`SOCKET | connecting to ${url}`);
|
logger.verbose(`SOCKET | connecting to ${url}`);
|
||||||
|
|
||||||
// eslint-disable-next-line no-process-env
|
// eslint-disable-next-line node/no-process-env
|
||||||
if (process.env.APP_ENV === "browser") {
|
if (process.env.APP_ENV === "browser") {
|
||||||
this._socket = new WebSocket(url);
|
this._socket = new WebSocket(url);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
/* eslint-disable global-require */
|
|
||||||
/**
|
/**
|
||||||
* Library for message based communication between nodes
|
* Library for message based communication between nodes
|
||||||
* @module lib/link
|
* @module lib/link
|
||||||
* @author Hornwitser
|
* @author Hornwitser
|
||||||
*/
|
*/
|
||||||
"use strict";
|
"use strict";
|
||||||
|
const link = require("./link");
|
||||||
|
const messages = require("./messages");
|
||||||
|
const connectors = require("./connectors");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
...require("./link"),
|
...link,
|
||||||
...require("./messages"),
|
...messages,
|
||||||
...require("./connectors"),
|
...connectors,
|
||||||
};
|
};
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable global-require */
|
/* eslint-disable node/global-require */
|
||||||
/**
|
/**
|
||||||
* Helpers for loading plugins in Node.js
|
* Helpers for loading plugins in Node.js
|
||||||
* @module lib/plugin_loader
|
* @module lib/plugin_loader
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ async function handlePluginCommand(args, pluginList, pluginListPath) {
|
|||||||
|
|
||||||
let pluginInfo;
|
let pluginInfo;
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line global-require
|
// eslint-disable-next-line node/global-require
|
||||||
pluginInfo = require(path.posix.join(pluginPath, "info"));
|
pluginInfo = require(path.posix.join(pluginPath, "info"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(`Unable to import plugin info from ${args.path}:\n${err.stack}`);
|
logger.error(`Unable to import plugin info from ${args.path}:\n${err.stack}`);
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
webpack.config.js
|
||||||
@@ -322,7 +322,7 @@ async function startup() {
|
|||||||
if (secondSigint) {
|
if (secondSigint) {
|
||||||
setBlocking(true);
|
setBlocking(true);
|
||||||
logger.fatal("Caught second interrupt, terminating immediately");
|
logger.fatal("Caught second interrupt, terminating immediately");
|
||||||
// eslint-disable-next-line no-process-exit
|
// eslint-disable-next-line node/no-process-exit
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ async function startup() {
|
|||||||
if (secondSigterm) {
|
if (secondSigterm) {
|
||||||
setBlocking(true);
|
setBlocking(true);
|
||||||
logger.fatal("Caught second termination, terminating immediately");
|
logger.fatal("Caught second termination, terminating immediately");
|
||||||
// eslint-disable-next-line no-process-exit
|
// eslint-disable-next-line node/no-process-exit
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const winston = require("winston");
|
|||||||
const libConfig = require("@clusterio/lib/config");
|
const libConfig = require("@clusterio/lib/config");
|
||||||
const libErrors = require("@clusterio/lib/errors");
|
const libErrors = require("@clusterio/lib/errors");
|
||||||
const libLink = require("@clusterio/lib/link");
|
const libLink = require("@clusterio/lib/link");
|
||||||
const { logger } = require("@clusterio/lib/logging");
|
const { levels, logger } = require("@clusterio/lib/logging");
|
||||||
const libLoggingUtils = require("@clusterio/lib/logging_utils");
|
const libLoggingUtils = require("@clusterio/lib/logging_utils");
|
||||||
const libPlugin = require("@clusterio/lib/plugin");
|
const libPlugin = require("@clusterio/lib/plugin");
|
||||||
const libPrometheus = require("@clusterio/lib/prometheus");
|
const libPrometheus = require("@clusterio/lib/prometheus");
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ class Master {
|
|||||||
// Start webpack development server if enabled
|
// Start webpack development server if enabled
|
||||||
if (args.dev || args.devPlugin) {
|
if (args.dev || args.devPlugin) {
|
||||||
logger.warn("Webpack development mode enabled");
|
logger.warn("Webpack development mode enabled");
|
||||||
/* eslint-disable global-require */
|
/* eslint-disable node/global-require, node/no-unpublished-require */
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const webpackDevMiddleware = require("webpack-dev-middleware");
|
const webpackDevMiddleware = require("webpack-dev-middleware");
|
||||||
const webpackConfigs = [];
|
const webpackConfigs = [];
|
||||||
@@ -136,7 +136,7 @@ class Master {
|
|||||||
webpackConfigs.push(config);
|
webpackConfigs.push(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* eslint-enable global-require */
|
/* eslint-enable node/global-require, node/no-unpublished-require */
|
||||||
|
|
||||||
const compiler = webpack(webpackConfigs);
|
const compiler = webpack(webpackConfigs);
|
||||||
this.devMiddleware = webpackDevMiddleware(compiler, {});
|
this.devMiddleware = webpackDevMiddleware(compiler, {});
|
||||||
|
|||||||
@@ -2,18 +2,44 @@
|
|||||||
-- Based on code from playerManager and trainTeleports
|
-- Based on code from playerManager and trainTeleports
|
||||||
local serialize = {}
|
local serialize = {}
|
||||||
|
|
||||||
|
local function version_to_table(version)
|
||||||
|
local t = {}
|
||||||
|
for p in string.gmatch(version, "%d+") do
|
||||||
|
t[#t + 1] = tonumber(p)
|
||||||
|
end
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
-- 0.17 compatibility
|
-- 0.17 compatibility
|
||||||
local supports_bar, get_bar, has_bar
|
local supports_bar, get_bar, has_bar, version
|
||||||
if (pcall(function() local mods = script.active_mods end)) then
|
if (pcall(function() local mods = script.active_mods end)) then
|
||||||
supports_bar = "supports_bar"
|
supports_bar = "supports_bar"
|
||||||
get_bar = "get_bar"
|
get_bar = "get_bar"
|
||||||
set_bar = "set_bar"
|
set_bar = "set_bar"
|
||||||
|
version = version_to_table(script.active_mods.base)
|
||||||
else
|
else
|
||||||
supports_bar = "hasbar"
|
supports_bar = "hasbar"
|
||||||
get_bar = "getbar"
|
get_bar = "getbar"
|
||||||
set_bar = "setbar"
|
set_bar = "setbar"
|
||||||
|
version = version_to_table("0.17.69")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- returns true if the game version is greater than or equal to the given version
|
||||||
|
local function version_ge(comp)
|
||||||
|
comp = version_to_table(comp)
|
||||||
|
for i=1, 3 do
|
||||||
|
if comp[i] > version[i] then
|
||||||
|
return false
|
||||||
|
elseif comp[i] < version[i] then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
local has_create_grid = version_ge("1.1.7")
|
||||||
|
|
||||||
|
|
||||||
-- Equipment Grids are serialized into an array of equipment entries
|
-- Equipment Grids are serialized into an array of equipment entries
|
||||||
-- where ench entry is a table with the following fields:
|
-- where ench entry is a table with the following fields:
|
||||||
-- n: name
|
-- n: name
|
||||||
@@ -173,7 +199,14 @@ function serialize.deserialize_item_stack(slot, entry)
|
|||||||
slot.allow_manual_label_change = label.a
|
slot.allow_manual_label_change = label.a
|
||||||
end
|
end
|
||||||
if entry.g then
|
if entry.g then
|
||||||
serialize.deserialize_equipment_grid(slot.grid, entry.g)
|
if slot.grid then
|
||||||
|
serialize.deserialize_equipment_grid(slot.grid, entry.g)
|
||||||
|
elseif slot.type == "item-with-entity-data" and has_create_grid then
|
||||||
|
slot.create_grid()
|
||||||
|
serialize.deserialize_equipment_grid(slot.grid, entry.g)
|
||||||
|
else
|
||||||
|
print("Error: Attempt to deserialize equipment grid on an unsupported entity")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if entry.i then
|
if entry.i then
|
||||||
local sub_inventory = slot.get_inventory(defines.inventory.item_main)
|
local sub_inventory = slot.get_inventory(defines.inventory.item_main)
|
||||||
|
|||||||
+4
-18
@@ -384,20 +384,6 @@ class Instance extends libLink.Link {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.verbose("Rotating old logs...");
|
|
||||||
// clean old log file to avoid crash
|
|
||||||
try {
|
|
||||||
let logPath = this.path("factorio-current.log");
|
|
||||||
let stat = await fs.stat(logPath);
|
|
||||||
if (stat.isFile()) {
|
|
||||||
let logFilename = `factorio-${Math.floor(Date.parse(stat.mtime)/1000)}.log`;
|
|
||||||
await fs.rename(logPath, this.path(logFilename));
|
|
||||||
this.logger.verbose(`Log rotated as ${logFilename}`);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
this.logger.error(`Error rotating logs:\n${err.stack}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-use-before-define
|
// eslint-disable-next-line no-use-before-define
|
||||||
await symlinkMods(this, "sharedMods");
|
await symlinkMods(this, "sharedMods");
|
||||||
}
|
}
|
||||||
@@ -467,7 +453,7 @@ class Instance extends libLink.Link {
|
|||||||
// Find stand alone modules to load
|
// Find stand alone modules to load
|
||||||
// XXX for now only the included clusterio module is loaded
|
// XXX for now only the included clusterio module is loaded
|
||||||
for (let entry of await fs.readdir(path.join(__dirname, "modules"), { withFileTypes: true })) {
|
for (let entry of await fs.readdir(path.join(__dirname, "modules"), { withFileTypes: true })) {
|
||||||
if (entry.isDirectory()) {
|
if (!entry.isFile()) {
|
||||||
if (modules.has(entry.name)) {
|
if (modules.has(entry.name)) {
|
||||||
throw new Error(`Module with name ${entry.name} already exists in a plugin`);
|
throw new Error(`Module with name ${entry.name} already exists in a plugin`);
|
||||||
}
|
}
|
||||||
@@ -1427,7 +1413,7 @@ class Slave extends libLink.Link {
|
|||||||
+--------------------------------------------------------------------+
|
+--------------------------------------------------------------------+
|
||||||
${err.stack}`
|
${err.stack}`
|
||||||
);
|
);
|
||||||
// eslint-disable-next-line no-process-exit
|
// eslint-disable-next-line node/no-process-exit
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1633,7 +1619,7 @@ async function startSlave() {
|
|||||||
if (secondSigint) {
|
if (secondSigint) {
|
||||||
setBlocking(true);
|
setBlocking(true);
|
||||||
logger.fatal("Caught second interrupt, terminating immediately");
|
logger.fatal("Caught second interrupt, terminating immediately");
|
||||||
// eslint-disable-next-line no-process-exit
|
// eslint-disable-next-line node/no-process-exit
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1646,7 +1632,7 @@ async function startSlave() {
|
|||||||
if (secondSigterm) {
|
if (secondSigterm) {
|
||||||
setBlocking(true);
|
setBlocking(true);
|
||||||
logger.fatal("Caught second termination, terminating immediately");
|
logger.fatal("Caught second termination, terminating immediately");
|
||||||
// eslint-disable-next-line no-process-exit
|
// eslint-disable-next-line node/no-process-exit
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,5 +90,5 @@ export default async function bootstrap() {
|
|||||||
controlConnector.setTimeout(15);
|
controlConnector.setTimeout(15);
|
||||||
let control = new Control(controlConnector, plugins);
|
let control = new Control(controlConnector, plugins);
|
||||||
|
|
||||||
ReactDOM.render(<App control={control} plugins={plugins}/>, document.getElementById("root"));
|
ReactDOM.render(<App control={control}/>, document.getElementById("root"));
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,6 @@ import { logger } from "@clusterio/lib/logging";
|
|||||||
import ErrorBoundary from "./ErrorBoundary";
|
import ErrorBoundary from "./ErrorBoundary";
|
||||||
import SiteLayout from "./SiteLayout";
|
import SiteLayout from "./SiteLayout";
|
||||||
import ControlContext from "./ControlContext";
|
import ControlContext from "./ControlContext";
|
||||||
import PluginsContext from "./PluginsContext";
|
|
||||||
import LoginForm from "./LoginForm";
|
import LoginForm from "./LoginForm";
|
||||||
|
|
||||||
import { Card, Spin, Typography } from "antd";
|
import { Card, Spin, Typography } from "antd";
|
||||||
@@ -95,11 +94,9 @@ export default function App(props) {
|
|||||||
return (
|
return (
|
||||||
<ErrorBoundary Component={ErrorCard}>
|
<ErrorBoundary Component={ErrorCard}>
|
||||||
<ControlContext.Provider value={props.control}>
|
<ControlContext.Provider value={props.control}>
|
||||||
<PluginsContext.Provider value={props.plugins}>
|
<BrowserRouter basename={webRoot}>
|
||||||
<BrowserRouter basename={webRoot}>
|
{page}
|
||||||
{page}
|
</BrowserRouter>
|
||||||
</BrowserRouter>
|
|
||||||
</PluginsContext.Provider>
|
|
||||||
</ControlContext.Provider>
|
</ControlContext.Provider>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Button, Card, Divider, Form, Image, Input, List, Space, Spin, Typograph
|
|||||||
import LockOutlined from "@ant-design/icons/LockOutlined";
|
import LockOutlined from "@ant-design/icons/LockOutlined";
|
||||||
|
|
||||||
import logo from "../images/logo.png";
|
import logo from "../images/logo.png";
|
||||||
import PluginsContext from "./PluginsContext";
|
import ControlContext from "./ControlContext";
|
||||||
|
|
||||||
const { Paragraph, Text } = Typography;
|
const { Paragraph, Text } = Typography;
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ function TokenAuth(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function LoginForm(props) {
|
export default function LoginForm(props) {
|
||||||
let plugins = useContext(PluginsContext);
|
let plugins = useContext(ControlContext).plugins;
|
||||||
|
|
||||||
let loginForms = [];
|
let loginForms = [];
|
||||||
for (let plugin of plugins.values()) {
|
for (let plugin of plugins.values()) {
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ import React, { useEffect, useContext, useState } from "react";
|
|||||||
import { useHistory, useParams } from "react-router-dom";
|
import { useHistory, useParams } from "react-router-dom";
|
||||||
import { Alert, Descriptions, Spin } from "antd";
|
import { Alert, Descriptions, Spin } from "antd";
|
||||||
|
|
||||||
import PluginsContext from "./PluginsContext";
|
import ControlContext from "./ControlContext";
|
||||||
import PageLayout from "./PageLayout";
|
import PageLayout from "./PageLayout";
|
||||||
import { notifyErrorHandler } from "../util/notify";
|
import { notifyErrorHandler } from "../util/notify";
|
||||||
|
|
||||||
|
|
||||||
export default function PluginViewPage() {
|
export default function PluginViewPage() {
|
||||||
let params = useParams();
|
let params = useParams();
|
||||||
let plugins = useContext(PluginsContext);
|
let plugins = useContext(ControlContext).plugins;
|
||||||
let [pluginList, setPluginList] = useState(null);
|
let [pluginList, setPluginList] = useState(null);
|
||||||
let pluginName = params.name;
|
let pluginName = params.name;
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import { useHistory } from "react-router-dom";
|
|||||||
import { Table } from "antd";
|
import { Table } from "antd";
|
||||||
|
|
||||||
import notify from "../util/notify";
|
import notify from "../util/notify";
|
||||||
import PluginsContext from "./PluginsContext";
|
import ControlContext from "./ControlContext";
|
||||||
import PageLayout from "./PageLayout";
|
import PageLayout from "./PageLayout";
|
||||||
|
|
||||||
|
|
||||||
export default function PluginsPage() {
|
export default function PluginsPage() {
|
||||||
let plugins = useContext(PluginsContext);
|
let plugins = useContext(ControlContext).plugins;
|
||||||
let history = useHistory();
|
let history = useHistory();
|
||||||
let [pluginList, setPluginList] = useState([]);
|
let [pluginList, setPluginList] = useState([]);
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import webUiPackage from "../../package.json";
|
|||||||
import { useAccount } from "../model/account";
|
import { useAccount } from "../model/account";
|
||||||
import ErrorBoundary from "./ErrorBoundary";
|
import ErrorBoundary from "./ErrorBoundary";
|
||||||
import ErrorPage from "./ErrorPage";
|
import ErrorPage from "./ErrorPage";
|
||||||
import PluginsContext from "./PluginsContext";
|
import ControlContext from "./ControlContext";
|
||||||
import { pages } from "../pages";
|
import { pages } from "../pages";
|
||||||
|
|
||||||
const { Header, Sider } = Layout;
|
const { Header, Sider } = Layout;
|
||||||
@@ -17,7 +17,7 @@ export default function SiteLayout(props) {
|
|||||||
let history = useHistory();
|
let history = useHistory();
|
||||||
let [currentSidebarPath, setCurrentSidebarPath] = useState(null);
|
let [currentSidebarPath, setCurrentSidebarPath] = useState(null);
|
||||||
let account = useAccount();
|
let account = useAccount();
|
||||||
let plugins = useContext(PluginsContext);
|
let plugins = useContext(ControlContext).plugins;
|
||||||
|
|
||||||
function SetSidebar(setSidebarProps) {
|
function SetSidebar(setSidebarProps) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ export * from "./model/item_metadata.jsx";
|
|||||||
|
|
||||||
|
|
||||||
export { default as ControlContext } from "./components/ControlContext";
|
export { default as ControlContext } from "./components/ControlContext";
|
||||||
export { default as PluginsContext } from "./components/PluginsContext";
|
|
||||||
|
|
||||||
export { default as BaseConfigTree } from "./components/BaseConfigTree";
|
export { default as BaseConfigTree } from "./components/BaseConfigTree";
|
||||||
export { default as InstanceConfigTree } from "./components/InstanceConfigTree";
|
export { default as InstanceConfigTree } from "./components/InstanceConfigTree";
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
webpack.config.js
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
webpack.config.js
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
webpack.config.js
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
webpack.config.js
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
webpack.config.js
|
||||||
@@ -46,7 +46,7 @@ class TestControlConnector extends libLink.WebSocketClientConnector {
|
|||||||
// Mark that this test takes a lot of time, or depeneds on a test
|
// Mark that this test takes a lot of time, or depeneds on a test
|
||||||
// that takes a lot of time.
|
// that takes a lot of time.
|
||||||
function slowTest(test) {
|
function slowTest(test) {
|
||||||
// eslint-disable-next-line no-process-env
|
// eslint-disable-next-line node/no-process-env
|
||||||
if (process.env.FAST_TEST) {
|
if (process.env.FAST_TEST) {
|
||||||
test.skip();
|
test.skip();
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -5,10 +5,10 @@
|
|||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@clusterio/ctl": "2.0.0-alpha.5",
|
"@clusterio/ctl": "^2.0.0-alpha.6",
|
||||||
"@clusterio/lib": "2.0.0-alpha.5",
|
"@clusterio/lib": "^2.0.0-alpha.6",
|
||||||
"@clusterio/master": "2.0.0-alpha.5",
|
"@clusterio/master": "^2.0.0-alpha.6",
|
||||||
"@clusterio/slave": "2.0.0-alpha.5",
|
"@clusterio/slave": "^2.0.0-alpha.6",
|
||||||
"express": "^4.16.2",
|
"express": "^4.16.2",
|
||||||
"fs-extra": "^8.1.0",
|
"fs-extra": "^8.1.0",
|
||||||
"jsonwebtoken": "^8.2.1",
|
"jsonwebtoken": "^8.2.1",
|
||||||
|
|||||||
Reference in new issue
Block a user