serverless-ircd 0.6.0 → 0.8.0

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 (350) hide show
  1. package/.github/workflows/ci.yml +9 -4
  2. package/.gitmodules +4 -1
  3. package/CHANGELOG.md +480 -22
  4. package/README.md +244 -57
  5. package/apps/aws-stack/package.json +1 -1
  6. package/apps/aws-stack/src/aws-stack.ts +186 -18
  7. package/apps/aws-stack/tests/stack.test.ts +400 -56
  8. package/apps/cf-tcp-container/package.json +1 -1
  9. package/apps/cf-worker/package.json +1 -1
  10. package/apps/cf-worker/src/origin-allowlist.ts +99 -0
  11. package/apps/cf-worker/src/worker.ts +89 -9
  12. package/apps/cf-worker/tests/fixtures/web-dist/index.html +18 -0
  13. package/apps/cf-worker/tests/fixtures/web-dist/webclient/index.html +18 -0
  14. package/apps/cf-worker/tests/origin-allowlist.test.ts +101 -0
  15. package/apps/cf-worker/tests/smoke.test.ts +28 -2
  16. package/apps/cf-worker/tests/ws-origin.test.ts +89 -0
  17. package/apps/cf-worker/wrangler.test.toml +23 -0
  18. package/apps/cf-worker/wrangler.toml +56 -0
  19. package/apps/local-cli/package.json +1 -1
  20. package/apps/local-cli/src/config-loader.ts +8 -0
  21. package/apps/local-cli/src/main.ts +16 -0
  22. package/apps/local-cli/src/server.ts +1 -0
  23. package/apps/local-cli/tests/config-loader.test.ts +14 -0
  24. package/apps/web/landing/index.html +215 -0
  25. package/apps/web/package.json +28 -0
  26. package/apps/web/scripts/build.mjs +132 -0
  27. package/apps/web/src/build-env.ts +43 -0
  28. package/apps/web/src/config-schema.ts +138 -0
  29. package/apps/web/static/config.json +28 -0
  30. package/apps/web/static/config.prod.json +28 -0
  31. package/apps/web/static/config.staging.json +28 -0
  32. package/apps/web/tests/build-env.test.ts +63 -0
  33. package/apps/web/tests/build-smoke.test.ts +103 -0
  34. package/apps/web/tests/config-schema.test.ts +432 -0
  35. package/apps/web/tests/workspace.test.ts +12 -0
  36. package/apps/web/tsconfig.json +10 -0
  37. package/apps/web/upstream/.browserslistrc +3 -0
  38. package/apps/web/upstream/.editorconfig +9 -0
  39. package/apps/web/upstream/.eslintignore +3 -0
  40. package/apps/web/upstream/.eslintrc.js +90 -0
  41. package/apps/web/upstream/.github/FUNDING.yml +12 -0
  42. package/apps/web/upstream/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  43. package/apps/web/upstream/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  44. package/apps/web/upstream/.github/workflows/push.yml +26 -0
  45. package/apps/web/upstream/.github/workflows/release.yml +33 -0
  46. package/apps/web/upstream/.github/workflows/release_manual.yml +55 -0
  47. package/apps/web/upstream/.prettierrc.js +9 -0
  48. package/apps/web/upstream/.stylelintignore +5 -0
  49. package/apps/web/upstream/.stylelintrc.js +21 -0
  50. package/apps/web/upstream/LICENSE +201 -0
  51. package/apps/web/upstream/README.md +76 -0
  52. package/apps/web/upstream/babel.config.js +25 -0
  53. package/apps/web/upstream/crowdin.yml +3 -0
  54. package/apps/web/upstream/index.html +35 -0
  55. package/apps/web/upstream/jest.config.js +7 -0
  56. package/apps/web/upstream/jsdoc.json +22 -0
  57. package/apps/web/upstream/package.json +80 -0
  58. package/apps/web/upstream/scripts/pre-commit +43 -0
  59. package/apps/web/upstream/src/components/App.vue +516 -0
  60. package/apps/web/upstream/src/components/AppSettings.vue +587 -0
  61. package/apps/web/upstream/src/components/AutoComplete.vue +284 -0
  62. package/apps/web/upstream/src/components/Avatar.vue +105 -0
  63. package/apps/web/upstream/src/components/AwayStatusIndicator.vue +77 -0
  64. package/apps/web/upstream/src/components/BufferKey.vue +121 -0
  65. package/apps/web/upstream/src/components/BufferSettings.vue +97 -0
  66. package/apps/web/upstream/src/components/Captcha.vue +85 -0
  67. package/apps/web/upstream/src/components/ChannelBanlist.vue +96 -0
  68. package/apps/web/upstream/src/components/ChannelInfo.vue +159 -0
  69. package/apps/web/upstream/src/components/ChannelInvitelist.vue +276 -0
  70. package/apps/web/upstream/src/components/ChannelList.vue +345 -0
  71. package/apps/web/upstream/src/components/Container.vue +401 -0
  72. package/apps/web/upstream/src/components/ContainerHeader.vue +522 -0
  73. package/apps/web/upstream/src/components/ControlInput.vue +1016 -0
  74. package/apps/web/upstream/src/components/LoadingAnimation.vue +104 -0
  75. package/apps/web/upstream/src/components/MediaViewer.vue +199 -0
  76. package/apps/web/upstream/src/components/MessageInfo.vue +192 -0
  77. package/apps/web/upstream/src/components/MessageList.vue +1028 -0
  78. package/apps/web/upstream/src/components/MessageListAvatar.vue +20 -0
  79. package/apps/web/upstream/src/components/MessageListMessageCompact.vue +361 -0
  80. package/apps/web/upstream/src/components/MessageListMessageInline.vue +257 -0
  81. package/apps/web/upstream/src/components/MessageListMessageModern.vue +430 -0
  82. package/apps/web/upstream/src/components/NetworkSettings.vue +528 -0
  83. package/apps/web/upstream/src/components/Nicklist.vue +309 -0
  84. package/apps/web/upstream/src/components/NicklistUser.vue +181 -0
  85. package/apps/web/upstream/src/components/NotConnected.vue +271 -0
  86. package/apps/web/upstream/src/components/SelfUser.vue +283 -0
  87. package/apps/web/upstream/src/components/ServerSelector.vue +162 -0
  88. package/apps/web/upstream/src/components/ServerView.vue +126 -0
  89. package/apps/web/upstream/src/components/SettingsAdvanced.vue +232 -0
  90. package/apps/web/upstream/src/components/SettingsAliases.vue +121 -0
  91. package/apps/web/upstream/src/components/Sidebar.vue +429 -0
  92. package/apps/web/upstream/src/components/SidebarAboutBuffer.vue +288 -0
  93. package/apps/web/upstream/src/components/SidebarState.vue +145 -0
  94. package/apps/web/upstream/src/components/StartupError.vue +35 -0
  95. package/apps/web/upstream/src/components/StateBrowser.vue +420 -0
  96. package/apps/web/upstream/src/components/StateBrowserBuffer.vue +124 -0
  97. package/apps/web/upstream/src/components/StateBrowserNetwork.vue +823 -0
  98. package/apps/web/upstream/src/components/StateBrowserUsermenu.vue +162 -0
  99. package/apps/web/upstream/src/components/TypingStatusIndicator.vue +34 -0
  100. package/apps/web/upstream/src/components/TypingUsersList.vue +56 -0
  101. package/apps/web/upstream/src/components/UrlEmbed.vue +149 -0
  102. package/apps/web/upstream/src/components/UserBox.vue +728 -0
  103. package/apps/web/upstream/src/components/inputtools/Emoji.vue +67 -0
  104. package/apps/web/upstream/src/components/inputtools/TextStyle.vue +142 -0
  105. package/apps/web/upstream/src/components/startups/CommonLayout.vue +208 -0
  106. package/apps/web/upstream/src/components/startups/CustomServer.vue +495 -0
  107. package/apps/web/upstream/src/components/startups/KiwiBnc.vue +361 -0
  108. package/apps/web/upstream/src/components/startups/Personal.vue +317 -0
  109. package/apps/web/upstream/src/components/startups/Welcome.vue +544 -0
  110. package/apps/web/upstream/src/components/startups/ZncLogin.vue +229 -0
  111. package/apps/web/upstream/src/components/utils/InputConfirm.vue +68 -0
  112. package/apps/web/upstream/src/components/utils/InputPrompt.vue +118 -0
  113. package/apps/web/upstream/src/components/utils/InputText.vue +172 -0
  114. package/apps/web/upstream/src/components/utils/IrcInput.vue +579 -0
  115. package/apps/web/upstream/src/components/utils/PluginWrapper.vue +26 -0
  116. package/apps/web/upstream/src/components/utils/TabbedView.vue +149 -0
  117. package/apps/web/upstream/src/components/utils/TransitionExpand.vue +97 -0
  118. package/apps/web/upstream/src/helpers/Colours.js +128 -0
  119. package/apps/web/upstream/src/helpers/IrcdDiffs.js +26 -0
  120. package/apps/web/upstream/src/helpers/Md5.js +193 -0
  121. package/apps/web/upstream/src/helpers/Misc.js +401 -0
  122. package/apps/web/upstream/src/helpers/TextFormatting.js +237 -0
  123. package/apps/web/upstream/src/libs/AliasRewriter.js +157 -0
  124. package/apps/web/upstream/src/libs/AudioManager.js +60 -0
  125. package/apps/web/upstream/src/libs/BouncerMiddleware.js +247 -0
  126. package/apps/web/upstream/src/libs/BouncerProvider.js +551 -0
  127. package/apps/web/upstream/src/libs/ChathistoryMiddleware.js +153 -0
  128. package/apps/web/upstream/src/libs/ConfigLoader.js +94 -0
  129. package/apps/web/upstream/src/libs/EmojiProvider.js +46 -0
  130. package/apps/web/upstream/src/libs/GlobalApi.js +346 -0
  131. package/apps/web/upstream/src/libs/IPC.js +51 -0
  132. package/apps/web/upstream/src/libs/InputHandler.js +921 -0
  133. package/apps/web/upstream/src/libs/IrcClient.js +1506 -0
  134. package/apps/web/upstream/src/libs/Logger.js +71 -0
  135. package/apps/web/upstream/src/libs/Message.js +169 -0
  136. package/apps/web/upstream/src/libs/MessageFormatter.js +364 -0
  137. package/apps/web/upstream/src/libs/MessageParser.js +249 -0
  138. package/apps/web/upstream/src/libs/Notifications.js +78 -0
  139. package/apps/web/upstream/src/libs/ServerConnection.js +270 -0
  140. package/apps/web/upstream/src/libs/ServerSession.js +102 -0
  141. package/apps/web/upstream/src/libs/SoundBleep.js +20 -0
  142. package/apps/web/upstream/src/libs/StatePersistence.js +90 -0
  143. package/apps/web/upstream/src/libs/ThemeManager.js +128 -0
  144. package/apps/web/upstream/src/libs/TypingMiddleware.js +105 -0
  145. package/apps/web/upstream/src/libs/WindowTitle.js +63 -0
  146. package/apps/web/upstream/src/libs/batchedAdd.js +74 -0
  147. package/apps/web/upstream/src/libs/bufferTools.js +177 -0
  148. package/apps/web/upstream/src/libs/polyfill/Element.closest.js +18 -0
  149. package/apps/web/upstream/src/libs/renderers/Html.js +113 -0
  150. package/apps/web/upstream/src/libs/settingTools.js +31 -0
  151. package/apps/web/upstream/src/libs/state/BufferState.js +703 -0
  152. package/apps/web/upstream/src/libs/state/NetworkState.js +158 -0
  153. package/apps/web/upstream/src/libs/state/UserState.js +89 -0
  154. package/apps/web/upstream/src/libs/state/common.js +26 -0
  155. package/apps/web/upstream/src/libs/state.js +961 -0
  156. package/apps/web/upstream/src/libs/storage/Local.js +51 -0
  157. package/apps/web/upstream/src/main.js +566 -0
  158. package/apps/web/upstream/src/res/autocompleteCommands.js +31 -0
  159. package/apps/web/upstream/src/res/configTemplates.js +373 -0
  160. package/apps/web/upstream/src/res/globalStyle.css +277 -0
  161. package/apps/web/upstream/src/res/kiwiLoadingLogo.png +0 -0
  162. package/apps/web/upstream/src/res/locales/app.af-ZA.po +1145 -0
  163. package/apps/web/upstream/src/res/locales/app.ar-SA.po +1145 -0
  164. package/apps/web/upstream/src/res/locales/app.bg-BG.po +1145 -0
  165. package/apps/web/upstream/src/res/locales/app.bs-BA.po +1145 -0
  166. package/apps/web/upstream/src/res/locales/app.ca-ES.po +1145 -0
  167. package/apps/web/upstream/src/res/locales/app.cs-CZ.po +1145 -0
  168. package/apps/web/upstream/src/res/locales/app.da-DK.po +1145 -0
  169. package/apps/web/upstream/src/res/locales/app.de-DE.po +1145 -0
  170. package/apps/web/upstream/src/res/locales/app.dev.po +1246 -0
  171. package/apps/web/upstream/src/res/locales/app.el-GR.po +1145 -0
  172. package/apps/web/upstream/src/res/locales/app.en-US.po +1145 -0
  173. package/apps/web/upstream/src/res/locales/app.es-419.po +1145 -0
  174. package/apps/web/upstream/src/res/locales/app.es-AR.po +1145 -0
  175. package/apps/web/upstream/src/res/locales/app.es-EM.po +536 -0
  176. package/apps/web/upstream/src/res/locales/app.es-ES.po +1145 -0
  177. package/apps/web/upstream/src/res/locales/app.es-US.po +1145 -0
  178. package/apps/web/upstream/src/res/locales/app.eu-ES.po +1145 -0
  179. package/apps/web/upstream/src/res/locales/app.fi-FI.po +1145 -0
  180. package/apps/web/upstream/src/res/locales/app.fr-FR.po +1145 -0
  181. package/apps/web/upstream/src/res/locales/app.gl-ES.po +1145 -0
  182. package/apps/web/upstream/src/res/locales/app.he-IL.po +1145 -0
  183. package/apps/web/upstream/src/res/locales/app.hi-IN.po +1145 -0
  184. package/apps/web/upstream/src/res/locales/app.hu-HU.po +1145 -0
  185. package/apps/web/upstream/src/res/locales/app.id-ID.po +1145 -0
  186. package/apps/web/upstream/src/res/locales/app.it-IT.po +1145 -0
  187. package/apps/web/upstream/src/res/locales/app.ja-JP.po +1145 -0
  188. package/apps/web/upstream/src/res/locales/app.ko-KR.po +1145 -0
  189. package/apps/web/upstream/src/res/locales/app.nl-NL.po +1145 -0
  190. package/apps/web/upstream/src/res/locales/app.no-NO.po +1145 -0
  191. package/apps/web/upstream/src/res/locales/app.pl-PL.po +1145 -0
  192. package/apps/web/upstream/src/res/locales/app.pt-BR.po +1145 -0
  193. package/apps/web/upstream/src/res/locales/app.pt-PT.po +1145 -0
  194. package/apps/web/upstream/src/res/locales/app.ro-RO.po +1145 -0
  195. package/apps/web/upstream/src/res/locales/app.ru-RU.po +1145 -0
  196. package/apps/web/upstream/src/res/locales/app.sl-SI.po +1145 -0
  197. package/apps/web/upstream/src/res/locales/app.sq-AL.po +1145 -0
  198. package/apps/web/upstream/src/res/locales/app.sr-SP.po +1145 -0
  199. package/apps/web/upstream/src/res/locales/app.sv-SE.po +1145 -0
  200. package/apps/web/upstream/src/res/locales/app.tr-TR.po +1145 -0
  201. package/apps/web/upstream/src/res/locales/app.uk-UA.po +1145 -0
  202. package/apps/web/upstream/src/res/locales/app.vi-VN.po +1145 -0
  203. package/apps/web/upstream/src/res/locales/app.zh-CN.po +1145 -0
  204. package/apps/web/upstream/src/res/locales/app.zh-TW.po +1145 -0
  205. package/apps/web/upstream/src/res/localesList.json +27 -0
  206. package/apps/web/upstream/src/res/logo.png +0 -0
  207. package/apps/web/upstream/src/thirdparty/about.html +43 -0
  208. package/apps/web/upstream/src/thirdparty/index.js +5 -0
  209. package/apps/web/upstream/src/thirdparty/kiwiirccom.vue +185 -0
  210. package/apps/web/upstream/static/config.json +28 -0
  211. package/apps/web/upstream/static/emoticons/smile.png +0 -0
  212. package/apps/web/upstream/static/favicon.png +0 -0
  213. package/apps/web/upstream/static/highlight.mp3 +0 -0
  214. package/apps/web/upstream/static/highlight.ogg +0 -0
  215. package/apps/web/upstream/static/locales/.gitignore +2 -0
  216. package/apps/web/upstream/static/plugins/customise.html.example +10 -0
  217. package/apps/web/upstream/static/themes/coffee/theme.css +145 -0
  218. package/apps/web/upstream/static/themes/common/base.css +1064 -0
  219. package/apps/web/upstream/static/themes/dark/theme.css +196 -0
  220. package/apps/web/upstream/static/themes/default/theme.css +92 -0
  221. package/apps/web/upstream/static/themes/elite/theme.css +248 -0
  222. package/apps/web/upstream/static/themes/grayfox/theme.css +143 -0
  223. package/apps/web/upstream/static/themes/nightswatch/theme.css +367 -0
  224. package/apps/web/upstream/static/themes/osprey/theme.css +115 -0
  225. package/apps/web/upstream/static/themes/radioactive/theme.css +1211 -0
  226. package/apps/web/upstream/static/themes/sky/theme.css +107 -0
  227. package/apps/web/upstream/tests/unit/BatchAdd.spec.js +174 -0
  228. package/apps/web/upstream/tests/unit/MessageParser.spec.js +125 -0
  229. package/apps/web/upstream/tests/unit/Misc.spec.js +24 -0
  230. package/apps/web/upstream/tests/unit/NetworkState.spec.js +58 -0
  231. package/apps/web/upstream/tests/unit/StartupError.spec.js +20 -0
  232. package/apps/web/upstream/vue.config.js +150 -0
  233. package/apps/web/upstream/yarn.lock +9767 -0
  234. package/apps/web/vitest.config.ts +13 -0
  235. package/biome.json +1 -0
  236. package/docs/AWS-Deployment.md +21 -8
  237. package/docs/Cloudflare-Deployment-Guide.md +22 -6
  238. package/docs/Home.md +1 -0
  239. package/docs/PlanExtensions.md +113 -3
  240. package/docs/Release-Process.md +23 -13
  241. package/docs/Services.md +546 -0
  242. package/docs/WebClientGuide.md +536 -0
  243. package/package.json +2 -2
  244. package/packages/aws-adapter/package.json +1 -1
  245. package/packages/aws-adapter/src/aws-runtime.ts +5 -0
  246. package/packages/aws-adapter/src/cdk-table-defs.ts +6 -0
  247. package/packages/aws-adapter/src/config-loader.ts +11 -0
  248. package/packages/aws-adapter/src/connection-counter.ts +89 -0
  249. package/packages/aws-adapter/src/dynamo-services-store.ts +649 -0
  250. package/packages/aws-adapter/src/handlers/connect.ts +55 -51
  251. package/packages/aws-adapter/src/handlers/default.ts +36 -4
  252. package/packages/aws-adapter/src/handlers/index.ts +15 -0
  253. package/packages/aws-adapter/src/handlers/nlb-stream.ts +15 -0
  254. package/packages/aws-adapter/src/handlers/sweeper.ts +5 -1
  255. package/packages/aws-adapter/src/index.ts +4 -0
  256. package/packages/aws-adapter/src/stats.ts +6 -1
  257. package/packages/aws-adapter/src/tables.ts +34 -4
  258. package/packages/aws-adapter/tests/aws-harness.ts +3 -0
  259. package/packages/aws-adapter/tests/config-loader.test.ts +8 -0
  260. package/packages/aws-adapter/tests/connect.test.ts +158 -32
  261. package/packages/aws-adapter/tests/connection-counter.test.ts +127 -0
  262. package/packages/aws-adapter/tests/dynamo-services-store-dynamo.test.ts +183 -0
  263. package/packages/aws-adapter/tests/dynamo-services-store-unit.test.ts +568 -0
  264. package/packages/aws-adapter/tests/handlers.test.ts +105 -3
  265. package/packages/aws-adapter/tests/tables.test.ts +6 -1
  266. package/packages/cf-adapter/package.json +1 -1
  267. package/packages/cf-adapter/src/config-loader.ts +11 -0
  268. package/packages/cf-adapter/src/connection-do.ts +112 -2
  269. package/packages/cf-adapter/src/d1-services-store.ts +703 -0
  270. package/packages/cf-adapter/src/env.ts +8 -0
  271. package/packages/cf-adapter/src/index.ts +5 -0
  272. package/packages/cf-adapter/tests/cf-harness.ts +12 -1
  273. package/packages/cf-adapter/tests/config-loader.test.ts +19 -0
  274. package/packages/cf-adapter/tests/connection-do-nickserv-d1.test.ts +128 -0
  275. package/packages/cf-adapter/tests/connection-do.test.ts +150 -2
  276. package/packages/cf-adapter/tests/d1-services-store.test.ts +582 -0
  277. package/packages/cf-adapter/tests/serialize.test.ts +1 -0
  278. package/packages/in-memory-runtime/package.json +1 -1
  279. package/packages/irc-core/package.json +1 -1
  280. package/packages/irc-core/reports/mutation/mutation.html +342 -0
  281. package/packages/irc-core/scripts/generate-build-info.mjs +26 -5
  282. package/packages/irc-core/src/commands/account-auth.ts +172 -0
  283. package/packages/irc-core/src/commands/chanserv.ts +882 -0
  284. package/packages/irc-core/src/commands/hostserv.ts +487 -0
  285. package/packages/irc-core/src/commands/index.ts +12 -0
  286. package/packages/irc-core/src/commands/join.ts +164 -8
  287. package/packages/irc-core/src/commands/markread.ts +202 -0
  288. package/packages/irc-core/src/commands/memoserv.ts +319 -0
  289. package/packages/irc-core/src/commands/mode.ts +96 -4
  290. package/packages/irc-core/src/commands/nickserv.ts +390 -0
  291. package/packages/irc-core/src/commands/oper.ts +18 -1
  292. package/packages/irc-core/src/commands/operserv.ts +346 -0
  293. package/packages/irc-core/src/commands/pre-away.ts +3 -1
  294. package/packages/irc-core/src/commands/privmsg.ts +42 -0
  295. package/packages/irc-core/src/commands/read-marker.ts +8 -8
  296. package/packages/irc-core/src/commands/registration.ts +61 -6
  297. package/packages/irc-core/src/commands/sasl.ts +18 -49
  298. package/packages/irc-core/src/commands/tagmsg.ts +41 -6
  299. package/packages/irc-core/src/commands/topic.ts +37 -0
  300. package/packages/irc-core/src/config.ts +36 -5
  301. package/packages/irc-core/src/effects.ts +56 -1
  302. package/packages/irc-core/src/ports.ts +1653 -84
  303. package/packages/irc-core/src/protocol/numerics.ts +8 -0
  304. package/packages/irc-core/src/state/channel.ts +21 -1
  305. package/packages/irc-core/src/state/connection.ts +25 -1
  306. package/packages/irc-core/src/types.ts +48 -12
  307. package/packages/irc-core/tests/batch.test.ts +15 -0
  308. package/packages/irc-core/tests/commands/chanserv.test.ts +1668 -0
  309. package/packages/irc-core/tests/commands/chathistory.test.ts +6 -0
  310. package/packages/irc-core/tests/commands/hostserv.test.ts +935 -0
  311. package/packages/irc-core/tests/commands/join.test.ts +393 -1
  312. package/packages/irc-core/tests/commands/markread.test.ts +361 -0
  313. package/packages/irc-core/tests/commands/memoserv.test.ts +654 -0
  314. package/packages/irc-core/tests/commands/mode.test.ts +381 -2
  315. package/packages/irc-core/tests/commands/nickserv.test.ts +807 -0
  316. package/packages/irc-core/tests/commands/oper.test.ts +13 -0
  317. package/packages/irc-core/tests/commands/operserv.test.ts +656 -0
  318. package/packages/irc-core/tests/commands/privmsg.test.ts +147 -0
  319. package/packages/irc-core/tests/commands/read-marker.test.ts +28 -28
  320. package/packages/irc-core/tests/commands/registration.test.ts +788 -14
  321. package/packages/irc-core/tests/commands/sasl.test.ts +185 -12
  322. package/packages/irc-core/tests/commands/server-info.test.ts +9 -5
  323. package/packages/irc-core/tests/commands/tagmsg.test.ts +73 -33
  324. package/packages/irc-core/tests/commands/topic.test.ts +94 -2
  325. package/packages/irc-core/tests/commands/unified-account.test.ts +416 -0
  326. package/packages/irc-core/tests/config.test.ts +49 -5
  327. package/packages/irc-core/tests/effects.test.ts +19 -0
  328. package/packages/irc-core/tests/message-store.test.ts +63 -0
  329. package/packages/irc-core/tests/numerics.test.ts +13 -0
  330. package/packages/irc-core/tests/parser.test.ts +109 -0
  331. package/packages/irc-core/tests/persistent-services-store.test.ts +582 -0
  332. package/packages/irc-core/tests/services-store.test.ts +1289 -0
  333. package/packages/irc-core/tests/state/channel.test.ts +3 -0
  334. package/packages/irc-server/package.json +1 -1
  335. package/packages/irc-server/src/actor.ts +71 -16
  336. package/packages/irc-server/src/dispatch.ts +94 -7
  337. package/packages/irc-server/src/routing.ts +19 -0
  338. package/packages/irc-server/tests/actor.test.ts +623 -12
  339. package/packages/irc-server/tests/dispatch.test.ts +270 -2
  340. package/packages/irc-server/tests/routing.test.ts +6 -0
  341. package/packages/irc-test-support/package.json +1 -1
  342. package/packages/irc-test-support/src/in-memory-harness.ts +29 -3
  343. package/packages/irc-test-support/src/index.ts +1 -0
  344. package/packages/irc-test-support/src/scenarios.ts +24 -2
  345. package/packages/irc-test-support/tests/in-memory-harness.test.ts +32 -0
  346. package/tools/ci-hardening/package.json +1 -1
  347. package/tools/load-test/package.json +1 -1
  348. package/tools/tcp-ws-forwarder/package.json +1 -1
  349. package/tools/tcp-ws-forwarder/tests/forwarder.test.ts +2 -2
  350. package/packages/irc-core/tests/read-marker-store.test.ts +0 -108
