222 Commits
Author SHA1 Message Date
Hornwitser 8b4ec58459 Exit if masterAuthToken is missing
Exit client.js with a non-zero exit code if it's detected that the
masterAuthToken is missing in the config.
2019-10-12 23:39:40 +02:00
Hornwitser 6b090cddbe Spawn factorio server deteached in client.js
Sending ^C via the terminal on Linux may cause SIGINT to be sent twice
to the factorio process, causing it to exit without completing the
saving.  This happens because the shell sends the interupt to all
members of the process group for the job and this includes both the
node client process and the factorio server process.

Avoid this situation by passing detached to spawn when the platform is
Linux, which causes the process to be created with its own process group
and therefore not targeted by a SIGINT from the shell.

This unfortunately does not work on Windows as we can't send SIGINT or
^C to a process there.  Doing subprocces.kill on Windows terminates the
process similarly to how SIGKILL works on Linux.
2019-09-18 18:11:49 +02:00
Hornwitser 0c45e57732 Add authentication to socket.io server
Authenticate connections made to the socket.io server via a token query
parameter that's validated in a similar manner to the x-access-token for
HTTP requests.
2019-09-10 23:51:48 +02:00
Hornwitser 66c0238a3d Remove undescore
A 50 kb library is not needed to make a function run once, especially
not when it doesn't work.  _.once does not modify the function passed to
it to only run once it returns a new function that only runs once.
Since the result of once was discarded, it had no effect.

