omegga 0.1.85 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +142 -62
- package/bin/omegga +10 -4
- package/dist/brickadia/config.d.ts +3 -0
- package/dist/brickadia/config.d.ts.map +1 -0
- package/dist/brickadia/config.js +61 -0
- package/dist/brickadia/config.js.map +1 -0
- package/dist/brickadia/presets.d.ts +65 -0
- package/dist/brickadia/presets.js +3 -0
- package/dist/brickadia/presets.js.map +1 -0
- package/dist/brickadia/server.d.ts +20 -0
- package/dist/brickadia/server.d.ts.map +1 -0
- package/dist/brickadia/server.js +188 -0
- package/dist/brickadia/server.js.map +1 -0
- package/dist/brickadia/types.d.ts +45 -0
- package/dist/brickadia/types.d.ts.map +1 -0
- package/dist/brickadia/types.js +3 -0
- package/dist/brickadia/types.js.map +1 -0
- package/dist/cli/auth.d.ts +20 -0
- package/dist/cli/auth.d.ts.map +1 -0
- package/dist/cli/auth.js +115 -0
- package/dist/cli/auth.js.map +1 -0
- package/dist/cli/config.d.ts +10 -0
- package/dist/cli/config.d.ts.map +1 -0
- package/dist/cli/config.js +72 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/index.d.ts +20 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +15 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/installer.d.ts +1 -0
- package/dist/cli/installer.d.ts.map +1 -0
- package/dist/cli/installer.js +55 -0
- package/dist/cli/installer.js.map +1 -0
- package/dist/cli/plugin.d.ts +11 -0
- package/dist/cli/plugin.d.ts.map +1 -0
- package/dist/cli/plugin.js +598 -0
- package/dist/cli/plugin.js.map +1 -0
- package/dist/cli/terminal.d.ts +34 -0
- package/dist/cli/terminal.d.ts.map +1 -0
- package/dist/cli/terminal.js +395 -0
- package/dist/cli/terminal.js.map +1 -0
- package/dist/config/authorizer.d.ts +2 -0
- package/dist/config/authorizer.d.ts.map +1 -0
- package/dist/config/authorizer.js +38 -0
- package/dist/config/authorizer.js.map +1 -0
- package/dist/config/formats/format_js.d.ts +3 -0
- package/dist/config/formats/format_js.d.ts.map +1 -0
- package/dist/config/formats/format_js.js +10 -0
- package/dist/config/formats/format_js.js.map +1 -0
- package/dist/config/formats/format_yml.d.ts +3 -0
- package/dist/config/formats/format_yml.d.ts.map +1 -0
- package/dist/config/formats/format_yml.js +14 -0
- package/dist/config/formats/format_yml.js.map +1 -0
- package/dist/config/index.d.ts +18 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +86 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/reader.d.ts +3 -0
- package/dist/config/reader.d.ts.map +1 -0
- package/dist/config/reader.js +30 -0
- package/dist/config/reader.js.map +1 -0
- package/dist/config/types.d.ts +37 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +3 -0
- package/dist/config/types.js.map +1 -0
- package/dist/config/validator.d.ts +6 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +26 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/config/writer.d.ts +3 -0
- package/dist/config/writer.d.ts.map +1 -0
- package/dist/config/writer.js +25 -0
- package/dist/config/writer.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/info/default_commands.json +28 -0
- package/dist/lib.d.ts +21 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +54 -0
- package/dist/lib.js.map +1 -0
- package/dist/logger.d.ts +41 -0
- package/dist/logger.js +67 -0
- package/dist/logger.js.map +1 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +284 -0
- package/dist/main.js.map +1 -0
- package/dist/omegga/auth.d.ts +6 -0
- package/dist/omegga/auth.d.ts.map +1 -0
- package/dist/omegga/auth.js +139 -0
- package/dist/omegga/auth.js.map +1 -0
- package/dist/omegga/commandInjector.d.ts +35 -0
- package/dist/omegga/commandInjector.d.ts.map +1 -0
- package/dist/omegga/commandInjector.js +234 -0
- package/dist/omegga/commandInjector.js.map +1 -0
- package/dist/omegga/index.d.ts +7 -0
- package/dist/omegga/index.d.ts.map +1 -0
- package/dist/omegga/index.js +43 -0
- package/dist/omegga/index.js.map +1 -0
- package/dist/omegga/logWrangler.d.ts +32 -0
- package/dist/omegga/logWrangler.d.ts.map +1 -0
- package/dist/omegga/logWrangler.js +279 -0
- package/dist/omegga/logWrangler.js.map +1 -0
- package/dist/omegga/matchers/auth.d.ts +9 -0
- package/dist/omegga/matchers/auth.d.ts.map +1 -0
- package/dist/omegga/matchers/auth.js +53 -0
- package/dist/omegga/matchers/auth.js.map +1 -0
- package/dist/omegga/matchers/chat.d.ts +9 -0
- package/dist/omegga/matchers/chat.d.ts.map +1 -0
- package/dist/omegga/matchers/chat.js +68 -0
- package/dist/omegga/matchers/chat.js.map +1 -0
- package/dist/omegga/matchers/command.d.ts +7 -0
- package/dist/omegga/matchers/command.d.ts.map +1 -0
- package/dist/omegga/matchers/command.js +39 -0
- package/dist/omegga/matchers/command.js.map +1 -0
- package/dist/omegga/matchers/exit.d.ts +3 -0
- package/dist/omegga/matchers/exit.d.ts.map +1 -0
- package/dist/omegga/matchers/exit.js +21 -0
- package/dist/omegga/matchers/exit.js.map +1 -0
- package/dist/omegga/matchers/index.d.ts +3 -0
- package/dist/omegga/matchers/index.d.ts.map +1 -0
- package/dist/omegga/matchers/index.js +39 -0
- package/dist/omegga/matchers/index.js.map +1 -0
- package/dist/omegga/matchers/init.d.ts +3 -0
- package/dist/omegga/matchers/init.d.ts.map +1 -0
- package/dist/omegga/matchers/init.js +26 -0
- package/dist/omegga/matchers/init.js.map +1 -0
- package/dist/omegga/matchers/interact.d.ts +4 -0
- package/dist/omegga/matchers/interact.js +39 -0
- package/dist/omegga/matchers/interact.js.map +1 -0
- package/dist/omegga/matchers/join.d.ts +4 -0
- package/dist/omegga/matchers/join.d.ts.map +1 -0
- package/dist/omegga/matchers/join.js +95 -0
- package/dist/omegga/matchers/join.js.map +1 -0
- package/dist/omegga/matchers/leave.d.ts +4 -0
- package/dist/omegga/matchers/leave.d.ts.map +1 -0
- package/dist/omegga/matchers/leave.js +59 -0
- package/dist/omegga/matchers/leave.js.map +1 -0
- package/dist/omegga/matchers/mapChange.d.ts +3 -0
- package/dist/omegga/matchers/mapChange.d.ts.map +1 -0
- package/dist/omegga/matchers/mapChange.js +38 -0
- package/dist/omegga/matchers/mapChange.js.map +1 -0
- package/dist/omegga/matchers/types.d.ts +5 -0
- package/dist/omegga/matchers/types.d.ts.map +1 -0
- package/dist/omegga/matchers/types.js +7 -0
- package/dist/omegga/matchers/types.js.map +1 -0
- package/dist/omegga/matchers/version.d.ts +3 -0
- package/dist/omegga/matchers/version.d.ts.map +1 -0
- package/dist/omegga/matchers/version.js +45 -0
- package/dist/omegga/matchers/version.js.map +1 -0
- package/dist/omegga/player.d.ts +71 -0
- package/dist/omegga/player.d.ts.map +1 -0
- package/dist/omegga/player.js +442 -0
- package/dist/omegga/player.js.map +1 -0
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.d.ts +23 -0
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.d.ts.map +1 -0
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.js +441 -0
- package/dist/omegga/plugin/plugin_jsonrpc_stdio.js.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.d.ts +129 -0
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.d.ts.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js +260 -0
- package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe/worker.d.ts +1 -0
- package/dist/omegga/plugin/plugin_node_safe/worker.d.ts.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe/worker.js +289 -0
- package/dist/omegga/plugin/plugin_node_safe/worker.js.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe.d.ts +24 -0
- package/dist/omegga/plugin/plugin_node_safe.d.ts.map +1 -0
- package/dist/omegga/plugin/plugin_node_safe.js +397 -0
- package/dist/omegga/plugin/plugin_node_safe.js.map +1 -0
- package/dist/omegga/plugin/plugin_node_unsafe.d.ts +13 -0
- package/dist/omegga/plugin/plugin_node_unsafe.d.ts.map +1 -0
- package/dist/omegga/plugin/plugin_node_unsafe.js +178 -0
- package/dist/omegga/plugin/plugin_node_unsafe.js.map +1 -0
- package/dist/omegga/plugin.d.ts +86 -0
- package/dist/omegga/plugin.d.ts.map +1 -0
- package/dist/omegga/plugin.js +458 -0
- package/dist/omegga/plugin.js.map +1 -0
- package/dist/omegga/server.d.ts +149 -0
- package/dist/omegga/server.d.ts.map +1 -0
- package/dist/omegga/server.js +601 -0
- package/dist/omegga/server.js.map +1 -0
- package/dist/omegga/types.d.ts +48 -0
- package/dist/omegga/types.d.ts.map +1 -0
- package/dist/omegga/types.js +3 -0
- package/dist/omegga/types.js.map +1 -0
- package/dist/omegga/wrapper.d.ts +22 -0
- package/dist/omegga/wrapper.d.ts.map +1 -0
- package/dist/omegga/wrapper.js +75 -0
- package/dist/omegga/wrapper.js.map +1 -0
- package/dist/omeggaplugin.d.ts +1 -0
- package/dist/omeggaplugin.js +4 -0
- package/dist/omeggaplugin.js.map +1 -0
- package/dist/plugin.d.ts +781 -0
- package/dist/plugin.js +41 -0
- package/dist/plugin.js.map +1 -0
- package/dist/softconfig.d.ts +51 -0
- package/dist/softconfig.d.ts.map +1 -0
- package/dist/softconfig.js +82 -0
- package/dist/softconfig.js.map +1 -0
- package/dist/util/brick/checkBounds.d.ts +8 -0
- package/dist/util/brick/checkBounds.d.ts.map +1 -0
- package/dist/util/brick/checkBounds.js +22 -0
- package/dist/util/brick/checkBounds.js.map +1 -0
- package/dist/util/brick/constants.d.ts +18 -0
- package/dist/util/brick/constants.d.ts.map +1 -0
- package/dist/util/brick/constants.js +184 -0
- package/dist/util/brick/constants.js.map +1 -0
- package/dist/util/brick/getBounds.d.ts +4 -0
- package/dist/util/brick/getBounds.d.ts.map +1 -0
- package/dist/util/brick/getBounds.js +39 -0
- package/dist/util/brick/getBounds.js.map +1 -0
- package/dist/util/brick/getBrickSize.d.ts +3 -0
- package/dist/util/brick/getBrickSize.d.ts.map +1 -0
- package/dist/util/brick/getBrickSize.js +12 -0
- package/dist/util/brick/getBrickSize.js.map +1 -0
- package/dist/util/brick/getScaleAxis.d.ts +3 -0
- package/dist/util/brick/getScaleAxis.d.ts.map +1 -0
- package/dist/util/brick/getScaleAxis.js +38 -0
- package/dist/util/brick/getScaleAxis.js.map +1 -0
- package/dist/util/brick/index.d.ts +13 -0
- package/dist/util/brick/index.d.ts.map +1 -0
- package/dist/util/brick/index.js +29 -0
- package/dist/util/brick/index.js.map +1 -0
- package/dist/util/brick/rotate.d.ts +17 -0
- package/dist/util/brick/rotate.d.ts.map +1 -0
- package/dist/util/brick/rotate.js +38 -0
- package/dist/util/brick/rotate.js.map +1 -0
- package/dist/util/brick/setOwnership.d.ts +12 -0
- package/dist/util/brick/setOwnership.d.ts.map +1 -0
- package/dist/util/brick/setOwnership.js +21 -0
- package/dist/util/brick/setOwnership.js.map +1 -0
- package/dist/util/chat.d.ts +23 -0
- package/dist/util/chat.d.ts.map +1 -0
- package/dist/util/chat.js +50 -0
- package/dist/util/chat.js.map +1 -0
- package/dist/util/color.d.ts +13 -0
- package/dist/util/color.d.ts.map +1 -0
- package/dist/util/color.js +130 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/file.d.ts +5 -0
- package/dist/util/file.d.ts.map +1 -0
- package/dist/util/file.js +114 -0
- package/dist/util/file.js.map +1 -0
- package/dist/util/index.d.ts +162 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +92 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/map.d.ts +6 -0
- package/dist/util/map.d.ts.map +1 -0
- package/dist/util/map.js +26 -0
- package/dist/util/map.js.map +1 -0
- package/dist/util/pattern.d.ts +1 -0
- package/dist/util/pattern.d.ts.map +1 -0
- package/dist/util/pattern.js +11 -0
- package/dist/util/pattern.js.map +1 -0
- package/dist/util/time.d.ts +4 -0
- package/dist/util/time.d.ts.map +1 -0
- package/dist/util/time.js +41 -0
- package/dist/util/time.js.map +1 -0
- package/dist/util/uuid.d.ts +2 -0
- package/dist/util/uuid.d.ts.map +1 -0
- package/dist/util/uuid.js +8 -0
- package/dist/util/uuid.js.map +1 -0
- package/dist/util/wsl.d.ts +1 -0
- package/dist/util/wsl.d.ts.map +1 -0
- package/dist/util/wsl.js +14 -0
- package/dist/util/wsl.js.map +1 -0
- package/dist/webserver/backend/api.d.ts +3 -0
- package/dist/webserver/backend/api.d.ts.map +1 -0
- package/dist/webserver/backend/api.js +685 -0
- package/dist/webserver/backend/api.js.map +1 -0
- package/dist/webserver/backend/calendar.d.ts +5 -0
- package/dist/webserver/backend/calendar.d.ts.map +1 -0
- package/dist/webserver/backend/calendar.js +21 -0
- package/dist/webserver/backend/calendar.js.map +1 -0
- package/dist/webserver/backend/database.d.ts +149 -0
- package/dist/webserver/backend/database.d.ts.map +1 -0
- package/dist/webserver/backend/database.js +575 -0
- package/dist/webserver/backend/database.js.map +1 -0
- package/dist/webserver/backend/index.d.ts +31 -0
- package/dist/webserver/backend/index.d.ts.map +1 -0
- package/dist/webserver/backend/index.js +189 -0
- package/dist/webserver/backend/index.js.map +1 -0
- package/dist/webserver/backend/metrics.d.ts +3 -0
- package/dist/webserver/backend/metrics.d.ts.map +1 -0
- package/dist/webserver/backend/metrics.js +203 -0
- package/dist/webserver/backend/metrics.js.map +1 -0
- package/dist/webserver/backend/types.d.ts +115 -0
- package/dist/webserver/backend/types.d.ts.map +1 -0
- package/dist/webserver/backend/types.js +3 -0
- package/dist/webserver/backend/types.js.map +1 -0
- package/dist/webserver/backend/util.d.ts +2 -0
- package/dist/webserver/backend/util.d.ts.map +1 -0
- package/dist/webserver/backend/util.js +78 -0
- package/dist/webserver/backend/util.js.map +1 -0
- package/dist/webserver/index.d.ts +2 -0
- package/dist/webserver/index.d.ts.map +1 -0
- package/dist/webserver/index.js +9 -0
- package/dist/webserver/index.js.map +1 -0
- package/{src/webserver/frontend → frontend}/app.html +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceBold.ttf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceItalic.otf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceMedium.otf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceRegular.ttf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/RobotoBold.ttf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/RobotoItalic.ttf +0 -0
- package/{src/webserver/frontend → frontend}/assets/fonts/RobotoRegular.ttf +0 -0
- package/{src/webserver/frontend → frontend}/assets/img/auth_bg.webp +0 -0
- package/{src/webserver/frontend → frontend}/assets/img/dark_bg.webp +0 -0
- package/{src/webserver/frontend → frontend}/assets/img/turkey.webp +0 -0
- package/{src/webserver/frontend → frontend}/auth.html +0 -0
- package/index.js +10 -2
- package/package.json +44 -16
- package/public/app.bundle.js +537 -73
- package/public/app.bundle.js.map +1 -1
- package/public/app.css +727 -2
- package/public/app.css.map +1 -1
- package/public/auth.bundle.js +18 -18
- package/public/auth.bundle.js.map +1 -1
- package/public/auth.css +364 -2
- package/public/auth.css.map +1 -1
- package/templates/rpc/README.md +29 -0
- package/templates/rpc/doc.json +7 -0
- package/templates/rpc/omegga_plugin +0 -0
- package/templates/rpc/plugin.json +4 -0
- package/templates/rpc/setup.sh +3 -0
- package/templates/safe/README.md +29 -0
- package/templates/safe/access.json +1 -0
- package/templates/safe/doc.json +7 -0
- package/templates/safe/omegga.plugin.js +20 -0
- package/templates/safe/plugin.json +4 -0
- package/templates/safe/setup.sh +4 -0
- package/templates/safe-ts/.gitignore.rename +3 -0
- package/templates/safe-ts/README.md +29 -0
- package/templates/safe-ts/access.json +1 -0
- package/templates/safe-ts/doc.json +7 -0
- package/templates/safe-ts/omegga.d.ts +1311 -0
- package/templates/safe-ts/omegga.plugin.ts +29 -0
- package/templates/safe-ts/plugin.json +4 -0
- package/templates/safe-ts/setup.sh +4 -0
- package/templates/safe-ts/tsconfig.json +10 -0
- package/templates/unsafe/README.md +29 -0
- package/templates/unsafe/doc.json +7 -0
- package/templates/unsafe/omegga.main.js +15 -0
- package/templates/unsafe/plugin.json +4 -0
- package/templates/unsafe/setup.sh +4 -0
- package/.babelrc.json +0 -5
- package/.github/workflows/lint.yml +0 -26
- package/.prettierrc +0 -7
- package/.vscode/extensions.json +0 -5
- package/src/OMEGGA_LEGACY_INSTALL +0 -44
- package/src/brickadia/config.js +0 -42
- package/src/brickadia/server.js +0 -227
- package/src/cli/auth.js +0 -104
- package/src/cli/config.js +0 -77
- package/src/cli/index.js +0 -6
- package/src/cli/installer.js +0 -65
- package/src/cli/plugin.js +0 -575
- package/src/cli/terminal.js +0 -466
- package/src/config/authorizer.js +0 -37
- package/src/config/formats/format_js.js +0 -6
- package/src/config/formats/format_yml.js +0 -8
- package/src/config/index.js +0 -81
- package/src/config/reader.js +0 -27
- package/src/config/validator.js +0 -32
- package/src/config/writer.js +0 -20
- package/src/info/default_commands.json +0 -26
- package/src/lib.js +0 -23
- package/src/main.js +0 -332
- package/src/omegga/auth.js +0 -138
- package/src/omegga/commandInjector.js +0 -228
- package/src/omegga/index.js +0 -22
- package/src/omegga/logWrangler.js +0 -323
- package/src/omegga/matchers/auth.js +0 -49
- package/src/omegga/matchers/chat.js +0 -73
- package/src/omegga/matchers/command.js +0 -39
- package/src/omegga/matchers/exit.js +0 -19
- package/src/omegga/matchers/init.js +0 -23
- package/src/omegga/matchers/join.js +0 -115
- package/src/omegga/matchers/leave.js +0 -58
- package/src/omegga/matchers/mapChange.js +0 -37
- package/src/omegga/matchers/version.js +0 -45
- package/src/omegga/player.js +0 -585
- package/src/omegga/plugin/plugin_jsonrpc_stdio.js +0 -526
- package/src/omegga/plugin/plugin_node_safe/proxyOmegga.js +0 -117
- package/src/omegga/plugin/plugin_node_safe/worker.js +0 -238
- package/src/omegga/plugin/plugin_node_safe.js +0 -473
- package/src/omegga/plugin/plugin_node_unsafe.js +0 -177
- package/src/omegga/plugin.js +0 -565
- package/src/omegga/server.js +0 -658
- package/src/omegga/wrapper.js +0 -62
- package/src/softconfig.js +0 -64
- package/src/util/brick/checkBounds.js +0 -22
- package/src/util/brick/constants.js +0 -185
- package/src/util/brick/getBounds.js +0 -36
- package/src/util/brick/getBrickSize.js +0 -9
- package/src/util/brick/getScaleAxis.js +0 -31
- package/src/util/brick/index.js +0 -9
- package/src/util/brick/rotate.js +0 -43
- package/src/util/brick/setOwnership.js +0 -20
- package/src/util/chat.js +0 -28
- package/src/util/color.js +0 -143
- package/src/util/file.js +0 -119
- package/src/util/index.js +0 -28
- package/src/util/map.js +0 -28
- package/src/util/pattern.js +0 -14
- package/src/util/time.js +0 -46
- package/src/util/uuid.js +0 -8
- package/src/util/wsl.js +0 -9
- package/src/webserver/backend/api.js +0 -795
- package/src/webserver/backend/calendar.js +0 -15
- package/src/webserver/backend/database.js +0 -725
- package/src/webserver/backend/index.js +0 -206
- package/src/webserver/backend/metrics.js +0 -148
- package/src/webserver/backend/util.js +0 -75
- package/src/webserver/frontend/.eslintrc.yml +0 -26
- package/src/webserver/frontend/app.js +0 -78
- package/src/webserver/frontend/auth.js +0 -16
- package/src/webserver/frontend/components/Background.vue +0 -83
- package/src/webserver/frontend/components/Button.vue +0 -105
- package/src/webserver/frontend/components/ChatEntry.vue +0 -107
- package/src/webserver/frontend/components/ChatTime.vue +0 -40
- package/src/webserver/frontend/components/Dimmer.vue +0 -43
- package/src/webserver/frontend/components/Dropdown.vue +0 -145
- package/src/webserver/frontend/components/Footer.vue +0 -29
- package/src/webserver/frontend/components/Header.vue +0 -27
- package/src/webserver/frontend/components/InfiniteScroll.vue +0 -51
- package/src/webserver/frontend/components/Input.vue +0 -93
- package/src/webserver/frontend/components/ListInput.vue +0 -105
- package/src/webserver/frontend/components/Loader.vue +0 -98
- package/src/webserver/frontend/components/MainMenuButton.vue +0 -83
- package/src/webserver/frontend/components/Modal.vue +0 -44
- package/src/webserver/frontend/components/NavBar.vue +0 -24
- package/src/webserver/frontend/components/PlayerDropdown.vue +0 -210
- package/src/webserver/frontend/components/PopoutContent.vue +0 -32
- package/src/webserver/frontend/components/RoleDropdown.vue +0 -157
- package/src/webserver/frontend/components/Scroll.vue +0 -33
- package/src/webserver/frontend/components/Toggle.vue +0 -91
- package/src/webserver/frontend/components/index.js +0 -33
- package/src/webserver/frontend/css/font.scss +0 -53
- package/src/webserver/frontend/css/mixins.scss +0 -49
- package/src/webserver/frontend/css/style.scss +0 -166
- package/src/webserver/frontend/css/theme.scss +0 -64
- package/src/webserver/frontend/partials/NavHeader.vue +0 -55
- package/src/webserver/frontend/partials/Page.vue +0 -40
- package/src/webserver/frontend/partials/PageContent.vue +0 -31
- package/src/webserver/frontend/partials/SideNav.vue +0 -115
- package/src/webserver/frontend/partials/index.js +0 -4
- package/src/webserver/frontend/router.js +0 -83
- package/src/webserver/frontend/views/Auth.vue +0 -190
- package/src/webserver/frontend/views/History.vue +0 -462
- package/src/webserver/frontend/views/Home.vue +0 -251
- package/src/webserver/frontend/views/Main.vue +0 -69
- package/src/webserver/frontend/views/NotFound.vue +0 -10
- package/src/webserver/frontend/views/Players.vue +0 -425
- package/src/webserver/frontend/views/PlayersInspector.vue +0 -538
- package/src/webserver/frontend/views/Plugins.vue +0 -217
- package/src/webserver/frontend/views/PluginsInspector.vue +0 -418
- package/src/webserver/frontend/views/Server.vue +0 -167
- package/src/webserver/frontend/views/Users.vue +0 -538
- package/src/webserver/frontend/widgets/Chat.vue +0 -124
- package/src/webserver/frontend/widgets/Status.vue +0 -91
- package/src/webserver/frontend/widgets/index.js +0 -2
- package/src/webserver/frontend/widgets/tooltip.js +0 -108
- package/src/webserver/index.js +0 -4
package/src/omegga/server.js
DELETED
|
@@ -1,658 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const glob = require('glob');
|
|
4
|
-
const brs = require('brs-js');
|
|
5
|
-
|
|
6
|
-
const OmeggaWrapper = require('./wrapper.js');
|
|
7
|
-
const { PluginLoader } = require('./plugin.js');
|
|
8
|
-
const commandInjector = require('./commandInjector.js');
|
|
9
|
-
const { Webserver } = require('../webserver/index.js');
|
|
10
|
-
const soft = require('../softconfig.js');
|
|
11
|
-
const { uuid, pattern, map: mapUtils } = require('../util/index.js');
|
|
12
|
-
const file = require('../util/file.js');
|
|
13
|
-
const Terminal = require('../cli/terminal.js');
|
|
14
|
-
require('colors');
|
|
15
|
-
|
|
16
|
-
const DEFAULT_COMMANDS = require('../info/default_commands.json');
|
|
17
|
-
const MISSING_CMD =
|
|
18
|
-
'"Command not found. Type <color=\\"ffff00\\">/help</> for a list of commands or <color=\\"ffff00\\">/plugins</> for plugin information."';
|
|
19
|
-
|
|
20
|
-
const MATCHERS = [
|
|
21
|
-
require('./matchers/join.js'),
|
|
22
|
-
// 'join' event => { name, id, state, controller }
|
|
23
|
-
|
|
24
|
-
require('./matchers/leave.js'),
|
|
25
|
-
// 'leave' event => { name, id, state, controller }
|
|
26
|
-
|
|
27
|
-
require('./matchers/chat.js'),
|
|
28
|
-
// 'chat' event => name, message; 'chatcmd:command' event => name, [...args]
|
|
29
|
-
// 'kick' event => name, kicker, reason
|
|
30
|
-
|
|
31
|
-
require('./matchers/command.js'),
|
|
32
|
-
// 'cmd:command' event => name, args (string)
|
|
33
|
-
|
|
34
|
-
require('./matchers/auth.js'),
|
|
35
|
-
// assigns host, 'host' event, 'start' event, 'unauthorized' event
|
|
36
|
-
|
|
37
|
-
require('./matchers/exit.js'),
|
|
38
|
-
// 'exit' event
|
|
39
|
-
|
|
40
|
-
require('./matchers/version.js'),
|
|
41
|
-
// 'version' event, check game version
|
|
42
|
-
|
|
43
|
-
require('./matchers/init.js'),
|
|
44
|
-
// watch loginit for any funny business
|
|
45
|
-
|
|
46
|
-
require('./matchers/mapChange.js'),
|
|
47
|
-
// 'mapchange' event
|
|
48
|
-
];
|
|
49
|
-
|
|
50
|
-
// TODO: safe broadcast parsing
|
|
51
|
-
|
|
52
|
-
const verboseLog = (...args) => {
|
|
53
|
-
if (!global.VERBOSE) return;
|
|
54
|
-
if (Omegga.log) Omegga.log('V>'.magenta, ...args);
|
|
55
|
-
else console.log('V>'.magenta, ...args);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
class Omegga extends OmeggaWrapper {
|
|
59
|
-
// pluginloader is not private so plugins can potentially add more formats
|
|
60
|
-
pluginLoader = undefined;
|
|
61
|
-
|
|
62
|
-
/** The save counter prevents omegga from saving over the same file */
|
|
63
|
-
_tempSaveCounter = 0;
|
|
64
|
-
/** The save prefix is prepended to all temporary saves */
|
|
65
|
-
_tempSavePrefix = 'omegga_temp_';
|
|
66
|
-
|
|
67
|
-
// allow a terminal to be used instead of console log
|
|
68
|
-
static terminal = undefined;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* send a console log to the readline terminal or stdout
|
|
72
|
-
* @param {...args} - things to print out
|
|
73
|
-
*/
|
|
74
|
-
static log(...args) {
|
|
75
|
-
(Omegga.terminal || console).log(...args);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* send a console error to the readline terminal or stderr
|
|
80
|
-
* @param {...args} - things to print out
|
|
81
|
-
*/
|
|
82
|
-
static error(...args) {
|
|
83
|
-
(Omegga.terminal || console).error(...args);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* send a console warn to the readline terminal or stdout
|
|
88
|
-
* @param {...args} - things to print out
|
|
89
|
-
*/
|
|
90
|
-
static warn(...args) {
|
|
91
|
-
(Omegga.terminal || console).warn(...args);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* send a console log when omegga is launched when --verbose
|
|
96
|
-
* @param {...args} message to print
|
|
97
|
-
*/
|
|
98
|
-
static verbose(...args) {
|
|
99
|
-
verboseLog(...args);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* send a console log to the readline terminal or console
|
|
104
|
-
* @param {terminal} - readline terminal instance
|
|
105
|
-
*/
|
|
106
|
-
static setTerminal(term) {
|
|
107
|
-
if (term instanceof Terminal) Omegga.terminal = term;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Omegga instance
|
|
112
|
-
* @constructor
|
|
113
|
-
*/
|
|
114
|
-
constructor(serverPath, cfg, options = {}) {
|
|
115
|
-
super(serverPath, cfg);
|
|
116
|
-
this.verbose = global.VERBOSE;
|
|
117
|
-
|
|
118
|
-
// inject commands
|
|
119
|
-
verboseLog('Setting up command injector');
|
|
120
|
-
commandInjector(this, this.logWrangler);
|
|
121
|
-
|
|
122
|
-
// launch options (disabling webserver)
|
|
123
|
-
this.options = options;
|
|
124
|
-
|
|
125
|
-
// path to save files
|
|
126
|
-
this.savePath = path.join(this.path, soft.DATA_PATH, 'Saved/Builds');
|
|
127
|
-
|
|
128
|
-
// path to config files
|
|
129
|
-
this.configPath = path.join(this.path, soft.DATA_PATH, 'Saved/Server');
|
|
130
|
-
|
|
131
|
-
// create dir folders
|
|
132
|
-
verboseLog('Creating directories');
|
|
133
|
-
file.mkdir(this.savePath);
|
|
134
|
-
file.mkdir(this.configPath);
|
|
135
|
-
|
|
136
|
-
// ignore auth file copy
|
|
137
|
-
if (!options.noauth) {
|
|
138
|
-
verboseLog('Copying auth files');
|
|
139
|
-
this.copyAuthFiles();
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// create the webserver if it's enabled
|
|
143
|
-
// the web interface provides access to server information while the server is running
|
|
144
|
-
// and lets you view chat logs, disable plugins, etc
|
|
145
|
-
if (!options.noweb) {
|
|
146
|
-
verboseLog('Creating webserver');
|
|
147
|
-
this.webserver = new Webserver(options, this);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if (!options.noplugin) {
|
|
151
|
-
verboseLog('Creating plugin loader');
|
|
152
|
-
// create the pluginloader
|
|
153
|
-
this.pluginLoader = new PluginLoader(
|
|
154
|
-
path.join(this.path, soft.PLUGIN_PATH),
|
|
155
|
-
this
|
|
156
|
-
);
|
|
157
|
-
|
|
158
|
-
verboseLog('Creating loading plugins');
|
|
159
|
-
// load all the plugin formats in
|
|
160
|
-
this.pluginLoader.loadFormats(path.join(__dirname, 'plugin'));
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/** @type {Array<Player>}list of online players */
|
|
164
|
-
this.players = [];
|
|
165
|
-
|
|
166
|
-
/** host player info `{id: uuid, name: player name}` */
|
|
167
|
-
this.host = undefined;
|
|
168
|
-
|
|
169
|
-
/** @type {String} current game version - may later be turned into CL#### versions */
|
|
170
|
-
this.version = -1;
|
|
171
|
-
|
|
172
|
-
/** @type {Boolean} whether server has started */
|
|
173
|
-
this.started = false;
|
|
174
|
-
/** @type {Boolean} whether server is starting up */
|
|
175
|
-
this.starting = false;
|
|
176
|
-
|
|
177
|
-
/** @type {String} current map */
|
|
178
|
-
this.currentMap = '';
|
|
179
|
-
|
|
180
|
-
// add all the matchers to the server
|
|
181
|
-
verboseLog('Adding matchers');
|
|
182
|
-
for (const matcher of MATCHERS) {
|
|
183
|
-
const { pattern, callback } = matcher(this);
|
|
184
|
-
this.addMatcher(pattern, callback);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
process.on('uncaughtException', async err => {
|
|
188
|
-
verboseLog('Uncaught exception', err);
|
|
189
|
-
this.emit('error', err);
|
|
190
|
-
// publish stop to database
|
|
191
|
-
if (this.webserver && this.webserver.database) {
|
|
192
|
-
this.webserver.database.addChatLog('server', {}, 'Server error');
|
|
193
|
-
}
|
|
194
|
-
try {
|
|
195
|
-
await this.stop();
|
|
196
|
-
} catch (e) {
|
|
197
|
-
Omegga.error(e);
|
|
198
|
-
}
|
|
199
|
-
process.exit();
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
// when brickadia starts, mark the server as started
|
|
203
|
-
this.on('start', ({ map }) => {
|
|
204
|
-
this.started = true;
|
|
205
|
-
this.starting = false;
|
|
206
|
-
this.currentMap = map;
|
|
207
|
-
this.writeln('Chat.MessageForUnknownCommands 0');
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
// when brickadia exits, stop omegga
|
|
211
|
-
this.on('exit', () => {
|
|
212
|
-
this.stop();
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
// when the process closes, emit the exit signal and stop
|
|
216
|
-
this.on('closed', () => {
|
|
217
|
-
if (this.started) this.emit('exit');
|
|
218
|
-
if (!this.stopping) this.stop();
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
// detect when a missing command is sent
|
|
222
|
-
this.on('cmd', (cmd, name) => {
|
|
223
|
-
// if it's not in the default commands and it's not registered to a plugin,
|
|
224
|
-
// it's okay to send the missing command message
|
|
225
|
-
if (
|
|
226
|
-
!DEFAULT_COMMANDS.includes(cmd) &&
|
|
227
|
-
(!this.pluginLoader || !this.pluginLoader.isCommand(cmd))
|
|
228
|
-
) {
|
|
229
|
-
this.whisper(name, MISSING_CMD);
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* start webserver, load plugins, start the brickadia server
|
|
236
|
-
* this should not be called by a plugin
|
|
237
|
-
* @returns {Promise}
|
|
238
|
-
*/
|
|
239
|
-
//
|
|
240
|
-
async start() {
|
|
241
|
-
this.starting = true;
|
|
242
|
-
if (this.webserver) await this.webserver.start();
|
|
243
|
-
if (this.pluginLoader) {
|
|
244
|
-
// scan for plugins
|
|
245
|
-
verboseLog('Scanning for plugins');
|
|
246
|
-
await this.pluginLoader.scan();
|
|
247
|
-
|
|
248
|
-
// load the plugins
|
|
249
|
-
verboseLog('Loading plugins');
|
|
250
|
-
await this.pluginLoader.reload();
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
verboseLog('Starting Brickadia');
|
|
254
|
-
super.start();
|
|
255
|
-
this.emit('server:starting');
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* unload plugins and stop the server
|
|
260
|
-
* this should not be called by a plugin
|
|
261
|
-
* @returns {Promise}
|
|
262
|
-
*/
|
|
263
|
-
async stop() {
|
|
264
|
-
if (!this.started && !this.starting) {
|
|
265
|
-
verboseLog("Stop called while server wasn't started or was starting");
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
if (this.stopping) {
|
|
270
|
-
verboseLog('Stop called while server was starting');
|
|
271
|
-
return;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
this.stopping = true;
|
|
275
|
-
this.emit('server:stopping');
|
|
276
|
-
if (this.pluginLoader) {
|
|
277
|
-
verboseLog('Unloading plugins');
|
|
278
|
-
await this.pluginLoader.unload();
|
|
279
|
-
}
|
|
280
|
-
verboseLog('Stopping server');
|
|
281
|
-
super.stop();
|
|
282
|
-
if (this.stopping) this.emit('server:stopped');
|
|
283
|
-
this.stopping = false;
|
|
284
|
-
this.started = false;
|
|
285
|
-
this.starting = false;
|
|
286
|
-
this.players = [];
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
/**
|
|
290
|
-
* Copies auth files from home config dir
|
|
291
|
-
* this should never be called by a plugin
|
|
292
|
-
*/
|
|
293
|
-
copyAuthFiles() {
|
|
294
|
-
const authPath = path.join(this.path, soft.DATA_PATH, 'Saved/Auth');
|
|
295
|
-
const homeAuthPath = path.join(soft.CONFIG_HOME, soft.CONFIG_AUTH_DIR);
|
|
296
|
-
|
|
297
|
-
file.copyFiles(homeAuthPath, authPath, soft.BRICKADIA_AUTH_FILES);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// TODO: split messages that longer than 512 characters
|
|
301
|
-
// TODO: delete characters that are known to crash the game
|
|
302
|
-
/**
|
|
303
|
-
* broadcast messages to chat
|
|
304
|
-
* messages are broken by new line
|
|
305
|
-
* multiple arguments are additional lines
|
|
306
|
-
* all messages longer than 512 characters are deleted automatically, though omegga wouldn't have sent them anyway
|
|
307
|
-
* @param {...String} - unescaped chat messages to send. may need to wrap messages with quotes
|
|
308
|
-
*/
|
|
309
|
-
//
|
|
310
|
-
broadcast(...messages) {
|
|
311
|
-
messages
|
|
312
|
-
.flatMap(m => m.toString().split('\n'))
|
|
313
|
-
.filter(m => m.length < 512)
|
|
314
|
-
.forEach(m => this.writeln(`Chat.Broadcast ${m}`));
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* whisper messages to a player's chat
|
|
319
|
-
* messages are broken by new line
|
|
320
|
-
* multiple arguments are additional lines
|
|
321
|
-
* all messages longer than 512 characters are deleted automatically, though omegga wouldn't have sent them anyway
|
|
322
|
-
* @param {String} - player identifier or player object
|
|
323
|
-
* @param {...String} - unescaped chat messages to send. may need to wrap messages with quotes
|
|
324
|
-
*/
|
|
325
|
-
//
|
|
326
|
-
whisper(target, ...messages) {
|
|
327
|
-
// find the target player
|
|
328
|
-
if (typeof target !== 'object') target = this.getPlayer(target);
|
|
329
|
-
|
|
330
|
-
// whisper the messages to that player
|
|
331
|
-
messages
|
|
332
|
-
.flatMap(m => m.toString().split('\n'))
|
|
333
|
-
.filter(m => m.length < 512)
|
|
334
|
-
.forEach(m => this.writeln(`Chat.Whisper "${target.name}" ${m}`));
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* get a list of players
|
|
339
|
-
* @return {players} - list of players {id: uuid, name: name} objects
|
|
340
|
-
*/
|
|
341
|
-
getPlayers() {
|
|
342
|
-
return this.players.map(p => ({ ...p }));
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Get up-to-date role setup from RoleSetup.json
|
|
347
|
-
* @return {object}
|
|
348
|
-
*/
|
|
349
|
-
getRoleSetup() {
|
|
350
|
-
return file.readWatchedJSON(path.join(this.configPath, 'RoleSetup.json'));
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Get up-to-date role assignments from RoleAssignment.json
|
|
355
|
-
* @return {object}
|
|
356
|
-
*/
|
|
357
|
-
getRoleAssignments() {
|
|
358
|
-
return file.readWatchedJSON(
|
|
359
|
-
path.join(this.configPath, 'RoleAssignments.json')
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Get up-to-date ban list from BanList.json
|
|
365
|
-
* @return {object}
|
|
366
|
-
*/
|
|
367
|
-
getBanList() {
|
|
368
|
-
return file.readWatchedJSON(path.join(this.configPath, 'BanList.json'));
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* Get up-to-date name cache from PlayerNameCache.json
|
|
373
|
-
* @return {object}
|
|
374
|
-
*/
|
|
375
|
-
getNameCache() {
|
|
376
|
-
return file.readWatchedJSON(
|
|
377
|
-
path.join(this.configPath, 'PlayerNameCache.json')
|
|
378
|
-
);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* find a player by name, id, controller, or state
|
|
383
|
-
* @param {String} - name, id, controller, or state
|
|
384
|
-
* @return {Player}
|
|
385
|
-
*/
|
|
386
|
-
getPlayer(arg) {
|
|
387
|
-
return this.players.find(
|
|
388
|
-
p =>
|
|
389
|
-
p.name === arg ||
|
|
390
|
-
p.id === arg ||
|
|
391
|
-
p.controller === arg ||
|
|
392
|
-
p.state === arg
|
|
393
|
-
);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* find a player by rough name, prioritize exact matches and get fuzzier
|
|
398
|
-
* @param {String} - player name, fuzzy
|
|
399
|
-
* @return {Player}
|
|
400
|
-
*/
|
|
401
|
-
findPlayerByName(name) {
|
|
402
|
-
name = name.toLowerCase();
|
|
403
|
-
const exploded = pattern.explode(name);
|
|
404
|
-
return (
|
|
405
|
-
this.players.find(p => p.name === name) || // find by exact match
|
|
406
|
-
this.players.find(p => p.name.indexOf(name) > -1) || // find by rough match
|
|
407
|
-
this.players.find(p => p.name.match(exploded))
|
|
408
|
-
); // find by exploded regex match (ck finds cake, tbp finds TheBlackParrot)
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* get the host's ID
|
|
413
|
-
* @return {String} - Host Id
|
|
414
|
-
*/
|
|
415
|
-
getHostId() {
|
|
416
|
-
return this.host ? this.host.id : '';
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
/**
|
|
420
|
-
* clear a user's bricks (by uuid, name, controller, or player object)
|
|
421
|
-
* @param {String|Object} - player or player identifier
|
|
422
|
-
* @param {Boolean} - quietly clear bricks
|
|
423
|
-
*/
|
|
424
|
-
clearBricks(target, quiet = false) {
|
|
425
|
-
// target is a player object, just use that id
|
|
426
|
-
if (typeof target === 'object' && target.id) target = target.id;
|
|
427
|
-
// if the target isn't a uuid already, find the player by name or controller and use that uuid
|
|
428
|
-
else if (typeof target === 'string' && !uuid.match(target)) {
|
|
429
|
-
// only set the target if the player exists
|
|
430
|
-
const player = this.getPlayer(target);
|
|
431
|
-
target = player && player.id;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
if (!target) return;
|
|
435
|
-
|
|
436
|
-
this.writeln(`Bricks.Clear ${target} ${quiet ? 1 : ''}`);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Clear all bricks on the server
|
|
441
|
-
* @param {Boolean} - quietly clear bricks
|
|
442
|
-
*/
|
|
443
|
-
clearAllBricks(quiet = false) {
|
|
444
|
-
this.writeln(`Bricks.ClearAll ${quiet ? 1 : ''}`);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Save bricks under a name
|
|
449
|
-
* @param {String} - save file name
|
|
450
|
-
*/
|
|
451
|
-
saveBricks(name) {
|
|
452
|
-
// add quotes around the filename if it doesn't have them (backwards compat w/ plugins)
|
|
453
|
-
if (!(name.startsWith('"') && name.endsWith('"'))) name = `"${name}"`;
|
|
454
|
-
this.writeln(`Bricks.Save ${name}`);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* Load bricks on the server
|
|
459
|
-
* @param {String} - save name
|
|
460
|
-
* @param {Number} - world X offset
|
|
461
|
-
* @param {Number} - world Y offset
|
|
462
|
-
* @param {Number} - world Z offset
|
|
463
|
-
* @param {Boolean} - quiet mode
|
|
464
|
-
*/
|
|
465
|
-
loadBricks(name, { offX = 0, offY = 0, offZ = 0, quiet = false } = {}) {
|
|
466
|
-
// add quotes around the filename if it doesn't have them (backwards compat w/ plugins)
|
|
467
|
-
if (!(name.startsWith('"') && name.endsWith('"'))) name = `"${name}"`;
|
|
468
|
-
|
|
469
|
-
this.writeln(
|
|
470
|
-
`Bricks.Load ${name} ${offX} ${offY} ${offZ} ${quiet ? 1 : ''}`
|
|
471
|
-
);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* get all saves in the save folder and child folders
|
|
476
|
-
* @return {Array<String>}
|
|
477
|
-
*/
|
|
478
|
-
getSaves() {
|
|
479
|
-
return fs.existsSync(this.savePath)
|
|
480
|
-
? glob.sync(this.savePath + '/**/*.brs')
|
|
481
|
-
: [];
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Checks if a save exists and returns an absolute path
|
|
486
|
-
* @param {String} - Save filename
|
|
487
|
-
* @return {String} - Path to string
|
|
488
|
-
*/
|
|
489
|
-
getSavePath(name) {
|
|
490
|
-
const file = path.join(
|
|
491
|
-
this.savePath,
|
|
492
|
-
name.endsWith('.brs') ? name : name + '.brs'
|
|
493
|
-
);
|
|
494
|
-
return fs.existsSync(file) ? file : undefined;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
/**
|
|
498
|
-
* unsafely load save data (wrap in try/catch)
|
|
499
|
-
* @param {String} - save file name
|
|
500
|
-
* @param {SaveData} - BRS JS Save data
|
|
501
|
-
*/
|
|
502
|
-
writeSaveData(name, data) {
|
|
503
|
-
if (typeof name !== 'string')
|
|
504
|
-
throw 'expected name argument for writeSaveData';
|
|
505
|
-
|
|
506
|
-
const file = path.join(this.savePath, name + '.brs');
|
|
507
|
-
if (!file.startsWith(this.savePath))
|
|
508
|
-
throw 'save file not in Saved/Builds directory';
|
|
509
|
-
fs.writeFileSync(file, new Uint8Array(brs.write(data)));
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* unsafely read save data (wrap in try/catch)
|
|
514
|
-
* @param {String} - save file name
|
|
515
|
-
* @param {Boolean} - only read save header data
|
|
516
|
-
* @return {SaveData} - BRS JS Save Data
|
|
517
|
-
*/
|
|
518
|
-
readSaveData(name, nobricks = false) {
|
|
519
|
-
if (typeof name !== 'string')
|
|
520
|
-
throw 'expected name argument for readSaveData';
|
|
521
|
-
|
|
522
|
-
const file = this.getSavePath(name);
|
|
523
|
-
if (!file || !file.startsWith(this.savePath))
|
|
524
|
-
throw 'save file not in Saved/Builds directory';
|
|
525
|
-
if (file)
|
|
526
|
-
return brs.read(fs.readFileSync(file), {
|
|
527
|
-
preview: false,
|
|
528
|
-
bricks: !nobricks,
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* load bricks from save data and resolve when game finishes loading
|
|
534
|
-
* @param {SaveData} - BRS JS Save data
|
|
535
|
-
* @param {Number} - save load X offset
|
|
536
|
-
* @param {Number} - save load Y offset
|
|
537
|
-
* @param {Number} - save load Z offset
|
|
538
|
-
* @param {Boolean} - quiet mode
|
|
539
|
-
* @return {Promise}
|
|
540
|
-
*/
|
|
541
|
-
async loadSaveData(
|
|
542
|
-
data,
|
|
543
|
-
{ offX = 0, offY = 0, offZ = 0, quiet = false } = {}
|
|
544
|
-
) {
|
|
545
|
-
const saveFile =
|
|
546
|
-
this._tempSavePrefix + Date.now() + '_' + this._tempSaveCounter++;
|
|
547
|
-
// write savedata to file
|
|
548
|
-
this.writeSaveData(saveFile, data);
|
|
549
|
-
|
|
550
|
-
// wait for the server to finish reading the save
|
|
551
|
-
await this.watchLogChunk(
|
|
552
|
-
`Bricks.Load "${saveFile}" ${offX} ${offY} ${offZ} ${quiet ? 1 : ''}`,
|
|
553
|
-
/^LogBrickSerializer: (.+)$/,
|
|
554
|
-
{
|
|
555
|
-
first: match => match[0].endsWith(saveFile + '.brs...'),
|
|
556
|
-
last: match => match[1].match(/Read .+ bricks/),
|
|
557
|
-
afterMatchDelay: 0,
|
|
558
|
-
timeoutDelay: 30000,
|
|
559
|
-
}
|
|
560
|
-
);
|
|
561
|
-
|
|
562
|
-
// delete the save file after we're done
|
|
563
|
-
const savePath = this.getSavePath(saveFile);
|
|
564
|
-
if (savePath) {
|
|
565
|
-
fs.unlinkSync(savePath);
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* get current bricks as save data
|
|
571
|
-
* @return {Promise<SaveData>} - BRS JS Save Data
|
|
572
|
-
*/
|
|
573
|
-
async getSaveData() {
|
|
574
|
-
const saveFile =
|
|
575
|
-
this._tempSavePrefix + Date.now() + '_' + this._tempSaveCounter++;
|
|
576
|
-
|
|
577
|
-
// wait for the server to save the file
|
|
578
|
-
await this.watchLogChunk(
|
|
579
|
-
`Bricks.Save "${saveFile}"`,
|
|
580
|
-
/^(LogBrickSerializer|LogTemp): (.+)$/,
|
|
581
|
-
{
|
|
582
|
-
first: match => match[0].endsWith(saveFile + '.brs...'),
|
|
583
|
-
last: match =>
|
|
584
|
-
match[2].match(
|
|
585
|
-
/Saved .+ bricks and .+ components from .+ owners|Error: No bricks in grid!/
|
|
586
|
-
),
|
|
587
|
-
afterMatchDelay: 0,
|
|
588
|
-
timeoutDelay: 30000,
|
|
589
|
-
}
|
|
590
|
-
);
|
|
591
|
-
|
|
592
|
-
// read the save file
|
|
593
|
-
const savePath = this.getSavePath(saveFile);
|
|
594
|
-
if (savePath) {
|
|
595
|
-
// read and parse the save file
|
|
596
|
-
const saveData = brs.read(fs.readFileSync(savePath));
|
|
597
|
-
|
|
598
|
-
// delete the save file after we're done reading it
|
|
599
|
-
fs.unlinkSync(savePath);
|
|
600
|
-
|
|
601
|
-
// return the parsed save
|
|
602
|
-
return saveData;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
return undefined;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
/**
|
|
609
|
-
* Change server map
|
|
610
|
-
* @param {String} - Map name
|
|
611
|
-
* @return {Promise}
|
|
612
|
-
*/
|
|
613
|
-
async changeMap(map) {
|
|
614
|
-
if (!map) return;
|
|
615
|
-
|
|
616
|
-
// ServerTravel requires /Game/Maps/Plate/Plate instead of Plate
|
|
617
|
-
const brName = mapUtils.n2brn(map);
|
|
618
|
-
|
|
619
|
-
// wait for the server to change maps
|
|
620
|
-
const match = await this.addWatcher(
|
|
621
|
-
/^.*(LogLoad: Took .+ seconds to LoadMap\((?<map>.+)\))|(ERROR: The map .+)$/,
|
|
622
|
-
{
|
|
623
|
-
timeoutDelay: 30000,
|
|
624
|
-
exec: () => this.writeln(`ServerTravel ${brName}`),
|
|
625
|
-
}
|
|
626
|
-
);
|
|
627
|
-
const success = !!(
|
|
628
|
-
match &&
|
|
629
|
-
match[0] &&
|
|
630
|
-
match[0].groups &&
|
|
631
|
-
match[0].groups.map
|
|
632
|
-
);
|
|
633
|
-
return success;
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
/* Command injector methods are overwritten, this code is here for the doc */
|
|
637
|
-
|
|
638
|
-
/**
|
|
639
|
-
* Get a server status object containing bricks, time, players, player ping, player roles, etc
|
|
640
|
-
* @return {Promise<Object>} - Server Status
|
|
641
|
-
*/
|
|
642
|
-
async getServerStatus() {}
|
|
643
|
-
|
|
644
|
-
/**
|
|
645
|
-
* get every player's position and alive states
|
|
646
|
-
* @return {Promise<Array<Object>>}
|
|
647
|
-
*/
|
|
648
|
-
async getAllPlayerPositions() {}
|
|
649
|
-
|
|
650
|
-
/**
|
|
651
|
-
* get all minigames and their players (and the player's teams)
|
|
652
|
-
* @return {Promise<Array<Object>>}
|
|
653
|
-
*/
|
|
654
|
-
async getMinigames() {}
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
global.Omegga = Omegga;
|
|
658
|
-
module.exports = Omegga;
|
package/src/omegga/wrapper.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
The wrapper combines the things looking at or waiting for logs with the actual server logs
|
|
3
|
-
*/
|
|
4
|
-
const { EventEmitter } = require('events');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
|
|
7
|
-
const BrickadiaServer = require('../brickadia/server.js');
|
|
8
|
-
const soft = require('../softconfig.js');
|
|
9
|
-
const LogWrangler = require('./logWrangler.js');
|
|
10
|
-
|
|
11
|
-
class OmeggaWrapper extends EventEmitter {
|
|
12
|
-
#server = undefined;
|
|
13
|
-
|
|
14
|
-
constructor(serverPath, cfg) {
|
|
15
|
-
super();
|
|
16
|
-
this.setMaxListeners(Infinity);
|
|
17
|
-
|
|
18
|
-
this.config = cfg;
|
|
19
|
-
this.path =
|
|
20
|
-
path.isAbsolute(serverPath) || serverPath.startsWith('/')
|
|
21
|
-
? serverPath
|
|
22
|
-
: path.join(process.cwd(), serverPath);
|
|
23
|
-
this.dataPath = path.join(this.path, soft.DATA_PATH);
|
|
24
|
-
this.#server = new BrickadiaServer(this.dataPath, cfg);
|
|
25
|
-
|
|
26
|
-
// log wrangler wrangles logs... it reads brickadia logs and clumps them together
|
|
27
|
-
this.logWrangler = new LogWrangler(this);
|
|
28
|
-
this.#server.on('line', this.logWrangler.callback);
|
|
29
|
-
this.#server.on('line', line => this.emit('line', line));
|
|
30
|
-
this.#server.on('closed', () => this.emit('closed'));
|
|
31
|
-
this.addMatcher = this.logWrangler.addMatcher;
|
|
32
|
-
this.addWatcher = this.logWrangler.addWatcher;
|
|
33
|
-
this.watchLogArray = this.logWrangler.watchLogArray;
|
|
34
|
-
this.watchLogChunk = this.logWrangler.watchLogChunk;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// passthrough to server
|
|
38
|
-
write(str) {
|
|
39
|
-
this.#server.write(str);
|
|
40
|
-
}
|
|
41
|
-
writeln(str) {
|
|
42
|
-
this.#server.writeln(str);
|
|
43
|
-
}
|
|
44
|
-
start() {
|
|
45
|
-
return this.#server.start();
|
|
46
|
-
}
|
|
47
|
-
stop() {
|
|
48
|
-
return this.#server.stop();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// event emitter to catch everything
|
|
52
|
-
emit(type, ...args) {
|
|
53
|
-
try {
|
|
54
|
-
super.emit('*', type, ...args);
|
|
55
|
-
} catch (e) {
|
|
56
|
-
// error emitting
|
|
57
|
-
}
|
|
58
|
-
return super.emit(type, ...args);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
module.exports = OmeggaWrapper;
|