From bd4e8216141832929edf41483e06792d9ce73d1a Mon Sep 17 00:00:00 2001 From: Nachtalb Date: Sat, 1 May 2021 01:36:44 +0200 Subject: [PATCH 01/24] Improve readability of more.js --- client/js/socket-events/more.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/js/socket-events/more.js b/client/js/socket-events/more.js index 5acaa3cb..78970430 100644 --- a/client/js/socket-events/more.js +++ b/client/js/socket-events/more.js @@ -6,17 +6,17 @@ import socket from "../socket"; import store from "../store"; socket.on("more", function (data) { - const channel = store.getters.findChannel(data.chan); + const channel = store.getters.findChannel(data.chan).channel; if (!channel) { return; } - channel.channel.moreHistoryAvailable = - data.totalMessages > channel.channel.messages.length + data.messages.length; - channel.channel.messages.unshift(...data.messages); + channel.moreHistoryAvailable = + data.totalMessages > channel.messages.length + data.messages.length; + channel.messages.unshift(...data.messages); Vue.nextTick(() => { - channel.channel.historyLoading = false; + channel.historyLoading = false; }); }); From 11aa52687c54e8adeb5fab302924a744e2242ace Mon Sep 17 00:00:00 2001 From: Nachtalb Date: Sat, 1 May 2021 01:46:55 +0200 Subject: [PATCH 02/24] Fill inputhistory on channel load and more message load --- client/js/socket-events/more.js | 7 +++++++ client/js/store.js | 9 ++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/client/js/socket-events/more.js b/client/js/socket-events/more.js index 78970430..ee864895 100644 --- a/client/js/socket-events/more.js +++ b/client/js/socket-events/more.js @@ -12,6 +12,13 @@ socket.on("more", function (data) { return; } + channel.inputHistory = channel.inputHistory.concat( + data.messages + .filter((m) => m.self && m.text && m.type === "message") + .map((m) => m.text) + .reverse() + .slice(null, 100 - channel.inputHistory.length) + ); channel.moreHistoryAvailable = data.totalMessages > channel.messages.length + data.messages.length; channel.messages.unshift(...data.messages); diff --git a/client/js/store.js b/client/js/store.js index 3d336d06..d3669bdd 100644 --- a/client/js/store.js +++ b/client/js/store.js @@ -160,7 +160,14 @@ const store = new Vuex.Store({ // TODO: This should be a mutation channel.pendingMessage = ""; channel.inputHistoryPosition = 0; - channel.inputHistory = [""]; + + channel.inputHistory = [""].concat( + channel.messages + .filter((m) => m.self && m.text && m.type === "message") + .map((m) => m.text) + .reverse() + .slice(null, 99) + ); channel.historyLoading = false; channel.scrolledToBottom = true; channel.editTopic = false; From 04cf2277d9ebf4bd582c99a05e5ebe19229a4568 Mon Sep 17 00:00:00 2001 From: Nachtalb Date: Wed, 5 May 2021 18:09:18 +0200 Subject: [PATCH 03/24] Prevent possible error when findChannel can't find the wanted channel Using ?. (optional chaining) requires ecma version 2020 as it is fairly new. Webpack / Babel can handle it. --- .eslintrc.yml | 2 +- client/js/socket-events/more.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index b67991b5..d59c3b80 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -2,7 +2,7 @@ root: true parserOptions: - ecmaVersion: 2018 + ecmaVersion: 2020 env: es6: true diff --git a/client/js/socket-events/more.js b/client/js/socket-events/more.js index ee864895..34abf2c5 100644 --- a/client/js/socket-events/more.js +++ b/client/js/socket-events/more.js @@ -6,7 +6,7 @@ import socket from "../socket"; import store from "../store"; socket.on("more", function (data) { - const channel = store.getters.findChannel(data.chan).channel; + const channel = store.getters.findChannel(data.chan)?.channel; if (!channel) { return; From 24a738d521b62dfe401460c5975cda11c3a791a6 Mon Sep 17 00:00:00 2001 From: Nachtalb Date: Thu, 6 May 2021 03:22:09 +0200 Subject: [PATCH 04/24] Add new command to open the search window --- client/components/ChatInput.vue | 4 ++++ client/components/Windows/Help.vue | 9 +++++++++ client/js/commands/search.js | 20 ++++++++++++++++++++ src/plugins/inputs/index.js | 2 +- 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 client/js/commands/search.js diff --git a/client/components/ChatInput.vue b/client/components/ChatInput.vue index d12b9405..f0dbb14b 100644 --- a/client/components/ChatInput.vue +++ b/client/components/ChatInput.vue @@ -183,6 +183,10 @@ export default { }, setInputSize() { this.$nextTick(() => { + if (!this.$refs.input) { + return; + } + const style = window.getComputedStyle(this.$refs.input); const lineHeight = parseFloat(style.lineHeight, 10) || 1; diff --git a/client/components/Windows/Help.vue b/client/components/Windows/Help.vue index 7305b1ec..8015bbf8 100644 --- a/client/components/Windows/Help.vue +++ b/client/components/Windows/Help.vue @@ -673,6 +673,15 @@ +
+
+ /search query +
+
+

Search for messages in the current channel / user

+
+
+
/topic [newtopic] diff --git a/client/js/commands/search.js b/client/js/commands/search.js new file mode 100644 index 00000000..31e8c49b --- /dev/null +++ b/client/js/commands/search.js @@ -0,0 +1,20 @@ +"use strict"; + +import store from "../store"; +import {router} from "../router"; + +function input(args) { + router.push({ + name: "SearchResults", + params: { + id: store.state.activeChannel.channel.id, + }, + query: { + q: args.join(" "), + }, + }); + + return true; +} + +export default {input}; diff --git a/src/plugins/inputs/index.js b/src/plugins/inputs/index.js index 911d06cb..5f012254 100644 --- a/src/plugins/inputs/index.js +++ b/src/plugins/inputs/index.js @@ -1,4 +1,4 @@ -const clientSideCommands = ["/collapse", "/expand"]; +const clientSideCommands = ["/collapse", "/expand", "/search"]; const passThroughCommands = [ "/as", From cadcc4b97c24edaede5da86f9412741fc96d4a67 Mon Sep 17 00:00:00 2001 From: Nachtalb Date: Thu, 6 May 2021 03:24:20 +0200 Subject: [PATCH 05/24] Autofocus search input in case no query is present --- client/components/MessageSearchForm.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client/components/MessageSearchForm.vue b/client/components/MessageSearchForm.vue index 233e099f..340d7e2d 100644 --- a/client/components/MessageSearchForm.vue +++ b/client/components/MessageSearchForm.vue @@ -104,6 +104,10 @@ export default { mounted() { this.searchInput = this.$route.query.q; this.searchOpened = this.onSearchPage; + + if (!this.searchInput) { + this.$refs.searchInputField.focus(); + } }, methods: { closeSearch() { From dbf6ff064b14f91338a0d556c06c1f49b70068e0 Mon Sep 17 00:00:00 2001 From: Alex Jones Date: Sat, 8 May 2021 18:10:45 +1000 Subject: [PATCH 06/24] Add support for JPEG XL mimetype --- src/plugins/irc-events/link.js | 1 + src/plugins/uploader.js | 1 + 2 files changed, 2 insertions(+) diff --git a/src/plugins/irc-events/link.js b/src/plugins/irc-events/link.js index e268d9ef..4b2f44a0 100644 --- a/src/plugins/irc-events/link.js +++ b/src/plugins/irc-events/link.js @@ -222,6 +222,7 @@ function parse(msg, chan, preview, res, client) { case "image/gif": case "image/jpg": case "image/jpeg": + case "image/jxl": case "image/webp": case "image/avif": if (!Helper.config.prefetchStorage && Helper.config.disableMediaPreview) { diff --git a/src/plugins/uploader.js b/src/plugins/uploader.js index 249aa579..587933c2 100644 --- a/src/plugins/uploader.js +++ b/src/plugins/uploader.js @@ -28,6 +28,7 @@ const inlineContentDispositionTypes = { "image/png": "image.png", "image/webp": "image.webp", "image/avif": "image.avif", + "image/jxl": "image.jxl", "text/plain": "text.txt", "video/mp4": "video.mp4", "video/ogg": "video.ogv", From 42bafe71655a73cfcbfb15043f39963f0cd9a2b2 Mon Sep 17 00:00:00 2001 From: Mateusz Hajder <6783135+mhajder@users.noreply.github.com> Date: Sun, 23 May 2021 16:40:08 +0200 Subject: [PATCH 07/24] Change the IRC server to Libera.Chat --- .github/ISSUE_TEMPLATE/Bug_Report.md | 2 +- .github/ISSUE_TEMPLATE/Feature_Request.md | 2 +- .github/ISSUE_TEMPLATE/config.yml | 2 +- .github/SUPPORT.md | 2 +- README.md | 4 ++-- SECURITY.md | 2 +- defaults/config.js | 10 +++++----- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/Bug_Report.md b/.github/ISSUE_TEMPLATE/Bug_Report.md index da44fb06..22efc625 100644 --- a/.github/ISSUE_TEMPLATE/Bug_Report.md +++ b/.github/ISSUE_TEMPLATE/Bug_Report.md @@ -4,7 +4,7 @@ about: Create a bug report labels: "Type: Bug" --- - + - _Node version:_ - _Browser version:_ diff --git a/.github/ISSUE_TEMPLATE/Feature_Request.md b/.github/ISSUE_TEMPLATE/Feature_Request.md index 51f7a656..a0ea13c3 100644 --- a/.github/ISSUE_TEMPLATE/Feature_Request.md +++ b/.github/ISSUE_TEMPLATE/Feature_Request.md @@ -4,7 +4,7 @@ about: Request a new feature labels: "Type: Feature" --- - + ### Feature Description diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 6534742d..a06afb86 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -13,4 +13,4 @@ contact_links: - name: General support url: https://demo.thelounge.chat/?join=%23thelounge - about: "Join #thelounge on Freenode to ask a question before creating an issue" + about: "Join #thelounge on Libera.Chat to ask a question before creating an issue" diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md index 1fbda01d..62c3148e 100644 --- a/.github/SUPPORT.md +++ b/.github/SUPPORT.md @@ -6,6 +6,6 @@ need help, you have a few options: - Check out [existing questions on Stack Overflow](https://stackoverflow.com/questions/tagged/thelounge) to see if yours has been answered before. If not, feel free to [ask for a new question](https://stackoverflow.com/questions/ask?tags=thelounge) (using `thelounge` tag so that other people can easily find it). -- Find us on the Freenode channel `#thelounge`. You might not get an answer +- Find us on the Libera.Chat channel `#thelounge`. You might not get an answer right away, but this channel is full of nice people who will be happy to help you. diff --git a/README.md b/README.md index 8ea89439..66d08464 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,8 @@

#thelounge IRC channel on freenode + alt="#thelounge IRC channel on Libera.Chat" + src="https://img.shields.io/badge/Libera.Chat-%23thelounge-415364.svg?colorA=ff9e18"> npm version diff --git a/SECURITY.md b/SECURITY.md index 909e8718..7c292045 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -4,6 +4,6 @@ - Contact us privately first, in a [responsible disclosure](https://en.wikipedia.org/wiki/Responsible_disclosure) manner. -- On IRC, send a private message to any voiced user on our Freenode channel, +- On IRC, send a private message to any voiced user on our Libera.Chat channel, `#thelounge`. - By email, send us your report at . diff --git a/defaults/config.js b/defaults/config.js index 9b21cc84..390f732d 100644 --- a/defaults/config.js +++ b/defaults/config.js @@ -231,12 +231,12 @@ module.exports = { // - `join`: Comma-separated list of channels to auto-join once connected. // // This value is set to connect to the official channel of The Lounge on - // Freenode by default: + // Libera.Chat by default: // // ```js // defaults: { - // name: "Freenode", - // host: "chat.freenode.net", + // name: "Libera.Chat", + // host: "irc.libera.chat", // port: 6697, // password: "", // tls: true, @@ -248,8 +248,8 @@ module.exports = { // } // ``` defaults: { - name: "Freenode", - host: "chat.freenode.net", + name: "Libera.Chat", + host: "irc.libera.chat", port: 6697, password: "", tls: true, From af236dd280abf403e1e747fb738f7e9246046435 Mon Sep 17 00:00:00 2001 From: Mateusz Hajder <6783135+mhajder@users.noreply.github.com> Date: Wed, 26 May 2021 13:41:33 +0200 Subject: [PATCH 08/24] Add the default IRC network for tests --- test/fixtures/.thelounge/config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/fixtures/.thelounge/config.js b/test/fixtures/.thelounge/config.js index cbc7b926..9767acc9 100644 --- a/test/fixtures/.thelounge/config.js +++ b/test/fixtures/.thelounge/config.js @@ -2,6 +2,8 @@ var config = require("../../../defaults/config.js"); +config.defaults.name = "Example IRC Server"; +config.defaults.host = "irc.example.com"; config.public = true; config.prefetch = true; config.host = config.bind = "127.0.0.1"; From 28c413319f60da47afc2441e97f072338841b560 Mon Sep 17 00:00:00 2001 From: Mateusz Hajder <6783135+mhajder@users.noreply.github.com> Date: Wed, 26 May 2021 13:43:06 +0200 Subject: [PATCH 09/24] Change IRC server and channels in tests to more generic --- .../ircmessageparser/cleanIrcMessage.js | 4 ++-- .../js/helpers/ircmessageparser/findLinks.js | 4 ++-- test/client/js/helpers/parse.js | 12 ++++++------ test/models/network.js | 18 +++++++++--------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/test/client/js/helpers/ircmessageparser/cleanIrcMessage.js b/test/client/js/helpers/ircmessageparser/cleanIrcMessage.js index 2636b29f..056c039d 100644 --- a/test/client/js/helpers/ircmessageparser/cleanIrcMessage.js +++ b/test/client/js/helpers/ircmessageparser/cleanIrcMessage.js @@ -55,8 +55,8 @@ describe("cleanIrcMessage", function () { expected: "bold bold", }, { - input: "\x02irc\x0f://\x1dfreenode.net\x0f/\x034,8thelounge", - expected: "irc://freenode.net/thelounge", + input: "\x02irc\x0f://\x1dirc.example.com\x0f/\x034,8thelounge", + expected: "irc://irc.example.com/thelounge", }, { input: "\x02#\x038,9thelounge", diff --git a/test/client/js/helpers/ircmessageparser/findLinks.js b/test/client/js/helpers/ircmessageparser/findLinks.js index 9effda56..d1c9a27f 100644 --- a/test/client/js/helpers/ircmessageparser/findLinks.js +++ b/test/client/js/helpers/ircmessageparser/findLinks.js @@ -8,12 +8,12 @@ const { describe("findLinks", () => { it("should find url", () => { - const input = "irc://freenode.net/thelounge"; + const input = "irc://irc.example.com/thelounge"; const expected = [ { start: 0, end: 28, - link: "irc://freenode.net/thelounge", + link: "irc://irc.example.com/thelounge", }, ]; diff --git a/test/client/js/helpers/parse.js b/test/client/js/helpers/parse.js index f4902abe..79171afa 100644 --- a/test/client/js/helpers/parse.js +++ b/test/client/js/helpers/parse.js @@ -63,10 +63,10 @@ describe("IRC formatted message parser", () => { it("should find urls", async () => { const testCases = [ { - input: "irc://freenode.net/thelounge", + input: "irc://irc.example.com/thelounge", expected: - '' + - "irc://freenode.net/thelounge" + + '' + + "irc://irc.example.com/thelounge" + "", }, { @@ -416,12 +416,12 @@ describe("IRC formatted message parser", () => { it("should go bonkers like mirc", async () => { const testCases = [ { - input: "\x02irc\x0f://\x1dfreenode.net\x0f/\x034,8thelounge", + input: "\x02irc\x0f://\x1dirc.example.com\x0f/\x034,8thelounge", expected: - '' + + '' + 'irc' + "://" + - 'freenode.net' + + 'irc.example.com' + "/" + 'thelounge' + "", diff --git a/test/models/network.js b/test/models/network.js index 6d6d8119..e1273f29 100644 --- a/test/models/network.js +++ b/test/models/network.js @@ -91,7 +91,7 @@ describe("Network", function () { rejectUnauthorized: false, }); expect(network.validate()).to.be.true; - expect(network.host).to.equal("chat.freenode.net"); + expect(network.host).to.equal("irc.example.com"); expect(network.port).to.equal(6697); expect(network.tls).to.be.true; expect(network.rejectUnauthorized).to.be.true; @@ -103,7 +103,7 @@ describe("Network", function () { host: "some.fake.tld", }); expect(network2.validate()).to.be.true; - expect(network2.host).to.equal("chat.freenode.net"); + expect(network2.host).to.equal("irc.example.com"); Helper.config.lockNetwork = false; }); @@ -265,7 +265,7 @@ describe("Network", function () { // Lobby and initial channel expect(network.channels.length).to.equal(2); - const newChan = new Chan({name: "#freenode"}); + const newChan = new Chan({name: "#foo"}); network.addChannel(newChan); expect(network.channels.length).to.equal(3); @@ -278,13 +278,13 @@ describe("Network", function () { const network = new Network({ channels: [chan1, chan2, chan3], - name: "freenode", + name: "foo", }); - const newChan = new Chan({name: "#freenode"}); + const newChan = new Chan({name: "#foo"}); network.addChannel(newChan); - expect(network.channels[0].name).to.equal("freenode"); + expect(network.channels[0].name).to.equal("foo"); expect(network.channels[1]).to.equal(chan1); expect(network.channels[2]).to.equal(newChan); expect(network.channels[3]).to.equal(chan2); @@ -299,7 +299,7 @@ describe("Network", function () { channels: [chan1, chan2], }); - const newChan = new Chan({name: "#freenode"}); + const newChan = new Chan({name: "#foo"}); network.addChannel(newChan); expect(network.channels[1]).to.equal(chan1); @@ -393,7 +393,7 @@ describe("Network", function () { channels: [banlist, chan1, user1], }); - const newChan = new Chan({name: "#freenode"}); + const newChan = new Chan({name: "#foo"}); network.addChannel(newChan); expect(network.channels[1]).to.equal(newChan); @@ -404,7 +404,7 @@ describe("Network", function () { it("should never add something in front of the lobby", function () { const network = new Network({ - name: "freenode", + name: "foo", channels: [], }); From 6f7fd800440078651ac4a40b559946cbbb4a21f5 Mon Sep 17 00:00:00 2001 From: Mateusz Hajder <6783135+mhajder@users.noreply.github.com> Date: Wed, 26 May 2021 13:59:04 +0200 Subject: [PATCH 10/24] Fix length of the link in tests --- test/client/js/helpers/ircmessageparser/findLinks.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/client/js/helpers/ircmessageparser/findLinks.js b/test/client/js/helpers/ircmessageparser/findLinks.js index d1c9a27f..3f0c1ece 100644 --- a/test/client/js/helpers/ircmessageparser/findLinks.js +++ b/test/client/js/helpers/ircmessageparser/findLinks.js @@ -12,7 +12,7 @@ describe("findLinks", () => { const expected = [ { start: 0, - end: 28, + end: 31, link: "irc://irc.example.com/thelounge", }, ]; From 4d310cd545984d4c7ea767fdc0a8f85396e55f66 Mon Sep 17 00:00:00 2001 From: Austin Anderson Date: Sat, 22 May 2021 10:42:57 -0700 Subject: [PATCH 11/24] Render styling for colored host masks On some IRC networks, users have vanity host masks with colors or other text styling. Rizon is one such network. For example, a user connecting from 127.0.0.1 could instead have the host angerson@this.is.my.host.mask. this.is.my.host.mask may have IRC color code characters in it, which without this change would be displayed as a bunch of jumbled garbage in the /whois response or join/part messages. Resolves #4232. --- client/components/MessageTypes/chghost.vue | 7 +++++-- client/components/MessageTypes/join.vue | 4 +++- client/components/MessageTypes/part.vue | 3 ++- client/components/MessageTypes/quit.vue | 3 ++- client/components/MessageTypes/whois.vue | 7 ++++++- client/components/Special/ListBans.vue | 6 +++++- client/components/Special/ListIgnored.vue | 6 +++++- client/components/Special/ListInvites.vue | 8 +++++++- 8 files changed, 35 insertions(+), 9 deletions(-) diff --git a/client/components/MessageTypes/chghost.vue b/client/components/MessageTypes/chghost.vue index ef8e2f83..e54c245d 100644 --- a/client/components/MessageTypes/chghost.vue +++ b/client/components/MessageTypes/chghost.vue @@ -6,17 +6,20 @@ >username to {{ message.new_ident }} hostname to {{ message.new_host }} + >hostname to +