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.
Files changed (467) hide show
  1. package/README.md +142 -62
  2. package/bin/omegga +10 -4
  3. package/dist/brickadia/config.d.ts +3 -0
  4. package/dist/brickadia/config.d.ts.map +1 -0
  5. package/dist/brickadia/config.js +61 -0
  6. package/dist/brickadia/config.js.map +1 -0
  7. package/dist/brickadia/presets.d.ts +65 -0
  8. package/dist/brickadia/presets.js +3 -0
  9. package/dist/brickadia/presets.js.map +1 -0
  10. package/dist/brickadia/server.d.ts +20 -0
  11. package/dist/brickadia/server.d.ts.map +1 -0
  12. package/dist/brickadia/server.js +188 -0
  13. package/dist/brickadia/server.js.map +1 -0
  14. package/dist/brickadia/types.d.ts +45 -0
  15. package/dist/brickadia/types.d.ts.map +1 -0
  16. package/dist/brickadia/types.js +3 -0
  17. package/dist/brickadia/types.js.map +1 -0
  18. package/dist/cli/auth.d.ts +20 -0
  19. package/dist/cli/auth.d.ts.map +1 -0
  20. package/dist/cli/auth.js +115 -0
  21. package/dist/cli/auth.js.map +1 -0
  22. package/dist/cli/config.d.ts +10 -0
  23. package/dist/cli/config.d.ts.map +1 -0
  24. package/dist/cli/config.js +72 -0
  25. package/dist/cli/config.js.map +1 -0
  26. package/dist/cli/index.d.ts +20 -0
  27. package/dist/cli/index.d.ts.map +1 -0
  28. package/dist/cli/index.js +15 -0
  29. package/dist/cli/index.js.map +1 -0
  30. package/dist/cli/installer.d.ts +1 -0
  31. package/dist/cli/installer.d.ts.map +1 -0
  32. package/dist/cli/installer.js +55 -0
  33. package/dist/cli/installer.js.map +1 -0
  34. package/dist/cli/plugin.d.ts +11 -0
  35. package/dist/cli/plugin.d.ts.map +1 -0
  36. package/dist/cli/plugin.js +598 -0
  37. package/dist/cli/plugin.js.map +1 -0
  38. package/dist/cli/terminal.d.ts +34 -0
  39. package/dist/cli/terminal.d.ts.map +1 -0
  40. package/dist/cli/terminal.js +395 -0
  41. package/dist/cli/terminal.js.map +1 -0
  42. package/dist/config/authorizer.d.ts +2 -0
  43. package/dist/config/authorizer.d.ts.map +1 -0
  44. package/dist/config/authorizer.js +38 -0
  45. package/dist/config/authorizer.js.map +1 -0
  46. package/dist/config/formats/format_js.d.ts +3 -0
  47. package/dist/config/formats/format_js.d.ts.map +1 -0
  48. package/dist/config/formats/format_js.js +10 -0
  49. package/dist/config/formats/format_js.js.map +1 -0
  50. package/dist/config/formats/format_yml.d.ts +3 -0
  51. package/dist/config/formats/format_yml.d.ts.map +1 -0
  52. package/dist/config/formats/format_yml.js +14 -0
  53. package/dist/config/formats/format_yml.js.map +1 -0
  54. package/dist/config/index.d.ts +18 -0
  55. package/dist/config/index.d.ts.map +1 -0
  56. package/dist/config/index.js +86 -0
  57. package/dist/config/index.js.map +1 -0
  58. package/dist/config/reader.d.ts +3 -0
  59. package/dist/config/reader.d.ts.map +1 -0
  60. package/dist/config/reader.js +30 -0
  61. package/dist/config/reader.js.map +1 -0
  62. package/dist/config/types.d.ts +37 -0
  63. package/dist/config/types.d.ts.map +1 -0
  64. package/dist/config/types.js +3 -0
  65. package/dist/config/types.js.map +1 -0
  66. package/dist/config/validator.d.ts +6 -0
  67. package/dist/config/validator.d.ts.map +1 -0
  68. package/dist/config/validator.js +26 -0
  69. package/dist/config/validator.js.map +1 -0
  70. package/dist/config/writer.d.ts +3 -0
  71. package/dist/config/writer.d.ts.map +1 -0
  72. package/dist/config/writer.js +25 -0
  73. package/dist/config/writer.js.map +1 -0
  74. package/dist/index.d.ts +22 -0
  75. package/dist/index.js +55 -0
  76. package/dist/index.js.map +1 -0
  77. package/dist/info/default_commands.json +28 -0
  78. package/dist/lib.d.ts +21 -0
  79. package/dist/lib.d.ts.map +1 -0
  80. package/dist/lib.js +54 -0
  81. package/dist/lib.js.map +1 -0
  82. package/dist/logger.d.ts +41 -0
  83. package/dist/logger.js +67 -0
  84. package/dist/logger.js.map +1 -0
  85. package/dist/main.d.ts +1 -0
  86. package/dist/main.d.ts.map +1 -0
  87. package/dist/main.js +284 -0
  88. package/dist/main.js.map +1 -0
  89. package/dist/omegga/auth.d.ts +6 -0
  90. package/dist/omegga/auth.d.ts.map +1 -0
  91. package/dist/omegga/auth.js +139 -0
  92. package/dist/omegga/auth.js.map +1 -0
  93. package/dist/omegga/commandInjector.d.ts +35 -0
  94. package/dist/omegga/commandInjector.d.ts.map +1 -0
  95. package/dist/omegga/commandInjector.js +234 -0
  96. package/dist/omegga/commandInjector.js.map +1 -0
  97. package/dist/omegga/index.d.ts +7 -0
  98. package/dist/omegga/index.d.ts.map +1 -0
  99. package/dist/omegga/index.js +43 -0
  100. package/dist/omegga/index.js.map +1 -0
  101. package/dist/omegga/logWrangler.d.ts +32 -0
  102. package/dist/omegga/logWrangler.d.ts.map +1 -0
  103. package/dist/omegga/logWrangler.js +279 -0
  104. package/dist/omegga/logWrangler.js.map +1 -0
  105. package/dist/omegga/matchers/auth.d.ts +9 -0
  106. package/dist/omegga/matchers/auth.d.ts.map +1 -0
  107. package/dist/omegga/matchers/auth.js +53 -0
  108. package/dist/omegga/matchers/auth.js.map +1 -0
  109. package/dist/omegga/matchers/chat.d.ts +9 -0
  110. package/dist/omegga/matchers/chat.d.ts.map +1 -0
  111. package/dist/omegga/matchers/chat.js +68 -0
  112. package/dist/omegga/matchers/chat.js.map +1 -0
  113. package/dist/omegga/matchers/command.d.ts +7 -0
  114. package/dist/omegga/matchers/command.d.ts.map +1 -0
  115. package/dist/omegga/matchers/command.js +39 -0
  116. package/dist/omegga/matchers/command.js.map +1 -0
  117. package/dist/omegga/matchers/exit.d.ts +3 -0
  118. package/dist/omegga/matchers/exit.d.ts.map +1 -0
  119. package/dist/omegga/matchers/exit.js +21 -0
  120. package/dist/omegga/matchers/exit.js.map +1 -0
  121. package/dist/omegga/matchers/index.d.ts +3 -0
  122. package/dist/omegga/matchers/index.d.ts.map +1 -0
  123. package/dist/omegga/matchers/index.js +39 -0
  124. package/dist/omegga/matchers/index.js.map +1 -0
  125. package/dist/omegga/matchers/init.d.ts +3 -0
  126. package/dist/omegga/matchers/init.d.ts.map +1 -0
  127. package/dist/omegga/matchers/init.js +26 -0
  128. package/dist/omegga/matchers/init.js.map +1 -0
  129. package/dist/omegga/matchers/interact.d.ts +4 -0
  130. package/dist/omegga/matchers/interact.js +39 -0
  131. package/dist/omegga/matchers/interact.js.map +1 -0
  132. package/dist/omegga/matchers/join.d.ts +4 -0
  133. package/dist/omegga/matchers/join.d.ts.map +1 -0
  134. package/dist/omegga/matchers/join.js +95 -0
  135. package/dist/omegga/matchers/join.js.map +1 -0
  136. package/dist/omegga/matchers/leave.d.ts +4 -0
  137. package/dist/omegga/matchers/leave.d.ts.map +1 -0
  138. package/dist/omegga/matchers/leave.js +59 -0
  139. package/dist/omegga/matchers/leave.js.map +1 -0
  140. package/dist/omegga/matchers/mapChange.d.ts +3 -0
  141. package/dist/omegga/matchers/mapChange.d.ts.map +1 -0
  142. package/dist/omegga/matchers/mapChange.js +38 -0
  143. package/dist/omegga/matchers/mapChange.js.map +1 -0
  144. package/dist/omegga/matchers/types.d.ts +5 -0
  145. package/dist/omegga/matchers/types.d.ts.map +1 -0
  146. package/dist/omegga/matchers/types.js +7 -0
  147. package/dist/omegga/matchers/types.js.map +1 -0
  148. package/dist/omegga/matchers/version.d.ts +3 -0
  149. package/dist/omegga/matchers/version.d.ts.map +1 -0
  150. package/dist/omegga/matchers/version.js +45 -0
  151. package/dist/omegga/matchers/version.js.map +1 -0
  152. package/dist/omegga/player.d.ts +71 -0
  153. package/dist/omegga/player.d.ts.map +1 -0
  154. package/dist/omegga/player.js +442 -0
  155. package/dist/omegga/player.js.map +1 -0
  156. package/dist/omegga/plugin/plugin_jsonrpc_stdio.d.ts +23 -0
  157. package/dist/omegga/plugin/plugin_jsonrpc_stdio.d.ts.map +1 -0
  158. package/dist/omegga/plugin/plugin_jsonrpc_stdio.js +441 -0
  159. package/dist/omegga/plugin/plugin_jsonrpc_stdio.js.map +1 -0
  160. package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.d.ts +129 -0
  161. package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.d.ts.map +1 -0
  162. package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js +260 -0
  163. package/dist/omegga/plugin/plugin_node_safe/proxyOmegga.js.map +1 -0
  164. package/dist/omegga/plugin/plugin_node_safe/worker.d.ts +1 -0
  165. package/dist/omegga/plugin/plugin_node_safe/worker.d.ts.map +1 -0
  166. package/dist/omegga/plugin/plugin_node_safe/worker.js +289 -0
  167. package/dist/omegga/plugin/plugin_node_safe/worker.js.map +1 -0
  168. package/dist/omegga/plugin/plugin_node_safe.d.ts +24 -0
  169. package/dist/omegga/plugin/plugin_node_safe.d.ts.map +1 -0
  170. package/dist/omegga/plugin/plugin_node_safe.js +397 -0
  171. package/dist/omegga/plugin/plugin_node_safe.js.map +1 -0
  172. package/dist/omegga/plugin/plugin_node_unsafe.d.ts +13 -0
  173. package/dist/omegga/plugin/plugin_node_unsafe.d.ts.map +1 -0
  174. package/dist/omegga/plugin/plugin_node_unsafe.js +178 -0
  175. package/dist/omegga/plugin/plugin_node_unsafe.js.map +1 -0
  176. package/dist/omegga/plugin.d.ts +86 -0
  177. package/dist/omegga/plugin.d.ts.map +1 -0
  178. package/dist/omegga/plugin.js +458 -0
  179. package/dist/omegga/plugin.js.map +1 -0
  180. package/dist/omegga/server.d.ts +149 -0
  181. package/dist/omegga/server.d.ts.map +1 -0
  182. package/dist/omegga/server.js +601 -0
  183. package/dist/omegga/server.js.map +1 -0
  184. package/dist/omegga/types.d.ts +48 -0
  185. package/dist/omegga/types.d.ts.map +1 -0
  186. package/dist/omegga/types.js +3 -0
  187. package/dist/omegga/types.js.map +1 -0
  188. package/dist/omegga/wrapper.d.ts +22 -0
  189. package/dist/omegga/wrapper.d.ts.map +1 -0
  190. package/dist/omegga/wrapper.js +75 -0
  191. package/dist/omegga/wrapper.js.map +1 -0
  192. package/dist/omeggaplugin.d.ts +1 -0
  193. package/dist/omeggaplugin.js +4 -0
  194. package/dist/omeggaplugin.js.map +1 -0
  195. package/dist/plugin.d.ts +781 -0
  196. package/dist/plugin.js +41 -0
  197. package/dist/plugin.js.map +1 -0
  198. package/dist/softconfig.d.ts +51 -0
  199. package/dist/softconfig.d.ts.map +1 -0
  200. package/dist/softconfig.js +82 -0
  201. package/dist/softconfig.js.map +1 -0
  202. package/dist/util/brick/checkBounds.d.ts +8 -0
  203. package/dist/util/brick/checkBounds.d.ts.map +1 -0
  204. package/dist/util/brick/checkBounds.js +22 -0
  205. package/dist/util/brick/checkBounds.js.map +1 -0
  206. package/dist/util/brick/constants.d.ts +18 -0
  207. package/dist/util/brick/constants.d.ts.map +1 -0
  208. package/dist/util/brick/constants.js +184 -0
  209. package/dist/util/brick/constants.js.map +1 -0
  210. package/dist/util/brick/getBounds.d.ts +4 -0
  211. package/dist/util/brick/getBounds.d.ts.map +1 -0
  212. package/dist/util/brick/getBounds.js +39 -0
  213. package/dist/util/brick/getBounds.js.map +1 -0
  214. package/dist/util/brick/getBrickSize.d.ts +3 -0
  215. package/dist/util/brick/getBrickSize.d.ts.map +1 -0
  216. package/dist/util/brick/getBrickSize.js +12 -0
  217. package/dist/util/brick/getBrickSize.js.map +1 -0
  218. package/dist/util/brick/getScaleAxis.d.ts +3 -0
  219. package/dist/util/brick/getScaleAxis.d.ts.map +1 -0
  220. package/dist/util/brick/getScaleAxis.js +38 -0
  221. package/dist/util/brick/getScaleAxis.js.map +1 -0
  222. package/dist/util/brick/index.d.ts +13 -0
  223. package/dist/util/brick/index.d.ts.map +1 -0
  224. package/dist/util/brick/index.js +29 -0
  225. package/dist/util/brick/index.js.map +1 -0
  226. package/dist/util/brick/rotate.d.ts +17 -0
  227. package/dist/util/brick/rotate.d.ts.map +1 -0
  228. package/dist/util/brick/rotate.js +38 -0
  229. package/dist/util/brick/rotate.js.map +1 -0
  230. package/dist/util/brick/setOwnership.d.ts +12 -0
  231. package/dist/util/brick/setOwnership.d.ts.map +1 -0
  232. package/dist/util/brick/setOwnership.js +21 -0
  233. package/dist/util/brick/setOwnership.js.map +1 -0
  234. package/dist/util/chat.d.ts +23 -0
  235. package/dist/util/chat.d.ts.map +1 -0
  236. package/dist/util/chat.js +50 -0
  237. package/dist/util/chat.js.map +1 -0
  238. package/dist/util/color.d.ts +13 -0
  239. package/dist/util/color.d.ts.map +1 -0
  240. package/dist/util/color.js +130 -0
  241. package/dist/util/color.js.map +1 -0
  242. package/dist/util/file.d.ts +5 -0
  243. package/dist/util/file.d.ts.map +1 -0
  244. package/dist/util/file.js +114 -0
  245. package/dist/util/file.js.map +1 -0
  246. package/dist/util/index.d.ts +162 -0
  247. package/dist/util/index.d.ts.map +1 -0
  248. package/dist/util/index.js +92 -0
  249. package/dist/util/index.js.map +1 -0
  250. package/dist/util/map.d.ts +6 -0
  251. package/dist/util/map.d.ts.map +1 -0
  252. package/dist/util/map.js +26 -0
  253. package/dist/util/map.js.map +1 -0
  254. package/dist/util/pattern.d.ts +1 -0
  255. package/dist/util/pattern.d.ts.map +1 -0
  256. package/dist/util/pattern.js +11 -0
  257. package/dist/util/pattern.js.map +1 -0
  258. package/dist/util/time.d.ts +4 -0
  259. package/dist/util/time.d.ts.map +1 -0
  260. package/dist/util/time.js +41 -0
  261. package/dist/util/time.js.map +1 -0
  262. package/dist/util/uuid.d.ts +2 -0
  263. package/dist/util/uuid.d.ts.map +1 -0
  264. package/dist/util/uuid.js +8 -0
  265. package/dist/util/uuid.js.map +1 -0
  266. package/dist/util/wsl.d.ts +1 -0
  267. package/dist/util/wsl.d.ts.map +1 -0
  268. package/dist/util/wsl.js +14 -0
  269. package/dist/util/wsl.js.map +1 -0
  270. package/dist/webserver/backend/api.d.ts +3 -0
  271. package/dist/webserver/backend/api.d.ts.map +1 -0
  272. package/dist/webserver/backend/api.js +685 -0
  273. package/dist/webserver/backend/api.js.map +1 -0
  274. package/dist/webserver/backend/calendar.d.ts +5 -0
  275. package/dist/webserver/backend/calendar.d.ts.map +1 -0
  276. package/dist/webserver/backend/calendar.js +21 -0
  277. package/dist/webserver/backend/calendar.js.map +1 -0
  278. package/dist/webserver/backend/database.d.ts +149 -0
  279. package/dist/webserver/backend/database.d.ts.map +1 -0
  280. package/dist/webserver/backend/database.js +575 -0
  281. package/dist/webserver/backend/database.js.map +1 -0
  282. package/dist/webserver/backend/index.d.ts +31 -0
  283. package/dist/webserver/backend/index.d.ts.map +1 -0
  284. package/dist/webserver/backend/index.js +189 -0
  285. package/dist/webserver/backend/index.js.map +1 -0
  286. package/dist/webserver/backend/metrics.d.ts +3 -0
  287. package/dist/webserver/backend/metrics.d.ts.map +1 -0
  288. package/dist/webserver/backend/metrics.js +203 -0
  289. package/dist/webserver/backend/metrics.js.map +1 -0
  290. package/dist/webserver/backend/types.d.ts +115 -0
  291. package/dist/webserver/backend/types.d.ts.map +1 -0
  292. package/dist/webserver/backend/types.js +3 -0
  293. package/dist/webserver/backend/types.js.map +1 -0
  294. package/dist/webserver/backend/util.d.ts +2 -0
  295. package/dist/webserver/backend/util.d.ts.map +1 -0
  296. package/dist/webserver/backend/util.js +78 -0
  297. package/dist/webserver/backend/util.js.map +1 -0
  298. package/dist/webserver/index.d.ts +2 -0
  299. package/dist/webserver/index.d.ts.map +1 -0
  300. package/dist/webserver/index.js +9 -0
  301. package/dist/webserver/index.js.map +1 -0
  302. package/{src/webserver/frontend → frontend}/app.html +0 -0
  303. package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceBold.ttf +0 -0
  304. package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceItalic.otf +0 -0
  305. package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceMedium.otf +0 -0
  306. package/{src/webserver/frontend → frontend}/assets/fonts/GlacialIndifferenceRegular.ttf +0 -0
  307. package/{src/webserver/frontend → frontend}/assets/fonts/RobotoBold.ttf +0 -0
  308. package/{src/webserver/frontend → frontend}/assets/fonts/RobotoItalic.ttf +0 -0
  309. package/{src/webserver/frontend → frontend}/assets/fonts/RobotoRegular.ttf +0 -0
  310. package/{src/webserver/frontend → frontend}/assets/img/auth_bg.webp +0 -0
  311. package/{src/webserver/frontend → frontend}/assets/img/dark_bg.webp +0 -0
  312. package/{src/webserver/frontend → frontend}/assets/img/turkey.webp +0 -0
  313. package/{src/webserver/frontend → frontend}/auth.html +0 -0
  314. package/index.js +10 -2
  315. package/package.json +44 -16
  316. package/public/app.bundle.js +537 -73
  317. package/public/app.bundle.js.map +1 -1
  318. package/public/app.css +727 -2
  319. package/public/app.css.map +1 -1
  320. package/public/auth.bundle.js +18 -18
  321. package/public/auth.bundle.js.map +1 -1
  322. package/public/auth.css +364 -2
  323. package/public/auth.css.map +1 -1
  324. package/templates/rpc/README.md +29 -0
  325. package/templates/rpc/doc.json +7 -0
  326. package/templates/rpc/omegga_plugin +0 -0
  327. package/templates/rpc/plugin.json +4 -0
  328. package/templates/rpc/setup.sh +3 -0
  329. package/templates/safe/README.md +29 -0
  330. package/templates/safe/access.json +1 -0
  331. package/templates/safe/doc.json +7 -0
  332. package/templates/safe/omegga.plugin.js +20 -0
  333. package/templates/safe/plugin.json +4 -0
  334. package/templates/safe/setup.sh +4 -0
  335. package/templates/safe-ts/.gitignore.rename +3 -0
  336. package/templates/safe-ts/README.md +29 -0
  337. package/templates/safe-ts/access.json +1 -0
  338. package/templates/safe-ts/doc.json +7 -0
  339. package/templates/safe-ts/omegga.d.ts +1311 -0
  340. package/templates/safe-ts/omegga.plugin.ts +29 -0
  341. package/templates/safe-ts/plugin.json +4 -0
  342. package/templates/safe-ts/setup.sh +4 -0
  343. package/templates/safe-ts/tsconfig.json +10 -0
  344. package/templates/unsafe/README.md +29 -0
  345. package/templates/unsafe/doc.json +7 -0
  346. package/templates/unsafe/omegga.main.js +15 -0
  347. package/templates/unsafe/plugin.json +4 -0
  348. package/templates/unsafe/setup.sh +4 -0
  349. package/.babelrc.json +0 -5
  350. package/.github/workflows/lint.yml +0 -26
  351. package/.prettierrc +0 -7
  352. package/.vscode/extensions.json +0 -5
  353. package/src/OMEGGA_LEGACY_INSTALL +0 -44
  354. package/src/brickadia/config.js +0 -42
  355. package/src/brickadia/server.js +0 -227
  356. package/src/cli/auth.js +0 -104
  357. package/src/cli/config.js +0 -77
  358. package/src/cli/index.js +0 -6
  359. package/src/cli/installer.js +0 -65
  360. package/src/cli/plugin.js +0 -575
  361. package/src/cli/terminal.js +0 -466
  362. package/src/config/authorizer.js +0 -37
  363. package/src/config/formats/format_js.js +0 -6
  364. package/src/config/formats/format_yml.js +0 -8
  365. package/src/config/index.js +0 -81
  366. package/src/config/reader.js +0 -27
  367. package/src/config/validator.js +0 -32
  368. package/src/config/writer.js +0 -20
  369. package/src/info/default_commands.json +0 -26
  370. package/src/lib.js +0 -23
  371. package/src/main.js +0 -332
  372. package/src/omegga/auth.js +0 -138
  373. package/src/omegga/commandInjector.js +0 -228
  374. package/src/omegga/index.js +0 -22
  375. package/src/omegga/logWrangler.js +0 -323
  376. package/src/omegga/matchers/auth.js +0 -49
  377. package/src/omegga/matchers/chat.js +0 -73
  378. package/src/omegga/matchers/command.js +0 -39
  379. package/src/omegga/matchers/exit.js +0 -19
  380. package/src/omegga/matchers/init.js +0 -23
  381. package/src/omegga/matchers/join.js +0 -115
  382. package/src/omegga/matchers/leave.js +0 -58
  383. package/src/omegga/matchers/mapChange.js +0 -37
  384. package/src/omegga/matchers/version.js +0 -45
  385. package/src/omegga/player.js +0 -585
  386. package/src/omegga/plugin/plugin_jsonrpc_stdio.js +0 -526
  387. package/src/omegga/plugin/plugin_node_safe/proxyOmegga.js +0 -117
  388. package/src/omegga/plugin/plugin_node_safe/worker.js +0 -238
  389. package/src/omegga/plugin/plugin_node_safe.js +0 -473
  390. package/src/omegga/plugin/plugin_node_unsafe.js +0 -177
  391. package/src/omegga/plugin.js +0 -565
  392. package/src/omegga/server.js +0 -658
  393. package/src/omegga/wrapper.js +0 -62
  394. package/src/softconfig.js +0 -64
  395. package/src/util/brick/checkBounds.js +0 -22
  396. package/src/util/brick/constants.js +0 -185
  397. package/src/util/brick/getBounds.js +0 -36
  398. package/src/util/brick/getBrickSize.js +0 -9
  399. package/src/util/brick/getScaleAxis.js +0 -31
  400. package/src/util/brick/index.js +0 -9
  401. package/src/util/brick/rotate.js +0 -43
  402. package/src/util/brick/setOwnership.js +0 -20
  403. package/src/util/chat.js +0 -28
  404. package/src/util/color.js +0 -143
  405. package/src/util/file.js +0 -119
  406. package/src/util/index.js +0 -28
  407. package/src/util/map.js +0 -28
  408. package/src/util/pattern.js +0 -14
  409. package/src/util/time.js +0 -46
  410. package/src/util/uuid.js +0 -8
  411. package/src/util/wsl.js +0 -9
  412. package/src/webserver/backend/api.js +0 -795
  413. package/src/webserver/backend/calendar.js +0 -15
  414. package/src/webserver/backend/database.js +0 -725
  415. package/src/webserver/backend/index.js +0 -206
  416. package/src/webserver/backend/metrics.js +0 -148
  417. package/src/webserver/backend/util.js +0 -75
  418. package/src/webserver/frontend/.eslintrc.yml +0 -26
  419. package/src/webserver/frontend/app.js +0 -78
  420. package/src/webserver/frontend/auth.js +0 -16
  421. package/src/webserver/frontend/components/Background.vue +0 -83
  422. package/src/webserver/frontend/components/Button.vue +0 -105
  423. package/src/webserver/frontend/components/ChatEntry.vue +0 -107
  424. package/src/webserver/frontend/components/ChatTime.vue +0 -40
  425. package/src/webserver/frontend/components/Dimmer.vue +0 -43
  426. package/src/webserver/frontend/components/Dropdown.vue +0 -145
  427. package/src/webserver/frontend/components/Footer.vue +0 -29
  428. package/src/webserver/frontend/components/Header.vue +0 -27
  429. package/src/webserver/frontend/components/InfiniteScroll.vue +0 -51
  430. package/src/webserver/frontend/components/Input.vue +0 -93
  431. package/src/webserver/frontend/components/ListInput.vue +0 -105
  432. package/src/webserver/frontend/components/Loader.vue +0 -98
  433. package/src/webserver/frontend/components/MainMenuButton.vue +0 -83
  434. package/src/webserver/frontend/components/Modal.vue +0 -44
  435. package/src/webserver/frontend/components/NavBar.vue +0 -24
  436. package/src/webserver/frontend/components/PlayerDropdown.vue +0 -210
  437. package/src/webserver/frontend/components/PopoutContent.vue +0 -32
  438. package/src/webserver/frontend/components/RoleDropdown.vue +0 -157
  439. package/src/webserver/frontend/components/Scroll.vue +0 -33
  440. package/src/webserver/frontend/components/Toggle.vue +0 -91
  441. package/src/webserver/frontend/components/index.js +0 -33
  442. package/src/webserver/frontend/css/font.scss +0 -53
  443. package/src/webserver/frontend/css/mixins.scss +0 -49
  444. package/src/webserver/frontend/css/style.scss +0 -166
  445. package/src/webserver/frontend/css/theme.scss +0 -64
  446. package/src/webserver/frontend/partials/NavHeader.vue +0 -55
  447. package/src/webserver/frontend/partials/Page.vue +0 -40
  448. package/src/webserver/frontend/partials/PageContent.vue +0 -31
  449. package/src/webserver/frontend/partials/SideNav.vue +0 -115
  450. package/src/webserver/frontend/partials/index.js +0 -4
  451. package/src/webserver/frontend/router.js +0 -83
  452. package/src/webserver/frontend/views/Auth.vue +0 -190
  453. package/src/webserver/frontend/views/History.vue +0 -462
  454. package/src/webserver/frontend/views/Home.vue +0 -251
  455. package/src/webserver/frontend/views/Main.vue +0 -69
  456. package/src/webserver/frontend/views/NotFound.vue +0 -10
  457. package/src/webserver/frontend/views/Players.vue +0 -425
  458. package/src/webserver/frontend/views/PlayersInspector.vue +0 -538
  459. package/src/webserver/frontend/views/Plugins.vue +0 -217
  460. package/src/webserver/frontend/views/PluginsInspector.vue +0 -418
  461. package/src/webserver/frontend/views/Server.vue +0 -167
  462. package/src/webserver/frontend/views/Users.vue +0 -538
  463. package/src/webserver/frontend/widgets/Chat.vue +0 -124
  464. package/src/webserver/frontend/widgets/Status.vue +0 -91
  465. package/src/webserver/frontend/widgets/index.js +0 -2
  466. package/src/webserver/frontend/widgets/tooltip.js +0 -108
  467. package/src/webserver/index.js +0 -4
