fix: receive bttv live updates again (#6132)

This commit is contained in:
iProdigy
2025-04-06 04:58:09 -05:00
committed by GitHub
parent 3481c93365
commit d8ef52a308
7 changed files with 18 additions and 15 deletions
+1
View File
@@ -5,6 +5,7 @@
- Minor: Make paused chat indicator more visible, and fix its zoom behavior. (#6123) - Minor: Make paused chat indicator more visible, and fix its zoom behavior. (#6123)
- Bugfix: Don't create native messaging manifest file if browser directory doesn't exist. (#6116) - Bugfix: Don't create native messaging manifest file if browser directory doesn't exist. (#6116)
- Bugfix: Make reply-cancel button less coarse-grained. (#6106) - Bugfix: Make reply-cancel button less coarse-grained. (#6106)
- Bugfix: Fixed missing BetterTTV live updates of emotes. (#6132)
- Dev: Conan will no longer generate a `CMakeUserPresets.json` file. (#6117) - Dev: Conan will no longer generate a `CMakeUserPresets.json` file. (#6117)
- Dev: Pass `--force-openssl` when installing from CMake in Qt 6.8+. (#6129) - Dev: Pass `--force-openssl` when installing from CMake in Qt 6.8+. (#6129)
+2 -2
View File
@@ -21,13 +21,13 @@ BttvLiveUpdates::~BttvLiveUpdates()
} }
void BttvLiveUpdates::joinChannel(const QString &channelID, void BttvLiveUpdates::joinChannel(const QString &channelID,
const QString &userName) const QString &userID)
{ {
if (this->joinedChannels_.insert(channelID).second) if (this->joinedChannels_.insert(channelID).second)
{ {
this->subscribe({BttvLiveUpdateSubscriptionChannel{channelID}}); this->subscribe({BttvLiveUpdateSubscriptionChannel{channelID}});
this->subscribe({BttvLiveUpdateBroadcastMe{.twitchID = channelID, this->subscribe({BttvLiveUpdateBroadcastMe{.twitchID = channelID,
.userName = userName}}); .userID = userID}});
} }
} }
+2 -2
View File
@@ -32,9 +32,9 @@ public:
* if it's not already joined. * if it's not already joined.
* *
* @param channelID the Twitch channel-id of the broadcaster. * @param channelID the Twitch channel-id of the broadcaster.
* @param userName the Twitch username of the current user. * @param userID the Twitch user-id of the current user.
*/ */
void joinChannel(const QString &channelID, const QString &userName); void joinChannel(const QString &channelID, const QString &userID);
/** /**
* Parts a twitch channel by its id (without any prefix like 'twitch:') * Parts a twitch channel by its id (without any prefix like 'twitch:')
@@ -79,7 +79,8 @@ QJsonObject BttvLiveUpdateBroadcastMe::encode(bool /*isSubscribe*/) const
root["name"] = "broadcast_me"; root["name"] = "broadcast_me";
QJsonObject data; QJsonObject data;
data["name"] = this->userName; data["provider"] = "twitch";
data["providerId"] = this->userID;
data["channel"] = QString("twitch:%1").arg(this->twitchID); data["channel"] = QString("twitch:%1").arg(this->twitchID);
root["data"] = data; root["data"] = data;
@@ -89,7 +90,7 @@ QJsonObject BttvLiveUpdateBroadcastMe::encode(bool /*isSubscribe*/) const
bool BttvLiveUpdateBroadcastMe::operator==( bool BttvLiveUpdateBroadcastMe::operator==(
const BttvLiveUpdateBroadcastMe &rhs) const const BttvLiveUpdateBroadcastMe &rhs) const
{ {
return this->twitchID == rhs.twitchID && this->userName == rhs.userName; return this->twitchID == rhs.twitchID && this->userID == rhs.userID;
} }
bool BttvLiveUpdateBroadcastMe::operator!=( bool BttvLiveUpdateBroadcastMe::operator!=(
@@ -101,7 +102,7 @@ bool BttvLiveUpdateBroadcastMe::operator!=(
QDebug &operator<<(QDebug &dbg, const BttvLiveUpdateBroadcastMe &data) QDebug &operator<<(QDebug &dbg, const BttvLiveUpdateBroadcastMe &data)
{ {
dbg << "BttvLiveUpdateBroadcastMe{ twitchID:" << data.twitchID dbg << "BttvLiveUpdateBroadcastMe{ twitchID:" << data.twitchID
<< "userName:" << data.userName << '}'; << "userID:" << data.userID << '}';
return dbg; return dbg;
} }
@@ -22,7 +22,7 @@ struct BttvLiveUpdateSubscriptionChannel {
struct BttvLiveUpdateBroadcastMe { struct BttvLiveUpdateBroadcastMe {
QString twitchID; QString twitchID;
QString userName; QString userID;
QJsonObject encode(bool isSubscribe) const; QJsonObject encode(bool isSubscribe) const;
bool operator==(const BttvLiveUpdateBroadcastMe &rhs) const; bool operator==(const BttvLiveUpdateBroadcastMe &rhs) const;
@@ -72,7 +72,7 @@ struct hash<chatterino::BttvLiveUpdateBroadcastMe> {
{ {
size_t seed = 0; size_t seed = 0;
boost::hash_combine(seed, qHash(data.twitchID)); boost::hash_combine(seed, qHash(data.twitchID));
boost::hash_combine(seed, qHash(data.userName)); boost::hash_combine(seed, qHash(data.userID));
return seed; return seed;
} }
}; };
@@ -336,13 +336,14 @@ private:
WebsocketContextPtr onTLSInit(const websocketpp::connection_hdl & /*hdl*/) WebsocketContextPtr onTLSInit(const websocketpp::connection_hdl & /*hdl*/)
{ {
WebsocketContextPtr ctx( WebsocketContextPtr ctx(new boost::asio::ssl::context(
new boost::asio::ssl::context(boost::asio::ssl::context::tlsv12)); boost::asio::ssl::context::tls_client));
try try
{ {
ctx->set_options(boost::asio::ssl::context::default_workarounds | ctx->set_options(boost::asio::ssl::context::default_workarounds |
boost::asio::ssl::context::no_sslv2 | boost::asio::ssl::context::no_tlsv1 |
boost::asio::ssl::context::no_tlsv1_1 |
boost::asio::ssl::context::single_dh_use); boost::asio::ssl::context::single_dh_use);
} }
catch (const std::exception &e) catch (const std::exception &e)
+3 -3
View File
@@ -1021,12 +1021,12 @@ void TwitchChannel::joinBttvChannel() const
{ {
const auto currentAccount = const auto currentAccount =
getApp()->getAccounts()->twitch.getCurrent(); getApp()->getAccounts()->twitch.getCurrent();
QString userName; QString userID;
if (currentAccount && !currentAccount->isAnon()) if (currentAccount && !currentAccount->isAnon())
{ {
userName = currentAccount->getUserName(); userID = currentAccount->getUserId();
} }
getApp()->getBttvLiveUpdates()->joinChannel(this->roomId(), userName); getApp()->getBttvLiveUpdates()->joinChannel(this->roomId(), userID);
} }
} }