Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 7 commits into from May 8, 2022

Conversation

kornes
Copy link
Contributor

@kornes kornes commented May 7, 2022

Pull request checklist:

  • CHANGELOG.md was updated, if applicable

Description

Live notifications for channels which are not open in tabs are queried by user supplied names, in single call to Helix /streams.
Twitch will return error 400 Bad Request, when one of passed channel names will contain illegal characters.

That will cause chatterino to silently fail and not deliver any notifications, even for correct names on the list

chatterino.http: "GET 400 https://api.twitch.tv/helix/streams?user_login=_EsfandTV&user_login=georgehotz"
chatterino.notification: Failed to fetch live status for  ("_EsfandTV", "georgehotz")

This PR fixes that by adding input validation support for TableView in editor mode.
User won't be allowed to enter characters not matching pattern of correct twitch username:

  • no special characters at position 0
  • following, only 0-9 A-Z a-z and _
  • min length of 1, max 25 (although Helix currently doesn't care about this one)

src/util/Twitch.hpp Outdated Show resolved Hide resolved
kornes and others added 3 commits May 7, 2022 20:16
src/util/Twitch.hpp Outdated Show resolved Hide resolved
Add unit tests for the regular expressions to validate our assumptions
@pajlada pajlada enabled auto-merge (squash) May 8, 2022 10:13
@pajlada pajlada changed the title Fix live notifications from failing when channel name is incorrect Prevent user from entering incorrect characters in Live Notifications channels list May 8, 2022
@pajlada pajlada merged commit 07dd8c5 into Chatterino:master May 8, 2022
@Mm2PL Mm2PL mentioned this pull request Aug 4, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants