morko / haxroomie Goto Github PK
View Code? Open in Web Editor NEWHaxroomie is an API and CLI to run headless HaxBall rooms without GUI.
Haxroomie is an API and CLI to run headless HaxBall rooms without GUI.
User changed the plugin config in all three rooms he was running, but after running reload it only reloaded one of them.
He changed the config for one plugin in all three rooms.
Currently when loading a plugin from invalid path the CLI spits out this cryptic message:
2019-06-23 13:20:01 [error]: TypeError: Cannot set property 'name' of undefined
at Config.loadFilesInRoomConfig (/home/oskari/workspace/node/haxroomie/src/cli/Config.js:88:22)
at Config.load (/home/oskari/workspace/node/haxroomie/src/cli/Config.js:51:26)
at Config.reload (/home/oskari/workspace/node/haxroomie/src/cli/Config.js:127:26)
at Object.run (/home/oskari/workspace/node/haxroomie/src/cli/Commands.js:131:41)
at Commands.execute (/home/oskari/workspace/node/haxroomie/src/cli/CommandHandler.js:53:24)
at CommandPrompt.onNewLine (/home/oskari/workspace/node/haxroomie/src/cli/CommandPrompt.js:194:22)
at Interface.emit (events.js:198:13)
at Interface._onLine (readline.js:308:10)
at Interface._line (readline.js:656:8)
at Interface._ttyWrite (readline.js:937:14)
The haxroomie HHM plugin defines multiple functions in the global namespace at the browser context prefixed with hr. Instead the could be grouped under haxroomie object to minimize the pollution.
When the current room is not running the rooms
command gives an error.
room1> close room1
room1> rooms
2019-06-23 11:53:43 [error]: Could not execute: rooms
2019-06-23 11:53:43 [error]: Error: Room is not running.
plugins might store some persistent data there
Should treat this as a regular plugin even though some CLI commands depend on it. If it does not get loaded disable the commands.
Easier to keep different versions of them.
If error happens during openRoom
the browser navigates out of the headless haxball page which is fine normally, but when developing in windowed mode it is annoying.
Do not do this when using windowed mode.
When testing changes to plugins it would be great if the plugins
option would be preferred over the pluginConfig
option that tries to load the plugins from available repositories.
The keys in pluginConfig
could be checked against plugins
and the plugins that exist on both should be removed from pluginConfig
.
Then when adding the plugins
the removed pluginConfig
keys could be iterated and the settings for added plugins can be set with HHM.manager.setPluginConfig
.
Should add a link to the GitHub page https://morko.github.io/haxroomie/ so users can find the documentation.
In the CLI the host player probably should not be listed. Also the indicator for admin could be more clear. It is hard to see who are admins quick atm.
Requesting the open and close functions through the sessions send method is just confusing and should be replaced with asynchronous openRoom and closeRoom methods.
New way to subscribe for the event is
room.onHhm_eventType = […]
To register one function for several types just do
room.onHhm_eventType1 = room.onHhm_eventType2 = […]
Looking at https://github.com/morko/haxroomie/blob/develop/src/hhm/haxroomie-plugin.js you can either simply add them to defaultRoomEventHandlers or change defaultHHMEvents and the loop to look similar to the one for defaultRoomEventHandlers
(thanks saviola)
The session should probably be closed if the browser tab is closed because there is probably no use for it without the tab.
If not waited, then reload
command will throw error on new rooms that have autoStart: true
.
Line 142 in 8201fb0
This will cause problems because the browser has the same session name for each tab.
Easier for user to follow what changed.
Friend bought new VPS to host a haxroomie lobby. Works fine but cannot input terminal commands after someone joins the lobby. For instance, he will join the lobby and go onto his terminal to type "admin 1" but there will be no response or admin given to the player. Chat comes through, player join messages come through, but he can't use any commands to give admins, etc.
Currently the CLI searches for the config in the current working directory. It would make more sense to try load one from e.g.
/home/user/.haxroomie/config.js
If haxroomie
would be ran without the -c
option, then one of the example configs could be copied to the mentioned directory.
should show the errors and maybe stack
If a plugin is ignored in haxroomie-plugins.js the HHM event still gets sent and it does not contain the plugin in expected form.
Eases the development and testing.
Currently user needs to create the haxroomie object and after that call createBrowser because constructors cant be asynchronous.
e.g.
let haxroomie = new Haxroomie();
await haxroomie.createBrowser();
This could be done in the factory function called e.g. createHaxroomie
.
let haxroomie = await createHaxroomie();
Do not ignore the pluginConfig
option when using roomScript
. Only disable the plugin config that is defined in the default hhm config.
Happened when closed and opened the room fast. Browser probably did not have enough time to navigate out of the haxball page.
2019-02-21 10:39:52 [error]: SEND_TO_ROOM_ERROR (haxroomie): Error: Failed to add page binding with name sendToHaxroomie: window['sendToHaxroomie'] already exists! at Page.exposeFunction (C:\Users\oskar\workspace\node\haxroomie\node_modules\puppeteer\lib\Page.js:428:13) at Page.<anonymous> (C:\Users\oskar\workspace\node\haxroomie\node_modules\puppeteer\lib\helper.js:109:23) at RoomOpener.open (C:\Users\oskar\workspace\node\haxroomie\src\room\RoomOpener.js:144:21) at process._tickCallback (internal/process/next_tick.js:68:7)
2019-03-14 14:40:05 [debug]: BROADCAST {"type":"CLIENT_CONNECTED","sender":"haxroomie","payload":{"roomInfo":null,"clientID":"4SnsV6CSSb7F2oi0AAAC"}}
Missing the roomInfo!
provide a link to the tutorial in wiki
A default plugin sav/plugin-control
will require host role to be available so it should be included in the example configs.
Add a link to the support discord server.
With the saviola777/haxball-headless-manager@4c41619 version of HHM the error message is
Failed to load resource: the server responded with a status of 404 ()
so should change
haxroomie/src/room/RoomController.js
Lines 319 to 320 in 7c2b35b
Failed to load resource: the server responded with a status of 404
This would make the readme more clean and easier to navigate the option documentation with a custom sidebar in the wiki.
In the CLI if user does reload
and the only property in the config changed is the pluginConfig
, it will still restart the room although it is not needed.
The link to the default config gives a 404 error. You could also link to
https://github.com/saviola777/haxball-headless-manager/blob/master/config/default.js
at this point, since my default config is "haxroomie-compatible" I believe.
In haxroomie CLI config the user should be able to load a repository like this:
repositories: [
{
type: 'local',
path: '/path/to/local/repository'
}
]
https://github.com/steveush/foodoc seems to be good candidate
Currently the help
shows
open Opens room with given id.
close Closes room with given id.
but it might not be clear to user what is the room id.
Noticed that documentation is missing from
openRoom
can return undefinedCurrently the lockfile is stored in src/cli which is not very nice place for it.
In Linux the best place to store a lockfile is probably /run/lock but nodejs does not have a method for receiving that directory so it's probably better to store in temp dir using the os.tmpdir()
method to receive it cross platform.
Currently if you define a token property in the rooms config it gets ignored and user still get asked for the password when using CLI. For easier development etc. it should be possible to define e.g. token: process.env.HAX_TOKEN
in the config.
Add links and info where to get the tokens to open rooms. These links should be in the haxroomie CLI and README.md.
Add support for multiple tabs in the console.
2019-06-17 15:40:12 [error]: Error: Could not load the config: /home/asdf/config.js
at Config.load (/home/asdf/.npm/lib/node_modules/haxroomie/src/cli/Config.js:45:13)
at new Config (/home/asdf/.npm/lib/node_modules/haxroomie/src/cli/Config.js:14:24)
at HRConsoleApp.start (/home/asdf/.npm/lib/node_modules/haxroomie/src/cli/HRConsoleApp.js:33:19)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
Should say its a syntax error.
Its easy for unexperienced users to use '
and then mess up the config.
The logging currently is a bit too much. E.g. it is not really necessary to print the error stack when user tries to use an invalid command. RoomController
probably should not log the errors because it is already sending events that contain the errors so they can be handled on "client side".
README.md is missing instructions for how to update haxroomie.
Line 117 in 7c2b35b
s.src = `${HHM.baseUrl}hhm.js?_=${Date.now()}`;
HHM now supports defining the roles that can see the command.
function registerHelp(command, helpText, { numArgs = "", roles = [] } = {})
# clearbans: clears all the bans id
Add a way to
Plugin list can maybe be obtained with
HHM.manager.getEnabledPluginIds().map((id) => HHM.manager.getPluginName(id));
Also throws if user adds a new room with a plugin
property.
RELOAD CONFIG /example/haxroomie/config.js
room1> 2019-06-23 12:08:44 [error]: Could not execute: reload
2019-06-23 12:08:44 [error]: TypeError: Cannot read property 'length' of undefined
at Config.getModifiedProperties (/home/oskari/workspace/node/haxroomie/src/cli/Config.js:214:64)
at Config.reload (/home/oskari/workspace/node/haxroomie/src/cli/Config.js:166:37)
at Object.run (/home/oskari/workspace/node/haxroomie/src/cli/Commands.js:131:41)
at Commands.execute (/home/oskari/workspace/node/haxroomie/src/cli/CommandHandler.js:53:24)
at onNewLine (/home/oskari/workspace/node/haxroomie/src/cli/cprompt.js:109:15)
at Interface.rl.on (/home/oskari/workspace/node/haxroomie/src/cli/cprompt.js:36:25)
at Interface.emit (events.js:193:13)
at Interface._onLine (readline.js:307:10)
at Interface._line (readline.js:680:8)
at Interface._ttyWrite (readline.js:960:14)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.