Skip to content

Commit

Permalink
Change order of query parameters of Twitch Player URLs. (Chatterino#5326
Browse files Browse the repository at this point in the history
)

This ensures that it doesn't "fake redirect".

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
  • Loading branch information
mavjs and pajlada authored Apr 18, 2024
1 parent 86a2782 commit 7c97e6b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Bugfix: Fixed links having `http://` added to the beginning in certain cases. (#5323)
- Bugfix: Fixed topmost windows from losing their status after opening dialogs on Windows. (#5330)
- Bugfix: Fixed a gap appearing when using filters on `/watching`. (#5329)
- Dev: Changed the order of the query parameters for Twitch player URLs. (#5326)

## 2.5.0-beta.1

Expand Down
3 changes: 3 additions & 0 deletions src/common/Common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

namespace chatterino {

const inline auto TWITCH_PLAYER_URL =
QStringLiteral("https://player.twitch.tv/?channel=%1&parent=twitch.tv");

enum class HighlightState {
None,
Highlighted,
Expand Down
3 changes: 1 addition & 2 deletions src/providers/twitch/TwitchChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ TwitchChannel::TwitchChannel(const QString &name)
, nameOptions{name, name, name}
, subscriptionUrl_("https://www.twitch.tv/subs/" + name)
, channelUrl_("https://twitch.tv/" + name)
, popoutPlayerUrl_("https://player.twitch.tv/?parent=twitch.tv&channel=" +
name)
, popoutPlayerUrl_(TWITCH_PLAYER_URL.arg(name))
, bttvEmotes_(std::make_shared<EmoteMap>())
, ffzEmotes_(std::make_shared<EmoteMap>())
, seventvEmotes_(std::make_shared<EmoteMap>())
Expand Down
6 changes: 3 additions & 3 deletions src/singletons/Toasts.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "Toasts.hpp"

#include "Application.hpp"
#include "common/Common.hpp"
#include "common/Literals.hpp"
#include "common/QLogging.hpp"
#include "common/Version.hpp"
Expand Down Expand Up @@ -177,9 +178,8 @@ class CustomHandler : public WinToastLib::IWinToastHandler
case ToastReaction::OpenInPlayer:
if (platform_ == Platform::Twitch)
{
QDesktopServices::openUrl(QUrl(
u"https://player.twitch.tv/?parent=twitch.tv&channel=" %
channelName_));
QDesktopServices::openUrl(
QUrl(TWITCH_PLAYER_URL.arg(channelName_)));
}
break;
case ToastReaction::OpenInStreamlink: {
Expand Down
3 changes: 1 addition & 2 deletions src/widgets/splits/Split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,7 @@ void Split::openChannelInBrowserPlayer(ChannelPtr channel)
if (auto *twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
{
QDesktopServices::openUrl(
"https://player.twitch.tv/?parent=twitch.tv&channel=" +
twitchChannel->getName());
QUrl(TWITCH_PLAYER_URL.arg(twitchChannel->getName())));
}
}

Expand Down

0 comments on commit 7c97e6b

Please sign in to comment.