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,728 @@
1
+ <template>
2
+ <div class="kiwi-userbox">
3
+ <span v-if="isSelf" class="kiwi-userbox-selfprofile">
4
+ {{ $t('user_you') }}
5
+ </span>
6
+ <div class="kiwi-userbox-header">
7
+ <div class="kiwi-userbox-avatar">
8
+ <avatar :user="user" size="large" />
9
+ <away-status-indicator :network="network" :user="user" />
10
+ </div>
11
+ <div class="kiwi-userbox-userinfo">
12
+ <span
13
+ class="kiwi-userbox-nick"
14
+ :style="{ 'color': user.getColour() }"
15
+ >{{ user.nick }}</span>
16
+ <span v-if="userMode" class="kiwi-userbox-modestring">+{{ userMode }}</span>
17
+ <span class="kiwi-userbox-usermask">{{ user.username }}@{{ user.host }}</span>
18
+ </div>
19
+ </div>
20
+
21
+ <template v-if="pluginUiInfoElements.length">
22
+ <component
23
+ :is="plugin.component"
24
+ v-for="plugin in pluginUiInfoElements"
25
+ :key="plugin.id"
26
+ :plugin-props="{
27
+ user: user,
28
+ userbox: self,
29
+ }"
30
+ v-bind="plugin.props"
31
+ :network="network"
32
+ :buffer="buffer"
33
+ :user="user"
34
+ :sidebar-state="sidebarState"
35
+ />
36
+ </template>
37
+
38
+ <div v-else-if="realname" class="kiwi-userbox-basicinfo">
39
+ <span class="kiwi-userbox-basicinfo-title">{{ $t('whois_realname') }}:</span>
40
+ <span class="kiwi-userbox-basicinfo-data" v-html="formattedRealname" />
41
+ </div>
42
+
43
+ <div class="kiwi-userbox-actions">
44
+ <a v-if="!isSelf && !buffer.isQuery()" class="kiwi-userbox-action" @click="openQuery">
45
+ <i class="fa fa-comment-o" aria-hidden="true" />
46
+ {{ $t('send_a_message') }}
47
+ </a>
48
+ <a v-if="!whoisRequested" class="kiwi-userbox-action" @click="updateWhoisData">
49
+ <i class="fa fa-question-circle" aria-hidden="true" />
50
+ {{ $t('more_information') }}
51
+ </a>
52
+ <div class="kiwi-userbox-actions kiwi-userbox-plugin-actions">
53
+ <component
54
+ :is="plugin.component"
55
+ v-for="plugin in pluginUiButtonElements"
56
+ :key="plugin.id"
57
+ :plugin-props="{
58
+ user: user,
59
+ userbox: self,
60
+ }"
61
+ v-bind="plugin.props"
62
+ :network="network"
63
+ :buffer="buffer"
64
+ :user="user"
65
+ :sidebar-state="sidebarState"
66
+ />
67
+ </div>
68
+ </div>
69
+
70
+ <form v-if="!isSelf" class="u-form kiwi-userbox-ignoreuser">
71
+ <label>
72
+ <input v-model="user.ignore" type="checkbox">
73
+ <span> {{ $t('ignore_user') }} </span>
74
+ </label>
75
+ </form>
76
+
77
+ <div
78
+ v-if="whoisRequested"
79
+ :class="[whoisLoading?'kiwi-userbox-whois--loading':'']"
80
+ class="kiwi-userbox-whois"
81
+ >
82
+ <template v-if="whoisLoading">
83
+ <i class="fa fa-spin fa-spinner" aria-hidden="true" />
84
+ </template>
85
+ <template v-else-if="pluginUiWhoisElements.length">
86
+ <component
87
+ :is="plugin.component"
88
+ v-for="plugin in pluginUiWhoisElements"
89
+ :key="plugin.id"
90
+ :plugin-props="{
91
+ user: user,
92
+ userbox: self,
93
+ }"
94
+ v-bind="plugin.props"
95
+ :network="network"
96
+ :buffer="buffer"
97
+ :user="user"
98
+ :sidebar-state="sidebarState"
99
+ />
100
+ </template>
101
+ <template v-else>
102
+ <span class="kiwi-userbox-whois-line">
103
+ {{ user.away ?
104
+ $t('whois_status') + ': ' + user.away :
105
+ $t('whois_status_available')
106
+ }}
107
+ </span>
108
+ <span v-if="user.account" class="kiwi-userbox-whois-line">
109
+ {{ $t('user_account', {user: user.account}) }}
110
+ </span>
111
+ <span class="kiwi-userbox-whois-line">
112
+ {{ $t('user_realname', {realname: user.realname}) }}
113
+ </span>
114
+ <span v-if="user.bot" class="kiwi-userbox-whois-line">{{ $t('user_bot') }}</span>
115
+ <span v-if="user.helpop" class="kiwi-userbox-whois-line">
116
+ {{ $t('user_help') }}
117
+ </span>
118
+ <span v-if="user.operator" class="kiwi-userbox-whois-line">
119
+ {{ $t('user_op') }}
120
+ </span>
121
+ <span v-if="user.server" class="kiwi-userbox-whois-line">
122
+ {{ $t('user_server', {
123
+ server: user.server,
124
+ info: (user.server_info ? `(${user.server_info})` : '')
125
+ }) }}
126
+ </span>
127
+ <span v-if="user.secure" class="kiwi-userbox-whois-line">
128
+ {{ $t('user_secure') }}
129
+ </span>
130
+ <span
131
+ v-if="user.channels"
132
+ class="kiwi-userbox-whois-line"
133
+ @click="onChannelsClick($event)"
134
+ v-html="$t('user_channels', {channels: userChannels})"
135
+ />
136
+ </template>
137
+ </div>
138
+
139
+ <div v-if="buffer.isChannel() && areWeAnOp && !isSelf" class="kiwi-userbox-opactions">
140
+ <form class="u-form" @submit.prevent="">
141
+ <label v-if="isUserOnBuffer">
142
+ {{ $t('user_access') }} <select v-model="userMode">
143
+ <option
144
+ v-for="mode in availableChannelModes"
145
+ :key="mode.mode"
146
+ :value="mode.mode"
147
+ >
148
+ {{ mode.description }}
149
+ </option>
150
+ <option value="">{{ $t('user_normal') }}</option>
151
+ </select>
152
+ </label>
153
+ <label v-if="isUserOnBuffer">
154
+ <button
155
+ type="button"
156
+ class="u-button u-button-secondary
157
+ kiwi-userbox-opaction-kick kiwi-userbox-opaction"
158
+ @click="kickUser"
159
+ >
160
+ <i class="fa fa-sign-out" aria-hidden="true" />
161
+ {{ $t('user_kick') }}
162
+ </button>
163
+ </label>
164
+ <label>
165
+ <button
166
+ type="button"
167
+ class="u-button u-button-secondary
168
+ kiwi-userbox-opaction-ban kiwi-userbox-opaction"
169
+ @click="banUser"
170
+ >
171
+ <i class="fa fa-ban" aria-hidden="true" />
172
+ {{ $t('user_ban') }}
173
+ </button>
174
+ </label>
175
+ <label v-if="isUserOnBuffer">
176
+ <button
177
+ type="button"
178
+ class="u-button u-button-secondary
179
+ kiwi-userbox-opaction-kickban kiwi-userbox-opaction"
180
+ @click="kickbanUser"
181
+ >
182
+ <i class="fa fa-exclamation-triangle" aria-hidden="true" />
183
+ {{ $t('user_kickban') }}
184
+ </button>
185
+ </label>
186
+ </form>
187
+ </div>
188
+ <div
189
+ v-if="buffer.isQuery() && invitableBuffers.length > 0"
190
+ class="kiwi-userbox-query-invite kiwi-userbox-actions u-form"
191
+ >
192
+ <select v-model="inviteChan" class="u-input">
193
+ <option value="">{{ $t('select_channel') }}</option>
194
+ <option
195
+ v-for="chan in invitableBuffers"
196
+ :key="'inviteChan-' + chan"
197
+ :value="chan"
198
+ >{{ chan }}</option>
199
+ </select>
200
+ <a class="u-button u-button-secondary" @click="inviteUser()">
201
+ {{ $t('invite_user') }}
202
+ </a>
203
+ </div>
204
+ </div>
205
+ </template>
206
+
207
+ <script>
208
+
209
+ 'kiwi public';
210
+
211
+ import * as ipRegex from 'ip-regex';
212
+ import * as TextFormatting from '@/helpers/TextFormatting';
213
+ import * as IrcdDiffs from '@/helpers/IrcdDiffs';
214
+ import GlobalApi from '@/libs/GlobalApi';
215
+ import toHtml from '@/libs/renderers/Html';
216
+ import parseMessage from '@/libs/MessageParser';
217
+ import Avatar from './Avatar';
218
+ import AwayStatusIndicator from './AwayStatusIndicator';
219
+
220
+ export default {
221
+ components: {
222
+ Avatar,
223
+ AwayStatusIndicator,
224
+ },
225
+ props: ['network', 'buffer', 'user', 'sidebarState'],
226
+ data: function data() {
227
+ return {
228
+ self: this,
229
+ whoisRequested: false,
230
+ whoisLoading: false,
231
+ inviteChan: '',
232
+ pluginUiButtonElements: GlobalApi.singleton().userboxButtonPlugins,
233
+ pluginUiInfoElements: GlobalApi.singleton().userboxInfoPlugins,
234
+ pluginUiWhoisElements: GlobalApi.singleton().userboxWhoisPlugins,
235
+ };
236
+ },
237
+ computed: {
238
+ // Channel modes differ on some IRCds so get them from the network options
239
+ availableChannelModes: function availableChannelModes() {
240
+ let availableModes = [];
241
+ let prefixes = this.network.ircClient.network.options.PREFIX;
242
+ let knownPrefix = {
243
+ q: 'Owner',
244
+ a: 'Admin',
245
+ o: 'Operator',
246
+ h: 'Half-Operator',
247
+ v: 'Voice',
248
+ };
249
+
250
+ prefixes.forEach((prefix) => {
251
+ let mode = prefix.mode;
252
+ if (knownPrefix[mode]) {
253
+ availableModes.push({
254
+ mode: mode,
255
+ description: knownPrefix[mode],
256
+ });
257
+ }
258
+ });
259
+
260
+ return availableModes;
261
+ },
262
+ areWeAnOp: function areWeAnOp() {
263
+ if (!this.buffer) {
264
+ return false;
265
+ }
266
+
267
+ return this.buffer.isUserAnOp(this.buffer.getNetwork().nick);
268
+ },
269
+ realname() {
270
+ return (this.user.realname || '').trim();
271
+ },
272
+ formattedRealname() {
273
+ let blocks = parseMessage(this.realname, { extras: false });
274
+ let content = toHtml(blocks, false);
275
+ return content;
276
+ },
277
+ isUserOnBuffer: function isUserOnBuffer() {
278
+ if (!this.buffer) {
279
+ return false;
280
+ }
281
+
282
+ if (!this.user.buffers[this.buffer.id]) {
283
+ // Probably switched buffer while the userbox was open
284
+ return false;
285
+ }
286
+
287
+ return true;
288
+ },
289
+ userMode: {
290
+ get: function getUserMode() {
291
+ if (!this.buffer) {
292
+ return '';
293
+ }
294
+
295
+ let userBufferInfo = this.user.buffers[this.buffer.id];
296
+ if (!userBufferInfo) {
297
+ // Probably switched buffer while the userbox was open
298
+ return '';
299
+ }
300
+
301
+ let modes = userBufferInfo.modes;
302
+ return modes.length > 0 ?
303
+ modes[0] :
304
+ '';
305
+ },
306
+ // Switch the current user mode for the new one
307
+ set: function setUserMode(newVal) {
308
+ let client = this.network.ircClient;
309
+ let oldVal = this.userMode;
310
+
311
+ let changes = [];
312
+ let targets = [];
313
+
314
+ if (oldVal) {
315
+ changes.push('-' + oldVal);
316
+ targets.push(this.user.nick);
317
+ }
318
+ if (newVal) {
319
+ changes.push('+' + newVal);
320
+ targets.push(this.user.nick);
321
+ }
322
+
323
+ let params = ['MODE', this.buffer.name, changes.join('')].concat(targets);
324
+ client.raw(params);
325
+ },
326
+ },
327
+ userChannels() {
328
+ let channels = this.user.channels.trim().split(' ');
329
+ for (let i = 0; i < channels.length; i++) {
330
+ channels[i] = TextFormatting.linkifyChannels(channels[i]);
331
+ }
332
+ return channels.join(' ');
333
+ },
334
+ isSelf() {
335
+ return this.user === this.network.currentUser();
336
+ },
337
+ invitableBuffers() {
338
+ let buffers = [];
339
+ this.network.buffers.forEach((buffer) => {
340
+ if (
341
+ buffer.isChannel() &&
342
+ buffer.isUserAnOp(this.network.nick) &&
343
+ !buffer.hasNick(this.user.nick)
344
+ ) {
345
+ buffers.push(buffer.name);
346
+ }
347
+ });
348
+ return buffers;
349
+ },
350
+ },
351
+ watch: {
352
+ user: function watchUser() {
353
+ // Reset the whois view since the user is now different
354
+ this.whoisRequested = false;
355
+ this.whoisLoading = false;
356
+ },
357
+ },
358
+ methods: {
359
+ userModeOnThisBuffer: function userModeOnBuffer(user) {
360
+ if (!this.buffer) {
361
+ return '';
362
+ }
363
+
364
+ let userBufferInfo = user.buffers[this.buffer.id];
365
+ let modes = userBufferInfo.modes;
366
+ return modes.length > 0 ?
367
+ modes[0] :
368
+ '';
369
+ },
370
+ openQuery: function openQuery() {
371
+ this.sidebarState.showNicklist();
372
+ let buffer = this.$state.addBuffer(this.network.id, this.user.nick);
373
+ this.$state.setActiveBuffer(this.network.id, buffer.name);
374
+ if (this.$state.ui.is_narrow) {
375
+ this.$state.$emit('userbox.hide');
376
+ }
377
+ },
378
+ onChannelsClick(event) {
379
+ let channelName = event.target.getAttribute('data-channel-name');
380
+ if (channelName) {
381
+ let network = this.buffer.getNetwork();
382
+ this.$state.addBuffer(this.buffer.networkid, channelName);
383
+ network.ircClient.join(channelName);
384
+ }
385
+ },
386
+ updateWhoisData: function updateWhoisData() {
387
+ this.whoisRequested = true;
388
+ this.whoisLoading = true;
389
+ this.network.ircClient.whois(this.user.nick, () => {
390
+ this.whoisLoading = false;
391
+ });
392
+ },
393
+ kickUser: function kickUser() {
394
+ let reason = this.$state.setting('buffers.default_kick_reason');
395
+ this.network.ircClient.raw('KICK', this.buffer.name, this.user.nick, reason);
396
+ },
397
+ createBanMask: function createBanMask() {
398
+ // try to ban via user account first
399
+ if (this.user.account) {
400
+ // if EXTBAN is supported use that
401
+ let extban = IrcdDiffs.extbanAccount(this.network);
402
+ if (extban) {
403
+ return extban + ':' + this.user.account;
404
+ }
405
+
406
+ // if the account name is in the host ban the host
407
+ // Eg. user@network/user/accountname
408
+ if (this.user.host.toLowerCase().indexOf(this.user.account.toLowerCase()) > -1) {
409
+ return '*!*@' + this.user.host;
410
+ }
411
+ }
412
+
413
+ // if an ip address is in the host and not the whole host ban the ip
414
+ // Eg. user@gateway/1.2.3.4
415
+ let ipTest = new RegExp('(' + ipRegex.v4().source + '|' + ipRegex.v6().source + ')');
416
+ if (ipTest.test(this.user.host)) {
417
+ let match = this.user.host.match(ipTest)[0];
418
+ if (match !== this.user.host) {
419
+ return '*!*@*' + match + '*';
420
+ }
421
+ }
422
+
423
+ // if an 8 char hex is the username ban by username. Commonly used in gateways
424
+ // Eg. 59d4c432@a.clients.kiwiirc.com
425
+ let hexTest = /^([a-f0-9]{8})$/i;
426
+ if (hexTest.test(this.user.username)) {
427
+ let match = this.user.username.match(hexTest)[0];
428
+ return '*!' + match + '@*';
429
+ }
430
+
431
+ // fallback to default_ban_mask from config
432
+ let mask = this.$state.setting('buffers.default_ban_mask');
433
+ mask = mask.replace('%n', this.user.nick);
434
+ mask = mask.replace('%i', this.user.username);
435
+ mask = mask.replace('%h', this.user.host);
436
+
437
+ return mask;
438
+ },
439
+ banUser: function banUser() {
440
+ if (!this.user.username || !this.user.host) {
441
+ return;
442
+ }
443
+
444
+ let banMask = this.createBanMask();
445
+ this.network.ircClient.raw('MODE', this.buffer.name, '+b', banMask);
446
+ },
447
+ kickbanUser: function kickbanuser() {
448
+ if (!this.user.username || !this.user.host) {
449
+ return;
450
+ }
451
+
452
+ let banMask = this.createBanMask();
453
+ let reason = this.$state.setting('buffers.default_kick_reason');
454
+ this.network.ircClient.raw('MODE', this.buffer.name, '+b', banMask);
455
+ this.network.ircClient.raw('KICK', this.buffer.name, this.user.nick, reason);
456
+ },
457
+ inviteUser() {
458
+ if (!this.inviteChan) {
459
+ return;
460
+ }
461
+ this.network.ircClient.invite(this.inviteChan, this.user.nick);
462
+ },
463
+ },
464
+ };
465
+ </script>
466
+
467
+ <style lang="less">
468
+ .kiwi-sidebar.kiwi-sidebar-section-user {
469
+ right: 0;
470
+ width: 380px;
471
+ }
472
+
473
+ .kiwi-userbox {
474
+ box-sizing: border-box;
475
+ overflow-y: auto;
476
+ height: 100%;
477
+ }
478
+
479
+ .kiwi-userbox-selfprofile {
480
+ display: block;
481
+ margin: 0 auto;
482
+ width: 100%;
483
+ padding: 1em;
484
+ text-align: center;
485
+ border-bottom: 1px solid rgba(0, 0, 0, 0.2);
486
+ box-sizing: border-box;
487
+ }
488
+
489
+ .kiwi-userbox-header {
490
+ position: relative;
491
+ padding: 0.5em;
492
+ box-sizing: border-box;
493
+ display: flex;
494
+ }
495
+
496
+ .kiwi-userbox-avatar {
497
+ position: relative;
498
+ margin: 1em;
499
+ width: 100px;
500
+ height: 100px;
501
+ flex-shrink: 0;
502
+ }
503
+
504
+ .kiwi-userbox-avatar .kiwi-avatar-inner {
505
+ font-size: 3em;
506
+ border-width: 3px;
507
+ }
508
+
509
+ .kiwi-userbox-avatar .kiwi-awaystatusindicator {
510
+ width: 16px;
511
+ height: 16px;
512
+ top: 4px;
513
+ right: 2px;
514
+ position: absolute;
515
+ }
516
+
517
+ .kiwi-userbox-userinfo {
518
+ box-sizing: border-box;
519
+ margin-top: 1.2em;
520
+ flex-grow: 1;
521
+ }
522
+
523
+ .kiwi-userbox-nick {
524
+ font-weight: 800;
525
+ font-size: 1.4em;
526
+ }
527
+
528
+ .kiwi-userbox-modestring {
529
+ font-weight: normal;
530
+ font-size: 0.8em;
531
+ margin-left: 6px;
532
+ }
533
+
534
+ .kiwi-userbox-usermask {
535
+ display: block;
536
+ opacity: 0.6;
537
+ cursor: default;
538
+ word-break: break-all;
539
+ padding-left: 1px;
540
+ }
541
+
542
+ .fa-user.kiwi-userbox-icon {
543
+ display: inline-block;
544
+ font-size: 2em;
545
+ }
546
+
547
+ .kiwi-userbox-basicinfo {
548
+ width: 100%;
549
+ display: block;
550
+ padding: 0 1.5em 0.5em 1.5em;
551
+ box-sizing: border-box;
552
+ }
553
+
554
+ .kiwi-userbox-basicinfo-title,
555
+ .kiwi-userbox-basicinfo-data {
556
+ display: block;
557
+ width: 100%;
558
+ cursor: default;
559
+ margin: 0;
560
+ }
561
+
562
+ .kiwi-userbox-basicinfo-title {
563
+ font-size: 1em;
564
+ line-height: 1em;
565
+ padding: 0;
566
+ font-weight: 900;
567
+ }
568
+
569
+ .kiwi-userbox-basicinfo-data {
570
+ font-weight: normal;
571
+ opacity: 1;
572
+ }
573
+
574
+ .kiwi-userbox-actions {
575
+ width: 100%;
576
+ padding: 0.5em;
577
+ text-align: center;
578
+ user-select: none;
579
+ box-sizing: border-box;
580
+
581
+ /* using display flex here to prevent spaces making things uneven */
582
+ display: flex;
583
+ flex-wrap: wrap;
584
+ justify-content: center;
585
+
586
+ .kiwi-userbox-action {
587
+ border: 1px solid;
588
+ padding: 0.5em 1em;
589
+ cursor: pointer;
590
+ margin: 0.5em;
591
+ transition: all 0.3s;
592
+ border-radius: 3px;
593
+ }
594
+
595
+ .kiwi-userbox-action:empty {
596
+ display: none;
597
+ }
598
+
599
+ label {
600
+ display: block;
601
+ cursor: pointer;
602
+
603
+ span {
604
+ text-align: left;
605
+ width: auto;
606
+ }
607
+ }
608
+ }
609
+
610
+ .kiwi-userbox-plugin-actions {
611
+ padding: 0;
612
+ }
613
+
614
+ .kiwi-userbox-opactions {
615
+ width: 100%;
616
+ text-align: center;
617
+ box-sizing: border-box;
618
+ margin: 0 0 1em 0;
619
+ border-top: 1px solid;
620
+ padding: 1em 1.5em;
621
+ }
622
+
623
+ .kiwi-userbox-opactions label {
624
+ width: 100%;
625
+ font-size: 1.2em;
626
+ font-weight: 600;
627
+ display: block;
628
+ margin-bottom: 0.7em;
629
+ }
630
+
631
+ .kiwi-userbox-opactions label select {
632
+ display: block;
633
+ clear: both;
634
+ padding: 10px;
635
+ border-radius: 0.25em;
636
+ box-shadow: none;
637
+ border: 1px solid;
638
+ width: 100%;
639
+ margin-top: 10px;
640
+ cursor: pointer;
641
+ }
642
+
643
+ .kiwi-userbox-opaction {
644
+ width: 100%;
645
+ padding: 0 1em;
646
+ text-align: left;
647
+ border: none;
648
+ line-height: 2.2em;
649
+ font-size: 0.8em;
650
+ }
651
+
652
+ .kiwi-userbox-opaction i {
653
+ margin-right: 0.2em;
654
+ font-size: 1.2em;
655
+ }
656
+
657
+ .kiwi-userbox-query-invite select {
658
+ margin-right: 10px;
659
+ }
660
+
661
+ .kiwi-userbox-whois {
662
+ line-height: 1.4em;
663
+ padding: 1em;
664
+ margin: 0 1em 1em 1em;
665
+ background: none;
666
+ box-sizing: border-box;
667
+ border-radius: 1em;
668
+ }
669
+
670
+ .kiwi-userbox-whois-line {
671
+ display: block;
672
+ }
673
+
674
+ .kiwi-userbox-whois--loading {
675
+ text-align: center;
676
+ font-size: 20px;
677
+ line-height: 20px;
678
+ }
679
+
680
+ .kiwi-userbox-ignoreuser {
681
+ display: flex;
682
+ flex-direction: row;
683
+ justify-content: center;
684
+ }
685
+
686
+ .kiwi-userbox-ignoreuser label {
687
+ margin: 0 0 1em 0;
688
+ }
689
+
690
+ .kiwi-userbox-ignoreuser span {
691
+ /* This fixes a vertical align issue between the checkbox and span */
692
+ float: right;
693
+ }
694
+
695
+ @media screen and (max-width: 769px) {
696
+ .kiwi-container--sidebar-drawn .kiwi-sidebar-userbox {
697
+ width: 100%;
698
+ }
699
+
700
+ .kiwi-userbox {
701
+ left: 0;
702
+ right: 0;
703
+ bottom: 40px;
704
+ top: auto;
705
+ max-width: 100%;
706
+ border-width: 1px 0;
707
+ }
708
+
709
+ .kiwi-userbox .kiwi-userbox-header i {
710
+ display: none;
711
+ }
712
+
713
+ .kiwi-userbox-actions {
714
+ width: 100%;
715
+ box-sizing: border-box;
716
+ }
717
+
718
+ .kiwi-userbox-plugin-actions {
719
+ padding: 0;
720
+ }
721
+
722
+ .kiwi-userbox-actions .kiwi-userbox-action {
723
+ width: 66%;
724
+ clear: both;
725
+ display: block;
726
+ }
727
+ }
728
+ </style>