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.
- package/.github/workflows/ci.yml +6 -1
- package/.gitmodules +3 -0
- package/CHANGELOG.md +214 -0
- package/README.md +110 -23
- package/apps/aws-stack/package.json +1 -1
- package/apps/cf-tcp-container/package.json +1 -1
- package/apps/cf-worker/package.json +1 -1
- package/apps/cf-worker/src/origin-allowlist.ts +99 -0
- package/apps/cf-worker/src/worker.ts +89 -9
- package/apps/cf-worker/tests/fixtures/web-dist/app/index.html +18 -0
- package/apps/cf-worker/tests/fixtures/web-dist/index.html +18 -0
- package/apps/cf-worker/tests/origin-allowlist.test.ts +101 -0
- package/apps/cf-worker/tests/smoke.test.ts +28 -2
- package/apps/cf-worker/tests/ws-origin.test.ts +89 -0
- package/apps/cf-worker/wrangler.test.toml +23 -0
- package/apps/cf-worker/wrangler.toml +54 -0
- package/apps/local-cli/package.json +1 -1
- package/apps/web/landing/index.html +217 -0
- package/apps/web/package.json +28 -0
- package/apps/web/scripts/build.mjs +125 -0
- package/apps/web/src/build-env.ts +43 -0
- package/apps/web/src/config-schema.ts +138 -0
- package/apps/web/static/config.json +28 -0
- package/apps/web/static/config.prod.json +28 -0
- package/apps/web/static/config.staging.json +28 -0
- package/apps/web/tests/build-env.test.ts +63 -0
- package/apps/web/tests/build-smoke.test.ts +103 -0
- package/apps/web/tests/config-schema.test.ts +432 -0
- package/apps/web/tests/workspace.test.ts +12 -0
- package/apps/web/tsconfig.json +10 -0
- package/apps/web/upstream/.browserslistrc +3 -0
- package/apps/web/upstream/.editorconfig +9 -0
- package/apps/web/upstream/.eslintignore +3 -0
- package/apps/web/upstream/.eslintrc.js +90 -0
- package/apps/web/upstream/.github/FUNDING.yml +12 -0
- package/apps/web/upstream/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- package/apps/web/upstream/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/apps/web/upstream/.github/workflows/push.yml +26 -0
- package/apps/web/upstream/.github/workflows/release.yml +33 -0
- package/apps/web/upstream/.github/workflows/release_manual.yml +55 -0
- package/apps/web/upstream/.prettierrc.js +9 -0
- package/apps/web/upstream/.stylelintignore +5 -0
- package/apps/web/upstream/.stylelintrc.js +21 -0
- package/apps/web/upstream/LICENSE +201 -0
- package/apps/web/upstream/README.md +76 -0
- package/apps/web/upstream/babel.config.js +25 -0
- package/apps/web/upstream/crowdin.yml +3 -0
- package/apps/web/upstream/index.html +35 -0
- package/apps/web/upstream/jest.config.js +7 -0
- package/apps/web/upstream/jsdoc.json +22 -0
- package/apps/web/upstream/package.json +80 -0
- package/apps/web/upstream/scripts/pre-commit +43 -0
- package/apps/web/upstream/src/components/App.vue +516 -0
- package/apps/web/upstream/src/components/AppSettings.vue +587 -0
- package/apps/web/upstream/src/components/AutoComplete.vue +284 -0
- package/apps/web/upstream/src/components/Avatar.vue +105 -0
- package/apps/web/upstream/src/components/AwayStatusIndicator.vue +77 -0
- package/apps/web/upstream/src/components/BufferKey.vue +121 -0
- package/apps/web/upstream/src/components/BufferSettings.vue +97 -0
- package/apps/web/upstream/src/components/Captcha.vue +85 -0
- package/apps/web/upstream/src/components/ChannelBanlist.vue +96 -0
- package/apps/web/upstream/src/components/ChannelInfo.vue +159 -0
- package/apps/web/upstream/src/components/ChannelInvitelist.vue +276 -0
- package/apps/web/upstream/src/components/ChannelList.vue +345 -0
- package/apps/web/upstream/src/components/Container.vue +401 -0
- package/apps/web/upstream/src/components/ContainerHeader.vue +522 -0
- package/apps/web/upstream/src/components/ControlInput.vue +1016 -0
- package/apps/web/upstream/src/components/LoadingAnimation.vue +104 -0
- package/apps/web/upstream/src/components/MediaViewer.vue +199 -0
- package/apps/web/upstream/src/components/MessageInfo.vue +192 -0
- package/apps/web/upstream/src/components/MessageList.vue +1028 -0
- package/apps/web/upstream/src/components/MessageListAvatar.vue +20 -0
- package/apps/web/upstream/src/components/MessageListMessageCompact.vue +361 -0
- package/apps/web/upstream/src/components/MessageListMessageInline.vue +257 -0
- package/apps/web/upstream/src/components/MessageListMessageModern.vue +430 -0
- package/apps/web/upstream/src/components/NetworkSettings.vue +528 -0
- package/apps/web/upstream/src/components/Nicklist.vue +309 -0
- package/apps/web/upstream/src/components/NicklistUser.vue +181 -0
- package/apps/web/upstream/src/components/NotConnected.vue +271 -0
- package/apps/web/upstream/src/components/SelfUser.vue +283 -0
- package/apps/web/upstream/src/components/ServerSelector.vue +162 -0
- package/apps/web/upstream/src/components/ServerView.vue +126 -0
- package/apps/web/upstream/src/components/SettingsAdvanced.vue +232 -0
- package/apps/web/upstream/src/components/SettingsAliases.vue +121 -0
- package/apps/web/upstream/src/components/Sidebar.vue +429 -0
- package/apps/web/upstream/src/components/SidebarAboutBuffer.vue +288 -0
- package/apps/web/upstream/src/components/SidebarState.vue +145 -0
- package/apps/web/upstream/src/components/StartupError.vue +35 -0
- package/apps/web/upstream/src/components/StateBrowser.vue +420 -0
- package/apps/web/upstream/src/components/StateBrowserBuffer.vue +124 -0
- package/apps/web/upstream/src/components/StateBrowserNetwork.vue +823 -0
- package/apps/web/upstream/src/components/StateBrowserUsermenu.vue +162 -0
- package/apps/web/upstream/src/components/TypingStatusIndicator.vue +34 -0
- package/apps/web/upstream/src/components/TypingUsersList.vue +56 -0
- package/apps/web/upstream/src/components/UrlEmbed.vue +149 -0
- package/apps/web/upstream/src/components/UserBox.vue +728 -0
- package/apps/web/upstream/src/components/inputtools/Emoji.vue +67 -0
- package/apps/web/upstream/src/components/inputtools/TextStyle.vue +142 -0
- package/apps/web/upstream/src/components/startups/CommonLayout.vue +208 -0
- package/apps/web/upstream/src/components/startups/CustomServer.vue +495 -0
- package/apps/web/upstream/src/components/startups/KiwiBnc.vue +361 -0
- package/apps/web/upstream/src/components/startups/Personal.vue +317 -0
- package/apps/web/upstream/src/components/startups/Welcome.vue +544 -0
- package/apps/web/upstream/src/components/startups/ZncLogin.vue +229 -0
- package/apps/web/upstream/src/components/utils/InputConfirm.vue +68 -0
- package/apps/web/upstream/src/components/utils/InputPrompt.vue +118 -0
- package/apps/web/upstream/src/components/utils/InputText.vue +172 -0
- package/apps/web/upstream/src/components/utils/IrcInput.vue +579 -0
- package/apps/web/upstream/src/components/utils/PluginWrapper.vue +26 -0
- package/apps/web/upstream/src/components/utils/TabbedView.vue +149 -0
- package/apps/web/upstream/src/components/utils/TransitionExpand.vue +97 -0
- package/apps/web/upstream/src/helpers/Colours.js +128 -0
- package/apps/web/upstream/src/helpers/IrcdDiffs.js +26 -0
- package/apps/web/upstream/src/helpers/Md5.js +193 -0
- package/apps/web/upstream/src/helpers/Misc.js +401 -0
- package/apps/web/upstream/src/helpers/TextFormatting.js +237 -0
- package/apps/web/upstream/src/libs/AliasRewriter.js +157 -0
- package/apps/web/upstream/src/libs/AudioManager.js +60 -0
- package/apps/web/upstream/src/libs/BouncerMiddleware.js +247 -0
- package/apps/web/upstream/src/libs/BouncerProvider.js +551 -0
- package/apps/web/upstream/src/libs/ChathistoryMiddleware.js +153 -0
- package/apps/web/upstream/src/libs/ConfigLoader.js +94 -0
- package/apps/web/upstream/src/libs/EmojiProvider.js +46 -0
- package/apps/web/upstream/src/libs/GlobalApi.js +346 -0
- package/apps/web/upstream/src/libs/IPC.js +51 -0
- package/apps/web/upstream/src/libs/InputHandler.js +921 -0
- package/apps/web/upstream/src/libs/IrcClient.js +1506 -0
- package/apps/web/upstream/src/libs/Logger.js +71 -0
- package/apps/web/upstream/src/libs/Message.js +169 -0
- package/apps/web/upstream/src/libs/MessageFormatter.js +364 -0
- package/apps/web/upstream/src/libs/MessageParser.js +249 -0
- package/apps/web/upstream/src/libs/Notifications.js +78 -0
- package/apps/web/upstream/src/libs/ServerConnection.js +270 -0
- package/apps/web/upstream/src/libs/ServerSession.js +102 -0
- package/apps/web/upstream/src/libs/SoundBleep.js +20 -0
- package/apps/web/upstream/src/libs/StatePersistence.js +90 -0
- package/apps/web/upstream/src/libs/ThemeManager.js +128 -0
- package/apps/web/upstream/src/libs/TypingMiddleware.js +105 -0
- package/apps/web/upstream/src/libs/WindowTitle.js +63 -0
- package/apps/web/upstream/src/libs/batchedAdd.js +74 -0
- package/apps/web/upstream/src/libs/bufferTools.js +177 -0
- package/apps/web/upstream/src/libs/polyfill/Element.closest.js +18 -0
- package/apps/web/upstream/src/libs/renderers/Html.js +113 -0
- package/apps/web/upstream/src/libs/settingTools.js +31 -0
- package/apps/web/upstream/src/libs/state/BufferState.js +703 -0
- package/apps/web/upstream/src/libs/state/NetworkState.js +158 -0
- package/apps/web/upstream/src/libs/state/UserState.js +89 -0
- package/apps/web/upstream/src/libs/state/common.js +26 -0
- package/apps/web/upstream/src/libs/state.js +961 -0
- package/apps/web/upstream/src/libs/storage/Local.js +51 -0
- package/apps/web/upstream/src/main.js +566 -0
- package/apps/web/upstream/src/res/autocompleteCommands.js +31 -0
- package/apps/web/upstream/src/res/configTemplates.js +373 -0
- package/apps/web/upstream/src/res/globalStyle.css +277 -0
- package/apps/web/upstream/src/res/kiwiLoadingLogo.png +0 -0
- package/apps/web/upstream/src/res/locales/app.af-ZA.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ar-SA.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.bg-BG.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.bs-BA.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ca-ES.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.cs-CZ.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.da-DK.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.de-DE.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.dev.po +1246 -0
- package/apps/web/upstream/src/res/locales/app.el-GR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.en-US.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.es-419.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.es-AR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.es-EM.po +536 -0
- package/apps/web/upstream/src/res/locales/app.es-ES.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.es-US.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.eu-ES.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.fi-FI.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.fr-FR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.gl-ES.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.he-IL.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.hi-IN.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.hu-HU.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.id-ID.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.it-IT.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ja-JP.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ko-KR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.nl-NL.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.no-NO.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.pl-PL.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.pt-BR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.pt-PT.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ro-RO.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.ru-RU.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.sl-SI.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.sq-AL.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.sr-SP.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.sv-SE.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.tr-TR.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.uk-UA.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.vi-VN.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.zh-CN.po +1145 -0
- package/apps/web/upstream/src/res/locales/app.zh-TW.po +1145 -0
- package/apps/web/upstream/src/res/localesList.json +27 -0
- package/apps/web/upstream/src/res/logo.png +0 -0
- package/apps/web/upstream/src/thirdparty/about.html +43 -0
- package/apps/web/upstream/src/thirdparty/index.js +5 -0
- package/apps/web/upstream/src/thirdparty/kiwiirccom.vue +185 -0
- package/apps/web/upstream/static/config.json +28 -0
- package/apps/web/upstream/static/emoticons/smile.png +0 -0
- package/apps/web/upstream/static/favicon.png +0 -0
- package/apps/web/upstream/static/highlight.mp3 +0 -0
- package/apps/web/upstream/static/highlight.ogg +0 -0
- package/apps/web/upstream/static/locales/.gitignore +2 -0
- package/apps/web/upstream/static/plugins/customise.html.example +10 -0
- package/apps/web/upstream/static/themes/coffee/theme.css +145 -0
- package/apps/web/upstream/static/themes/common/base.css +1064 -0
- package/apps/web/upstream/static/themes/dark/theme.css +196 -0
- package/apps/web/upstream/static/themes/default/theme.css +92 -0
- package/apps/web/upstream/static/themes/elite/theme.css +248 -0
- package/apps/web/upstream/static/themes/grayfox/theme.css +143 -0
- package/apps/web/upstream/static/themes/nightswatch/theme.css +367 -0
- package/apps/web/upstream/static/themes/osprey/theme.css +115 -0
- package/apps/web/upstream/static/themes/radioactive/theme.css +1211 -0
- package/apps/web/upstream/static/themes/sky/theme.css +107 -0
- package/apps/web/upstream/tests/unit/BatchAdd.spec.js +174 -0
- package/apps/web/upstream/tests/unit/MessageParser.spec.js +125 -0
- package/apps/web/upstream/tests/unit/Misc.spec.js +24 -0
- package/apps/web/upstream/tests/unit/NetworkState.spec.js +58 -0
- package/apps/web/upstream/tests/unit/StartupError.spec.js +20 -0
- package/apps/web/upstream/vue.config.js +150 -0
- package/apps/web/upstream/yarn.lock +9767 -0
- package/apps/web/vitest.config.ts +13 -0
- package/biome.json +1 -0
- package/docs/Home.md +1 -0
- package/docs/WebClientGuide.md +535 -0
- package/package.json +2 -2
- package/packages/aws-adapter/package.json +1 -1
- package/packages/cf-adapter/package.json +1 -1
- package/packages/cf-adapter/tests/cf-harness.ts +12 -1
- package/packages/in-memory-runtime/package.json +1 -1
- package/packages/irc-core/package.json +1 -1
- package/packages/irc-core/reports/mutation/mutation.html +342 -0
- package/packages/irc-core/tests/batch.test.ts +15 -0
- package/packages/irc-core/tests/numerics.test.ts +13 -0
- package/packages/irc-core/tests/parser.test.ts +109 -0
- package/packages/irc-server/package.json +1 -1
- package/packages/irc-test-support/package.json +1 -1
- package/packages/irc-test-support/src/scenarios.ts +24 -2
- package/tools/ci-hardening/package.json +1 -1
- package/tools/load-test/package.json +1 -1
- package/tools/tcp-ws-forwarder/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<img
|
|
4
|
+
ref="kiwi-loading-logo"
|
|
5
|
+
src="../res/kiwiLoadingLogo.png"
|
|
6
|
+
class="kiwi-loading-logo"
|
|
7
|
+
alt=""
|
|
8
|
+
>
|
|
9
|
+
<canvas ref="kiwi-loading-canvas" class="kiwi-loading-animation" />
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
|
|
15
|
+
'kiwi public';
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
data() {
|
|
19
|
+
return {
|
|
20
|
+
logo: '',
|
|
21
|
+
c: '',
|
|
22
|
+
x: '',
|
|
23
|
+
Y: [],
|
|
24
|
+
t: 0,
|
|
25
|
+
fontSize: 72,
|
|
26
|
+
font: 'bold ' + 72 + 'px verdana',
|
|
27
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce eu arcu ipsum. ',
|
|
28
|
+
animationFrame: null,
|
|
29
|
+
destroying: false,
|
|
30
|
+
};
|
|
31
|
+
},
|
|
32
|
+
mounted() {
|
|
33
|
+
this.logo = this.$refs['kiwi-loading-logo'];
|
|
34
|
+
this.c = this.$refs['kiwi-loading-canvas'];
|
|
35
|
+
this.x = this.c.getContext('2d');
|
|
36
|
+
let tmpText = '';
|
|
37
|
+
for (let i = 0; i < 9; i += 1) tmpText += this.text;
|
|
38
|
+
this.text = String(tmpText).match(/.{1,43}/g);
|
|
39
|
+
this.c.width = 1256;
|
|
40
|
+
this.c.height = 1080;
|
|
41
|
+
for (let i = 0; i < this.text.length; i += 1) {
|
|
42
|
+
this.Y.push(i * this.fontSize - 1600);
|
|
43
|
+
}
|
|
44
|
+
this.logo.onload = () => {
|
|
45
|
+
if (this.destroying) {
|
|
46
|
+
// the component has already been destroyed, we nolonger need the animation
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.draw();
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
beforeDestroy() {
|
|
53
|
+
this.destroying = true;
|
|
54
|
+
cancelAnimationFrame(this.animationFrame);
|
|
55
|
+
},
|
|
56
|
+
methods: {
|
|
57
|
+
draw() {
|
|
58
|
+
this.x.clearRect(0, 0, this.c.width, this.c.height);
|
|
59
|
+
this.x.globalCompositeOperation = 'source-over';
|
|
60
|
+
this.x.drawImage(this.logo, 0, 0, this.c.width, this.c.height);
|
|
61
|
+
this.x.globalCompositeOperation = 'xor';
|
|
62
|
+
this.x.fillStyle = '#000';
|
|
63
|
+
this.x.font = this.font;
|
|
64
|
+
for (let i = 0; i < this.text.length; i += 1) {
|
|
65
|
+
if (this.t % 4.5 < 2) {
|
|
66
|
+
this.Y[i] += (250 + ((10 + i) / this.text.length) * 4000) / 120;
|
|
67
|
+
if (this.Y[i] > i * this.fontSize) {
|
|
68
|
+
this.Y[i] = i * this.fontSize;
|
|
69
|
+
}
|
|
70
|
+
} else {
|
|
71
|
+
if (this.text.length - (this.t % 4.5 - 2) / 2.5 * this.text.length * 1.75 < i) {
|
|
72
|
+
this.Y[i] += 10 + this.Y[i] / 20;
|
|
73
|
+
}
|
|
74
|
+
if (this.Y[i] > 1080 || this.Y[i] < 0) {
|
|
75
|
+
this.Y[i] = -1500 + i * this.fontSize;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (this.Y[i] > -100) {
|
|
79
|
+
this.x.fillText(this.text[i], 0, this.fontSize + this.Y[i]);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
this.x.globalCompositeOperation = 'source-out';
|
|
83
|
+
this.x.drawImage(this.logo, 0, 0, this.c.width, this.c.height);
|
|
84
|
+
this.x.globalCompositeOperation = 'source-over';
|
|
85
|
+
this.x.globalAlpha = 0.1;
|
|
86
|
+
this.x.drawImage(this.logo, 0, 0, this.c.width, this.c.height);
|
|
87
|
+
this.x.globalAlpha = 1;
|
|
88
|
+
this.animationFrame = requestAnimationFrame(this.draw);
|
|
89
|
+
this.t += 1 / 40;
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
</script>
|
|
94
|
+
|
|
95
|
+
<style>
|
|
96
|
+
.kiwi-loading-logo {
|
|
97
|
+
display: none;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.kiwi-loading-animation {
|
|
101
|
+
height: 100%;
|
|
102
|
+
width: 100%;
|
|
103
|
+
}
|
|
104
|
+
</style>
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="kiwi-mediaviewer">
|
|
3
|
+
<div class="kiwi-mediaviewer-controls">
|
|
4
|
+
<a
|
|
5
|
+
v-if="showPin"
|
|
6
|
+
class="u-button u-link kiwi-mediaviewer-controls-pin"
|
|
7
|
+
@click="$emit('pin')"
|
|
8
|
+
>
|
|
9
|
+
<i class="fa fa-map-pin" aria-hidden="true" />
|
|
10
|
+
</a>
|
|
11
|
+
<a
|
|
12
|
+
class="u-button u-button-warning kiwi-mediaviewer-controls-close"
|
|
13
|
+
@click="$emit('close');"
|
|
14
|
+
>
|
|
15
|
+
<i class="fa fa-window-close" aria-hidden="true" />
|
|
16
|
+
</a>
|
|
17
|
+
</div>
|
|
18
|
+
<div class="kiwi-mediaviewer-content">
|
|
19
|
+
<iframe
|
|
20
|
+
v-if="isIframe"
|
|
21
|
+
ref="iframe"
|
|
22
|
+
:src="url"
|
|
23
|
+
:sandbox="iframeSandboxOptions"
|
|
24
|
+
class="kiwi-mediaviewer-iframe"
|
|
25
|
+
/>
|
|
26
|
+
<component
|
|
27
|
+
:is="component"
|
|
28
|
+
v-else-if="component"
|
|
29
|
+
:component-props="componentProps"
|
|
30
|
+
v-bind="componentProps"
|
|
31
|
+
@close="$emit('close')"
|
|
32
|
+
@setHeight="setHeight"
|
|
33
|
+
@setMaxHeight="setMaxHeight"
|
|
34
|
+
/>
|
|
35
|
+
<url-embed
|
|
36
|
+
v-else
|
|
37
|
+
:url="url"
|
|
38
|
+
:show-pin="showPin"
|
|
39
|
+
:iframe-sandbox-options="iframeSandboxOptions"
|
|
40
|
+
@close="$emit('close')"
|
|
41
|
+
@setHeight="setHeight"
|
|
42
|
+
@setMaxHeight="setMaxHeight"
|
|
43
|
+
/>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
'kiwi public';
|
|
50
|
+
|
|
51
|
+
import _ from 'lodash';
|
|
52
|
+
import UrlEmbed from './UrlEmbed.vue';
|
|
53
|
+
|
|
54
|
+
export default {
|
|
55
|
+
components: {
|
|
56
|
+
UrlEmbed,
|
|
57
|
+
},
|
|
58
|
+
props: ['url', 'component', 'componentProps', 'isIframe', 'showPin'],
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
debouncedUpdateEmbed: null,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
computed: {
|
|
65
|
+
iframeSandboxOptions() {
|
|
66
|
+
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-sandbox
|
|
67
|
+
// Mostly all permissions other than allow-top-navigation so that embedded content
|
|
68
|
+
// cannot redirect the page away from kiwi
|
|
69
|
+
let options = [
|
|
70
|
+
'allow-downloads',
|
|
71
|
+
'allow-forms',
|
|
72
|
+
'allow-modals',
|
|
73
|
+
'allow-orientation-lock',
|
|
74
|
+
'allow-pointer-lock',
|
|
75
|
+
'allow-popups',
|
|
76
|
+
'allow-popups-to-escape-sandbox',
|
|
77
|
+
'allow-presentation',
|
|
78
|
+
'allow-same-origin',
|
|
79
|
+
'allow-scripts',
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
return options.join(' ');
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
watch: {
|
|
86
|
+
url() {
|
|
87
|
+
this.debouncedUpdateEmbed();
|
|
88
|
+
},
|
|
89
|
+
isIframe() {
|
|
90
|
+
this.debouncedUpdateEmbed();
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
created() {
|
|
94
|
+
// Debounce as both watchers may call it in the same tick
|
|
95
|
+
// also causes the method to be called next tick to give dom time to update
|
|
96
|
+
this.debouncedUpdateEmbed = _.debounce(() => {
|
|
97
|
+
this.updateEmbed(true);
|
|
98
|
+
}, 0);
|
|
99
|
+
},
|
|
100
|
+
mounted() {
|
|
101
|
+
this.updateEmbed(false);
|
|
102
|
+
this.$nextTick(() => {
|
|
103
|
+
this.emitEvent('opened');
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
methods: {
|
|
107
|
+
updateEmbed(shouldEmit) {
|
|
108
|
+
this.setMaxHeight('');
|
|
109
|
+
|
|
110
|
+
if (this.isIframe || this.component) {
|
|
111
|
+
this.setHeight((this.isIframe) ? '40%' : 'auto');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (shouldEmit) {
|
|
115
|
+
this.emitEvent('updated');
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
emitEvent(type) {
|
|
119
|
+
const event = {
|
|
120
|
+
isInline: this.showPin || false,
|
|
121
|
+
};
|
|
122
|
+
if (this.isIframe) {
|
|
123
|
+
event.type = 'iframe';
|
|
124
|
+
event.iframe = this.$refs.iframe;
|
|
125
|
+
event.url = this.url;
|
|
126
|
+
} else if (this.component) {
|
|
127
|
+
event.type = 'component';
|
|
128
|
+
event.component = this.component;
|
|
129
|
+
event.componentProps = this.componentProps;
|
|
130
|
+
} else {
|
|
131
|
+
event.type = 'embed';
|
|
132
|
+
event.url = this.url;
|
|
133
|
+
}
|
|
134
|
+
this.$state.$emit(`mediaviewer.${type}`, event);
|
|
135
|
+
},
|
|
136
|
+
setHeight(newHeight) {
|
|
137
|
+
this.$el.style.height = newHeight;
|
|
138
|
+
},
|
|
139
|
+
setMaxHeight(newHeight) {
|
|
140
|
+
this.$el.style.maxHeight = newHeight;
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<style>
|
|
147
|
+
.kiwi-mediaviewer {
|
|
148
|
+
box-sizing: border-box;
|
|
149
|
+
position: relative;
|
|
150
|
+
overflow: hidden;
|
|
151
|
+
width: 100%;
|
|
152
|
+
height: 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.kiwi-mediaviewer-controls {
|
|
156
|
+
position: absolute;
|
|
157
|
+
top: 0;
|
|
158
|
+
right: 16px;
|
|
159
|
+
z-index: 1;
|
|
160
|
+
background: var(--brand-default-bg);
|
|
161
|
+
border-radius: 5px;
|
|
162
|
+
padding: 3px;
|
|
163
|
+
opacity: 0;
|
|
164
|
+
transition: opacity 0.1s;
|
|
165
|
+
box-shadow: 0 1px var(--brand-input-border);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.kiwi-mediaviewer:hover .kiwi-mediaviewer-controls {
|
|
169
|
+
opacity: 1;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.kiwi-mediaviewer-controls-close {
|
|
173
|
+
padding: 3px 15px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.kiwi-mediaviewer-content {
|
|
177
|
+
height: 100%;
|
|
178
|
+
overflow: auto;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.kiwi-mediaviewer-iframe {
|
|
182
|
+
position: absolute;
|
|
183
|
+
height: 100%;
|
|
184
|
+
width: 100%;
|
|
185
|
+
top: 0;
|
|
186
|
+
border: none;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
@media screen and (max-width: 769px) {
|
|
190
|
+
.kiwi-mediaviewer-controls {
|
|
191
|
+
right: 6px;
|
|
192
|
+
opacity: 1;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.kiwi-mediaviewer-controls-close {
|
|
196
|
+
padding: 3px 7px;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
</style>
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="kiwi-messageinfo" @click.stop>
|
|
3
|
+
<div v-if="message.mentioned_urls.length > 0" class="kiwi-messageinfo-urls">
|
|
4
|
+
<div v-for="url in message.mentioned_urls" :key="url" class="kiwi-messageinfo-url">
|
|
5
|
+
<a class="u-button u-button-secondary" @click="urlPreview(url)">Preview</a>
|
|
6
|
+
<a
|
|
7
|
+
:href="url"
|
|
8
|
+
target="_blank"
|
|
9
|
+
class="u-link"
|
|
10
|
+
>
|
|
11
|
+
{{ url }}
|
|
12
|
+
</a>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div
|
|
16
|
+
:class="{'kiwi-messageinfo-actions--open': requestingInput}"
|
|
17
|
+
class="kiwi-messageinfo-actions"
|
|
18
|
+
>
|
|
19
|
+
<a
|
|
20
|
+
v-if="!requestingInput && buffer.name !== message.nick && !isSelf()"
|
|
21
|
+
class="u-link kiwi-messageinfo-reply"
|
|
22
|
+
@click="openQuery"
|
|
23
|
+
>
|
|
24
|
+
{{ $t('reply_in_private') }}
|
|
25
|
+
</a>
|
|
26
|
+
|
|
27
|
+
<div v-if="areWeAnOp() && !isSelf()" class="kiwi-messageinfo-opbuttons">
|
|
28
|
+
<input-prompt
|
|
29
|
+
label="Kick reason:" @submit="onKick"
|
|
30
|
+
@cancel="requestingInput = false"
|
|
31
|
+
>
|
|
32
|
+
<a
|
|
33
|
+
v-if="!requestingInput"
|
|
34
|
+
class="u-link kiwi-messageinfo-kick-user" @click="requestingInput = true"
|
|
35
|
+
>
|
|
36
|
+
Kick {{ message.nick }}
|
|
37
|
+
</a>
|
|
38
|
+
</input-prompt>
|
|
39
|
+
<input-prompt
|
|
40
|
+
label="Ban reason:" @submit="onBan"
|
|
41
|
+
@cancel="requestingInput = false"
|
|
42
|
+
>
|
|
43
|
+
<a
|
|
44
|
+
v-if="!requestingInput"
|
|
45
|
+
class="u-link kiwi-messageinfo-ban-user" @click="requestingInput = true"
|
|
46
|
+
>
|
|
47
|
+
Ban {{ message.nick }}
|
|
48
|
+
</a>
|
|
49
|
+
</input-prompt>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</template>
|
|
54
|
+
|
|
55
|
+
<script>
|
|
56
|
+
'kiwi public';
|
|
57
|
+
|
|
58
|
+
export default {
|
|
59
|
+
components: {
|
|
60
|
+
},
|
|
61
|
+
props: ['buffer', 'message'],
|
|
62
|
+
data: function data() {
|
|
63
|
+
return {
|
|
64
|
+
requestingInput: false,
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
computed: {
|
|
68
|
+
},
|
|
69
|
+
methods: {
|
|
70
|
+
urlPreview: function urlPreview(url) {
|
|
71
|
+
this.$state.$emit('mediaviewer.show', url);
|
|
72
|
+
},
|
|
73
|
+
areWeAnOp: function areWeAnOp() {
|
|
74
|
+
let ourNick = this.buffer.getNetwork().nick;
|
|
75
|
+
return this.buffer.isUserAnOp(ourNick);
|
|
76
|
+
},
|
|
77
|
+
isSelf: function isSelf() {
|
|
78
|
+
let user = this.$state.getUser(this.buffer.getNetwork().id, this.message.nick);
|
|
79
|
+
return this.buffer.getNetwork().ircClient.user.nick === user.nick;
|
|
80
|
+
},
|
|
81
|
+
onBan: function onBan(reason) {
|
|
82
|
+
let network = this.buffer.getNetwork();
|
|
83
|
+
network.ircClient.mode(this.buffer.name, '+b', this.message.nick);
|
|
84
|
+
},
|
|
85
|
+
onKick: function onKick(promptedReason) {
|
|
86
|
+
let network = this.buffer.getNetwork();
|
|
87
|
+
let defaultReason = this.$state.setting('buffers.default_kick_reason');
|
|
88
|
+
let reason = promptedReason || defaultReason;
|
|
89
|
+
network.ircClient.raw('KICK', this.buffer.name, this.message.nick, reason);
|
|
90
|
+
},
|
|
91
|
+
openQuery: function openQuery() {
|
|
92
|
+
let network = this.buffer.getNetwork();
|
|
93
|
+
let buffer = this.$state.addBuffer(network.id, this.message.nick);
|
|
94
|
+
this.$state.setActiveBuffer(network.id, buffer.name);
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
</script>
|
|
99
|
+
|
|
100
|
+
<style>
|
|
101
|
+
.kiwi-messageinfo {
|
|
102
|
+
display: block;
|
|
103
|
+
position: relative;
|
|
104
|
+
padding: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.kiwi-messageinfo-urls {
|
|
108
|
+
margin-top: 10px;
|
|
109
|
+
padding-top: 10px;
|
|
110
|
+
padding-bottom: 10px;
|
|
111
|
+
border-top: 1px solid;
|
|
112
|
+
border-bottom: 1px solid;
|
|
113
|
+
overflow: hidden;
|
|
114
|
+
width: 100%;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.kiwi-messageinfo-url {
|
|
118
|
+
margin-bottom: 5px;
|
|
119
|
+
display: flex;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.kiwi-messageinfo-url .u-button {
|
|
123
|
+
line-height: 30px;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.kiwi-messageinfo-urls .kiwi-messageinfo-url:last-of-type {
|
|
127
|
+
margin-bottom: 0;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.kiwi-messageinfo-actions {
|
|
131
|
+
margin-top: 10px;
|
|
132
|
+
overflow: hidden;
|
|
133
|
+
width: 100%;
|
|
134
|
+
text-align: left;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.kiwi-messageinfo-url .u-link {
|
|
138
|
+
white-space: nowrap;
|
|
139
|
+
text-overflow: ellipsis;
|
|
140
|
+
display: inline-block;
|
|
141
|
+
overflow: hidden;
|
|
142
|
+
flex: 1;
|
|
143
|
+
line-height: 30px;
|
|
144
|
+
margin-left: 10px;
|
|
145
|
+
padding: 5px 10px;
|
|
146
|
+
text-align: center;
|
|
147
|
+
border: 1px solid;
|
|
148
|
+
border-radius: 3px;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.kiwi-messageinfo-close {
|
|
152
|
+
position: absolute;
|
|
153
|
+
right: 20px;
|
|
154
|
+
bottom: 5px;
|
|
155
|
+
font-size: 1.3em;
|
|
156
|
+
cursor: pointer;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.kiwi-messageinfo-opbuttons {
|
|
160
|
+
margin-left: 2em;
|
|
161
|
+
display: inline-block;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.kiwi-messageinfo-actions--open .kiwi-messageinfo-opbuttons {
|
|
165
|
+
margin-left: 0;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.kiwi-messageinfo-opbuttons .u-input-prompt a,
|
|
169
|
+
.kiwi-messageinfo-reply {
|
|
170
|
+
padding: 5px 10px;
|
|
171
|
+
display: inline-block;
|
|
172
|
+
border-radius: 4px;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.kiwi-messageinfo-opbuttons .u-input-prompt input {
|
|
176
|
+
margin-bottom: 5px;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@media screen and (max-width: 490px) {
|
|
180
|
+
.kiwi-messageinfo-actions {
|
|
181
|
+
text-align: center;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.kiwi-messageinfo-opbuttons {
|
|
185
|
+
margin: 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.kiwi-messageinfo-opbuttons .u-input-prompt a {
|
|
189
|
+
margin-top: 10px;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
</style>
|