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,162 @@
1
+ <template>
2
+ <div
3
+ :class="[is_usermenu_open?'kiwi-statebrowser-usermenu--open':'']"
4
+ class="kiwi-statebrowser-usermenu"
5
+ >
6
+ <div
7
+ :class="[isConnected ?
8
+ 'kiwi-statebrowser-usermenu-avatar--connected' :
9
+ 'kiwi-statebrowser-usermenu-avatar--disconnected'
10
+ ]"
11
+ class="kiwi-statebrowser-usermenu-avatar"
12
+ @click="is_usermenu_open=!is_usermenu_open"
13
+ >
14
+ <avatar
15
+ v-if="getUser"
16
+ :user="getUser"
17
+ size="large"
18
+ />
19
+ <away-status-indicator
20
+ v-if="network && network.state === 'connected'"
21
+ :network="network"
22
+ :user="getUser"
23
+ :toggle="false"
24
+ />
25
+ </div>
26
+ <div v-if="is_usermenu_open" class="kiwi-statebrowser-usermenu-body">
27
+ <p> {{ $t('state_remembered') }} </p>
28
+ <a class="u-link" @click="clickForget">{{ $t('state_forget') }}</a>
29
+ <div class="kiwi-statebrowser-usermenu-close" @click="is_usermenu_open=false">
30
+ <i class="fa fa-times" aria-hidden="true" />
31
+ </div>
32
+ </div>
33
+ <div v-else class="kiwi-statebrowser-usermenu-network">
34
+ {{ networkName }}
35
+ </div>
36
+ </div>
37
+ </template>
38
+ <script>
39
+
40
+ 'kiwi public';
41
+
42
+ import * as TextFormatting from '@/helpers/TextFormatting';
43
+
44
+ import UserState from '@/libs/state/UserState';
45
+ import AwayStatusIndicator from './AwayStatusIndicator';
46
+ import Avatar from './Avatar';
47
+
48
+ export default {
49
+ components: {
50
+ AwayStatusIndicator,
51
+ Avatar,
52
+ },
53
+ props: ['network'],
54
+ data() {
55
+ return {
56
+ is_usermenu_open: false,
57
+ };
58
+ },
59
+ computed: {
60
+ networkName() {
61
+ let name = TextFormatting.t('no_network');
62
+ if (this.network) {
63
+ name = this.network.name;
64
+ }
65
+ return name;
66
+ },
67
+ getUser() {
68
+ if (this.network && this.network.currentUser()) {
69
+ return this.network.currentUser();
70
+ }
71
+
72
+ return new UserState({ nick: 'User' });
73
+ },
74
+ isConnected() {
75
+ return this.network && this.network.state === 'connected';
76
+ },
77
+ },
78
+ methods: {
79
+ clickForget() {
80
+ let msg = 'This will delete all stored networks and start fresh. Are you sure?';
81
+ /* eslint-disable no-restricted-globals, no-alert */
82
+ let confirmed = confirm(msg);
83
+ if (!confirmed) {
84
+ return;
85
+ }
86
+
87
+ this.$state.persistence.forgetState();
88
+ window.location.reload();
89
+ },
90
+ },
91
+ };
92
+
93
+ </script>
94
+
95
+ <style>
96
+
97
+ .kiwi-statebrowser-usermenu {
98
+ width: 100%;
99
+ padding-bottom: 0;
100
+ padding-top: 34px;
101
+ }
102
+
103
+ .kiwi-statebrowser-usermenu-network {
104
+ padding: 0 0 10px 0;
105
+ cursor: default;
106
+ }
107
+
108
+ .kiwi-statebrowser-usermenu-close {
109
+ position: absolute;
110
+ top: 0;
111
+ right: 0;
112
+ width: 32px;
113
+ line-height: 32px;
114
+ text-align: center;
115
+ cursor: pointer;
116
+ font-weight: 800;
117
+ font-size: 20px;
118
+ opacity: 0.8;
119
+ border-bottom-left-radius: 14px;
120
+ transition: background 0.2s, opacity 0.2s;
121
+ }
122
+
123
+ .kiwi-statebrowser-usermenu-avatar {
124
+ position: relative;
125
+ width: 80px;
126
+ height: 80px;
127
+ margin: 0 auto 0.4em auto;
128
+ font-size: 2.8em;
129
+ transition: background 0.2s;
130
+ }
131
+
132
+ .kiwi-statebrowser-usermenu-avatar .kiwi-avatar-inner {
133
+ border-width: 3px;
134
+ }
135
+
136
+ .kiwi-statebrowser-usermenu .kiwi-awaystatusindicator {
137
+ position: absolute;
138
+ top: 4px;
139
+ right: 0;
140
+ width: 14px;
141
+ height: 14px;
142
+ border: 1px solid;
143
+ }
144
+
145
+ .kiwi-statebrowser-usermenu-body {
146
+ width: 100%;
147
+ box-sizing: border-box;
148
+ padding: 0 10px;
149
+ font-size: 0.8em;
150
+ margin-bottom: 10px;
151
+ }
152
+
153
+ .kiwi-statebrowser-usermenu-body p {
154
+ margin-bottom: 0;
155
+ }
156
+
157
+ @media screen and (max-width: 769px) {
158
+ .kiwi-statebrowser-usermenu-close {
159
+ display: none;
160
+ }
161
+ }
162
+ </style>
@@ -0,0 +1,34 @@
1
+ <template functional>
2
+ <span
3
+ v-if="props.user && $options.m.status(props) !== ''"
4
+ :class="{
5
+ 'kiwi-typingstatusindicator--paused': $options.m.status(props) === 'paused',
6
+ [data.staticClass]: true,
7
+ }"
8
+ class="kiwi-typingstatusindicator kiwi-typing"
9
+ />
10
+ </template>
11
+
12
+ <script>
13
+ 'kiwi public';
14
+
15
+ const methods = {
16
+ props: {},
17
+ status(props) {
18
+ // let props = this.props;
19
+ if (!props.user || !props.buffer) {
20
+ return '';
21
+ }
22
+
23
+ return props.user.typingStatus(props.buffer.name).status;
24
+ },
25
+ };
26
+
27
+ export default {
28
+ props: {
29
+ user: Object,
30
+ buffer: Object,
31
+ },
32
+ m: methods,
33
+ };
34
+ </script>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div class="kiwi-typinguserslist">
3
+ <span
4
+ v-for="(user, idx) in typingUsers"
5
+ :key="user.key"
6
+ :style="{ color: userColour(user) }"
7
+ >
8
+ {{ user.nick }}{{ typingUsers.length - 1 > idx ? ',' : '' }}
9
+ </span><span v-if="typingUsers.length > 0" class="kiwi-typing" />
10
+ </div>
11
+ </template>
12
+ <script>
13
+ 'kiwi public';
14
+
15
+ import TypingStatusIndicator from './TypingStatusIndicator';
16
+
17
+ export default {
18
+ components: {
19
+ TypingStatusIndicator,
20
+ },
21
+ props: ['buffer'],
22
+ computed: {
23
+ users() {
24
+ if (this.buffer.isQuery()) {
25
+ // if this is a query return the target as users
26
+ let network = this.$state.getActiveNetwork();
27
+ let user = this.$state.getUser(network.id, this.buffer.name);
28
+ return user ? { [user.nick]: user } : {};
29
+ }
30
+ return this.buffer.users;
31
+ },
32
+ typingUsers() {
33
+ let myNick = this.$state.getActiveNetwork().nick;
34
+ return Object.values(this.users).filter((u) => u.nick !== myNick
35
+ && u.typingStatus(this.buffer.name).status);
36
+ },
37
+ },
38
+ methods: {
39
+ userColour(user) {
40
+ return user && this.buffer.setting('colour_nicknames_in_messages') ? user.getColour() : '';
41
+ },
42
+ },
43
+ };
44
+ </script>
45
+ <style>
46
+
47
+ .kiwi-typinguserslist {
48
+ position: absolute;
49
+ top: -24px;
50
+ background: var(--brand-default-bg);
51
+ font-size: 0.9em;
52
+ overflow: hidden;
53
+ max-height: 23px;
54
+ }
55
+
56
+ </style>
@@ -0,0 +1,149 @@
1
+ <template>
2
+ <div
3
+ :key="url"
4
+ class="kiwi-mediaviewer-embedly"
5
+ >
6
+ <a
7
+ ref="embedlyLink"
8
+ :href="url"
9
+ :data-card-key="settings.key"
10
+ class="kiwi-embedly-card"
11
+ data-card-chrome="0"
12
+ data-card-controls="0"
13
+ data-card-recommend="0"
14
+ >{{ $t('media_loading', {url: url}) }}</a>
15
+ </div>
16
+ </template>
17
+
18
+ <script>
19
+ 'kiwi public';
20
+
21
+ let embedlyTagIncluded = false;
22
+
23
+ export default {
24
+ props: ['url', 'showPin', 'iframeSandboxOptions'],
25
+ data() {
26
+ return {
27
+ embedlyObject: null,
28
+ waitTimer: 0,
29
+ waitCount: 0,
30
+ };
31
+ },
32
+ computed: {
33
+ settings() {
34
+ return this.$state.setting('embedly');
35
+ },
36
+ },
37
+ watch: {
38
+ url() {
39
+ this.cleanEmbed();
40
+ this.updateEmbed();
41
+ },
42
+ },
43
+ created() {
44
+ this.updateEmbed();
45
+ },
46
+ beforeDestroy() {
47
+ this.cleanEmbed();
48
+ },
49
+ methods: {
50
+ updateEmbed() {
51
+ let checkEmbedlyAndShowCard = () => {
52
+ // If the embedly function doesn't exist it's probably still loading
53
+ // the embedly script
54
+ if (typeof window.embedly !== 'function') {
55
+ if (this.waitTimer) {
56
+ // maybe the url changed and there already is a timer
57
+ clearTimeout(this.waitTimer);
58
+ this.waitTimer = 0;
59
+ }
60
+ if (this.waitCount < 300) {
61
+ // max wait 30 seconds (30000ms)
62
+ this.waitCount++;
63
+ this.waitTimer = setTimeout(checkEmbedlyAndShowCard, 100);
64
+ }
65
+ return;
66
+ }
67
+
68
+ this.$nextTick(() => {
69
+ this.embedlyObject = window.embedly('card', this.$refs.embedlyLink);
70
+ if (!this.embedlyObject) {
71
+ // embedly refused to create a card (maybe unsupported url)
72
+ if (this.showPin) {
73
+ // showPin is true when its an inline embed
74
+ this.$emit('close');
75
+ }
76
+
77
+ return;
78
+ }
79
+
80
+ this.embedlyObject.on('card.error', (iframe) => {
81
+ // not sure this event will be triggered
82
+ if (this.showPin) {
83
+ // showPin is true when its an inline embed
84
+ this.$emit('close');
85
+ }
86
+ });
87
+
88
+ this.$emit('setHeight', 'auto');
89
+
90
+ if (this.showPin) {
91
+ // This is inline so set a max height
92
+ this.$el.style.maxHeight = (this.settings.maxHeight || 400) + 'px';
93
+ } else {
94
+ // This is main media view set a relative max height
95
+ this.$emit('setMaxHeight', '54%');
96
+ }
97
+ });
98
+ };
99
+
100
+ if (!embedlyTagIncluded) {
101
+ const head = document.getElementsByTagName('head')[0];
102
+ const script = document.createElement('script');
103
+ script.type = 'text/javascript';
104
+ const embedlyUrl = this.$state.getSetting('settings.embedly.script') ||
105
+ '//cdn.embedly.com/widgets/platform.js';
106
+ script.src = embedlyUrl;
107
+ head.appendChild(script);
108
+ embedlyTagIncluded = true;
109
+ }
110
+ checkEmbedlyAndShowCard();
111
+ },
112
+ cleanEmbed() {
113
+ if (this.waitTimer) {
114
+ clearTimeout(this.waitTimer);
115
+ this.waitTimer = 0;
116
+ }
117
+ if (this.embedlyObject) {
118
+ this.embedlyObject.remove();
119
+ this.embedlyObject = null;
120
+ }
121
+ },
122
+ },
123
+ };
124
+
125
+ </script>
126
+
127
+ <style>
128
+
129
+ .embedly-card {
130
+ display: block;
131
+ margin: 4px 0;
132
+ }
133
+
134
+ .embedly-card-hug {
135
+ border: 1px solid rgba(0, 0, 0, 0.2);
136
+ border-radius: 5px;
137
+ background: #fff;
138
+ }
139
+
140
+ .kiwi-mediaviewer-embedly {
141
+ display: inline-block;
142
+ overflow: auto;
143
+ }
144
+
145
+ .kiwi-main-mediaviewer .kiwi-mediaviewer-embedly {
146
+ display: block;
147
+ }
148
+
149
+ </style>