serverless-ircd 0.6.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.
Files changed (247) hide show
  1. package/.github/workflows/ci.yml +6 -1
  2. package/.gitmodules +3 -0
  3. package/CHANGELOG.md +214 -0
  4. package/README.md +110 -23
  5. package/apps/aws-stack/package.json +1 -1
  6. package/apps/cf-tcp-container/package.json +1 -1
  7. package/apps/cf-worker/package.json +1 -1
  8. package/apps/cf-worker/src/origin-allowlist.ts +99 -0
  9. package/apps/cf-worker/src/worker.ts +89 -9
  10. package/apps/cf-worker/tests/fixtures/web-dist/app/index.html +18 -0
  11. package/apps/cf-worker/tests/fixtures/web-dist/index.html +18 -0
  12. package/apps/cf-worker/tests/origin-allowlist.test.ts +101 -0
  13. package/apps/cf-worker/tests/smoke.test.ts +28 -2
  14. package/apps/cf-worker/tests/ws-origin.test.ts +89 -0
  15. package/apps/cf-worker/wrangler.test.toml +23 -0
  16. package/apps/cf-worker/wrangler.toml +54 -0
  17. package/apps/local-cli/package.json +1 -1
  18. package/apps/web/landing/index.html +217 -0
  19. package/apps/web/package.json +28 -0
  20. package/apps/web/scripts/build.mjs +125 -0
  21. package/apps/web/src/build-env.ts +43 -0
  22. package/apps/web/src/config-schema.ts +138 -0
  23. package/apps/web/static/config.json +28 -0
  24. package/apps/web/static/config.prod.json +28 -0
  25. package/apps/web/static/config.staging.json +28 -0
  26. package/apps/web/tests/build-env.test.ts +63 -0
  27. package/apps/web/tests/build-smoke.test.ts +103 -0
  28. package/apps/web/tests/config-schema.test.ts +432 -0
  29. package/apps/web/tests/workspace.test.ts +12 -0
  30. package/apps/web/tsconfig.json +10 -0
  31. package/apps/web/upstream/.browserslistrc +3 -0
  32. package/apps/web/upstream/.editorconfig +9 -0
  33. package/apps/web/upstream/.eslintignore +3 -0
  34. package/apps/web/upstream/.eslintrc.js +90 -0
  35. package/apps/web/upstream/.github/FUNDING.yml +12 -0
  36. package/apps/web/upstream/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
  37. package/apps/web/upstream/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  38. package/apps/web/upstream/.github/workflows/push.yml +26 -0
  39. package/apps/web/upstream/.github/workflows/release.yml +33 -0
  40. package/apps/web/upstream/.github/workflows/release_manual.yml +55 -0
  41. package/apps/web/upstream/.prettierrc.js +9 -0
  42. package/apps/web/upstream/.stylelintignore +5 -0
  43. package/apps/web/upstream/.stylelintrc.js +21 -0
  44. package/apps/web/upstream/LICENSE +201 -0
  45. package/apps/web/upstream/README.md +76 -0
  46. package/apps/web/upstream/babel.config.js +25 -0
  47. package/apps/web/upstream/crowdin.yml +3 -0
  48. package/apps/web/upstream/index.html +35 -0
  49. package/apps/web/upstream/jest.config.js +7 -0
  50. package/apps/web/upstream/jsdoc.json +22 -0
  51. package/apps/web/upstream/package.json +80 -0
  52. package/apps/web/upstream/scripts/pre-commit +43 -0
  53. package/apps/web/upstream/src/components/App.vue +516 -0
  54. package/apps/web/upstream/src/components/AppSettings.vue +587 -0
  55. package/apps/web/upstream/src/components/AutoComplete.vue +284 -0
  56. package/apps/web/upstream/src/components/Avatar.vue +105 -0
  57. package/apps/web/upstream/src/components/AwayStatusIndicator.vue +77 -0
  58. package/apps/web/upstream/src/components/BufferKey.vue +121 -0
  59. package/apps/web/upstream/src/components/BufferSettings.vue +97 -0
  60. package/apps/web/upstream/src/components/Captcha.vue +85 -0
  61. package/apps/web/upstream/src/components/ChannelBanlist.vue +96 -0
  62. package/apps/web/upstream/src/components/ChannelInfo.vue +159 -0
  63. package/apps/web/upstream/src/components/ChannelInvitelist.vue +276 -0
  64. package/apps/web/upstream/src/components/ChannelList.vue +345 -0
  65. package/apps/web/upstream/src/components/Container.vue +401 -0
  66. package/apps/web/upstream/src/components/ContainerHeader.vue +522 -0
  67. package/apps/web/upstream/src/components/ControlInput.vue +1016 -0
  68. package/apps/web/upstream/src/components/LoadingAnimation.vue +104 -0
  69. package/apps/web/upstream/src/components/MediaViewer.vue +199 -0
  70. package/apps/web/upstream/src/components/MessageInfo.vue +192 -0
  71. package/apps/web/upstream/src/components/MessageList.vue +1028 -0
  72. package/apps/web/upstream/src/components/MessageListAvatar.vue +20 -0
  73. package/apps/web/upstream/src/components/MessageListMessageCompact.vue +361 -0
  74. package/apps/web/upstream/src/components/MessageListMessageInline.vue +257 -0
  75. package/apps/web/upstream/src/components/MessageListMessageModern.vue +430 -0
  76. package/apps/web/upstream/src/components/NetworkSettings.vue +528 -0
  77. package/apps/web/upstream/src/components/Nicklist.vue +309 -0
  78. package/apps/web/upstream/src/components/NicklistUser.vue +181 -0
  79. package/apps/web/upstream/src/components/NotConnected.vue +271 -0
  80. package/apps/web/upstream/src/components/SelfUser.vue +283 -0
  81. package/apps/web/upstream/src/components/ServerSelector.vue +162 -0
  82. package/apps/web/upstream/src/components/ServerView.vue +126 -0
  83. package/apps/web/upstream/src/components/SettingsAdvanced.vue +232 -0
  84. package/apps/web/upstream/src/components/SettingsAliases.vue +121 -0
  85. package/apps/web/upstream/src/components/Sidebar.vue +429 -0
  86. package/apps/web/upstream/src/components/SidebarAboutBuffer.vue +288 -0
  87. package/apps/web/upstream/src/components/SidebarState.vue +145 -0
  88. package/apps/web/upstream/src/components/StartupError.vue +35 -0
  89. package/apps/web/upstream/src/components/StateBrowser.vue +420 -0
  90. package/apps/web/upstream/src/components/StateBrowserBuffer.vue +124 -0
  91. package/apps/web/upstream/src/components/StateBrowserNetwork.vue +823 -0
  92. package/apps/web/upstream/src/components/StateBrowserUsermenu.vue +162 -0
  93. package/apps/web/upstream/src/components/TypingStatusIndicator.vue +34 -0
  94. package/apps/web/upstream/src/components/TypingUsersList.vue +56 -0
  95. package/apps/web/upstream/src/components/UrlEmbed.vue +149 -0
  96. package/apps/web/upstream/src/components/UserBox.vue +728 -0
  97. package/apps/web/upstream/src/components/inputtools/Emoji.vue +67 -0
  98. package/apps/web/upstream/src/components/inputtools/TextStyle.vue +142 -0
  99. package/apps/web/upstream/src/components/startups/CommonLayout.vue +208 -0
  100. package/apps/web/upstream/src/components/startups/CustomServer.vue +495 -0
  101. package/apps/web/upstream/src/components/startups/KiwiBnc.vue +361 -0
  102. package/apps/web/upstream/src/components/startups/Personal.vue +317 -0
  103. package/apps/web/upstream/src/components/startups/Welcome.vue +544 -0
  104. package/apps/web/upstream/src/components/startups/ZncLogin.vue +229 -0
  105. package/apps/web/upstream/src/components/utils/InputConfirm.vue +68 -0
  106. package/apps/web/upstream/src/components/utils/InputPrompt.vue +118 -0
  107. package/apps/web/upstream/src/components/utils/InputText.vue +172 -0
  108. package/apps/web/upstream/src/components/utils/IrcInput.vue +579 -0
  109. package/apps/web/upstream/src/components/utils/PluginWrapper.vue +26 -0
  110. package/apps/web/upstream/src/components/utils/TabbedView.vue +149 -0
  111. package/apps/web/upstream/src/components/utils/TransitionExpand.vue +97 -0
  112. package/apps/web/upstream/src/helpers/Colours.js +128 -0
  113. package/apps/web/upstream/src/helpers/IrcdDiffs.js +26 -0
  114. package/apps/web/upstream/src/helpers/Md5.js +193 -0
  115. package/apps/web/upstream/src/helpers/Misc.js +401 -0
  116. package/apps/web/upstream/src/helpers/TextFormatting.js +237 -0
  117. package/apps/web/upstream/src/libs/AliasRewriter.js +157 -0
  118. package/apps/web/upstream/src/libs/AudioManager.js +60 -0
  119. package/apps/web/upstream/src/libs/BouncerMiddleware.js +247 -0
  120. package/apps/web/upstream/src/libs/BouncerProvider.js +551 -0
  121. package/apps/web/upstream/src/libs/ChathistoryMiddleware.js +153 -0
  122. package/apps/web/upstream/src/libs/ConfigLoader.js +94 -0
  123. package/apps/web/upstream/src/libs/EmojiProvider.js +46 -0
  124. package/apps/web/upstream/src/libs/GlobalApi.js +346 -0
  125. package/apps/web/upstream/src/libs/IPC.js +51 -0
  126. package/apps/web/upstream/src/libs/InputHandler.js +921 -0
  127. package/apps/web/upstream/src/libs/IrcClient.js +1506 -0
  128. package/apps/web/upstream/src/libs/Logger.js +71 -0
  129. package/apps/web/upstream/src/libs/Message.js +169 -0
  130. package/apps/web/upstream/src/libs/MessageFormatter.js +364 -0
  131. package/apps/web/upstream/src/libs/MessageParser.js +249 -0
  132. package/apps/web/upstream/src/libs/Notifications.js +78 -0
  133. package/apps/web/upstream/src/libs/ServerConnection.js +270 -0
  134. package/apps/web/upstream/src/libs/ServerSession.js +102 -0
  135. package/apps/web/upstream/src/libs/SoundBleep.js +20 -0
  136. package/apps/web/upstream/src/libs/StatePersistence.js +90 -0
  137. package/apps/web/upstream/src/libs/ThemeManager.js +128 -0
  138. package/apps/web/upstream/src/libs/TypingMiddleware.js +105 -0
  139. package/apps/web/upstream/src/libs/WindowTitle.js +63 -0
  140. package/apps/web/upstream/src/libs/batchedAdd.js +74 -0
  141. package/apps/web/upstream/src/libs/bufferTools.js +177 -0
  142. package/apps/web/upstream/src/libs/polyfill/Element.closest.js +18 -0
  143. package/apps/web/upstream/src/libs/renderers/Html.js +113 -0
  144. package/apps/web/upstream/src/libs/settingTools.js +31 -0
  145. package/apps/web/upstream/src/libs/state/BufferState.js +703 -0
  146. package/apps/web/upstream/src/libs/state/NetworkState.js +158 -0
  147. package/apps/web/upstream/src/libs/state/UserState.js +89 -0
  148. package/apps/web/upstream/src/libs/state/common.js +26 -0
  149. package/apps/web/upstream/src/libs/state.js +961 -0
  150. package/apps/web/upstream/src/libs/storage/Local.js +51 -0
  151. package/apps/web/upstream/src/main.js +566 -0
  152. package/apps/web/upstream/src/res/autocompleteCommands.js +31 -0
  153. package/apps/web/upstream/src/res/configTemplates.js +373 -0
  154. package/apps/web/upstream/src/res/globalStyle.css +277 -0
  155. package/apps/web/upstream/src/res/kiwiLoadingLogo.png +0 -0
  156. package/apps/web/upstream/src/res/locales/app.af-ZA.po +1145 -0
  157. package/apps/web/upstream/src/res/locales/app.ar-SA.po +1145 -0
  158. package/apps/web/upstream/src/res/locales/app.bg-BG.po +1145 -0
  159. package/apps/web/upstream/src/res/locales/app.bs-BA.po +1145 -0
  160. package/apps/web/upstream/src/res/locales/app.ca-ES.po +1145 -0
  161. package/apps/web/upstream/src/res/locales/app.cs-CZ.po +1145 -0
  162. package/apps/web/upstream/src/res/locales/app.da-DK.po +1145 -0
  163. package/apps/web/upstream/src/res/locales/app.de-DE.po +1145 -0
  164. package/apps/web/upstream/src/res/locales/app.dev.po +1246 -0
  165. package/apps/web/upstream/src/res/locales/app.el-GR.po +1145 -0
  166. package/apps/web/upstream/src/res/locales/app.en-US.po +1145 -0
  167. package/apps/web/upstream/src/res/locales/app.es-419.po +1145 -0
  168. package/apps/web/upstream/src/res/locales/app.es-AR.po +1145 -0
  169. package/apps/web/upstream/src/res/locales/app.es-EM.po +536 -0
  170. package/apps/web/upstream/src/res/locales/app.es-ES.po +1145 -0
  171. package/apps/web/upstream/src/res/locales/app.es-US.po +1145 -0
  172. package/apps/web/upstream/src/res/locales/app.eu-ES.po +1145 -0
  173. package/apps/web/upstream/src/res/locales/app.fi-FI.po +1145 -0
  174. package/apps/web/upstream/src/res/locales/app.fr-FR.po +1145 -0
  175. package/apps/web/upstream/src/res/locales/app.gl-ES.po +1145 -0
  176. package/apps/web/upstream/src/res/locales/app.he-IL.po +1145 -0
  177. package/apps/web/upstream/src/res/locales/app.hi-IN.po +1145 -0
  178. package/apps/web/upstream/src/res/locales/app.hu-HU.po +1145 -0
  179. package/apps/web/upstream/src/res/locales/app.id-ID.po +1145 -0
  180. package/apps/web/upstream/src/res/locales/app.it-IT.po +1145 -0
  181. package/apps/web/upstream/src/res/locales/app.ja-JP.po +1145 -0
  182. package/apps/web/upstream/src/res/locales/app.ko-KR.po +1145 -0
  183. package/apps/web/upstream/src/res/locales/app.nl-NL.po +1145 -0
  184. package/apps/web/upstream/src/res/locales/app.no-NO.po +1145 -0
  185. package/apps/web/upstream/src/res/locales/app.pl-PL.po +1145 -0
  186. package/apps/web/upstream/src/res/locales/app.pt-BR.po +1145 -0
  187. package/apps/web/upstream/src/res/locales/app.pt-PT.po +1145 -0
  188. package/apps/web/upstream/src/res/locales/app.ro-RO.po +1145 -0
  189. package/apps/web/upstream/src/res/locales/app.ru-RU.po +1145 -0
  190. package/apps/web/upstream/src/res/locales/app.sl-SI.po +1145 -0
  191. package/apps/web/upstream/src/res/locales/app.sq-AL.po +1145 -0
  192. package/apps/web/upstream/src/res/locales/app.sr-SP.po +1145 -0
  193. package/apps/web/upstream/src/res/locales/app.sv-SE.po +1145 -0
  194. package/apps/web/upstream/src/res/locales/app.tr-TR.po +1145 -0
  195. package/apps/web/upstream/src/res/locales/app.uk-UA.po +1145 -0
  196. package/apps/web/upstream/src/res/locales/app.vi-VN.po +1145 -0
  197. package/apps/web/upstream/src/res/locales/app.zh-CN.po +1145 -0
  198. package/apps/web/upstream/src/res/locales/app.zh-TW.po +1145 -0
  199. package/apps/web/upstream/src/res/localesList.json +27 -0
  200. package/apps/web/upstream/src/res/logo.png +0 -0
  201. package/apps/web/upstream/src/thirdparty/about.html +43 -0
  202. package/apps/web/upstream/src/thirdparty/index.js +5 -0
  203. package/apps/web/upstream/src/thirdparty/kiwiirccom.vue +185 -0
  204. package/apps/web/upstream/static/config.json +28 -0
  205. package/apps/web/upstream/static/emoticons/smile.png +0 -0
  206. package/apps/web/upstream/static/favicon.png +0 -0
  207. package/apps/web/upstream/static/highlight.mp3 +0 -0
  208. package/apps/web/upstream/static/highlight.ogg +0 -0
  209. package/apps/web/upstream/static/locales/.gitignore +2 -0
  210. package/apps/web/upstream/static/plugins/customise.html.example +10 -0
  211. package/apps/web/upstream/static/themes/coffee/theme.css +145 -0
  212. package/apps/web/upstream/static/themes/common/base.css +1064 -0
  213. package/apps/web/upstream/static/themes/dark/theme.css +196 -0
  214. package/apps/web/upstream/static/themes/default/theme.css +92 -0
  215. package/apps/web/upstream/static/themes/elite/theme.css +248 -0
  216. package/apps/web/upstream/static/themes/grayfox/theme.css +143 -0
  217. package/apps/web/upstream/static/themes/nightswatch/theme.css +367 -0
  218. package/apps/web/upstream/static/themes/osprey/theme.css +115 -0
  219. package/apps/web/upstream/static/themes/radioactive/theme.css +1211 -0
  220. package/apps/web/upstream/static/themes/sky/theme.css +107 -0
  221. package/apps/web/upstream/tests/unit/BatchAdd.spec.js +174 -0
  222. package/apps/web/upstream/tests/unit/MessageParser.spec.js +125 -0
  223. package/apps/web/upstream/tests/unit/Misc.spec.js +24 -0
  224. package/apps/web/upstream/tests/unit/NetworkState.spec.js +58 -0
  225. package/apps/web/upstream/tests/unit/StartupError.spec.js +20 -0
  226. package/apps/web/upstream/vue.config.js +150 -0
  227. package/apps/web/upstream/yarn.lock +9767 -0
  228. package/apps/web/vitest.config.ts +13 -0
  229. package/biome.json +1 -0
  230. package/docs/Home.md +1 -0
  231. package/docs/WebClientGuide.md +535 -0
  232. package/package.json +2 -2
  233. package/packages/aws-adapter/package.json +1 -1
  234. package/packages/cf-adapter/package.json +1 -1
  235. package/packages/cf-adapter/tests/cf-harness.ts +12 -1
  236. package/packages/in-memory-runtime/package.json +1 -1
  237. package/packages/irc-core/package.json +1 -1
  238. package/packages/irc-core/reports/mutation/mutation.html +342 -0
  239. package/packages/irc-core/tests/batch.test.ts +15 -0
  240. package/packages/irc-core/tests/numerics.test.ts +13 -0
  241. package/packages/irc-core/tests/parser.test.ts +109 -0
  242. package/packages/irc-server/package.json +1 -1
  243. package/packages/irc-test-support/package.json +1 -1
  244. package/packages/irc-test-support/src/scenarios.ts +24 -2
  245. package/tools/ci-hardening/package.json +1 -1
  246. package/tools/load-test/package.json +1 -1
  247. package/tools/tcp-ws-forwarder/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ {
2
+ "plugins": ["plugins/markdown"],
3
+ "recurseDepth": 10,
4
+ "source": {
5
+ "include": "src/",
6
+ "includePattern": ".+\\.js(doc|x)?$",
7
+ "excludePattern": "(^|\\/|\\\\)_"
8
+ },
9
+ "sourceType": "module",
10
+ "tags": {
11
+ "allowUnknownTags": true,
12
+ "dictionaries": ["jsdoc","closure"]
13
+ },
14
+ "templates": {
15
+ "cleverLinks": false,
16
+ "monospaceLinks": false
17
+ },
18
+ "opts": {
19
+ "destination": "./srcdocs/",
20
+ "recurse": true
21
+ }
22
+ }
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "kiwiirc",
3
+ "version": "1.7.1",
4
+ "description": "Web based IRC client",
5
+ "author": "Darren <darren@darrenwhitlen.com>",
6
+ "scripts": {
7
+ "build": "vue-cli-service build --no-module",
8
+ "test:unit": "vue-cli-service test:unit",
9
+ "lint": "npm-run-all lint:*",
10
+ "lint:eslint": "vue-cli-service lint --no-fix",
11
+ "lint:stylelint": "stylelint \"src/**/*.{vue,htm,html,css,sss,less,scss}\"",
12
+ "dev": "vue-cli-service serve",
13
+ "test": "vue-cli-service test:unit",
14
+ "gendocs": "rm -rf srcdocs/ && jsdoc -c jsdoc.json"
15
+ },
16
+ "dependencies": {
17
+ "@babel/runtime-corejs3": "^7.22.6",
18
+ "@panter/vue-i18next": "^0.15.2",
19
+ "buffer": "^6.0.3",
20
+ "compare-versions": "^5.0.3",
21
+ "css-vars-ponyfill": "^2.4.8",
22
+ "event-emitter": "^0.3.5",
23
+ "font-awesome": "^4.7.0",
24
+ "htmlparser2": "^8.0.2",
25
+ "i18next": "^22.5.1",
26
+ "i18next-http-backend": "^v2.2.1",
27
+ "intersection-observer": "^0.12.2",
28
+ "ip-regex": "^4.3.0",
29
+ "irc-framework": "^4.13.1",
30
+ "json5": "^2.2.3",
31
+ "murmurhash3js": "^3.0.1",
32
+ "sockjs-client": "^1.6.1",
33
+ "stream-browserify": "^3.0.0",
34
+ "strftime": "^0.10.2",
35
+ "tinycon": "^0.6.8",
36
+ "vue": "^2.7.14",
37
+ "vue-virtual-scroller": "^1.1.2",
38
+ "whatwg-fetch": "^3.6.17",
39
+ "xhr": "^2.6.0"
40
+ },
41
+ "devDependencies": {
42
+ "@babel/core": "^7.22.9",
43
+ "@babel/eslint-parser": "^7.22.9",
44
+ "@babel/plugin-transform-runtime": "^7.22.9",
45
+ "@vue/cli-plugin-babel": "~5.0.8",
46
+ "@vue/cli-plugin-eslint": "~5.0.8",
47
+ "@vue/cli-plugin-unit-jest": "~5.0.8",
48
+ "@vue/cli-service": "~5.0.8",
49
+ "@vue/eslint-config-airbnb": "^6.0.0",
50
+ "@vue/test-utils": "1.3.6",
51
+ "@vue/vue2-jest": "^27.0.0",
52
+ "babel-jest": "^27.5.1",
53
+ "copy-webpack-plugin": "^11.0.0",
54
+ "eslint": "^7.32.0",
55
+ "eslint-config-standard": "^14.1.1",
56
+ "eslint-plugin-import": "^2.27.5",
57
+ "eslint-plugin-node": "^11.1.0",
58
+ "eslint-plugin-promise": "^4.3.1",
59
+ "eslint-plugin-rulesdir": "^0.2.2",
60
+ "eslint-plugin-standard": "^4.1.0",
61
+ "eslint-plugin-vue": "^8.7.1",
62
+ "eslint-plugin-vuejs-accessibility": "^1.2.0",
63
+ "html-loader": "^4.2.0",
64
+ "i18next-conv": "^12.1.1",
65
+ "jest": "^27.5.1",
66
+ "jsdoc": "^4.0.2",
67
+ "less": "^4.1.3",
68
+ "less-loader": "^11.1.3",
69
+ "npm-run-all": "^4.1.5",
70
+ "postcss-html": "^1.5.0",
71
+ "postcss-import": "^12.0.1",
72
+ "postcss-url": "^9.0.0",
73
+ "stylelint": "^14.16.1",
74
+ "stylelint-config-recommended-vue": "^1.5.0",
75
+ "stylelint-config-standard": "^29.0.0",
76
+ "stylelint-webpack-plugin": "3.3.0",
77
+ "vue-template-compiler": "^2.7.14",
78
+ "webpack": "^5.88.2"
79
+ }
80
+ }
@@ -0,0 +1,43 @@
1
+ #!/bin/bash
2
+
3
+ ## Source https://gist.github.com/rashtay/328da46a99a9d7c746636df1cf769675
4
+
5
+ STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".\(vue\|jsx\?\)$")
6
+ ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint"
7
+
8
+ if [[ "$STAGED_FILES" = "" ]]; then
9
+ exit 0
10
+ fi
11
+
12
+ PASS=true
13
+
14
+ printf "\nValidating Javascript:\n"
15
+
16
+ # Check for eslint
17
+ if [[ ! -x "$ESLINT" ]]; then
18
+ printf "\t\033[41mPlease install ESlint\033[0m (npm i --save-dev eslint)"
19
+ exit 1
20
+ fi
21
+
22
+ for FILE in $STAGED_FILES
23
+ do
24
+ "$ESLINT" "$FILE"
25
+
26
+ if [[ "$?" == 0 ]]; then
27
+ printf "\t\033[32mESLint Passed: $FILE\033[0m\n"
28
+ else
29
+ printf "\t\033[41mESLint Failed: $FILE\033[0m\n"
30
+ PASS=false
31
+ fi
32
+ done
33
+
34
+ printf "\nJavascript validation completed!\n"
35
+
36
+ if ! $PASS; then
37
+ printf "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass ESLint but do not. Please fix the ESLint errors and try again.\n"
38
+ exit 1
39
+ else
40
+ printf "\033[42mCOMMIT SUCCEEDED\033[0m\n"
41
+ fi
42
+
43
+ exit $?
@@ -0,0 +1,516 @@
1
+ <template>
2
+ <div
3
+ :class="{
4
+ 'kiwi-wrap--statebrowser-drawopen': stateBrowserDrawOpen,
5
+ 'kiwi-wrap--monospace': $state.setting('useMonospace'),
6
+ 'kiwi-wrap--touch': $state.ui.is_touch,
7
+ }"
8
+ :data-activebuffer="buffer ? buffer.name.toLowerCase() : ''"
9
+ class="kiwi-wrap kiwi-theme-bg"
10
+ @click="emitDocumentClick"
11
+ @paste.capture="emitBufferPaste"
12
+ >
13
+ <link :href="themeUrl" rel="stylesheet" type="text/css">
14
+
15
+ <template v-if="!hasStarted || (!fallbackComponent && networks.length === 0)">
16
+ <component :is="startupComponent" @start="startUp" />
17
+ </template>
18
+ <template v-else>
19
+ <state-browser :networks="networks" :sidebar-state="sidebarState" />
20
+ <div
21
+ :class="{
22
+ 'kiwi-workspace--disconnected': network && network.state !== 'connected'
23
+ }"
24
+ class="kiwi-workspace"
25
+ @click="stateBrowserDrawOpen = false"
26
+ >
27
+ <div class="kiwi-workspace-background" />
28
+
29
+ <template v-if="!activeComponent && network">
30
+ <container
31
+ :network="network"
32
+ :buffer="buffer"
33
+ :sidebar-state="sidebarState"
34
+ >
35
+ <template v-if="mediaviewerOpen" #before>
36
+ <media-viewer
37
+ :url="mediaviewerUrl"
38
+ :component="mediaviewerComponent"
39
+ :component-props="mediaviewerComponentProps"
40
+ :is-iframe="mediaviewerIframe"
41
+ class="kiwi-main-mediaviewer"
42
+ @close="$state.$emit('mediaviewer.hide', { source: 'user' });"
43
+ />
44
+ </template>
45
+ </container>
46
+ <control-input
47
+ v-if="buffer.show_input"
48
+ :network="network"
49
+ :buffer="buffer"
50
+ :sidebar-state="sidebarState"
51
+ />
52
+ </template>
53
+ <component
54
+ :is="fallbackComponent"
55
+ v-else-if="!activeComponent"
56
+ v-bind="fallbackComponentProps"
57
+ />
58
+ <component :is="activeComponent" v-else v-bind="activeComponentProps" />
59
+ </div>
60
+ </template>
61
+ </div>
62
+ </template>
63
+
64
+ <script>
65
+ 'kiwi public';
66
+
67
+ import cssVarsPonyfill from 'css-vars-ponyfill';
68
+ import '@/res/globalStyle.css';
69
+ import Tinycon from 'tinycon';
70
+
71
+ import startupWelcome from '@/components/startups/Welcome';
72
+ import startupZncLogin from '@/components/startups/ZncLogin';
73
+ import startupCustomServer from '@/components/startups/CustomServer';
74
+ import startupKiwiBnc from '@/components/startups/KiwiBnc';
75
+ import startupPersonal from '@/components/startups/Personal';
76
+ import StateBrowser from '@/components/StateBrowser';
77
+ import AppSettings from '@/components/AppSettings';
78
+ import Container from '@/components/Container';
79
+ import ControlInput from '@/components/ControlInput';
80
+ import MediaViewer from '@/components/MediaViewer';
81
+ import { State as SidebarState } from '@/components/Sidebar';
82
+ import * as Notifications from '@/libs/Notifications';
83
+ import * as bufferTools from '@/libs/bufferTools';
84
+ import ThemeManager from '@/libs/ThemeManager';
85
+ import Logger from '@/libs/Logger';
86
+
87
+ let log = Logger.namespace('App.vue');
88
+
89
+ export default {
90
+ components: {
91
+ StateBrowser,
92
+ Container,
93
+ ControlInput,
94
+ MediaViewer,
95
+ },
96
+ data() {
97
+ return {
98
+ startupComponent: null,
99
+ hasStarted: false,
100
+ // When on mobile screens, the statebrowser turns into a drawer
101
+ stateBrowserDrawOpen: false,
102
+ // If set, will become the main view instead of a buffer/nicklist container
103
+ activeComponent: null,
104
+ activeComponentProps: {},
105
+ // If set, will become the main view when no networks are available to be shown
106
+ // and there is no active component set
107
+ fallbackComponent: null,
108
+ fallbackComponentProps: {},
109
+ mediaviewerOpen: false,
110
+ mediaviewerUrl: '',
111
+ mediaviewerComponent: null,
112
+ mediaviewerComponentProps: {},
113
+ mediaviewerIframe: false,
114
+ themeUrl: '',
115
+ sidebarState: new SidebarState(),
116
+ };
117
+ },
118
+ computed: {
119
+ networks() {
120
+ return this.$state.networks;
121
+ },
122
+ network() {
123
+ return this.$state.getActiveNetwork();
124
+ },
125
+ buffer() {
126
+ return this.$state.getActiveBuffer();
127
+ },
128
+ },
129
+ created() {
130
+ this.listenForActiveComponents();
131
+ this.watchForThemes();
132
+ this.initStateBrowser();
133
+ this.initMediaviewer();
134
+ this.configureFavicon();
135
+
136
+ this.listen(document, 'keydown', (event) => this.onKeyDown(event));
137
+ this.listen(window, 'focus', (event) => this.onFocus(event));
138
+ this.listen(window, 'blur', (event) => this.onBlur(event));
139
+ this.listen(window, 'touchstart', (event) => this.onTouchStart(event));
140
+ },
141
+ mounted() {
142
+ // Decide which startup screen to use depending on the config
143
+ let startupScreens = {
144
+ welcome: startupWelcome,
145
+ customServer: startupCustomServer,
146
+ kiwiBnc: startupKiwiBnc,
147
+ znc: startupZncLogin,
148
+ personal: startupPersonal,
149
+ };
150
+ let extraStartupScreens = this.$state.getStartups();
151
+
152
+ let startupName = this.$state.settings.startupScreen || 'personal';
153
+ let startup = extraStartupScreens[startupName] || startupScreens[startupName];
154
+
155
+ if (!startup) {
156
+ Logger.error(`Startup screen "${startupName}" does not exist`);
157
+ } else {
158
+ this.startupComponent = startup;
159
+ }
160
+ this.trackWindowDimensions();
161
+ },
162
+ methods: {
163
+ // Triggered by a startup screen event
164
+ startUp(opts) {
165
+ log('startUp()');
166
+ if (opts && opts.fallbackComponent) {
167
+ this.fallbackComponent = opts.fallbackComponent;
168
+ }
169
+ if (opts && opts.fallbackComponentProps) {
170
+ this.fallbackComponentProps = opts.fallbackComponentProps;
171
+ }
172
+
173
+ // Make sure a startup screen can't trigger these more than once
174
+ if (!this.hasStarted) {
175
+ this.warnOnPageClose();
176
+
177
+ // Wait for a click or sending a message before asking for notification permission.
178
+ // Not doing this on an input event will get it blocked by some browsers.
179
+ let requestNotificationPermission = () => {
180
+ this.$state.$off('document.clicked', requestNotificationPermission);
181
+ this.$state.$off('input.raw', requestNotificationPermission);
182
+
183
+ Notifications.requestPermission(this.$state);
184
+ Notifications.listenForNewMessages(this.$state);
185
+ };
186
+
187
+ this.$state.$once('document.clicked', requestNotificationPermission);
188
+ this.$state.$once('input.raw', requestNotificationPermission);
189
+ }
190
+
191
+ this.hasStarted = true;
192
+ },
193
+ listenForActiveComponents() {
194
+ this.listen(this.$state, 'active.component', (component, props) => {
195
+ this.activeComponent = null;
196
+ if (component) {
197
+ this.activeComponentProps = props;
198
+ this.activeComponent = component;
199
+ }
200
+ });
201
+ this.listen(this.$state, 'active.component.toggle', (component, props) => {
202
+ if (component === this.activeComponent) {
203
+ this.activeComponent = null;
204
+ } else if (component) {
205
+ this.activeComponentProps = props;
206
+ this.activeComponent = component;
207
+ }
208
+ });
209
+ },
210
+ watchForThemes() {
211
+ let themes = ThemeManager.instance();
212
+ this.themeUrl = ThemeManager.themeUrl(themes.currentTheme());
213
+ this.$nextTick(() => cssVarsPonyfill());
214
+ this.listen(this.$state, 'theme.change', () => {
215
+ this.themeUrl = ThemeManager.themeUrl(themes.currentTheme());
216
+ this.$nextTick(() => cssVarsPonyfill());
217
+ });
218
+ },
219
+ initStateBrowser() {
220
+ this.listen(this.$state, 'statebrowser.toggle', () => {
221
+ this.stateBrowserDrawOpen = !this.stateBrowserDrawOpen;
222
+ });
223
+ this.listen(this.$state, 'statebrowser.show', () => {
224
+ this.stateBrowserDrawOpen = true;
225
+ });
226
+ this.listen(this.$state, 'statebrowser.hide', () => {
227
+ this.stateBrowserDrawOpen = false;
228
+ });
229
+ },
230
+ initMediaviewer() {
231
+ this.listen(this.$state, 'mediaviewer.show', (url) => {
232
+ let opts = {};
233
+
234
+ // The passed url may be a string or an options object
235
+ if (typeof url === 'string') {
236
+ opts = { url: url };
237
+ } else {
238
+ opts = url;
239
+ }
240
+
241
+ this.mediaviewerUrl = opts.url;
242
+ this.mediaviewerComponent = opts.component;
243
+ this.mediaviewerComponentProps = opts.componentProps;
244
+ this.mediaviewerIframe = opts.iframe;
245
+ this.mediaviewerOpen = true;
246
+ });
247
+
248
+ this.listen(this.$state, 'mediaviewer.hide', () => {
249
+ this.mediaviewerOpen = false;
250
+ });
251
+ },
252
+ configureFavicon() {
253
+ // favicon bubble
254
+ Tinycon.setOptions({
255
+ width: 7,
256
+ height: 9,
257
+ color: '#ffffff',
258
+ background: '#b32d2d',
259
+ fallback: true,
260
+ });
261
+
262
+ this.$state.$watch('ui.favicon_counter', (newVal) => {
263
+ if (newVal) {
264
+ Tinycon.setBubble(newVal);
265
+ } else {
266
+ Tinycon.reset();
267
+ }
268
+ });
269
+
270
+ this.listen(this.$state, 'message.new', (event) => {
271
+ let message = event.message;
272
+ if (!message.isHighlight || message.ignore || this.$state.ui.app_has_focus) {
273
+ return;
274
+ }
275
+
276
+ this.$state.ui.favicon_counter++;
277
+ });
278
+ },
279
+ trackWindowDimensions() {
280
+ // Track the window dimensions into the reactive ui state
281
+ let trackWindowDims = () => {
282
+ this.$state.ui.app_width = this.$el.clientWidth;
283
+ this.$state.ui.app_height = this.$el.clientHeight;
284
+ this.$state.ui.is_narrow = this.$el.clientWidth <= 769;
285
+ };
286
+ this.listen(window, 'resize', trackWindowDims);
287
+ trackWindowDims();
288
+ },
289
+ warnOnPageClose() {
290
+ window.onbeforeunload = () => {
291
+ if (this.$state.setting('warnOnExit')) {
292
+ return this.$t('window_unload');
293
+ }
294
+ return undefined;
295
+ };
296
+ window.onunload = () => {
297
+ this.$state.networks.forEach((net) => {
298
+ if (net.connection.direct && net.state === 'connected') {
299
+ net.ircClient.raw('QUIT', this.$state.setting('quitMessage') || 'Client Closed Connection');
300
+ }
301
+ });
302
+ };
303
+ },
304
+ emitBufferPaste(event) {
305
+ // bail if no buffer is active, or the buffer is hidden by another component
306
+ if (!this.$state.getActiveBuffer() || this.activeComponent !== null) {
307
+ return;
308
+ }
309
+
310
+ // bail if the target is an input-like element
311
+ if (
312
+ event.target instanceof HTMLInputElement ||
313
+ event.target instanceof HTMLSelectElement ||
314
+ event.target instanceof HTMLTextAreaElement
315
+ ) {
316
+ return;
317
+ }
318
+
319
+ this.$state.$emit('buffer.paste', event);
320
+ },
321
+ emitDocumentClick(event) {
322
+ this.$state.$emit('document.clicked', event);
323
+ },
324
+ onTouchStart(event) {
325
+ // Parts of the UI adjust themselves if we're known to be using a touchscreen
326
+ this.$state.ui.is_touch = true;
327
+ },
328
+ onBlur(event) {
329
+ this.$state.ui.app_has_focus = false;
330
+ },
331
+ onFocus(event) {
332
+ this.$state.ui.app_has_focus = true;
333
+ let buffer = this.$state.getActiveBuffer();
334
+ if (buffer) {
335
+ buffer.markAsRead(true);
336
+ }
337
+
338
+ this.$state.ui.favicon_counter = 0;
339
+ },
340
+ onKeyDown(event) {
341
+ this.$state.$emit('document.keydown', event);
342
+
343
+ let meta = false;
344
+
345
+ if (navigator.appVersion.indexOf('Mac') !== -1) {
346
+ meta = event.metaKey;
347
+ } else {
348
+ // none english languages use ctrl + alt to access extended chars
349
+ // make sure we do not interfere with that by only acting on ctrl
350
+ meta = event.ctrlKey && !event.altKey;
351
+ }
352
+
353
+ if (meta && event.keyCode === 221) {
354
+ // meta + ]
355
+ let buffer = bufferTools.getNextBuffer();
356
+ if (buffer) {
357
+ this.$state.setActiveBuffer(buffer.networkid, buffer.name);
358
+ }
359
+ event.preventDefault();
360
+ } else if (meta && event.keyCode === 219) {
361
+ // meta + [
362
+ let buffer = bufferTools.getPreviousBuffer();
363
+ if (buffer) {
364
+ this.$state.setActiveBuffer(buffer.networkid, buffer.name);
365
+ }
366
+ event.preventDefault();
367
+ } else if (meta && event.keyCode === 79) {
368
+ // meta + o
369
+ this.$state.$emit('active.component.toggle', AppSettings);
370
+ event.preventDefault();
371
+ } else if (meta && event.keyCode === 83) {
372
+ // meta + s
373
+ let network = this.$state.getActiveNetwork();
374
+ if (network) {
375
+ network.showServerBuffer('settings');
376
+ }
377
+ event.preventDefault();
378
+ }
379
+ },
380
+ },
381
+ };
382
+ </script>
383
+
384
+ <style lang="less">
385
+ @import "~font-awesome/less/variables.less";
386
+ /* stylelint-disable-next-line at-rule-no-unknown */
387
+ @fa-font-path "~font-awesome/fonts/";
388
+
389
+ /* stylelint-disable no-invalid-position-at-import-rule */
390
+ @import "~font-awesome/less/mixins.less";
391
+ @import "~font-awesome/less/core.less";
392
+ @import "~font-awesome/less/fixed-width.less";
393
+ @import "~font-awesome/less/icons.less";
394
+ @import "~font-awesome/less/path.less";
395
+ @import "~font-awesome/less/animated.less";
396
+
397
+ html {
398
+ height: 100%;
399
+ margin: 0;
400
+ padding: 0;
401
+ }
402
+
403
+ body {
404
+ height: 100%;
405
+ margin: 0;
406
+ padding: 0;
407
+ }
408
+
409
+ .kiwi-wrap {
410
+ font-size: 90%;
411
+ line-height: 1.6em;
412
+ font-family: Source Sans Pro, Helvetica, sans-serif;
413
+ -webkit-font-smoothing: antialiased;
414
+ height: 100%;
415
+ overflow: hidden;
416
+ }
417
+
418
+ /* .kiwi-workspace has ::before and ::after 4px above itself for the connection status */
419
+ .kiwi-workspace {
420
+ position: relative;
421
+ margin-left: 220px;
422
+ left: 0;
423
+ top: 4px;
424
+ display: flex;
425
+ flex-direction: column;
426
+ height: 100%;
427
+ transition: left 0.2s, margin-left 0.2s;
428
+ }
429
+
430
+ .kiwi-workspace::before,
431
+ .kiwi-workspace::after {
432
+ position: absolute;
433
+ content: '';
434
+ left: 0;
435
+ right: auto;
436
+ margin-top: -4px;
437
+ width: 100%;
438
+ height: 4px;
439
+ z-index: 0;
440
+ transition: width 0.3s;
441
+ }
442
+
443
+ .kiwi-workspace::after {
444
+ right: 0;
445
+ left: auto;
446
+ width: 0;
447
+ }
448
+
449
+ .kiwi-workspace--disconnected::before {
450
+ width: 0;
451
+ }
452
+
453
+ .kiwi-workspace--disconnected::after {
454
+ width: 100%;
455
+ }
456
+
457
+ .kiwi-workspace-background {
458
+ position: absolute;
459
+ top: 0;
460
+ left: 0;
461
+ height: 100%;
462
+ width: 100%;
463
+ z-index: -1;
464
+ }
465
+
466
+ .kiwi-statebrowser {
467
+ position: absolute;
468
+ top: 0;
469
+ left: 0;
470
+ width: 220px;
471
+ bottom: 0;
472
+ z-index: 11; /* Must be at least 1 higher than the workspace :after z-index; */
473
+ transition: left 0.145s, margin-left 0.145s;
474
+ }
475
+
476
+ .kiwi-container {
477
+ flex-grow: 1;
478
+
479
+ /* The nicklist scroller needs some type of height set on it's parent, but since we use flexbox
480
+ it starts conflicting on firefox. Luckily flexbox ignores this 5% and resizes it as we intend
481
+ anyway. */
482
+ height: 5%;
483
+ }
484
+
485
+ .kiwi-main-mediaviewer {
486
+ max-height: 70%;
487
+ overflow: auto;
488
+ border-bottom: 1px solid rgba(0, 0, 0, 0.3);
489
+ }
490
+
491
+ .kiwi-controlinput {
492
+ z-index: 2;
493
+ }
494
+
495
+ /* Small screen will cause the statebrowser to act as a drawer */
496
+ @media screen and (max-width: 769px) {
497
+ .kiwi-workspace {
498
+ left: 0;
499
+ margin-left: 0;
500
+ }
501
+
502
+ .kiwi-statebrowser {
503
+ left: -220px;
504
+ }
505
+
506
+ .kiwi-wrap--statebrowser-drawopen .kiwi-statebrowser {
507
+ left: 0;
508
+ }
509
+
510
+ .kiwi-wrap--statebrowser-drawopen .kiwi-workspace {
511
+ left: 75%;
512
+ transition: left 0.1s;
513
+ transition-delay: 0s;
514
+ }
515
+ }
516
+ </style>