@@ -0,0 +1,544 @@
1
+ <template>
2
+ <startup-layout
3
+ ref="layout"
4
+ class="kiwi-welcome-simple"
5
+ >
6
+ <template v-if="startupOptions.altComponent" #connection>
7
+ <component :is="startupOptions.altComponent" @close="onAltClose" />
8
+ </template>
9
+ <template v-else #connection>
10
+ <form class="u-form u-form--big kiwi-welcome-simple-form" @submit.prevent="formSubmit">
11
+ <h2 v-html="greetingText" />
12
+ <div
13
+ v-if="network && (connectErrors.length > 0 || network.state_error)"
14
+ class="kiwi-welcome-simple-error"
15
+ >
16
+ <template v-if="connectErrors.length > 0">
17
+ <span v-for="err in connectErrors" :key="err">{{ err }}</span>
18
+ </template>
19
+ <template v-else>
20
+ <span>{{ $t('network_noconnect') }}</span>
21
+ <span>{{ readableStateError(network.state_error) }}</span>
22
+ </template>
23
+ </div>
24
+
25
+ <input-text
26
+ v-model="nick"
27
+ v-focus="!nick || !show_password_box"
28
+ :label="$t('nick')"
29
+ type="text"
30
+ :class="{'kiwi-welcome-invalid-nick': !isNickValid}"
31
+ />
32
+
33
+ <div v-if="showPass && toggablePass" class="kiwi-welcome-simple-input-container">
34
+ <label
35
+ class="kiwi-welcome-simple-have-password"
36
+ >
37
+ <input v-model="show_password_box" type="checkbox">
38
+ <span> {{ $t('password_have') }} </span>
39
+ </label>
40
+ </div>
41
+
42
+ <div
43
+ v-if="showPass && (show_password_box || !toggablePass)"
44
+ class="kiwi-welcome-simple-input-container"
45
+ >
46
+ <input-text
47
+ v-model="password"
48
+ v-focus="nick || show_password_box"
49
+ :show-plain-text="true"
50
+ :label="$t('password')"
51
+ type="password"
52
+ />
53
+ </div>
54
+
55
+ <div v-if="showChannel" class="kiwi-welcome-simple-input-container">
56
+ <input-text
57
+ v-model="channel"
58
+ :label="$t('channel')"
59
+ />
60
+ </div>
61
+
62
+ <div v-if="termsContent" class="kiwi-welcome-simple-terms">
63
+ <div>
64
+ <input v-model="termsAccepted" type="checkbox">
65
+ </div>
66
+ <div class="kiwi-welcome-simple-terms-content" v-html="termsContent" />
67
+ </div>
68
+
69
+ <captcha
70
+ :network="network"
71
+ />
72
+
73
+ <button
74
+ v-if="!network || network.state === 'disconnected'"
75
+ :disabled="!readyToStart"
76
+ class="u-button u-button-primary u-submit kiwi-welcome-simple-start"
77
+ type="submit"
78
+ v-html="buttonText"
79
+ />
80
+ <button
81
+ v-else
82
+ type="button"
83
+ class="u-button u-button-primary u-submit kiwi-welcome-simple-start"
84
+ disabled
85
+ >
86
+ <i class="fa fa-spin fa-spinner" aria-hidden="true" />
87
+ </button>
88
+
89
+ <div v-html="footerText" />
90
+ </form>
91
+ </template>
92
+ </startup-layout>
93
+ </template>
94
+
95
+ <script>
96
+ 'kiwi public';
97
+
98
+ import _ from 'lodash';
99
+ import * as Misc from '@/helpers/Misc';
100
+ import Logger from '@/libs/Logger';
101
+ import BouncerProvider from '@/libs/BouncerProvider';
102
+ import Captcha from '@/components/Captcha';
103
+ import StartupLayout from './CommonLayout';
104
+
105
+ let log = Logger.namespace('Welcome.vue');
106
+
107
+ export default {
108
+ components: {
109
+ Captcha,
110
+ StartupLayout,
111
+ },
112
+ data() {
113
+ return {
114
+ connectErrors: [],
115
+ network: null,
116
+ channel: '',
117
+ nick: '',
118
+ password: '',
119
+ showChannel: true,
120
+ showPass: true,
121
+ toggablePass: true,
122
+ showNick: true,
123
+ show_password_box: false,
124
+ connectWithoutChannel: false,
125
+ showPlainText: false,
126
+ captchaReady: false,
127
+ termsAccepted: false,
128
+ };
129
+ },
130
+ computed: {
131
+ startupOptions() {
132
+ return this.$state.settings.startupOptions;
133
+ },
134
+ greetingText() {
135
+ let greeting = this.$state.settings.startupOptions.greetingText;
136
+ return typeof greeting === 'string' ?
137
+ greeting :
138
+ this.$t('start_greeting');
139
+ },
140
+ footerText() {
141
+ let footer = this.$state.settings.startupOptions.footerText;
142
+ return typeof footer === 'string' ?
143
+ footer :
144
+ '';
145
+ },
146
+ termsContent() {
147
+ let terms = this.$state.settings.startupOptions.termsContent;
148
+ return typeof terms === 'string' ?
149
+ terms :
150
+ '';
151
+ },
152
+ buttonText() {
153
+ let greeting = this.$state.settings.startupOptions.buttonText;
154
+ return typeof greeting === 'string' ?
155
+ greeting :
156
+ this.$t('start_button');
157
+ },
158
+ isNickValid() {
159
+ let nickPatternStr = this.$state.setting('startupOptions.nick_format');
160
+ let nickPattern = '';
161
+ if (!nickPatternStr) {
162
+ // Nicks cannot start with [0-9- ]
163
+ // ? is not a valid nick character but we allow it as it gets replaced
164
+ // with a number.
165
+ nickPattern = /^[a-z_\\[\]{}^`|][a-z0-9_\-\\[\]{}^`|]*$/i;
166
+ } else {
167
+ // Support custom pattern matches. Eg. only '@example.com' may be allowed
168
+ // on some IRCDs
169
+ let pattern = '';
170
+ let flags = '';
171
+ if (nickPatternStr[0] === '/') {
172
+ // Custom regex
173
+ let pos = nickPatternStr.lastIndexOf('/');
174
+ pattern = nickPatternStr.substring(1, pos);
175
+ flags = nickPatternStr.substr(pos + 1);
176
+ } else {
177
+ // Basic contains rule
178
+ pattern = _.escapeRegExp(nickPatternStr);
179
+ flags = 'i';
180
+ }
181
+
182
+ try {
183
+ nickPattern = new RegExp(pattern, flags);
184
+ } catch (error) {
185
+ log.error('Nick format error: ' + error.message);
186
+ return false;
187
+ }
188
+ }
189
+
190
+ return this.nick.match(nickPattern);
191
+ },
192
+ readyToStart() {
193
+ let ready = !!this.nick;
194
+
195
+ if (!this.connectWithoutChannel && !this.channel) {
196
+ ready = false;
197
+ }
198
+
199
+ // Make sure the channel name starts with a common channel prefix
200
+ if (!this.connectWithoutChannel) {
201
+ let bufferObjs = Misc.extractBuffers(this.channel);
202
+ bufferObjs.forEach((bufferObj) => {
203
+ if ('#&'.indexOf(bufferObj.name[0]) === -1) {
204
+ ready = false;
205
+ }
206
+ });
207
+ }
208
+
209
+ // If toggling the password is is disabled, assume it is required
210
+ if (!this.toggablePass && !this.password) {
211
+ ready = false;
212
+ }
213
+
214
+ if (!this.isNickValid) {
215
+ ready = false;
216
+ }
217
+
218
+ if (this.termsContent && !this.termsAccepted) {
219
+ ready = false;
220
+ }
221
+
222
+ return ready;
223
+ },
224
+ },
225
+ watch: {
226
+ show_password_box(newVal) {
227
+ if (newVal === false) {
228
+ // clear the password when show password is unchecked
229
+ this.password = '';
230
+ }
231
+ },
232
+ },
233
+ created() {
234
+ let options = this.startupOptions;
235
+ let connectOptions = this.connectOptions();
236
+
237
+ // Take some settings from a previous network if available
238
+ let previousNet = null;
239
+ if (connectOptions.hostname.trim()) {
240
+ previousNet = this.$state.getNetworkFromAddress(connectOptions.hostname.trim());
241
+ }
242
+
243
+ if (previousNet && previousNet.connection.nick) {
244
+ this.nick = previousNet.connection.nick;
245
+ } else if (Misc.queryStringVal('nick')) {
246
+ this.nick = Misc.queryStringVal('nick');
247
+ } else {
248
+ this.nick = options.nick;
249
+ }
250
+ this.nick = this.processNickRandomNumber(this.nick || '');
251
+
252
+ if (options.password) {
253
+ this.password = options.password;
254
+ } else if (previousNet && previousNet.password) {
255
+ this.password = previousNet.password;
256
+ this.show_password_box = true;
257
+ } else {
258
+ this.password = '';
259
+ }
260
+
261
+ this.channel = decodeURIComponent(window.location.hash) || options.channel || '';
262
+ this.showChannel = typeof options.showChannel === 'boolean' ?
263
+ options.showChannel :
264
+ true;
265
+ this.showNick = typeof options.showNick === 'boolean' ?
266
+ options.showNick :
267
+ true;
268
+ this.showPass = typeof options.showPassword === 'boolean' ?
269
+ options.showPassword :
270
+ true;
271
+ this.toggablePass = typeof options.toggablePassword === 'boolean' ?
272
+ options.toggablePassword :
273
+ true;
274
+
275
+ this.connectWithoutChannel = !!options.allowNoChannel;
276
+
277
+ if (options.bouncer) {
278
+ this.toggablePass = false;
279
+ this.showPass = true;
280
+ this.showChannel = false;
281
+ this.connectWithoutChannel = true;
282
+
283
+ let bouncer = new BouncerProvider(this.$state);
284
+ bouncer.enable(
285
+ connectOptions.hostname,
286
+ connectOptions.port,
287
+ connectOptions.tls,
288
+ connectOptions.direct,
289
+ connectOptions.direct_path
290
+ );
291
+ }
292
+
293
+ if (options.autoConnect && this.readyToStart) {
294
+ this.startUp();
295
+ }
296
+ },
297
+ methods: {
298
+ onAltClose(event) {
299
+ if (event.channel) {
300
+ this.channel = event.channel;
301
+ }
302
+ if (event.nick) {
303
+ this.nick = event.nick;
304
+ }
305
+ if (event.password) {
306
+ this.password = event.password;
307
+ }
308
+ if (event.error) {
309
+ this.connectErrors.push(event.error);
310
+ }
311
+
312
+ this.$state.settings.startupOptions.altComponent = null;
313
+ },
314
+ readableStateError(err) {
315
+ return Misc.networkErrorMessage(err);
316
+ },
317
+ formSubmit() {
318
+ if (this.readyToStart) {
319
+ this.startUp();
320
+ }
321
+ },
322
+ startUp() {
323
+ this.connectErrors = [];
324
+
325
+ let options = Object.assign({}, this.$state.settings.startupOptions);
326
+ let connectOptions = this.connectOptions();
327
+ let netAddress = _.trim(connectOptions.hostname);
328
+
329
+ // Check if we have this network already
330
+ let net = this.network || this.$state.getNetworkFromAddress(netAddress);
331
+
332
+ let password = this.password;
333
+
334
+ // If the network doesn't already exist, add a new one
335
+ net = net || this.$state.addNetwork('Network', this.nick, {
336
+ server: netAddress,
337
+ port: connectOptions.port,
338
+ tls: connectOptions.tls,
339
+ password: password,
340
+ encoding: _.trim(options.encoding),
341
+ direct: connectOptions.direct,
342
+ path: connectOptions.direct_path || '',
343
+ gecos: options.gecos,
344
+ username: options.username,
345
+ });
346
+
347
+ // Clear the server buffer in case it already existed and contains messages relating to
348
+ // the previous connection, such as errors. They are now redundant since this is a
349
+ // new connection.
350
+ net.serverBuffer().clearMessages();
351
+
352
+ // If we retreived an existing network, update the nick+password with what
353
+ // the user has just put in place
354
+ net.connection.nick = this.nick;
355
+ if (options.bouncer) {
356
+ // Bouncer mode uses server PASS
357
+ net.connection.password = `${this.nick}:${password}`;
358
+ net.password = '';
359
+ } else {
360
+ net.connection.password = '';
361
+ net.password = password;
362
+ }
363
+
364
+ if (_.trim(options.encoding || '')) {
365
+ net.connection.encoding = _.trim(options.encoding);
366
+ }
367
+
368
+ this.network = net;
369
+
370
+ // Only switch to the first channel we join if multiple are being joined
371
+ let hasSwitchedActiveBuffer = false;
372
+ let bufferObjs = Misc.extractBuffers(this.channel);
373
+ bufferObjs.forEach((bufferObj) => {
374
+ let newBuffer = this.$state.addBuffer(net.id, bufferObj.name);
375
+ newBuffer.enabled = true;
376
+
377
+ if (newBuffer && !hasSwitchedActiveBuffer) {
378
+ this.$state.setActiveBuffer(net.id, newBuffer.name);
379
+ hasSwitchedActiveBuffer = true;
380
+ }
381
+
382
+ if (bufferObj.key) {
383
+ newBuffer.key = bufferObj.key;
384
+ }
385
+ });
386
+
387
+ // switch to server buffer if no channels are joined
388
+ if (!options.bouncer && !hasSwitchedActiveBuffer) {
389
+ this.$state.setActiveBuffer(net.id, net.serverBuffer().name);
390
+ }
391
+
392
+ net.ircClient.connect();
393
+ let onRegistered = () => {
394
+ if (this.$refs.layout) {
395
+ this.$refs.layout.close();
396
+ }
397
+ net.ircClient.off('registered', onRegistered);
398
+ net.ircClient.off('close', onClosed);
399
+ net.ircClient.off('irc error', onError);
400
+ };
401
+ let onClosed = () => {
402
+ let lastError = this.network.last_error;
403
+ if (lastError && !this.connectErrors.includes(lastError)) {
404
+ this.connectErrors.push(lastError);
405
+ }
406
+ net.ircClient.off('registered', onRegistered);
407
+ net.ircClient.off('close', onClosed);
408
+ net.ircClient.off('irc error', onError);
409
+ };
410
+ let onError = (event) => {
411
+ if (!event.reason || this.connectErrors.includes(event.reason)) {
412
+ return;
413
+ }
414
+ this.connectErrors.push(event.reason);
415
+ };
416
+ net.ircClient.once('registered', onRegistered);
417
+ net.ircClient.once('close', onClosed);
418
+ net.ircClient.on('irc error', onError);
419
+ },
420
+ processNickRandomNumber(nick) {
421
+ // Replace ? with a random number
422
+ let tmp = (nick || '').replace(/\?/g, () => Math.floor(Math.random() * 100).toString());
423
+ return _.trim(tmp);
424
+ },
425
+ handleCaptcha(isReady) {
426
+ this.captchaReady = isReady;
427
+ },
428
+ connectOptions() {
429
+ let options = Object.assign({}, this.$state.settings.startupOptions);
430
+ let connectOptions = Misc.connectionInfoFromConfig(options);
431
+
432
+ // If a server isn't specified in the config, set some defaults
433
+ // The webircgateway will have a default network set and will connect
434
+ // there instead. This just removes the requirement of specifying the same
435
+ // irc network address in both the server-side and client side configs
436
+ connectOptions.hostname = connectOptions.hostname || 'default';
437
+ if (!connectOptions.port && connectOptions.direct) {
438
+ connectOptions.port = connectOptions.tls ?
439
+ 443 :
440
+ 80;
441
+ } else if (!connectOptions.port && !connectOptions.direct) {
442
+ connectOptions.port = connectOptions.tls ?
443
+ 6697 :
444
+ 6667;
445
+ }
446
+
447
+ return connectOptions;
448
+ },
449
+ },
450
+ };
451
+ </script>
452
+
453
+ <style>
454
+
455
+ /* Containers */
456
+ form.kiwi-welcome-simple-form {
457
+ width: 70%;
458
+ padding: 20px;
459
+ }
460
+
461
+ @media (max-width: 1025px) {
462
+ form.kiwi-welcome-simple-form {
463
+ width: 100%;
464
+ }
465
+ }
466
+
467
+ @media (max-width: 850px) {
468
+ form.kiwi-welcome-simple-form {
469
+ background: var(--brand-default-bg);
470
+ border-radius: 5px;
471
+ box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2);
472
+ }
473
+ }
474
+
475
+ @media (max-width: 600px) {
476
+ form.kiwi-welcome-simple-form {
477
+ max-width: 350px;
478
+ }
479
+ }
480
+
481
+ form.kiwi-welcome-simple-form h2 {
482
+ margin: 0 0 40px 0;
483
+ padding: 0;
484
+ cursor: default;
485
+ font-weight: 600;
486
+ font-size: 2.2em;
487
+ text-align: center;
488
+ line-height: 1.2em;
489
+ }
490
+
491
+ .kiwi-welcome-simple-error {
492
+ text-align: center;
493
+ margin: 1em 0;
494
+ padding: 1em;
495
+ }
496
+
497
+ .kiwi-welcome-simple-error span {
498
+ display: block;
499
+ font-style: italic;
500
+ margin-bottom: 8px;
501
+ }
502
+
503
+ .kiwi-welcome-simple-error span:last-of-type {
504
+ margin-bottom: 0;
505
+ }
506
+
507
+ .kiwi-welcome-simple-input-container {
508
+ width: 100%;
509
+ height: auto;
510
+ position: relative;
511
+ margin: 0 0 20px 0;
512
+ }
513
+
514
+ .kiwi-welcome-simple-input-container:last-of-type {
515
+ margin: 20px 0 40px 0;
516
+ }
517
+
518
+ .kiwi-welcome-simple-terms {
519
+ display: flex;
520
+ flex-direction: row;
521
+ }
522
+
523
+ .kiwi-welcome-simple-terms .kiwi-welcome-simple-terms-content {
524
+ margin-top: 3px;
525
+ line-height: 20px;
526
+ }
527
+
528
+ .kiwi-welcome-simple-form .u-submit {
529
+ width: 100%;
530
+ height: 50px;
531
+ font-size: 1.3em;
532
+ }
533
+
534
+ .kiwi-welcome-simple-start {
535
+ font-size: 1.1em;
536
+ cursor: pointer;
537
+ }
538
+
539
+ .kiwi-welcome-simple-start[disabled] {
540
+ cursor: not-allowed;
541
+ opacity: 0.65;
542
+ }
543
+
544
+ </style>