Giter Club home page Giter Club logo

haxroomie's People

Contributors

dependabot[bot] avatar jakjus avatar morko avatar oskarip-etteplan avatar raamyy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

haxroomie's Issues

Display better error message when file is not found

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) 

don't pollute global namespace

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.

rooms command does not work if executed on closed room

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.

prefer to load plugins from filesystem if pluginConfig with same name is present

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.

search for the CLI config from another directory

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.

ignored plugins not ignored

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.

export async factory function to create haxroomie

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();

Error: Failed to add page binding with name sendToHaxroomie

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)                                                              

save the lockfile in to temporary directory

Currently 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.

Allow using token from environment variable

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.

support multiple tabs in cli

Add support for multiple tabs in the console.

  • settings for starting multiple rooms could be read from user specified config file
  • token argument should be an optional named argument instead of required positional
  • if token is not provided with argument then prompt user for it for each started room
  • add new commands for the interactive "shell" to
    • list rooms
    • change room
    • restart room
  • the prompt should display the room name to indicate which room user is controlling

unclear error message when trying to load config with syntax error

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.

crazy error logging

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".

way to control HHM plugins

Add a way to

  • get list of currently loaded plugins and their information
  • enable plugins
  • disable plugins

Plugin list can maybe be obtained with

HHM.manager.getEnabledPluginIds().map((id) => HHM.manager.getPluginName(id));

Reloading config that adds a plugins option throws error

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) 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.