Prevent user from entering incorrect characters in Live Notifications channels list (#3715)

Co-authored-by: Sidd <iProdigy@users.noreply.github.com>
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
kornes
2022-05-08 10:27:25 +00:00
committed by GitHub
parent fd44f30c7d
commit 07dd8c560b
11 changed files with 199 additions and 0 deletions
+22
View File
@@ -5,6 +5,12 @@
namespace chatterino {
namespace {
const auto TWITCH_USER_LOGIN_PATTERN = R"(^[a-z0-9]\w{0,24}$)";
} // namespace
void openTwitchUsercard(QString channel, QString username)
{
QDesktopServices::openUrl("https://www.twitch.tv/popout/" + channel +
@@ -35,4 +41,20 @@ void stripChannelName(QString &channelName)
}
}
QRegularExpression twitchUserNameRegexp()
{
static QRegularExpression re(
TWITCH_USER_LOGIN_PATTERN,
QRegularExpression::PatternOption::CaseInsensitiveOption);
return re;
}
QRegularExpression twitchUserLoginRegexp()
{
static QRegularExpression re(TWITCH_USER_LOGIN_PATTERN);
return re;
}
} // namespace chatterino