serverless-ircd 0.5.0 → 0.7.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.
- package/.github/workflows/ci.yml +40 -3
- package/.github/workflows/deploy-aws.yml +1 -2
- package/.github/workflows/deploy-cf-tcp.yml +1 -5
- package/.github/workflows/deploy-cf.yml +1 -2
- package/.gitmodules +3 -0
- package/CHANGELOG.md +474 -0
- package/README.md +219 -22
- package/apps/aws-stack/README.md +33 -0
- package/apps/aws-stack/package.json +1 -1
- package/apps/aws-stack/src/aws-stack.ts +74 -9
- package/apps/aws-stack/tests/coverage-command.test.ts +155 -0
- package/apps/aws-stack/tests/stack.test.ts +2 -2
- package/apps/aws-stack/tests/synth-no-bundle.test.ts +129 -0
- package/apps/aws-stack/tests/vitest.setup.ts +18 -0
- package/apps/aws-stack/vitest.config.ts +3 -0
- package/apps/cf-tcp-container/package.json +1 -1
- package/apps/cf-tcp-container/src/config-loader.ts +6 -7
- package/apps/cf-tcp-container/src/container-server.ts +3 -0
- package/apps/cf-tcp-container/tests/config-loader.test.ts +10 -3
- package/apps/cf-tcp-container/wrangler.toml +1 -1
- package/apps/cf-worker/package.json +2 -1
- package/apps/cf-worker/src/origin-allowlist.ts +99 -0
- package/apps/cf-worker/src/worker.ts +89 -9
- package/apps/cf-worker/tests/fixtures/web-dist/app/index.html +18 -0
- package/apps/cf-worker/tests/fixtures/web-dist/index.html +18 -0
- package/apps/cf-worker/tests/origin-allowlist.test.ts +101 -0
- package/apps/cf-worker/tests/smoke.test.ts +28 -2
- package/apps/cf-worker/tests/ws-origin.test.ts +89 -0
- package/apps/cf-worker/vitest.config.ts +1 -1
- package/apps/cf-worker/wrangler.test.toml +23 -0
- package/apps/cf-worker/wrangler.toml +59 -3
- package/apps/local-cli/package.json +1 -1
- package/apps/local-cli/src/config-loader.ts +6 -6
- package/apps/local-cli/src/main.ts +20 -0
- package/apps/local-cli/src/server.ts +9 -7
- package/apps/local-cli/tests/e2e.test.ts +112 -28
- package/apps/local-cli/tests/tcp.test.ts +71 -19
- package/apps/local-cli/tests/ws-subprotocol.test.ts +12 -7
- package/apps/web/landing/index.html +217 -0
- package/apps/web/package.json +28 -0
- package/apps/web/scripts/build.mjs +125 -0
- package/apps/web/src/build-env.ts +43 -0
- package/apps/web/src/config-schema.ts +138 -0
- package/apps/web/static/config.json +28 -0
- package/apps/web/static/config.prod.json +28 -0
- package/apps/web/static/config.staging.json +28 -0
- package/apps/web/tests/build-env.test.ts +63 -0
- package/apps/web/tests/build-smoke.test.ts +103 -0
- package/apps/web/tests/config-schema.test.ts +432 -0
- package/apps/web/tests/workspace.test.ts +12 -0
- package/apps/web/tsconfig.json +10 -0
- package/apps/web/upstream/.browserslistrc +3 -0
- package/apps/web/upstream/.editorconfig +9 -0
- package/apps/web/upstream/.eslintignore +3 -0
- package/apps/web/upstream/.eslintrc.js +90 -0
- package/apps/web/upstream/.github/FUNDING.yml +12 -0
- package/apps/web/upstream/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/apps/web/upstream/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/apps/web/upstream/.github/workflows/push.yml +26 -0
- package/apps/web/upstream/.github/workflows/release.yml +33 -0
- package/apps/web/upstream/.github/workflows/release_manual.yml +55 -0
- package/apps/web/upstream/.prettierrc.js +9 -0
- package/apps/web/upstream/.stylelintignore +5 -0
- package/apps/web/upstream/.stylelintrc.js +21 -0
- package/apps/web/upstream/LICENSE +201 -0
- package/apps/web/upstream/README.md +76 -0
- package/apps/web/upstream/babel.config.js +25 -0
- package/apps/web/upstream/crowdin.yml +3 -0
- package/apps/web/upstream/index.html +35 -0
- package/apps/web/upstream/jest.config.js +7 -0
- package/apps/web/upstream/jsdoc.json +22 -0
- package/apps/web/upstream/package.json +80 -0
- package/apps/web/upstream/scripts/pre-commit +43 -0
- package/apps/web/upstream/src/components/App.vue +516 -0
- package/apps/web/upstream/src/components/AppSettings.vue +587 -0
- package/apps/web/upstream/src/components/AutoComplete.vue +284 -0
- package/apps/web/upstream/src/components/Avatar.vue +105 -0
- package/apps/web/upstream/src/components/AwayStatusIndicator.vue +77 -0
- package/apps/web/upstream/src/components/BufferKey.vue +121 -0
- package/apps/web/upstream/src/components/BufferSettings.vue +97 -0
- package/apps/web/upstream/src/components/Captcha.vue +85 -0
- package/apps/web/upstream/src/components/ChannelBanlist.vue +96 -0
- package/apps/web/upstream/src/components/ChannelInfo.vue +159 -0
- package/apps/web/upstream/src/components/ChannelInvitelist.vue +276 -0
- package/apps/web/upstream/src/components/ChannelList.vue +345 -0
- package/apps/web/upstream/src/components/Container.vue +401 -0
- package/apps/web/upstream/src/components/ContainerHeader.vue +522 -0
- package/apps/web/upstream/src/components/ControlInput.vue +1016 -0
- package/apps/web/upstream/src/components/LoadingAnimation.vue +104 -0
- package/apps/web/upstream/src/components/MediaViewer.vue +199 -0
- package/apps/web/upstream/src/components/MessageInfo.vue +192 -0
- package/apps/web/upstream/src/components/MessageList.vue +1028 -0
- package/apps/web/upstream/src/components/MessageListAvatar.vue +20 -0
- package/apps/web/upstream/src/components/MessageListMessageCompact.vue +361 -0
- package/apps/web/upstream/src/components/MessageListMessageInline.vue +257 -0
- package/apps/web/upstream/src/components/MessageListMessageModern.vue +430 -0
- package/apps/web/upstream/src/components/NetworkSettings.vue +528 -0
- package/apps/web/upstream/src/components/Nicklist.vue +309 -0
- package/apps/web/upstream/src/components/NicklistUser.vue +181 -0
- package/apps/web/upstream/src/components/NotConnected.vue +271 -0
- package/apps/web/upstream/src/components/SelfUser.vue +283 -0
- package/apps/web/upstream/src/components/ServerSelector.vue +162 -0
- package/apps/web/upstream/src/components/ServerView.vue +126 -0
- package/apps/web/upstream/src/components/SettingsAdvanced.vue +232 -0
- package/apps/web/upstream/src/components/SettingsAliases.vue +121 -0
- package/apps/web/upstream/src/components/Sidebar.vue +429 -0
- package/apps/web/upstream/src/components/SidebarAboutBuffer.vue +288 -0
- package/apps/web/upstream/src/components/SidebarState.vue +145 -0
- package/apps/web/upstream/src/components/StartupError.vue +35 -0
- package/apps/web/upstream/src/components/StateBrowser.vue +420 -0
- package/apps/web/upstream/src/components/StateBrowserBuffer.vue +124 -0
- package/apps/web/upstream/src/components/StateBrowserNetwork.vue +823 -0
- package/apps/web/upstream/src/components/StateBrowserUsermenu.vue +162 -0
- package/apps/web/upstream/src/components/TypingStatusIndicator.vue +34 -0
- package/apps/web/upstream/src/components/TypingUsersList.vue +56 -0
- package/apps/web/upstream/src/components/UrlEmbed.vue +149 -0
- package/apps/web/upstream/src/components/UserBox.vue +728 -0
- package/apps/web/upstream/src/components/inputtools/Emoji.vue +67 -0
- package/apps/web/upstream/src/components/inputtools/TextStyle.vue +142 -0
- package/apps/web/upstream/src/components/startups/CommonLayout.vue +208 -0
- package/apps/web/upstream/src/components/startups/CustomServer.vue +495 -0
- package/apps/web/upstream/src/components/startups/KiwiBnc.vue +361 -0
- package/apps/web/upstream/src/components/startups/Personal.vue +317 -0
- package/apps/web/upstream/src/components/startups/Welcome.vue +544 -0
- package/apps/web/upstream/src/components/startups/ZncLogin.vue +229 -0
- package/apps/web/upstream/src/components/utils/InputConfirm.vue +68 -0
- package/apps/web/upstream/src/components/utils/InputPrompt.vue +118 -0
- package/apps/web/upstream/src/components/utils/InputText.vue +172 -0
- package/apps/web/upstream/src/components/utils/IrcInput.vue +579 -0
- package/apps/web/upstream/src/components/utils/PluginWrapper.vue +26 -0
- package/apps/web/upstream/src/components/utils/TabbedView.vue +149 -0
- package/apps/web/upstream/src/components/utils/TransitionExpand.vue +97 -0
- package/apps/web/upstream/src/helpers/Colours.js +128 -0
- package/apps/web/upstream/src/helpers/IrcdDiffs.js +26 -0
- package/apps/web/upstream/src/helpers/Md5.js +193 -0
- package/apps/web/upstream/src/helpers/Misc.js +401 -0
- package/apps/web/upstream/src/helpers/TextFormatting.js +237 -0
- package/apps/web/upstream/src/libs/AliasRewriter.js +157 -0
- package/apps/web/upstream/src/libs/AudioManager.js +60 -0
- package/apps/web/upstream/src/libs/BouncerMiddleware.js +247 -0
- package/apps/web/upstream/src/libs/BouncerProvider.js +551 -0
- package/apps/web/upstream/src/libs/ChathistoryMiddleware.js +153 -0
- package/apps/web/upstream/src/libs/ConfigLoader.js +94 -0
- package/apps/web/upstream/src/libs/EmojiProvider.js +46 -0
- package/apps/web/upstream/src/libs/GlobalApi.js +346 -0
- package/apps/web/upstream/src/libs/IPC.js +51 -0
- package/apps/web/upstream/src/libs/InputHandler.js +921 -0
- package/apps/web/upstream/src/libs/IrcClient.js +1506 -0
- package/apps/web/upstream/src/libs/Logger.js +71 -0
- package/apps/web/upstream/src/libs/Message.js +169 -0
- package/apps/web/upstream/src/libs/MessageFormatter.js +364 -0
- package/apps/web/upstream/src/libs/MessageParser.js +249 -0
- package/apps/web/upstream/src/libs/Notifications.js +78 -0
- package/apps/web/upstream/src/libs/ServerConnection.js +270 -0
- package/apps/web/upstream/src/libs/ServerSession.js +102 -0
- package/apps/web/upstream/src/libs/SoundBleep.js +20 -0
- package/apps/web/upstream/src/libs/StatePersistence.js +90 -0
- package/apps/web/upstream/src/libs/ThemeManager.js +128 -0
- package/apps/web/upstream/src/libs/TypingMiddleware.js +105 -0
- package/apps/web/upstream/src/libs/WindowTitle.js +63 -0
- package/apps/web/upstream/src/libs/batchedAdd.js +74 -0
- package/apps/web/upstream/src/libs/bufferTools.js +177 -0
- package/apps/web/upstream/src/libs/polyfill/Element.closest.js +18 -0
- package/apps/web/upstream/src/libs/renderers/Html.js +113 -0
- package/apps/web/upstream/src/libs/settingTools.js +31 -0
- package/apps/web/upstream/src/libs/state/BufferState.js +703 -0
- package/apps/web/upstream/src/libs/state/NetworkState.js +158 -0
- package/apps/web/upstream/src/libs/state/UserState.js +89 -0
- package/apps/web/upstream/src/libs/state/common.js +26 -0
- package/apps/web/upstream/src/libs/state.js +961 -0
- package/apps/web/upstream/src/libs/storage/Local.js +51 -0
- package/apps/web/upstream/src/main.js +566 -0
- package/apps/web/upstream/src/res/autocompleteCommands.js +31 -0
- package/apps/web/upstream/src/res/configTemplates.js +373 -0
- package/apps/web/upstream/src/res/globalStyle.css +277 -0
- package/apps/web/upstream/src/res/kiwiLoadingLogo.png +0 -0
- package/apps/web/upstream/src/res/locales/app.af-ZA.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ar-SA.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.bg-BG.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.bs-BA.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ca-ES.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.cs-CZ.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.da-DK.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.de-DE.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.dev.po +1246 -0
- package/apps/web/upstream/src/res/locales/app.el-GR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.en-US.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.es-419.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.es-AR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.es-EM.po +536 -0
- package/apps/web/upstream/src/res/locales/app.es-ES.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.es-US.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.eu-ES.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.fi-FI.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.fr-FR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.gl-ES.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.he-IL.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.hi-IN.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.hu-HU.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.id-ID.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.it-IT.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ja-JP.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ko-KR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.nl-NL.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.no-NO.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.pl-PL.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.pt-BR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.pt-PT.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ro-RO.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ru-RU.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.sl-SI.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.sq-AL.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.sr-SP.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.sv-SE.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.tr-TR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.uk-UA.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.vi-VN.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.zh-CN.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.zh-TW.po +1145 -0
- package/apps/web/upstream/src/res/localesList.json +27 -0
- package/apps/web/upstream/src/res/logo.png +0 -0
- package/apps/web/upstream/src/thirdparty/about.html +43 -0
- package/apps/web/upstream/src/thirdparty/index.js +5 -0
- package/apps/web/upstream/src/thirdparty/kiwiirccom.vue +185 -0
- package/apps/web/upstream/static/config.json +28 -0
- package/apps/web/upstream/static/emoticons/smile.png +0 -0
- package/apps/web/upstream/static/favicon.png +0 -0
- package/apps/web/upstream/static/highlight.mp3 +0 -0
- package/apps/web/upstream/static/highlight.ogg +0 -0
- package/apps/web/upstream/static/locales/.gitignore +2 -0
- package/apps/web/upstream/static/plugins/customise.html.example +10 -0
- package/apps/web/upstream/static/themes/coffee/theme.css +145 -0
- package/apps/web/upstream/static/themes/common/base.css +1064 -0
- package/apps/web/upstream/static/themes/dark/theme.css +196 -0
- package/apps/web/upstream/static/themes/default/theme.css +92 -0
- package/apps/web/upstream/static/themes/elite/theme.css +248 -0
- package/apps/web/upstream/static/themes/grayfox/theme.css +143 -0
- package/apps/web/upstream/static/themes/nightswatch/theme.css +367 -0
- package/apps/web/upstream/static/themes/osprey/theme.css +115 -0
- package/apps/web/upstream/static/themes/radioactive/theme.css +1211 -0
- package/apps/web/upstream/static/themes/sky/theme.css +107 -0
- package/apps/web/upstream/tests/unit/BatchAdd.spec.js +174 -0
- package/apps/web/upstream/tests/unit/MessageParser.spec.js +125 -0
- package/apps/web/upstream/tests/unit/Misc.spec.js +24 -0
- package/apps/web/upstream/tests/unit/NetworkState.spec.js +58 -0
- package/apps/web/upstream/tests/unit/StartupError.spec.js +20 -0
- package/apps/web/upstream/vue.config.js +150 -0
- package/apps/web/upstream/yarn.lock +9767 -0
- package/apps/web/vitest.config.ts +13 -0
- package/biome.json +2 -0
- package/docs/ADR-001-pure-reducers-and-effect-system.md +74 -0
- package/docs/ADR-002-location-of-authority.md +82 -0
- package/docs/ADR-003-durable-object-sharding.md +110 -0
- package/docs/ADR-004-dynamodb-schema.md +96 -0
- package/docs/ADR-005-wss-only-transport-v1.md +83 -0
- package/docs/ADR-006-sasl-mechanism-scope.md +96 -0
- package/docs/ADR-007-deterministic-ports.md +82 -0
- package/docs/ADR-008-monorepo-tooling.md +60 -0
- package/docs/ADR-009-dual-transport-wss-and-irc-tls.md +138 -0
- package/docs/ADR-Index.md +15 -0
- package/docs/AWS-Adapter-Architecture.md +496 -0
- package/docs/AWS-Deployment.md +1275 -0
- package/docs/AWS-TCP-Deployment.md +410 -0
- package/docs/Cloudflare-Deployment-Guide.md +719 -0
- package/docs/Cloudflare-TCP-Deployment.md +510 -0
- package/docs/Home.md +16 -0
- package/docs/Observability.md +87 -0
- package/docs/PlanExtensions.md +812 -0
- package/docs/PlanIRCv3Websocket.md +503 -0
- package/docs/PlanWebClient.md +451 -0
- package/docs/Release-Process.md +443 -0
- package/docs/WebClientGuide.md +535 -0
- package/package.json +2 -2
- package/packages/aws-adapter/package.json +1 -1
- package/packages/aws-adapter/src/handlers/default.ts +3 -0
- package/packages/aws-adapter/src/handlers/nlb-stream.ts +9 -0
- package/packages/aws-adapter/src/serialize.ts +29 -1
- package/packages/aws-adapter/tests/account-store-dynamo.test.ts +49 -8
- package/packages/aws-adapter/tests/account-store.test.ts +4 -7
- package/packages/aws-adapter/tests/aws-harness.ts +5 -2
- package/packages/aws-adapter/tests/aws-integration.test.ts +8 -4
- package/packages/aws-adapter/tests/aws-runtime.test.ts +79 -0
- package/packages/aws-adapter/tests/config-loader.test.ts +11 -2
- package/packages/aws-adapter/tests/connect.test.ts +9 -9
- package/packages/aws-adapter/tests/disconnect-fanout.test.ts +3 -4
- package/packages/aws-adapter/tests/global-setup.ts +55 -30
- package/packages/aws-adapter/tests/gone-exception.test.ts +4 -9
- package/packages/aws-adapter/tests/handlers.test.ts +90 -4
- package/packages/aws-adapter/tests/message-store.test.ts +6 -5
- package/packages/aws-adapter/tests/nlb-stream.test.ts +60 -8
- package/packages/cf-adapter/package.json +2 -1
- package/packages/cf-adapter/src/connection-do.ts +3 -0
- package/packages/cf-adapter/src/serialize.ts +25 -4
- package/packages/cf-adapter/tests/cf-harness.ts +12 -1
- package/packages/cf-adapter/tests/cf-runtime.test.ts +269 -0
- package/packages/cf-adapter/tests/channel-do.test.ts +117 -0
- package/packages/cf-adapter/tests/config-loader.test.ts +49 -0
- package/packages/cf-adapter/tests/connection-do-pure.test.ts +91 -0
- package/packages/cf-adapter/tests/d1-account-store.test.ts +48 -0
- package/packages/cf-adapter/tests/registry-do.test.ts +104 -0
- package/packages/cf-adapter/tests/serialize.test.ts +308 -0
- package/packages/cf-adapter/vitest.config.ts +1 -1
- package/packages/in-memory-runtime/package.json +1 -1
- package/packages/irc-core/package.json +1 -1
- package/packages/irc-core/reports/mutation/mutation.html +342 -0
- package/packages/irc-core/src/caps/capabilities.ts +37 -3
- package/packages/irc-core/src/caps/index.ts +1 -0
- package/packages/irc-core/src/caps/sts.ts +84 -0
- package/packages/irc-core/src/commands/account-notify.ts +53 -0
- package/packages/irc-core/src/commands/away.ts +9 -3
- package/packages/irc-core/src/commands/cap.ts +23 -5
- package/packages/irc-core/src/commands/chathistory.ts +40 -11
- package/packages/irc-core/src/commands/index.ts +34 -0
- package/packages/irc-core/src/commands/isupport.ts +53 -0
- package/packages/irc-core/src/commands/mode.ts +8 -1
- package/packages/irc-core/src/commands/monitor.ts +327 -0
- package/packages/irc-core/src/commands/multiline.ts +256 -0
- package/packages/irc-core/src/commands/pre-away.ts +112 -0
- package/packages/irc-core/src/commands/privmsg.ts +19 -12
- package/packages/irc-core/src/commands/read-marker.ts +108 -0
- package/packages/irc-core/src/commands/registration.ts +8 -0
- package/packages/irc-core/src/commands/sasl.ts +24 -1
- package/packages/irc-core/src/commands/tagmsg.ts +71 -1
- package/packages/irc-core/src/commands/whois.ts +5 -0
- package/packages/irc-core/src/config.ts +65 -10
- package/packages/irc-core/src/effects.ts +14 -0
- package/packages/irc-core/src/ports.ts +389 -0
- package/packages/irc-core/src/protocol/index.ts +14 -0
- package/packages/irc-core/src/protocol/labeled-response.ts +133 -0
- package/packages/irc-core/src/protocol/numerics.ts +15 -0
- package/packages/irc-core/src/protocol/outbound.ts +16 -1
- package/packages/irc-core/src/protocol/standard-replies.ts +277 -0
- package/packages/irc-core/src/state/connection.ts +32 -1
- package/packages/irc-core/src/types.ts +112 -0
- package/packages/irc-core/stryker.commands.conf.json +1 -2
- package/packages/irc-core/tests/away-store.test.ts +73 -0
- package/packages/irc-core/tests/batch.test.ts +15 -0
- package/packages/irc-core/tests/caps/capabilities.test.ts +119 -2
- package/packages/irc-core/tests/caps/sts.test.ts +123 -0
- package/packages/irc-core/tests/commands/account-notify.test.ts +171 -0
- package/packages/irc-core/tests/commands/away.test.ts +85 -2
- package/packages/irc-core/tests/commands/cap.test.ts +165 -0
- package/packages/irc-core/tests/commands/chathistory.test.ts +148 -1
- package/packages/irc-core/tests/commands/echo-message.test.ts +9 -3
- package/packages/irc-core/tests/commands/isupport.test.ts +80 -0
- package/packages/irc-core/tests/commands/mode.test.ts +72 -0
- package/packages/irc-core/tests/commands/monitor.test.ts +411 -0
- package/packages/irc-core/tests/commands/multiline.test.ts +428 -0
- package/packages/irc-core/tests/commands/pre-away.test.ts +241 -0
- package/packages/irc-core/tests/commands/privmsg.test.ts +154 -3
- package/packages/irc-core/tests/commands/read-marker.test.ts +211 -0
- package/packages/irc-core/tests/commands/registration.test.ts +64 -0
- package/packages/irc-core/tests/commands/sasl.test.ts +116 -2
- package/packages/irc-core/tests/commands/tagmsg.test.ts +357 -0
- package/packages/irc-core/tests/commands/whois.test.ts +34 -0
- package/packages/irc-core/tests/config.test.ts +103 -13
- package/packages/irc-core/tests/labeled-response.test.ts +181 -0
- package/packages/irc-core/tests/message-tags.test.ts +114 -0
- package/packages/irc-core/tests/monitor-store.test.ts +200 -0
- package/packages/irc-core/tests/numerics.test.ts +13 -0
- package/packages/irc-core/tests/parser.test.ts +109 -0
- package/packages/irc-core/tests/read-marker-store.test.ts +108 -0
- package/packages/irc-core/tests/standard-replies.test.ts +412 -0
- package/packages/irc-core/tests/types.test.ts +27 -0
- package/packages/irc-server/package.json +1 -1
- package/packages/irc-server/src/actor.ts +450 -3
- package/packages/irc-server/src/dispatch.ts +108 -16
- package/packages/irc-server/tests/actor.test.ts +1432 -39
- package/packages/irc-server/tests/dispatch.test.ts +263 -2
- package/packages/irc-test-support/package.json +1 -1
- package/packages/irc-test-support/src/index.ts +6 -0
- package/packages/irc-test-support/src/scenarios.ts +24 -2
- package/packages/irc-test-support/src/test-config.ts +54 -0
- package/packages/irc-test-support/tests/test-config.test.ts +51 -0
- package/tools/ci-hardening/package.json +1 -1
- package/tools/ci-hardening/tests/ddb-local.test.ts +82 -0
- package/tools/load-test/package.json +33 -0
- package/tools/load-test/src/client.ts +351 -0
- package/tools/load-test/src/config.ts +313 -0
- package/tools/load-test/src/harness.ts +116 -0
- package/tools/load-test/src/main.ts +120 -0
- package/tools/load-test/src/metrics.ts +168 -0
- package/tools/load-test/src/report.ts +106 -0
- package/tools/load-test/tests/client.test.ts +212 -0
- package/tools/load-test/tests/config.test.ts +152 -0
- package/tools/load-test/tests/framing.test.ts +37 -0
- package/tools/load-test/tests/harness.test.ts +165 -0
- package/tools/load-test/tests/metrics.test.ts +174 -0
- package/tools/load-test/tests/report.test.ts +161 -0
- package/tools/load-test/tests/smoke.test.ts +67 -0
- package/tools/load-test/tsconfig.build.json +12 -0
- package/tools/load-test/tsconfig.test.json +10 -0
- package/tools/load-test/vitest.config.ts +29 -0
- package/tools/tcp-ws-forwarder/package.json +1 -1
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<startup-layout ref="layout" class="kiwi-startbnc">
|
|
3
|
+
<template #connection>
|
|
4
|
+
<form class="kiwi-startbnc-form" @submit.prevent="startUp">
|
|
5
|
+
<h2 v-html="greetingText" />
|
|
6
|
+
|
|
7
|
+
<div class="kiwi-startbnc-status">{{ statusMessage }}</div>
|
|
8
|
+
|
|
9
|
+
<label>
|
|
10
|
+
<span>{{ $t('username') }}</span>
|
|
11
|
+
<input v-model="username" :disabled="loading" type="text">
|
|
12
|
+
</label>
|
|
13
|
+
<label>
|
|
14
|
+
<span>{{ $t('password') }}</span>
|
|
15
|
+
<input v-model="password" :disabled="loading" type="password">
|
|
16
|
+
</label>
|
|
17
|
+
|
|
18
|
+
<button
|
|
19
|
+
:disabled="loading || !username || !password"
|
|
20
|
+
type="submit"
|
|
21
|
+
class="u-button u-button-primary u-submit"
|
|
22
|
+
>
|
|
23
|
+
<span v-if="!loading" v-html="buttonText" />
|
|
24
|
+
<i v-else class="fa fa-spinner fa-spin" aria-hidden="true" />
|
|
25
|
+
</button>
|
|
26
|
+
</form>
|
|
27
|
+
</template>
|
|
28
|
+
</startup-layout>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script>
|
|
32
|
+
'kiwi public';
|
|
33
|
+
|
|
34
|
+
import _ from 'lodash';
|
|
35
|
+
import Logger from '@/libs/Logger';
|
|
36
|
+
import StartupLayout from './CommonLayout';
|
|
37
|
+
|
|
38
|
+
let log = Logger.namespace('Startup/kiwiBnc');
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
components: {
|
|
42
|
+
StartupLayout,
|
|
43
|
+
},
|
|
44
|
+
data: function data() {
|
|
45
|
+
return {
|
|
46
|
+
loading: false,
|
|
47
|
+
username: '',
|
|
48
|
+
password: '',
|
|
49
|
+
statusMessage: '',
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
computed: {
|
|
53
|
+
greetingText: function greetingText() {
|
|
54
|
+
let greeting = this.$state.settings.startupOptions.greetingText;
|
|
55
|
+
return typeof greeting === 'string' ?
|
|
56
|
+
greeting :
|
|
57
|
+
this.$t('start_greeting');
|
|
58
|
+
},
|
|
59
|
+
buttonText: function buttonText() {
|
|
60
|
+
if (this.loading) {
|
|
61
|
+
return '';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let greeting = this.$state.settings.startupOptions.buttonText;
|
|
65
|
+
return typeof greeting === 'string' ?
|
|
66
|
+
greeting :
|
|
67
|
+
this.$t('start_button');
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
methods: {
|
|
71
|
+
startUp: async function startUp() {
|
|
72
|
+
this.statusMessage = this.$t('logging_in');
|
|
73
|
+
this.loading = true;
|
|
74
|
+
|
|
75
|
+
let bncnet = this.getBncNetwork();
|
|
76
|
+
|
|
77
|
+
let cleanUpEvents = () => {
|
|
78
|
+
bncnet.ircClient.off('registered', onRegistered);
|
|
79
|
+
bncnet.ircClient.off('irc error', onError);
|
|
80
|
+
bncnet.ircClient.off('close', onClose);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
let onRegistered = async() => {
|
|
84
|
+
cleanUpEvents();
|
|
85
|
+
|
|
86
|
+
let bncNetworks = await bncnet.ircClient.bnc.getNetworks();
|
|
87
|
+
for (let i = 0; i < bncNetworks.length; i++) {
|
|
88
|
+
let network = bncNetworks[i];
|
|
89
|
+
network.buffers = [];
|
|
90
|
+
try {
|
|
91
|
+
/* eslint-disable no-await-in-loop */
|
|
92
|
+
let buffers = await bncnet.ircClient.bnc.getBuffers(network.name);
|
|
93
|
+
network.buffers = buffers;
|
|
94
|
+
} catch (err) {
|
|
95
|
+
// Log the error here or something
|
|
96
|
+
log.error(err);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
this.addNetworkToState(network);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
this.monitorNetworkChanges(bncnet, bncNetworks);
|
|
103
|
+
this.$refs.layout.close();
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
let onError = (event) => {
|
|
107
|
+
cleanUpEvents();
|
|
108
|
+
this.statusMessage = this.$t('invalid_login');
|
|
109
|
+
this.loading = false;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
let onClose = (event) => {
|
|
113
|
+
cleanUpEvents();
|
|
114
|
+
this.statusMessage = this.$t('invalid_login');
|
|
115
|
+
this.loading = false;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
bncnet.ircClient.once('registered', onRegistered);
|
|
119
|
+
bncnet.ircClient.once('irc error', onError);
|
|
120
|
+
bncnet.ircClient.once('close', onClose);
|
|
121
|
+
bncnet.ircClient.connect();
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
getBncNetwork: function getBncNetwork() {
|
|
125
|
+
let bnc = this.$state.setting('bnc');
|
|
126
|
+
|
|
127
|
+
if (bnc.network) {
|
|
128
|
+
bnc.username = this.username;
|
|
129
|
+
bnc.password = this.password;
|
|
130
|
+
return bnc.network;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
let options = this.$state.settings.startupOptions;
|
|
134
|
+
|
|
135
|
+
// Indicate that all our connections will be going through a BNC
|
|
136
|
+
bnc.active = true;
|
|
137
|
+
bnc.server = options.server || '';
|
|
138
|
+
bnc.port = options.port || 6667;
|
|
139
|
+
bnc.tls = !!options.tls;
|
|
140
|
+
bnc.username = this.username;
|
|
141
|
+
bnc.password = this.password;
|
|
142
|
+
|
|
143
|
+
let bncnet = this.$state.addNetwork('bnccontrol', this.username, {
|
|
144
|
+
server: bnc.server,
|
|
145
|
+
port: bnc.port,
|
|
146
|
+
tls: bnc.tls,
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
bnc.network = bncnet;
|
|
150
|
+
|
|
151
|
+
return bncnet;
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
addNetworkToState: function addNetworkToState(network) {
|
|
155
|
+
// Expects network to be in the format of:
|
|
156
|
+
// {
|
|
157
|
+
// "buffers":[{"channel":"1","name":"#prawnsalad","joined":"1"}],
|
|
158
|
+
// "name":"freenode",
|
|
159
|
+
// "channel":"1",
|
|
160
|
+
// "connected":"1",
|
|
161
|
+
// "host":"irc.freenode.net",
|
|
162
|
+
// "port":"6667",
|
|
163
|
+
// "tls":"0",
|
|
164
|
+
// "nick":"notprawn99829"
|
|
165
|
+
// },
|
|
166
|
+
let net = this.$state.addNetwork(network.name, network.nick, {
|
|
167
|
+
server: network.host,
|
|
168
|
+
port: network.port,
|
|
169
|
+
tls: network.tls,
|
|
170
|
+
password: network.password,
|
|
171
|
+
bncname: network.name,
|
|
172
|
+
username: network.user,
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
network.buffers.forEach((buffer) => {
|
|
176
|
+
let newBuffer = this.$state.addBuffer(net.id, buffer.name);
|
|
177
|
+
if (buffer.joined) {
|
|
178
|
+
newBuffer.enabled = true;
|
|
179
|
+
}
|
|
180
|
+
if (buffer.seen) {
|
|
181
|
+
newBuffer.last_read = (new Date(buffer.seen)).getTime();
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
monitorNetworkChanges: function monitorNetworkChanges(bncNet, bncNetworks) {
|
|
187
|
+
let existingNets = Object.create(null);
|
|
188
|
+
function rememberNetworks() {
|
|
189
|
+
this.$state.networks.forEach((network) => {
|
|
190
|
+
if (!network.connection.bncname) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
existingNets[network.connection.bncname] = {
|
|
195
|
+
name: network.connection.bncname,
|
|
196
|
+
host: network.connection.server,
|
|
197
|
+
port: network.connection.port,
|
|
198
|
+
tls: network.connection.tls,
|
|
199
|
+
password: network.password,
|
|
200
|
+
nick: network.nick,
|
|
201
|
+
username: network.username,
|
|
202
|
+
};
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
rememberNetworks();
|
|
207
|
+
|
|
208
|
+
let saveState = (newVal) => {
|
|
209
|
+
this.$state.networks.forEach((network) => {
|
|
210
|
+
// Only deal with BNC networks
|
|
211
|
+
if (network.name === 'bnccontrol') {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
let bncName = network.connection.bncname;
|
|
216
|
+
let current = existingNets[bncName] || {};
|
|
217
|
+
let tags = {};
|
|
218
|
+
|
|
219
|
+
if (network.connection.server !== current.host) {
|
|
220
|
+
tags.host = network.connection.server;
|
|
221
|
+
}
|
|
222
|
+
if (network.connection.port !== current.port) {
|
|
223
|
+
tags.port = network.connection.port;
|
|
224
|
+
}
|
|
225
|
+
if (network.connection.tls !== current.tls) {
|
|
226
|
+
tags.tls = network.connection.tls;
|
|
227
|
+
}
|
|
228
|
+
if (network.password !== current.password) {
|
|
229
|
+
tags.password = network.password;
|
|
230
|
+
}
|
|
231
|
+
if (network.nick !== current.nick) {
|
|
232
|
+
tags.nick = network.nick;
|
|
233
|
+
}
|
|
234
|
+
if (network.username !== current.username) {
|
|
235
|
+
tags.user = network.username;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// A newly added network would not have a current name property set yet.
|
|
239
|
+
// Only save the network if we've entered a host.
|
|
240
|
+
if (!current.name && tags.host) {
|
|
241
|
+
network.connection.bncname = network.name;
|
|
242
|
+
bncNet.ircClient.bnc.addNetwork(
|
|
243
|
+
network.name,
|
|
244
|
+
tags.host,
|
|
245
|
+
tags.port,
|
|
246
|
+
tags.tls,
|
|
247
|
+
tags.nick,
|
|
248
|
+
tags.user,
|
|
249
|
+
tags.password,
|
|
250
|
+
);
|
|
251
|
+
} else if (current.name) {
|
|
252
|
+
bncNet.ircClient.bnc.saveNetwork(bncName, tags);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
rememberNetworks();
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
let debouncedSaveState = _.debounce(saveState, 2000);
|
|
260
|
+
|
|
261
|
+
this.$state.$watch('networks', debouncedSaveState, { deep: true });
|
|
262
|
+
|
|
263
|
+
// Just before we connect to a network, make sure the BNC is sabed and connected to
|
|
264
|
+
// it or at least trying to connect.
|
|
265
|
+
this.$state.$on('network.connecting', (event) => {
|
|
266
|
+
saveState();
|
|
267
|
+
|
|
268
|
+
let netName = event.network.connection.bncname;
|
|
269
|
+
let networkFromBnc = _.find(bncNetworks, { name: netName });
|
|
270
|
+
if (networkFromBnc && !networkFromBnc.connected) {
|
|
271
|
+
bncNet.ircClient.raw('BOUNCER connect ' + netName);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
// Very hacky until we have network name renaming on the bnc. When a new network
|
|
276
|
+
// is added, change the name to the next available network name.
|
|
277
|
+
this.$state.$on('network.new', (event) => {
|
|
278
|
+
let currentNum = 1;
|
|
279
|
+
let existingNet = true;
|
|
280
|
+
while (existingNet) {
|
|
281
|
+
existingNet = _.find(this.$state.networks, { name: 'Network' + currentNum });
|
|
282
|
+
if (!existingNet) {
|
|
283
|
+
event.network.name = 'Network' + currentNum;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
currentNum++;
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
this.$state.$on('network.removed', (event) => {
|
|
291
|
+
bncNet.ircClient.bnc.removeNetwork(event.network.connection.bncname);
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
this.$state.$on('buffer.close', (event) => {
|
|
295
|
+
let buffer = event.buffer;
|
|
296
|
+
let network = event.buffer.getNetwork();
|
|
297
|
+
let bncName = network.connection.bncname;
|
|
298
|
+
|
|
299
|
+
if (bncName) {
|
|
300
|
+
bncNet.ircClient.bnc.closeBuffer(bncName, buffer.name);
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
};
|
|
306
|
+
</script>
|
|
307
|
+
|
|
308
|
+
<style>
|
|
309
|
+
|
|
310
|
+
.kiwi-startbnc-form label {
|
|
311
|
+
text-align: left;
|
|
312
|
+
display: block;
|
|
313
|
+
margin-bottom: 1.5em;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.kiwi-startbnc-form input,
|
|
317
|
+
.kiwi-startbnc-form input:active {
|
|
318
|
+
font-size: 1em;
|
|
319
|
+
width: 100%;
|
|
320
|
+
box-sizing: border-box;
|
|
321
|
+
line-height: 30px;
|
|
322
|
+
padding: 0 10px;
|
|
323
|
+
border: none;
|
|
324
|
+
border-bottom: 2px solid #42b992;
|
|
325
|
+
outline: none;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
.kiwi-startbnc-status {
|
|
329
|
+
margin: 1em 0;
|
|
330
|
+
overflow: hidden;
|
|
331
|
+
max-height: 40px;
|
|
332
|
+
transition: max-height 0.2s;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
.kiwi-startbnc-status:empty {
|
|
336
|
+
background: red;
|
|
337
|
+
max-height: 0;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.kiwi-startbnc-start {
|
|
341
|
+
font-size: 1.1em;
|
|
342
|
+
cursor: pointer;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.kiwi-startbnc-form {
|
|
346
|
+
width: 300px;
|
|
347
|
+
background-color: #fff;
|
|
348
|
+
border-radius: 0.5em;
|
|
349
|
+
padding: 1em;
|
|
350
|
+
border: 1px solid #ececec;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
.kiwi-startbnc-form button {
|
|
354
|
+
width: 100%;
|
|
355
|
+
line-height: 36px;
|
|
356
|
+
padding: 0;
|
|
357
|
+
font-size: 1.2em;
|
|
358
|
+
font-weight: normal;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
</style>
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="kiwi-personal">
|
|
3
|
+
<h1>{{ $t('personal_client') }}</h1>
|
|
4
|
+
|
|
5
|
+
<div v-if="server && server.server && !readyToShowOptions" />
|
|
6
|
+
<div v-else-if="server && server.server">
|
|
7
|
+
<div v-if="addedNetworkToExisting">
|
|
8
|
+
<p>
|
|
9
|
+
{{ $t('personal_added_to_existing') }}
|
|
10
|
+
</p>
|
|
11
|
+
</div>
|
|
12
|
+
<div v-else>
|
|
13
|
+
<p v-html="$t('personal_connect_to', { network: `<b>${server.server}</b>` })" />
|
|
14
|
+
<button
|
|
15
|
+
v-if="hasOtherTab"
|
|
16
|
+
type="button"
|
|
17
|
+
class="u-button u-button-primary"
|
|
18
|
+
@click="addNetworkToExistingTab"
|
|
19
|
+
>
|
|
20
|
+
{{ $t('personal_add_existing_tab') }}
|
|
21
|
+
</button>
|
|
22
|
+
<button
|
|
23
|
+
v-else
|
|
24
|
+
type="button"
|
|
25
|
+
class="u-button u-button-primary"
|
|
26
|
+
@click="addNetwork()"
|
|
27
|
+
>
|
|
28
|
+
Add network to Kiwi
|
|
29
|
+
</button>
|
|
30
|
+
|
|
31
|
+
<br>
|
|
32
|
+
<button
|
|
33
|
+
type="button"
|
|
34
|
+
class="u-button u-button-primary"
|
|
35
|
+
@click="addNetwork(true)"
|
|
36
|
+
>
|
|
37
|
+
{{ $t('personal_connect_temporary') }}
|
|
38
|
+
</button> <br>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<div v-else>
|
|
42
|
+
<p>{{ $t('personal_addjoin') }}</p>
|
|
43
|
+
<p>{{ $t('personal_return') }}</p>
|
|
44
|
+
|
|
45
|
+
<button type="button" class="u-button u-button-primary" @click="addEmptyNetwork">
|
|
46
|
+
{{ $t('personal_add') }}
|
|
47
|
+
</button> <br>
|
|
48
|
+
|
|
49
|
+
<a
|
|
50
|
+
v-if="networks.length>0"
|
|
51
|
+
class="u-link kiwi-personal-existing-networks"
|
|
52
|
+
@click.stop="toggleStateBrowser"
|
|
53
|
+
>
|
|
54
|
+
{{ $t('personal_saved') }}
|
|
55
|
+
</a>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script>
|
|
61
|
+
'kiwi public';
|
|
62
|
+
|
|
63
|
+
import * as TextFormatting from '@/helpers/TextFormatting';
|
|
64
|
+
import * as Misc from '@/helpers/Misc';
|
|
65
|
+
import BouncerProvider from '@/libs/BouncerProvider';
|
|
66
|
+
import IPC from '@/libs/IPC';
|
|
67
|
+
|
|
68
|
+
let firstRun = true;
|
|
69
|
+
|
|
70
|
+
export default {
|
|
71
|
+
data: function data() {
|
|
72
|
+
return {
|
|
73
|
+
hasOtherTab: false,
|
|
74
|
+
addedNetworkToExisting: false,
|
|
75
|
+
server: null,
|
|
76
|
+
readyToShowOptions: false,
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
computed: {
|
|
80
|
+
networks() {
|
|
81
|
+
return this.$state.networks;
|
|
82
|
+
},
|
|
83
|
+
hasFragment() {
|
|
84
|
+
return window.location.hash && window.location.hash.length > 1;
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
created: function created() {
|
|
88
|
+
this.$state.setting('allowRegisterProtocolHandler', true);
|
|
89
|
+
|
|
90
|
+
// Enable IPC listeners
|
|
91
|
+
// This is used to allow opening new servers in existing tab
|
|
92
|
+
IPC.init();
|
|
93
|
+
|
|
94
|
+
let server = null;
|
|
95
|
+
if (this.hasFragment) {
|
|
96
|
+
server = this.parseFragment();
|
|
97
|
+
this.server = server;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (server) {
|
|
101
|
+
this.findOtherTabs().then((hasOtherTab) => {
|
|
102
|
+
if (hasOtherTab) {
|
|
103
|
+
this.hasOtherTab = true;
|
|
104
|
+
// Don't start the main kiwi app here as it's already open elsewhere
|
|
105
|
+
} else {
|
|
106
|
+
this.listenForOtherTabs();
|
|
107
|
+
this.init();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
this.readyToShowOptions = true;
|
|
111
|
+
});
|
|
112
|
+
} else {
|
|
113
|
+
this.listenForOtherTabs();
|
|
114
|
+
this.init();
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
methods: {
|
|
118
|
+
listenForOtherTabs() {
|
|
119
|
+
IPC.on('message', (e) => { // respond to other tabs that are looking
|
|
120
|
+
let msg = e.data;
|
|
121
|
+
if (msg.type === 'ping' && this.networks.length > 0) {
|
|
122
|
+
IPC.send({ type: 'pong' });
|
|
123
|
+
} else if (msg.type === 'addNetwork') {
|
|
124
|
+
let network = this.networks.find((n) => n.name === msg.server);
|
|
125
|
+
if (!network) {
|
|
126
|
+
network = this.$state.addNetwork(msg.server, msg.nick || ('Guest' + Math.floor(Math.random() * 100)), msg);
|
|
127
|
+
}
|
|
128
|
+
network.showServerBuffer('settings');
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
},
|
|
132
|
+
addEmptyNetwork() {
|
|
133
|
+
let nick = 'Guest' + Math.floor(Math.random() * 100);
|
|
134
|
+
let network = this.$state.addNetwork(TextFormatting.t('new_network'), nick, {});
|
|
135
|
+
network.showServerBuffer('settings');
|
|
136
|
+
},
|
|
137
|
+
async findOtherTabs() { // ping other tabs to try find one with added networks
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
const handleIPCMessage = (e) => {
|
|
140
|
+
let msg = e.data;
|
|
141
|
+
if (msg.type === 'pong') {
|
|
142
|
+
clearTimeout(timer);
|
|
143
|
+
resolve(true);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
let timer = setTimeout((e) => {
|
|
148
|
+
IPC.removeListener('message', handleIPCMessage);
|
|
149
|
+
resolve(false);
|
|
150
|
+
}, 200);
|
|
151
|
+
|
|
152
|
+
IPC.on('message', handleIPCMessage);
|
|
153
|
+
IPC.send({ type: 'ping' });
|
|
154
|
+
});
|
|
155
|
+
},
|
|
156
|
+
addNetworkToExistingTab() {
|
|
157
|
+
let nick = 'Guest' + Math.floor(Math.random() * 100);
|
|
158
|
+
let con = this.server;
|
|
159
|
+
|
|
160
|
+
this.$state.addNetwork(TextFormatting.t('new_network'), nick, {});
|
|
161
|
+
|
|
162
|
+
IPC.send({
|
|
163
|
+
nick: nick,
|
|
164
|
+
server: con.server,
|
|
165
|
+
port: con.port,
|
|
166
|
+
tls: con.tls,
|
|
167
|
+
direct: con.direct,
|
|
168
|
+
password: con.password || '',
|
|
169
|
+
type: 'addNetwork',
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
window.location.hash = '';
|
|
173
|
+
|
|
174
|
+
this.addedNetworkToExisting = true;
|
|
175
|
+
},
|
|
176
|
+
addNetwork(temporary = false) {
|
|
177
|
+
if (!this.server) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
let con = this.server;
|
|
182
|
+
|
|
183
|
+
if (temporary) {
|
|
184
|
+
this.$state.persistence.storageKey = null;
|
|
185
|
+
this.$state.persistence.forgetState();
|
|
186
|
+
|
|
187
|
+
this.init();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
let network = this.$state.getNetworkFromAddress(con.server);
|
|
191
|
+
if (!network) {
|
|
192
|
+
network = this.$state.addNetwork(con.server, con.nick || ('Guest' + Math.floor(Math.random() * 100)), {
|
|
193
|
+
server: con.server,
|
|
194
|
+
port: con.port,
|
|
195
|
+
tls: con.tls,
|
|
196
|
+
direct: con.direct,
|
|
197
|
+
password: con.password || '',
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
window.location.hash = '';
|
|
202
|
+
network.showServerBuffer('settings');
|
|
203
|
+
|
|
204
|
+
this.$emit('start', {
|
|
205
|
+
fallbackComponent: this.constructor,
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
parseFragment() {
|
|
209
|
+
if (window.location.hash.substr(1)) {
|
|
210
|
+
let fragment = window.location.hash.substr(1);
|
|
211
|
+
|
|
212
|
+
// Check to see if we're dealing with an encoded irc: uri (browsers do this
|
|
213
|
+
// when clicking an IRC link)
|
|
214
|
+
let uriCheck = fragment.substr(0, 7).toLowerCase();
|
|
215
|
+
if (uriCheck === 'ircs%3a' || uriCheck.substr(0, 6) === 'irc%3a') {
|
|
216
|
+
fragment = decodeURIComponent(fragment);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
let connections = Misc.parseIrcUri(fragment);
|
|
220
|
+
let con = connections[0];
|
|
221
|
+
return con;
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
224
|
+
},
|
|
225
|
+
toggleStateBrowser() {
|
|
226
|
+
this.$state.$emit('statebrowser.show');
|
|
227
|
+
},
|
|
228
|
+
async init() {
|
|
229
|
+
if (!firstRun) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
firstRun = false;
|
|
234
|
+
|
|
235
|
+
// persist the buffers in the state by default
|
|
236
|
+
let persistSetting = this.$state.settings.startupOptions.remember_buffers;
|
|
237
|
+
if (typeof persistSetting === 'undefined') {
|
|
238
|
+
this.$state.persistence.includeBuffers = true;
|
|
239
|
+
} else {
|
|
240
|
+
this.$state.persistence.includeBuffers = !!persistSetting;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
this.$state.persistence.watchStateForChanges();
|
|
244
|
+
|
|
245
|
+
if (this.$state.settings.startupOptions.bouncer) {
|
|
246
|
+
let controllerNet = this.$state.networks.find((n) => n.is_bnc);
|
|
247
|
+
if (controllerNet) {
|
|
248
|
+
let bouncer = new BouncerProvider(this.$state);
|
|
249
|
+
bouncer.enable(
|
|
250
|
+
controllerNet.connection.server,
|
|
251
|
+
controllerNet.connection.port,
|
|
252
|
+
controllerNet.connection.tls,
|
|
253
|
+
controllerNet.connection.direct,
|
|
254
|
+
controllerNet.connection.path,
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// force restricted: false as users need access
|
|
259
|
+
// to network settings to add a network
|
|
260
|
+
this.$state.setSetting('settings.restricted', false);
|
|
261
|
+
|
|
262
|
+
if (this.$state.networks.length) {
|
|
263
|
+
// small screen devices cannot open the statebrowser unless a network is selected
|
|
264
|
+
// if any network exists in saved config make that active on startup
|
|
265
|
+
this.$state.setActiveBuffer(this.$state.networks[0].id, '*');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
this.$emit('start', {
|
|
269
|
+
fallbackComponent: this.constructor,
|
|
270
|
+
});
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
</script>
|
|
275
|
+
|
|
276
|
+
<style>
|
|
277
|
+
|
|
278
|
+
.kiwi-personal {
|
|
279
|
+
box-sizing: border-box;
|
|
280
|
+
height: 100%;
|
|
281
|
+
overflow-y: auto;
|
|
282
|
+
text-align: center;
|
|
283
|
+
padding-top: 1em;
|
|
284
|
+
font-size: 1.2em;
|
|
285
|
+
display: flex;
|
|
286
|
+
align-items: center;
|
|
287
|
+
justify-content: center;
|
|
288
|
+
flex-direction: column;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
.kiwi-personal h1 {
|
|
292
|
+
margin: 0 0 20px 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.kiwi-personal p {
|
|
296
|
+
margin: 0 0 10px 0;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.kiwi-personal button {
|
|
300
|
+
margin: 10px auto 0 auto;
|
|
301
|
+
padding: 0 40px;
|
|
302
|
+
font-size: 1em;
|
|
303
|
+
line-height: 40px;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/* Only show the toggle state browser link if on a small screen */
|
|
307
|
+
.kiwi-personal-existing-networks {
|
|
308
|
+
display: none;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
@media screen and (max-width: 500px) {
|
|
312
|
+
.kiwi-personal-existing-networks {
|
|
313
|
+
display: inherit;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
</style>
|