Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into chatterino7
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz committed Feb 2, 2025
2 parents 54966f0 + f629eec commit 72ce97c
Show file tree
Hide file tree
Showing 108 changed files with 271 additions and 74 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
merge_group:

env:
TWITCH_PUBSUB_SERVER_TAG: v1.0.7
TWITCH_PUBSUB_SERVER_TAG: v1.0.8
HTTPBOX_TAG: v0.2.1
QT_QPA_PLATFORM: minimal
HOMEBREW_NO_AUTO_UPDATE: 1
Expand Down Expand Up @@ -92,8 +92,6 @@ jobs:
tar -xzf pubsub-server.tar.gz -C pubsub-server-test
rm pubsub-server.tar.gz
cd pubsub-server-test
curl -L -o server.crt "https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.crt"
curl -L -o server.key "https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.key"
cd ..
- name: Test
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
merge_group:

env:
TWITCH_PUBSUB_SERVER_TAG: v1.0.7
TWITCH_PUBSUB_SERVER_TAG: v1.0.8
HTTPBOX_TAG: v0.2.1
QT_QPA_PLATFORM: minimal
CONAN_VERSION: 2.11.0
Expand Down Expand Up @@ -141,8 +141,6 @@ jobs:
Expand-Archive pubsub-server.zip -DestinationPath pubsub-server-test
rm pubsub-server.zip
cd pubsub-server-test
Invoke-WebRequest -Uri "https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.crt" -outfile "server.crt"
Invoke-WebRequest -Uri "https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.key" -outfile "server.key"
cd ..
- name: Test
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
- main

env:
TWITCH_PUBSUB_SERVER_TAG: v1.0.7
TWITCH_PUBSUB_SERVER_TAG: v1.0.8
QT_QPA_PLATFORM: minimal