Remove underscore and implement instanceManagement running once properly
with 3 lines of code.
2019-08-07 10:18:14 +02:00
Hornwitser 13a069a798 Reimplement hashFile locally
Replace the 10 MB of dependencies that is hash-files with a homebrew
Promise based implementation of hashFile that uses crypto and fs.  This
somehow also ends up being the same amount of code as the one using
hash-files.
2019-08-07 10:18:14 +02:00
Godmave 0df1b8e1fd Add tailing of files and move socketio connect after plugin load (#191)
#add tailing of files to prevent lost data between factorio and clusterio
#move socketio connect to the bottom after the plugins are loaded 
  to prevent plugins not getting the connection event
#add some more transfer compression in different places
2019-08-05 07:47:57 +02:00
Hornwitser f76c84c3f1 Move node_modules/_app/ into lib/ as a package (#190)
Move the contents of node_modules/_app into lib/ as there shouldn't be
any content in node_modules.  This directory is automatically managed
and pruned by npm.

Add lib/ as a local package in package.json, this allows scripts
everywhere to require it's content as "lib/path" instead of relying on
local paths.  This shadows the StdLib Node.js Bindings package, but I
could care less.

Change all requires with lib as a local path and _app to use just lib.
2019-08-04 15:52:36 +02:00
Hornwitser a13d4c6805 Use published version of rcon-client-fork (#188)
Switch to a version of rcon-client-fork that's published on npm.  Avoids
having to put build files in the git repo.
2019-07-30 16:28:43 +03:00
Master-Guy 6ac8c0711f JSON fix
Small fix for JSON
2019-07-17 19:23:53 +02:00
Master-Guy c9cbc48d95 2/2 Add "info" field between client and master
Adds a "info" field to config.json and allows the client to send the contents of this info field to the master, so it also shows up (i.e. with /api/slaves)
2019-07-17 18:40:01 +02:00
Master-Guy 50370bf858 1/2 Add "info" field between client and master
Adds a "info" field to config.json and allows the client to send the contents of this info field to the master, so it also shows up (i.e. with /api/slaves)
2019-07-17 18:35:02 +02:00
Daniel Vestøl 6c32271c56 Fixed rcon timeout in the right place, set to 200s for 1250kB commands 2019-07-06 12:44:31 +02:00
Daniel Vestøl a122f2b09e Increased rcon timeout to 20s, increased maxPending to 5 2019-07-06 00:46:22 +02:00
Daniel Vestøl f35be2f355 Set max pending rcon requests to 1 2019-07-05 23:42:51 +02:00
Daniel Vestøl 9b6f8cf652 Fixed error related to getting playerCount 2018-11-17 16:09:46 +01:00
Daniel Vestøl 58b609cbd0 Fixed portable instances 2018-11-10 17:29:32 +01:00
Daniel Vestøl 8a84f4087a Bugfix and usability improvements 2018-09-23 09:17:07 +02:00
Daniel Vestøl 07b9d0a0f5 Fixed getMac spam in VMs, added log rotation 2018-08-23 10:04:19 +02:00
Daniel Vestøl 765146b559 Plugin loading now respects disabled plugins 2018-08-16 14:52:09 +02:00
Daniel Vestøl ffa2d0b0fb Fixed windows crash on ctrl+c preventing factorio from saving 2018-08-16 12:19:18 +02:00
Daniel Vestøl a76e07c07b Enable and disable plugins from the commandline (non functional as of yet) 2018-08-15 23:15:01 +02:00
Daniel Vestøl 9461978a6e Reduced log spam 2018-07-30 13:30:03 +02:00
Daniel Vestøl 4fed43bad6 [big change] Moved core clusterio Lua mod functionality into its own plugin 2018-07-28 13:45:05 +02:00
Gerkiz 49124021a8 Added docker support
Docker doesn't really do anything with the  '/quit'.
However, changing from 'quit' to 'serverprocess.kill("SIGINT");' solved this issue.
The node exits with:
'[dumb-init] Child exited with status 0. Goodbye.'
2018-07-25 21:47:03 +02:00
Daniel Vestøl 8abeb26dce Commandline tools to install/uninstall plugins from github 2018-07-25 01:14:43 +02:00
Daniel Vestøl 958cdfa15a Fixed node client.js manage * mods * 2018-07-24 23:14:02 +02:00
Daniel Vestøl d913d59d72 Handle instance creation failing gracefully upon lacking internet 2018-07-24 23:00:42 +02:00
Daniel Vestøl 42037fc451 client.js now adds Hotpatch to new maps 2018-07-18 10:30:35 +02:00
Daniel Vestøl e73a6052fe Instance creation with external instance paths are now working 2018-07-15 17:43:26 +02:00
Daniel Vestøl 724248b09b Merge branch 'master' into #85 2018-07-15 16:10:28 +02:00
Daniel Vestøl 98131ee66e Very big changes to help custom config paths 2018-07-13 22:56:10 +02:00
hintss af42b1fcd3 fix typo in log message 2018-07-13 01:36:12 -07:00
chrisgbk 9501861285 Fix race condition in node client download
Fix race condition in node client download
2018-07-10 04:23:40 -06:00
Daniel Vestøl bf19001055 Fixed --config, is probably unstable on client.js 2018-06-24 16:48:08 +02:00
Daniel Vestøl 443e5dc286 Arguments: --port --masterPort --sslPort --config --rcon-port --rcon-password 2018-06-24 16:46:31 +02:00
Daniel Vestøl 8267dae10e #85 update config.ini with absolute paths 2018-06-24 15:00:48 +02:00
Daniel Vestøl d177fb7304 client.js exits after creating and instance, better comments 2018-06-24 14:24:36 +02:00
Daniel Vestøl 7d99162072 Merge branch '#85' 2018-06-24 13:57:24 +02:00
Daniel Vestøl 447766c752 Fixed mod manager not exiting after downloading mods 2018-06-16 15:41:06 +02:00
Daniel Vestøl e4c276054b Don't spam internal errors when server is paused/shutting down 2018-06-13 20:59:39 +02:00
Daniel Vestøl 780feb7eb8 Prevented \n in playerCount, webinterface function to get queryString params added 2018-06-10 09:53:22 +02:00
Danielv123 812265d0fd messageInterface now returns a promise as well 2018-05-31 21:18:05 +02:00
Danielv123 da6f96a34b UPSdisplay now uses rcon return value instead of game.write_file 2018-05-31 21:15:34 +02:00
Danielv123 88e8ab454f Possibility of having master-only plugins 2018-05-31 21:03:05 +02:00
Danielv123 165cfffecb Use rcon.print instead of writefile for playercount reports 2018-05-13 09:58:25 +02:00
Danielv123 ce6dc3af28 messageInterface now takes a second arg for rcon return values (from rcon.print()) 2018-05-10 14:15:03 +02:00
Danielv123 0b81fb6351 Made factorio command ratelimiting configurable 2018-05-07 18:11:46 +02:00
Danielv123 6dd25cb1e8 Don't assume playercount is 0 just because a command fails 2018-05-06 10:32:11 +02:00
Danielv123 c02bb6d58f #85 made instance directory configurable in config.json 2018-05-04 17:50:20 +02:00
psihius be73f2f3a5 Changed command splitting logic from json data to lua tables 2018-05-01 21:36:38 +03:00