@@ -1,228 +0,0 @@
1
- const { color, time } = require('../util/index.js');
2
- const _ = require('lodash');
3
-
4
- // A list of commands that can be injected to things with the log wrangler
5
- /**
6
- * List of injected commands
7
- * @type {Object}
8
- */
9
- const COMMANDS = {
10
- /**
11
- * Get a server status object containing bricks, time, players, player ping, player roles, etc
12
- * @return {Promise<Object>} - Server Status
13
- */
14
- async getServerStatus() {
15
- const statusLines = await this.watchLogChunk(
16
- 'Server.Status',
17
- /^LogConsoleCommands: (.+)$/,
18
- {
19
- first: match => match[1].startsWith('Server Name:'),
20
- timeoutDelay: 1000,
21
- }
22
- );
23
-
24
- // the table lines all start with '* '
25
- // find all those lines, and remove the asterisk
26
- const [tableHeader, ...tableLines] = statusLines
27
- .filter(l => l[1].startsWith('* '))
28
- .map(l => l[1].slice(1));
29
-
30
- // use the size of each column to build a regex that matches each row
31
- const columnRegExp = new RegExp(
32
- tableHeader
33
- .match(/[^|]+/g) // get all strings between the |'s'
34
- .map((line, i) => [line.slice(1, -1), line.length - (i === 5 ? 1 : 2)]) // calculate the lengths (and remove the spaces)
35
- .map(
36
- ([name, len]) => ` (?<${name.trim().toLowerCase()}>.{${len}})( |$)`
37
- ) // create a regex pattern to match strings of that length (and trim off whitespace at the end)
38
- .join('\\|')
39
- ); // join the regexes with the |
40
-
41
- const status = {
42
- // easily extract certain values from the server status
43
- serverName: statusLines[0][1].match(/^Server Name: (.*)$/)[1],
44
- description: statusLines[1][1].match(/^Description: (.*)$/)[1],
45
- bricks: Number(statusLines[2][1].match(/^Bricks: (\d+)$/)[1]),
46
- components: Number(statusLines[3][1].match(/^Components: (\d+)$/)[1]),
47
- time: time.parseDuration(statusLines[4][1].match(/^Time: (.*)$/)[1]),
48
- // extract players using the generated table regex
49
- players: tableLines.map(l => {
50
- // match the player row with the generated regex
51
- const {
52
- groups: { name, ping, time: online, roles, address, id },
53
- } = l.match(columnRegExp);
54
- // trim and parse the matched data
55
- return {
56
- name: name.trim(),
57
- ping: time.parseDuration(ping.trim()),
58
- time: time.parseDuration(online.trim()),
59
- roles: roles
60
- .trim()
61
- .split(', ')
62
- .filter(r => r.length > 0), // roles are split by ', '
63
- address: address.replace('(Owner)', '').trim(),
64
- id: id.trim(),
65
- };
66
- }),
67
- };
68
-
69
- return status;
70
- },
71
-
72
- /**
73
- * get every player's position and alive states
74
- * @return {Promise<Array<Object>>}
75
- */
76
- async getAllPlayerPositions() {
77
- const pawnRegExp =
78
- /(?<index>\d+)\) BP_PlayerController_C .+?PersistentLevel\.(?<controller>BP_PlayerController_C_\d+)\.Pawn = (?:None|BP_FigureV2_C'.+?:PersistentLevel.(?<pawn>BP_FigureV2_C_\d+)')?$/;
79
- const posRegExp =
80
- /(?<index>\d+)\) CapsuleComponent .+?PersistentLevel\.(?<pawn>BP_FigureV2_C_\d+)\.CollisionCylinder\.RelativeLocation = \(X=(?<x>[\d.-]+),Y=(?<y>[\d.-]+),Z=(?<z>[\d.-]+)\)$/;
81
- const deadFigureRegExp =
82
- /(?<index>\d+)\) BP_FigureV2_C .+?PersistentLevel\.(?<pawn>BP_FigureV2_C_\d+)\.bIsDead = (?<dead>(True|False))$/;
83
-
84
- // wait for the pawn and position watchers to return all the results
85
- const [pawns, deadFigures, positions] = await Promise.all([
86
- this.watchLogChunk('GetAll BP_PlayerController_C Pawn', pawnRegExp, {
87
- first: 'index',
88
- timeoutDelay: 250,
89
- }),
90
- this.watchLogChunk('GetAll BP_FigureV2_C bIsDead', deadFigureRegExp, {
91
- first: 'index',
92
- timeoutDelay: 250,
93
- }),
94
- this.watchLogChunk(
95
- 'GetAll SceneComponent RelativeLocation Name=CollisionCylinder',
96
- posRegExp,
97
- { first: 'index', timeoutDelay: 250 }
98
- ),
99
- ]);
100
-
101
- return (
102
- pawns
103
- // iterate through the pawn+controllers
104
- .map(pawn => ({
105
- // find the player for the associated controller
106
- player: this.getPlayer(pawn.groups.controller),
107
- // find the position for the associated pawn
108
- pos: positions.find(pos => pawn.groups.pawn === pos.groups.pawn),
109
- isDead: deadFigures.find(
110
- dead => pawn.groups.pawn === dead.groups.pawn
111
- ),
112
- pawn,
113
- }))
114
- // filter by only those who have both player. previously we filtered by position but this breaks for players without a pawn, instead it's preferable to pass null
115
- .filter(p => p.player)
116
- // turn the position into a [x, y, z] number array (last 3 items in the array)
117
- .map(p => ({
118
- player: p.player,
119
- pawn: p.pawn.groups.pawn || null,
120
- pos: p.pos ? p.pos.slice(3).map(Number) : null,
121
- isDead: p.isDead ? p.isDead.groups.dead === 'True' : true,
122
- }))
123
- );
124
- },
125
-
126
- /**
127
- * get all minigames and their players (and the player's teams)
128
- * @return {Promise<Array<Object>>}
129
- */
130
- async getMinigames() {
131
- // patterns to match the console logs
132
- const ruleNameRegExp =
133
- /^(?<index>\d+)\) BP_Ruleset_C (.+):PersistentLevel.(?<ruleset>BP_Ruleset_C_\d+)\.RulesetName = (?<name>.*)$/;
134
- const ruleMembersRegExp =
135
- /^(?<index>\d+)\) BP_Ruleset_C (.+):PersistentLevel.(?<ruleset>BP_Ruleset_C_\d+)\.MemberStates =$/;
136
- const teamNameRegExp =
137
- /^(?<index>\d+)\) BP_Team(_\w+)?_C (.+):PersistentLevel.(?<ruleset>BP_Ruleset_C_\d+)\.(?<team>BP_Team(_\w+)?_C_\d+)\.TeamName = (?<name>.*)$/;
138
- const teamColorRegExp =
139
- /^(?<index>\d+)\) BP_Team(_\w+)?_C (.+):PersistentLevel.(?<ruleset>BP_Ruleset_C_\d+)\.(?<team>BP_Team(_\w+)?_C_\d+)\.TeamColor = \(B=(?<b>\d+),G=(?<g>\d+),R=(?<r>\d+),A=(?<a>\d+)\)$/;
140
- const teamMembersRegExp =
141
- /^(?<index>\d+)\) BP_Team(_\w+)?_C (.+):PersistentLevel.(?<ruleset>BP_Ruleset_C_\d+)\.(?<team>BP_Team(_\w+)?_C_\d+)\.MemberStates =$/;
142
- const playerStateRegExp =
143
- /^\t(?<index>\d+): BP_PlayerState_C'(.+):PersistentLevel\.(?<state>BP_PlayerState_C_\d+)'$/;
144
-
145
- try {
146
- // parse console output to get the minigame info
147
- const [rulesets, ruleMembers, teamMembers, teamNames, teamColors] =
148
- await Promise.all([
149
- this.watchLogChunk(
150
- 'GetAll BP_Ruleset_C RulesetName',
151
- ruleNameRegExp,
152
- {
153
- first: 'index',
154
- }
155
- ),
156
- this.watchLogArray(
157
- 'GetAll BP_Ruleset_C MemberStates',
158
- ruleMembersRegExp,
159
- playerStateRegExp
160
- ),
161
- this.watchLogArray(
162
- 'GetAll BP_Team_C MemberStates',
163
- teamMembersRegExp,
164
- playerStateRegExp
165
- ),
166
- this.watchLogChunk('GetAll BP_Team_C TeamName', teamNameRegExp, {
167
- first: 'index',
168
- }),
169
- // team color in a5 is based on (B=255,G=255,R=255,A=255)
170
- this.watchLogChunk('GetAll BP_Team_C TeamColor', teamColorRegExp, {
171
- first: 'index',
172
- }),
173
- ]);
174
-
175
- // figure out what to do with the matched color results
176
- const handleColor = match => {
177
- // color index, return the colorset color
178
- if (match.color) return color.DEFAULT_COLORSET[Number(match)].slice();
179
- else return [match.r, match.g, match.b, match.a].map(Number);
180
- };
181
-
182
- // join the data into a big object
183
- return rulesets.map(r => ({
184
- name: r.groups.name,
185
- ruleset: r.groups.ruleset,
186
-
187
- // get the players from the team members
188
- members: ruleMembers
189
- .find(m => m.item.ruleset === r.groups.ruleset)
190
- .members // get the members from this ruleset
191
- .map(m => this.getPlayer(m.state)), // get the players
192
-
193
- // get the teams for this ruleset
194
- teams: teamMembers
195
- .filter(m => m.item.ruleset === r.groups.ruleset) // only get teams from this ruleset
196
- .map(m => ({
197
- // team name
198
- name: _.get(
199
- teamNames.find(t => t.groups.team === m.item.team),
200
- 'groups.name'
201
- ),
202
- team: m.item.team,
203
-
204
- // get the colors (different for a4 and a5)
205
- color: handleColor(
206
- _.pick(
207
- teamColors.find(t => t.groups.team === m.item.team).groups,
208
- ['r', 'g', 'b', 'a']
209
- )
210
- ),
211
-
212
- // get the players from the team
213
- members: m.members.map(m => this.getPlayer(m.state)),
214
- })),
215
- }));
216
- } catch (e) {
217
- Omegga.error('error getting minigames', e);
218
- return undefined;
219
- }
220
- },
221
- };
222
-
223
- // inject the commands into the object given a log wrangler
224
- module.exports = (obj, logWrangler) => {
225
- for (const cmd in COMMANDS) {
226
- obj[cmd] = COMMANDS[cmd].bind(logWrangler);
227
- }
228
- };
@@ -1,22 +0,0 @@
1
- module.exports = {
2
- // contains omegga server
3
- Server: require('./server.js'),
4
-
5
- // Plugin loader format
6
- Plugin: require('./plugin.js'),
7
-
8
- // Player interface
9
- Player: require('./player.js'),
10
-
11
- // acts as the interface between server logs and matchers
12
- OmeggaWrapper: require('./wrapper.js'),
13
-
14
- // auth token generation helpers
15
- auth: require('./auth.js'),
16
-
17
- // tackles the problem of reading brickadia logs
18
- LogWrangler: require('./logWrangler.js'),
19
-
20
- // injects commands that only need a log wrangler to function
21
- commandInjector: require('./commandInjector.js'),
22
- };
@@ -1,323 +0,0 @@
1
- /*
2
- The wrapper combines the things looking at or waiting for logs with the actual server logs
3
- */
4
-
5
- const GENERIC_LINE_REGEX =
6
- /^(\[(?<date>\d{4}\.\d\d.\d\d-\d\d.\d\d.\d\d:\d{3})\]\[\s*(?<counter>\d+)\])?(?<generator>\w+): (?<data>.+)$/;
7
-
8
- class LogWrangler {
9
- // list of patterns and callbacks watching the brickadia logs in general
10
- #matchers = [];
11
-
12
- // list of patterns and promises waiting for specific console logs
13
- #watchers = [];
14
-
15
- constructor(omegga) {
16
- // passthru functions
17
- this.exec = cmd => omegga.writeln(cmd);
18
- this.getPlayer = arg => omegga.getPlayer(arg);
19
- this.getVersion = () => omegga.version;
20
-
21
- // callback reads in new lines
22
- this.callback = this.handleLog.bind(this);
23
-
24
- this.addMatcher = this.addMatcher.bind(this);
25
- this.addWatcher = this.addWatcher.bind(this);
26
- this.watchLogArray = this.watchLogArray.bind(this);
27
- this.watchLogChunk = this.watchLogChunk.bind(this);
28
- this.omegga = omegga;
29
- }
30
-
31
- // add a new matcher to listen in on the logs
32
- // pattern is regex or a function that returns a match
33
- // callback is a function that receives the result of the pattern
34
- // returns a deregister function
35
- addMatcher(pattern, callback) {
36
- if (
37
- (typeof pattern !== 'function' && !(pattern instanceof RegExp)) ||
38
- typeof callback !== 'function'
39
- )
40
- return undefined;
41
-
42
- // create the matcher from the callback and pattern, add it to the matchers
43
- const matcher = { pattern, callback };
44
- this.#matchers.push(matcher);
45
-
46
- // return a function to remove this matcher from the list of matchers
47
- return () => {
48
- const index = this.#matchers.indexOf(matcher);
49
- if (index > -1) this.#matchers.splice(index, 0);
50
- };
51
- }
52
-
53
- // wait for stdout to match this regex or matcher fn, returns the match or times out
54
- // pattern is regex or a function that returns a match
55
- // if bundle is set to true, it returns all matches after the timeout ends rather than resolving (can't be used with delay 0)
56
- // exec is a function run after adding the watcher
57
- // debounce (used with bundle) waits extra time after each match before timing out
58
- // afterMatchDelay (used with debounce) indicates to run a new timeout after the first match
59
- // last (used with bundle) is a function run on the match. when it returns true, the watcher resolves early
60
- // returns a promise, rejects after timeout ends
61
- addWatcher(
62
- pattern,
63
- {
64
- timeoutDelay = 50,
65
- bundle = false,
66
- debounce = false,
67
- afterMatchDelay = 0,
68
- last,
69
- exec,
70
- } = {}
71
- ) {
72
- if (typeof pattern !== 'function' && !(pattern instanceof RegExp))
73
- return undefined;
74
-
75
- return new Promise((resolve, reject) => {
76
- // create the watcher
77
- const watcher = {
78
- pattern,
79
- bundle,
80
- debounce,
81
- timeoutDelay,
82
- afterMatchDelay,
83
- last,
84
- matches: [],
85
- };
86
-
87
- (watcher.resolve = (...args) => {
88
- clearTimeout(watcher.timeout);
89
- resolve(args);
90
- }),
91
- // remove helper
92
- (watcher.remove = () => {
93
- const index = this.#watchers.indexOf(watcher);
94
- if (index > -1) {
95
- this.#watchers.splice(index, 1);
96
- }
97
- });
98
-
99
- // what the watcher dones when it completes
100
- watcher.done = () => {
101
- // remove the watcher if it exists
102
- watcher.remove();
103
-
104
- // if the bundle option is set to true, resolve on timeout end
105
- if (bundle) {
106
- resolve(watcher.matches);
107
- } else {
108
- // reject the promise
109
- reject('timed out');
110
- }
111
- };
112
-
113
- // if the delay is non 0, kill the promise after some time
114
- if (timeoutDelay !== 0) {
115
- watcher.timeout = setTimeout(watcher.done, timeoutDelay);
116
- }
117
-
118
- this.#watchers.push(watcher);
119
- exec && exec();
120
- });
121
- }
122
-
123
- // match a group of console logs that have the same counter (ran on the same thread)
124
- // first is a function or 'index' for the index capture group that determines if this is match is the first log
125
- // last is a function that determines if this match is the last log (and can terminate early)
126
- // aftermatch delay is borrowed from addWatcher
127
- watchLogChunk(
128
- cmd,
129
- pattern,
130
- { first, last, afterMatchDelay = 10, timeoutDelay = 100 }
131
- ) {
132
- // we're focused on the counter part of this, the rest will be passed to the pattern matcher
133
- const logLineRegExp =
134
- /\[(?<date>\d{4}\.\d\d.\d\d-\d\d.\d\d.\d\d:\d{3})\]\[\s*(?<counter>\d+)\](?<rest>.*)$/;
135
-
136
- // keep track of the current log line
137
- let currentCounter = -1;
138
-
139
- // create the
140
- return this.addWatcher(
141
- line => {
142
- const logLineMatch = line.match(logLineRegExp);
143
- if (!logLineMatch) return;
144
-
145
- // get the counter and rest of line from the log line match
146
- const {
147
- groups: { counter, rest },
148
- } = logLineMatch;
149
-
150
- // run the regular pattern matcher
151
- const match =
152
- pattern instanceof RegExp
153
- ? rest.match(pattern)
154
- : pattern(rest, rest.match(GENERIC_LINE_REGEX));
155
-
156
- // end the watcher early if there is no match and the match has started (log chunks are uninterrupted)
157
- // this usually means that two commands were run so quickly that the output occured on the same counter
158
- if (!match && currentCounter !== -1) {
159
- return '[OMEGGA_WATCHER_DONE]';
160
- }
161
-
162
- // ignore things that don't match
163
- if (!match) return;
164
-
165
- // determine if this is the first log in the chunk
166
- let isFirst = false;
167
-
168
- // if there is a first parameter
169
- if (first) {
170
- // if it's a function, use that function to match
171
- if (typeof first === 'function') isFirst = first(match);
172
- // if it's 'index', use the index capture group
173
- else if (first === 'index') isFirst = match.groups.index === '0';
174
- } else {
175
- // otherwise, it doesn't matter
176
- isFirst = true;
177
- }
178
-
179
- // assign counter if it's not set and it's the first, or no first function is set
180
- if (currentCounter === -1 && isFirst) {
181
- currentCounter = counter;
182
- }
183
- if (currentCounter === -1 && !isFirst) {
184
- return;
185
- }
186
-
187
- // prematurely terminate the match if another log is found
188
- if (counter !== currentCounter) return '[OMEGGA_WATCHER_DONE]';
189
-
190
- // add the match to the bundle
191
- return match;
192
- },
193
- {
194
- last,
195
- exec: () => this.exec(cmd),
196
- bundle: true,
197
- debounce: true,
198
- timeoutDelay,
199
- afterMatchDelay,
200
- }
201
- );
202
- }
203
-
204
- // get a chunked array from the log
205
- // patterns are actually regex and must have capture groups
206
- // the itemPattern must have an (?<index>) capture group
207
- // the return is in the format of:
208
- /*
209
- [{
210
- item: (itemPattern group),
211
- members: [
212
- ...memberPattern groups,
213
- ],
214
- }, ...]
215
- */
216
- async watchLogArray(cmd, itemPattern, memberPattern) {
217
- const results = await this.watchLogChunk(
218
- cmd,
219
- line => {
220
- // match on items
221
- const itemMatch = line.match(itemPattern);
222
- if (itemMatch) return ['item', itemMatch];
223
-
224
- // match on members
225
- const memberMatch = line.match(memberPattern);
226
- if (memberMatch) return ['member', memberMatch];
227
- },
228
- { first: arr => arr[0] === 'item' && arr[1].groups.index === '0' }
229
- );
230
-
231
- const array = [];
232
-
233
- // insert the results into the array
234
- for (const [type, { groups }] of results) {
235
- // insert an item into the array
236
- if (type === 'item') {
237
- array.push({ item: groups, members: [] });
238
-
239
- // insert a member into an item
240
- } else if (type === 'member' && array.length > 0) {
241
- array[array.length - 1].members.push(groups);
242
- }
243
- }
244
-
245
- return array;
246
- }
247
-
248
- // check all the matchers against this line
249
- handleLog(line) {
250
- // generic match the log
251
- const logMatch = line.match(GENERIC_LINE_REGEX);
252
-
253
- // pattern matcher handlers
254
- const patternMatchers = [
255
- {
256
- array: this.#matchers,
257
- onMatch(match, matcher) {
258
- // if the matcher's callback is a function, run it
259
- if (typeof matcher.callback === 'function') matcher.callback(match);
260
- },
261
- },
262
- {
263
- array: this.#watchers,
264
- onMatch(match, watcher) {
265
- // if the watcher is in bundle mode, add the match to its matches
266
- if (watcher.bundle) {
267
- // allow the watcher to terminate early
268
- if (match === '[OMEGGA_WATCHER_DONE]') {
269
- clearTimeout(watcher.timeout);
270
- watcher.done();
271
- return;
272
- }
273
-
274
- watcher.matches.push(match);
275
-
276
- // check if this is the last line and terminate early
277
- if (watcher.last && watcher.last(match)) {
278
- clearTimeout(watcher.timeout);
279
- watcher.done();
280
- return;
281
- }
282
-
283
- // if the watcher is debounced, reset the timer
284
- if (watcher.debounce) {
285
- clearTimeout(watcher.timeout);
286
- watcher.timeout = setTimeout(
287
- watcher.done,
288
- watcher.afterMatchDelay || watcher.timeoutDelay
289
- );
290
- }
291
-
292
- // otherwise resolve with the result and remove the watcher from the list
293
- } else {
294
- watcher.resolve(match);
295
- watcher.remove();
296
- }
297
- },
298
- },
299
- ];
300
-
301
- // loop through matchers and run callbacks if they match
302
- for (const { array, onMatch } of patternMatchers) {
303
- // iterate in reverse because removing indices will not skip over any elements
304
- for (let i = array.length - 1; i >= 0; i--) {
305
- const matcher = array[i];
306
- try {
307
- // run the match on a pattern or test with a function
308
- const match =
309
- matcher.pattern instanceof RegExp
310
- ? line.match(matcher.pattern)
311
- : matcher.pattern(line, logMatch);
312
-
313
- // if there's match, handle it for this type of matcher
314
- if (match) onMatch(match, matcher);
315
- } catch (e) {
316
- Omegga.error('error in matcher', matcher.pattern, e);
317
- }
318
- }
319
- }
320
- }
321
- }
322
-
323
- module.exports = LogWrangler;
@@ -1,49 +0,0 @@
1
- module.exports = omegga => {
2
- // patterns for leave message and host detection
3
- const hostRegExp = /^Logged in as (?<name>.+) \((?<id>[0-9a-fA-F-]{36})\)\.$/;
4
- const invalidRegExp =
5
- /^(Error: AuthState is Invalid on dedicated server - exiting\.|Changing AuthState from \w+ to Invalid\.)$/;
6
- const validRegExp =
7
- /^Changing AuthState from \w+ to Valid(Online|Offline)\.$/;
8
-
9
- return {
10
- // listen for auth messages
11
- pattern(_line, logMatch) {
12
- // line is not generic console log
13
- if (!logMatch) return;
14
-
15
- const { generator, data } = logMatch.groups;
16
- // check if log is an auth log
17
- if (generator !== 'LogAuthManager') return;
18
-
19
- // match against the patterns
20
- const hostMatch = data.match(hostRegExp);
21
- const invalidMatch = data.match(invalidRegExp);
22
- const validMatch = data.match(validRegExp);
23
-
24
- // if the log matches one of the patterns, return the result
25
- if (hostMatch) {
26
- const { name, id } = hostMatch.groups;
27
- return ['host', { name, id }];
28
- } else if (invalidMatch) {
29
- return ['invalid', null];
30
- } else if (validMatch) {
31
- return ['valid', null];
32
- }
33
- },
34
- // when there's a match, emit the chat message event
35
- callback([type, host]) {
36
- if (type == 'host') {
37
- // store the host info
38
- omegga.host = Object.freeze(host);
39
- omegga.emit('host', Object.freeze(host));
40
- } else if (type === 'valid') {
41
- // let the server know it has started
42
- omegga.emit('start', { map: omegga.currentMap });
43
- } else if (type === 'invalid') {
44
- omegga.emit('unauthorized');
45
- // do nothing with invalid auth?? how did we get here
46
- }
47
- },
48
- };
49
- };
@@ -1,73 +0,0 @@
1
- module.exports = omegga => {
2
- // pattern to get PlayerController from a leave message
3
- const chatRegExp = /^(?<name>.+?): (?<message>.+)$/;
4
- const kickRegExp =
5
- /^(?<name>.+?) was kicked by (?<kicker>.+?) \((?<reason>.+?)\)$/;
6
-
7
- const exists = name => omegga.players.some(p => p.name === name);
8
-
9
- const sanitizeMsg = msg =>
10
- msg
11
- .toString()
12
- .replace(/&gt;/g, '>')
13
- .replace(/&und;/g, '_')
14
- .replace(/&lt;/g, '<')
15
- .replace(/&scl;/g, ';');
16
-
17
- const sanitizeName = name => name.toString().replace(/&und;/g, '_');
18
-
19
- return {
20
- // listen for chat messages
21
- pattern(_line, logMatch) {
22
- // line is not generic console log
23
- if (!logMatch) return;
24
-
25
- const { generator, data } = logMatch.groups;
26
- // check if log is a chat log
27
- if (generator !== 'LogChat') return;
28
-
29
- // match the chat log to the chat message pattern
30
- const chatMatch = data.match(chatRegExp);
31
- const kickMatch = data.match(kickRegExp);
32
-
33
- if (chatMatch) {
34
- let { name, message } = chatMatch.groups;
35
-
36
- name = sanitizeName(name);
37
- message = sanitizeMsg(message);
38
-
39
- // no player has this name. probably a bug
40
- if (!exists(name)) return;
41
-
42
- // return the player with the corresponding controller
43
- return { type: 'chat', name, message };
44
- } else if (kickMatch) {
45
- let { name, kicker, reason } = kickMatch.groups;
46
- name = sanitizeName(name);
47
- kicker = sanitizeName(kicker);
48
- reason = sanitizeMsg(reason);
49
-
50
- if (!exists(name) || !exists(kicker)) return;
51
-
52
- return { type: 'kick', name, kicker, reason };
53
- }
54
- },
55
- // when there's a match, emit the chat message event
56
- callback({ type, name, kicker, message, reason }) {
57
- if (type === 'chat') {
58
- omegga.emit('chat', name, message);
59
-
60
- // chat command parsing, emit `chatcmd:test` when `!test` is sent in chat
61
- if (message.startsWith('!')) {
62
- const [cmd, ...args] = message.slice(1).split(' ');
63
- if (cmd.length > 0) {
64
- omegga.emit('chatcmd:' + cmd.toLowerCase(), name, ...args);
65
- omegga.emit('chatcmd', cmd.toLowerCase(), name, ...args);
66
- }
67
- }
68
- } else if (type === 'kick') {
69
- omegga.emit('kick', name, kicker, reason);
70
- }
71
- },
72
- };
73
- };