Hornwitser
e9f5cae4f0
Fix misc problems detected by ESLint
...
Reformat and clean up issues detected by ESLint.
2020-06-17 20:59:37 +02:00
Hornwitser
8cb21c5fa8
Add dangling commas
...
Ensure multiline object and array litterals are consistenly typed out
with dangling commas for the last element.
2020-06-17 20:59:37 +02:00
Hornwitser
3e4f0b6b5e
Fix indents
...
Fix incorrectly indented code as detected by ESLint.
2020-06-17 20:59:33 +02:00
Hornwitser
703fda43ad
Fix JSDoc issues
...
Fix missing documentation for parameters and return types, incorect
config and errors in type definitions.
2020-06-17 20:53:18 +02:00
Hornwitser
3dba92a03d
Use strict mode
...
Add strict mode directives to all js files.
2020-06-17 20:53:18 +02:00
Hornwitser
b254e4189d
Use more consistent spacing in objects literals
2020-06-17 20:53:18 +02:00
Hornwitser
29f066a191
Fix missing semicolons
...
Ensure all statements end with a semicolon.
2020-06-17 20:53:18 +02:00
Hornwitser
34aaeee354
Use double quotes
...
Convert existing mix of double quotes and single quotes to only use
double quotes unless the string contains double quotes.
2020-06-17 20:53:18 +02:00
Hornwitser
cf6f2cb70a
Add user and permission system
...
Add users, roles and permissions and rework the authentication to use
separate user and slave tokens for control and slave connections
respectively.
Add commands for listing permissions, roles and users, and creating,
editing and deleting roles and users.
2020-06-15 16:47:15 +02:00
Hornwitser
07cff0ab9a
Fix error during slave authentication failure
...
Treat sending messages over a link that is not connected as a
SessionLost error and handle AuthenticationFailed error in the
startup logic of slave.
2020-06-15 00:13:25 +02:00
Hornwitser
3dfed4d2ad
Remove master.factorio_directory config
...
Remove old config entry for the old locale API that was removed with the
introduction of the new export system in 260f976 .
2020-06-15 00:13:25 +02:00
Hornwitser
c3179f0423
Move ControlConfig to lib/config/definitions.js
...
Move the definition of the control config to lib/config so that the
master code can use it.
2020-06-15 00:13:25 +02:00
Hornwitser
931ad4816f
Update config of running Factorio instances
...
Monitor the factorio.settings config for changes and apply them to
running instances via the /config set command.
2020-05-31 22:28:51 +02:00
Hornwitser
5b043524b4
Implement setProp in configs
...
Add setProp method for selectively changing one property of an object
field in a config group.
2020-05-31 16:08:21 +02:00
Hornwitser
8c9daff0bb
Add name shortcut for ConfigGroup instances
...
Add .name shortcut to get the groupName class property of config group
instances.
2020-05-31 14:16:06 +02:00
Hornwitser
67ca8dcc4d
Implement config notification event
...
Add fieldChanged event to config objects that is triggered when the
value of a field in a group belonging to it is changed.
2020-05-30 14:27:59 +02:00
Hornwitser
fc3686b865
Invoke plugin hooks via common function
...
Use a common function to iterate through and invoke the given hook in
every plugin, and ignore errors thrown by plugins from these hooks.
2020-05-30 14:27:59 +02:00
Hornwitser
36cf14074e
Automatically upload export to master server
...
Upload the created export data zip file to a new /api/upload-export
endpoint on the master server which unpacks it into the appropriate
directory on the master.
2020-05-26 15:31:42 +02:00
Hornwitser
260f976fa3
Implement export of item icons and locale
...
Add mod and command for exporting the Factorio locale including mods,
and item icons assemled into a sprite sheet including mods.
2020-05-26 01:11:49 +02:00
Hornwitser
203f2d2a14
Fix Windows stop logic
...
Handle the Factorio server not exiting when encountering an error on
Windows and fix the hang detection for .stop().
2020-05-21 18:06:20 +02:00
Hornwitser
3211fbe985
Notify master about instance status update
...
Send updates to the master server when the running status of instances
change and add onInstanceStatusChanged hook to master plugins.
2020-05-11 18:10:11 +02:00
Hornwitser
a194508f52
Filter plugin messages forwarded to links
...
Drop events forwarded to a slave or instance that does not have the
plugin the event is defined in. Reject requests for the same reason.
2020-05-11 18:04:03 +02:00
Hornwitser
1b427af5f0
Fix client send buffer not being sent on ready
...
Fix WebSocketClientConnector not sending the send buffer queued up
between starting the connection and the master server sending the ready
signal for it.
2020-05-09 16:34:46 +02:00
Hornwitser
04ee3d3f96
Fix WebSocketClientConnector lifecycle events
...
Fix drop being repeatedly emitted while reconnecting and close not being
emitted on connection timeout.
2020-05-09 16:28:07 +02:00
Hornwitser
c35b6de70e
Notify on connection events
...
Implement notification to plugins for disconnect request, connect, drop,
and close. This allows plugins to properly handle slaves and the master
server shutting down without sending messages that will get lost.
2020-05-08 23:49:28 +02:00
Hornwitser
b8b8c44083
Fix onExit not being invoked if plugin load fails
...
Fix instance not properly exiting if an error occurs during the loading
of a plugin.
2020-05-08 18:15:17 +02:00
Hornwitser
1beffb1bfd
Fix crash on hartbeat on closing connection
...
Fix heartbeat incorrectly asserting it cannot be sent on a connection in
the closing state.
2020-05-08 18:09:48 +02:00
Hornwitser
b151dd8469
Fix documentation
...
Fix missing module declarations, broken lings, broken formating and
incorrect scopes in the documentation. For modules split over several
files it appears the only viable option is to use the memberof directive
on each documented member and only declare the index file as a module.
2020-05-08 17:28:06 +02:00
Hornwitser
5c1214ad38
Rename connected and dropped events
...
Rename the connector events connected and dropped to connect and drop
respectively to be consistent with common Node.js names for events like
close.
2020-05-07 12:36:43 +02:00
Hornwitser
1629eaf225
Track plugins loaded by master and slaves
...
Send a mapping of the plugins the master server has loaded to slaves
vice versa. Limit the plugins that may be loaded by instances to only
those that the master server has loaded.
2020-05-06 20:14:40 +02:00
Hornwitser
b6585e6364
Fix reconnect giving up too early
...
Fix the reconnect logic giving immediately if a previous reconnection
had been made long prior to the connection being dropped again.
2020-04-18 23:37:50 +02:00
Hornwitser
4f463a8180
Reduce number of bits in generated test cert
...
Add config entry for the number of bits to use in the auto generate TLS
certificate for the master server and reduce it to 512 for the
integration test. This reduces the time needed to generate the
certificate in the integration test.
2020-04-09 20:02:29 +02:00
Hornwitser
2c855a5846
Add debug-dump-ws command
...
Add debug command to dump the WebSocket messages being sent and received
by the master server to aid in finding chatty events.
2020-04-09 19:50:01 +02:00
Hornwitser
61d92a6910
Rename master plugin onExit hook to onShutdown
...
Rename the onExit hook for master plugins to onShutdown to better
reflect when it is invoked.
2020-04-09 19:50:01 +02:00
Hornwitser
9507608e59
Rework disconnect logic for connectors
...
Rework the way disconnection at shutdown is done to properly close
the connections when the master server is shut down.
2020-04-09 19:50:01 +02:00
Hornwitser
47ea8f5477
Rename connection shutdown to prepare disconnect
...
Rename the shutdownConnection request to prepareDisconnect to better
reflect its actual purpose.
2020-04-09 16:17:38 +02:00
Hornwitser
d537e5cf6b
Fix typo in default cpu metric
...
Fix proces_cpu_seconds_total being mislabled as process_cpu_seconds.
2020-04-09 16:17:38 +02:00
Hornwitser
56488b2c2d
Add resident memory and heap size metrics
...
Implement the default resident memory and heap size metrics.
2020-04-09 16:17:38 +02:00
Hornwitser
e908c5069b
Add autosave tracking and statistics
...
Detect when autosaves are made and track the size in a Prometheus gague.
2020-04-09 16:17:38 +02:00
Hornwitser
6bc07ad1b3
Add Factorio CPU and Memory usage statistics
...
Add per instance metrics for CPU and memory usage with the pidusage
library.
2020-04-09 16:17:38 +02:00
Hornwitser
56ee1fe955
Rework save logic with regard to start instance
...
Ensure that notifyExit is called if errors occur during startInstance
and createSave request, and rework startInstance save logic to create
a new savegame if no save is present and allow specifying the save to
load.
2020-04-09 16:17:38 +02:00
Hornwitser
75cd6d38db
Fix instance exit notification
...
Fix improper notification on Factorio server exit causing plugins and
the instance tracking to fail.
2020-04-04 15:14:23 +02:00
Hornwitser
8ebf0fc754
Add master server Web Root config
...
Add web_root option to the master server and use it create URLs for
resources hosted by it. This permits hosting the master server web
interface behind reverse proxy under a dedicated path.
2020-04-04 10:05:37 +02:00
Hornwitser
5c16809b5b
JSDoc use autodetected module name
...
Change @module <module name> entries to just @module as JSDoc is able to
automatically determine the module name.
2020-04-03 20:51:28 +02:00
Hornwitser
3cc84d6400
Use basicType helper in lib/database
...
Simplify the checking logic in lib/database by using the basicType
helper.
2020-04-03 20:51:28 +02:00
Hornwitser
65494a0a91
Move basicType to lib/helpers
...
Move the basicType function from the config lib to a shared helpers lib.
2020-04-03 20:51:28 +02:00
Hornwitser
f05100c94d
Remove unused files
...
Remove left over files that are no longer in use.
2020-04-03 20:51:28 +02:00
Hornwitser
9a4a535add
Expose Slave to instance plugins
...
Allow the slave object to be accessed by instance plugins through the
this.slave property.
2020-04-03 20:51:28 +02:00
Hornwitser
3ff5e630ca
Warn on unhandled Factorio ipc
...
Send warning to console if an ipc message is received but there were no
handlers registered to handle it.
2020-04-03 20:51:28 +02:00
Hornwitser
028f00e58a
Rename client.js to slave.js
...
Rename the client.js script to slave.js, and changed places where it's
refered to as client into slave.
2020-04-03 20:51:28 +02:00