concurrency:
Expand Down Expand Up @@ -70,8 +70,6 @@ jobs:
tar -xzf pubsub-server.tar.gz -C pubsub-server-test
rm pubsub-server.tar.gz
cd pubsub-server-test
curl -L -o server.crt "https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.crt"
curl -L -o server.key "https://github.com/Chatterino/twitch-pubsub-server-test/raw/${{ env.TWITCH_PUBSUB_SERVER_TAG }}/cmd/server/server.key"
cd ..
- uses: dtolnay/rust-toolchain@stable
Expand All @@ -96,7 +94,7 @@ jobs:
working-directory: build-test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5.3.0
uses: codecov/codecov-action@v5.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
plugins: gcov
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
url = https://github.com/Tencent/rapidjson
[submodule "lib/qtkeychain"]
path = lib/qtkeychain
url = https://github.com/Chatterino/qtkeychain
url = https://github.com/frankosterfeld/qtkeychain
[submodule "lib/websocketpp"]
path = lib/websocketpp
url = https://github.com/Chatterino/websocketpp
Expand Down
2 changes: 2 additions & 0 deletions BUILDING_ON_LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ sudo apt install qt6-base-dev qt6-5compat-dev qt6-svg-dev qt6-image-formats-plug
sudo pacman -S --needed qt6-base qt6-tools boost-libs openssl qt6-imageformats qt6-5compat qt6-svg boost rapidjson pkgconf openssl cmake
```

If you use Wayland, you will also need to ensure `qt6-wayland` is installed.

Alternatively you can use the [chatterino2-git](https://aur.archlinux.org/packages/chatterino2-git/) package to build and install Chatterino for you.

### Fedora 39 and above
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- Minor: Remove incognito browser support for `opera/launcher` (this should no longer be a thing). (#5805)
- Minor: Remove incognito browser support for `iexplore`, because internet explorer is EOL. (#5810)
- Minor: When (re-)connecting, visible channels are now joined first. (#5850)
- Minor: Added the ability to filter on messages by the author's user ID (example: `author.user_id == "22484632"`). (#5862)
- Minor: Improved error messaging of the `/clip` command. (#5879)
- Bugfix: Fixed a potential way to escape the Lua Plugin sandbox. (#5846)
- Bugfix: Fixed a crash relating to Lua HTTP. (#5800)
- Bugfix: Fixed a crash that could occur on Linux and macOS when clicking "Install" from the update prompt. (#5818)
Expand All @@ -15,11 +17,16 @@
- Bugfix: Closing a usercard will no longer cause stop-logging messages to be generated in channel logs. (#5828)
- Bugfix: Fixed tabs not scaling to the default scale when changing the scale from a non-default value. (#5794, #5833)
- Bugfix: Fixed deleted messages not immediately disappearing when "Hide deleted messages" is enabled. (#5844, #5854)
- Bugfix: Fixed announcements not showing up in mentions tab. (#5857)
- Bugfix: Fixed the reply button showing for inline whispers and announcements. (#5863)
- Bugfix: Fixed suspicious user treatment update messages not being searchable. (#5865)
- Dev: Highlight checks now use non-capturing groups for the boundaries. (#5784)
- Dev: Updated Conan dependencies. (#5776)
- Dev: Replaced usage of `parseTime` with `serverReceivedTime` for clearchat messages. (#5824, #5855)
- Dev: Support Boost 1.87. (#5832)
- Dev: Words from `TextElement`s are now combined where possible. (#5847)
- Dev: Fixed assertion failure when closing the edit-hotkey dialog. (#5869)
- Dev: Updated `qtkeychain` to 0.15.0. (#5871)

## 2.5.2

Expand Down
2 changes: 1 addition & 1 deletion lib/WinToast
2 changes: 1 addition & 1 deletion lib/expected-lite
2 changes: 1 addition & 1 deletion lib/settings
2 changes: 1 addition & 1 deletion mocks/include/mocks/Helix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Helix : public IHelix

MOCK_METHOD(void, createClip,
(QString channelId, ResultCallback<HelixClip> successCallback,
std::function<void(HelixClipError)> failureCallback,
std::function<void(HelixClipError, QString)> failureCallback,
std::function<void()> finallyCallback),
(override));

Expand Down
3 changes: 3 additions & 0 deletions src/controllers/filters/lang/Filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const QMap<QString, Type> MESSAGE_TYPING_CONTEXT{
{"author.badges", Type::StringList},
{"author.color", Type::Color},
{"author.name", Type::String},
{"author.user_id", Type::String},
{"author.no_color", Type::Bool},
{"author.subbed", Type::Bool},
{"author.sub_length", Type::Int},
Expand Down Expand Up @@ -60,6 +61,7 @@ ContextMap buildContextMap(const MessagePtr &m, chatterino::Channel *channel)
* author.badges
* author.color
* author.name
* author.user_id
* author.no_color
* author.subbed
* author.sub_length
Expand Down Expand Up @@ -121,6 +123,7 @@ ContextMap buildContextMap(const MessagePtr &m, chatterino::Channel *channel)
{"author.badges", std::move(badges)},
{"author.color", m->usernameColor},
{"author.name", m->displayName},
{"author.user_id", m->userID},
{"author.no_color", !m->usernameColor.isValid()},
{"author.subbed", subscribed},
{"author.sub_length", subLength},
Expand Down
1 change: 1 addition & 0 deletions src/controllers/filters/lang/Tokenizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const QMap<QString, QString> VALID_IDENTIFIERS_MAP{
{"author.badges", "author badges"},
{"author.color", "author color"},
{"author.name", "author name"},
{"author.user_id", "author user id"},
{"author.no_color", "author has no color?"},
{"author.subbed", "author subscribed?"},
{"author.sub_length", "author sub length"},
Expand Down
1 change: 1 addition & 0 deletions src/messages/Message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ QJsonObject Message::toJson() const
{"loginName"_L1, this->loginName},
{"displayName"_L1, this->displayName},
{"localizedName"_L1, this->localizedName},
{"userID"_L1, this->userID},
{"timeoutUser"_L1, this->timeoutUser},
{"channelName"_L1, this->channelName},
{"usernameColor"_L1, this->usernameColor.name(QColor::HexArgb)},
Expand Down
1 change: 1 addition & 0 deletions src/messages/Message.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ struct Message {
QString loginName;
QString displayName;
QString localizedName;
QString userID;
QString timeoutUser;
QString channelName;
QColor usernameColor;
Expand Down
48 changes: 32 additions & 16 deletions src/messages/MessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1979,6 +1979,7 @@ MessagePtr MessageBuilder::makeLowTrustUpdateMessage(
MessageColor::System, FontStyle::ChatMediumBold)
->setLink({Link::UserInfo, action.updatedByUserLogin});

QString text;
assert(action.treatment != PubSubLowTrustUsersMessage::Treatment::INVALID);
switch (action.treatment)
{
Expand All @@ -1994,6 +1995,9 @@ MessagePtr MessageBuilder::makeLowTrustUpdateMessage(
builder.emplace<TextElement>("from the suspicious user list.",
MessageElementFlag::Text,
MessageColor::System);
text = QString("%1 removed %2 from the suspicious user list.")
.arg(action.updatedByUserDisplayName,
action.suspiciousUserDisplayName);
}
break;

Expand All @@ -2009,6 +2013,9 @@ MessagePtr MessageBuilder::makeLowTrustUpdateMessage(
builder.emplace<TextElement>("as a monitored suspicious chatter.",
MessageElementFlag::Text,
MessageColor::System);
text = QString("%1 added %2 as a monitored suspicious chatter.")
.arg(action.updatedByUserDisplayName,
action.suspiciousUserDisplayName);
}
break;

Expand All @@ -2024,6 +2031,9 @@ MessagePtr MessageBuilder::makeLowTrustUpdateMessage(
builder.emplace<TextElement>("as a restricted suspicious chatter.",
MessageElementFlag::Text,
MessageColor::System);
text = QString("%1 added %2 as a restricted suspicious chatter.")
.arg(action.updatedByUserDisplayName,
action.suspiciousUserDisplayName);
}
break;

Expand All @@ -2033,6 +2043,8 @@ MessagePtr MessageBuilder::makeLowTrustUpdateMessage(
break;
}

builder->messageText = text;
builder->searchText = text;
return builder.release();
}

Expand Down Expand Up @@ -2102,6 +2114,7 @@ std::pair<MessagePtrMut, HighlightAlert> MessageBuilder::makeIrcMessage(

MessageBuilder builder;
builder.parseUsernameColor(tags, userID);
builder->userID = userID;

if (args.isAction)
{
Expand Down Expand Up @@ -2257,23 +2270,26 @@ std::pair<MessagePtrMut, HighlightAlert> MessageBuilder::makeIrcMessage(
ColorProvider::instance().color(ColorType::Whisper);
}

if (thread)
{
auto &img = getResources().buttons.replyThreadDark;
builder
.emplace<CircularImageElement>(Image::fromResourcePixmap(img, 0.15),
2, Qt::gray,
MessageElementFlag::ReplyButton)
->setLink({Link::ViewThread, thread->rootId()});
}
else
if (!args.isReceivedWhisper && tags.value("msg-id") != "announcement")
{
auto &img = getResources().buttons.replyDark;
builder
.emplace<CircularImageElement>(Image::fromResourcePixmap(img, 0.15),
2, Qt::gray,
MessageElementFlag::ReplyButton)
->setLink({Link::ReplyToMessage, builder->id});
if (thread)
{
auto &img = getResources().buttons.replyThreadDark;
builder
.emplace<CircularImageElement>(
Image::fromResourcePixmap(img, 0.15), 2, Qt::gray,
MessageElementFlag::ReplyButton)
->setLink({Link::ViewThread, thread->rootId()});
}
else
{
auto &img = getResources().buttons.replyDark;
builder
.emplace<CircularImageElement>(
Image::fromResourcePixmap(img, 0.15), 2, Qt::gray,
MessageElementFlag::ReplyButton)
->setLink({Link::ReplyToMessage, builder->id});
}
}

return {builder.release(), highlight};
Expand Down
8 changes: 7 additions & 1 deletion src/providers/twitch/IrcMessageHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,13 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *message,
if (isSub)
{
msg->flags.set(MessageFlag::Subscription);
msg->flags.unset(MessageFlag::Highlighted);

if (tags.value("msg-id") != "announcement")
{
// Announcements are currently tagged as subscriptions,
// but we want them to be able to show up in mentions
msg->flags.unset(MessageFlag::Highlighted);
}
}

sink.applySimilarityFilters(msg);
Expand Down
45 changes: 39 additions & 6 deletions src/providers/twitch/TwitchChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,21 @@ namespace {
#endif
constexpr int CLIP_CREATION_COOLDOWN = 5000;
const QString CLIPS_LINK("https://clips.twitch.tv/%1");
const QString CLIPS_FAILURE_CLIPS_UNAVAILABLE_TEXT(
"Failed to create a clip - clips are temporarily unavailable: %1");
const QString CLIPS_FAILURE_CLIPS_DISABLED_TEXT(
"Failed to create a clip - the streamer has clips disabled entirely or "
"requires a certain subscriber or follower status to create clips.");
"Failed to create a clip - the streamer has clips disabled in their "
"channel.");
const QString CLIPS_FAILURE_CLIPS_RESTRICTED_TEXT(
"Failed to create a clip - the streamer has restricted clip creation "
"to subscribers, or followers of an unknown duration.");
const QString CLIPS_FAILURE_CLIPS_RESTRICTED_CATEGORY_TEXT(
"Failed to create a clip - the streamer has disabled clips while in "
"this category.");
const QString CLIPS_FAILURE_NOT_AUTHENTICATED_TEXT(
"Failed to create a clip - you need to re-authenticate.");
const QString CLIPS_FAILURE_UNKNOWN_ERROR_TEXT(
"Failed to create a clip - an unknown error occurred.");
"Failed to create a clip: %1");
const QString LOGIN_PROMPT_TEXT("Click here to add your account again.");
const Link ACCOUNTS_LINK(Link::OpenAccountsPage, QString());

Expand Down Expand Up @@ -1774,7 +1782,7 @@ void TwitchChannel::createClip()
this->addMessage(builder.release(), MessageContext::Original);
},
// failureCallback
[this](auto error) {
[this](auto error, auto errorMessage) {
MessageBuilder builder;
QString text;
builder.message().flags.set(MessageFlag::System);
Expand All @@ -1783,6 +1791,15 @@ void TwitchChannel::createClip()

switch (error)
{
case HelixClipError::ClipsUnavailable: {
builder.emplace<TextElement>(
CLIPS_FAILURE_CLIPS_UNAVAILABLE_TEXT.arg(errorMessage),
MessageElementFlag::Text, MessageColor::System);
text =
CLIPS_FAILURE_CLIPS_UNAVAILABLE_TEXT.arg(errorMessage);
}
break;

case HelixClipError::ClipsDisabled: {
builder.emplace<TextElement>(
CLIPS_FAILURE_CLIPS_DISABLED_TEXT,
Expand All @@ -1791,6 +1808,22 @@ void TwitchChannel::createClip()
}
break;

case HelixClipError::ClipsRestricted: {
builder.emplace<TextElement>(
CLIPS_FAILURE_CLIPS_RESTRICTED_TEXT,
MessageElementFlag::Text, MessageColor::System);
text = CLIPS_FAILURE_CLIPS_RESTRICTED_TEXT;
}
break;

case HelixClipError::ClipsRestrictedCategory: {
builder.emplace<TextElement>(
CLIPS_FAILURE_CLIPS_RESTRICTED_CATEGORY_TEXT,
MessageElementFlag::Text, MessageColor::System);
text = CLIPS_FAILURE_CLIPS_RESTRICTED_CATEGORY_TEXT;
}
break;

case HelixClipError::UserNotAuthenticated: {
builder.emplace<TextElement>(
CLIPS_FAILURE_NOT_AUTHENTICATED_TEXT,
Expand All @@ -1810,9 +1843,9 @@ void TwitchChannel::createClip()
case HelixClipError::Unknown:
default: {
builder.emplace<TextElement>(
CLIPS_FAILURE_UNKNOWN_ERROR_TEXT,
CLIPS_FAILURE_UNKNOWN_ERROR_TEXT.arg(errorMessage),
MessageElementFlag::Text, MessageColor::System);
text = CLIPS_FAILURE_UNKNOWN_ERROR_TEXT;
text = CLIPS_FAILURE_UNKNOWN_ERROR_TEXT.arg(errorMessage);
}
break;
}
Expand Down
Loading

0 comments on commit 72ce97c

Please sign in to comment.