-
Notifications
You must be signed in to change notification settings - Fork 873
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
Panel, tipping, and favicon should now be working correctly for twitch publishers #888
Panel, tipping, and favicon should now be working correctly for twitch publishers #888
Conversation
...brave_rewards/resources/extension/brave_rewards/background/reducers/rewards_panel_reducer.ts
Outdated
Show resolved
Hide resolved
components/brave_rewards/resources/extension/brave_rewards/manifest.json
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- if you go to https://www.twitch.tv/directory/game/Fortnite you get
It should be regular twitch publisher info. Same happens for https://app.twitch.tv/download, https://www.twitch.tv/p/partners, https://help.twitch.tv/customer/en/portal/articles/658863-creating-an-account-with-twitch, etc
-
seeing a lot of empty logs like this
[87144:775:1205/103540.829246:VERBOSE1:bat_get_media.cc(62)] Media Id:
-
please open security review for it
-
I get this errors when I close browser
[87144:775:1205/104748.100851:INFO:CONSOLE(0)] "Error handling response: TypeError: Cannot read property '0' of undefined
at chrome-extension://jidkidbbcafjabdphckchenhfomhnfma/out/brave_rewards_panel_background.bundle.js:426:35", source: chrome-extension://jidkidbbcafjabdphckchenhfomhnfma/_generated_background_page.html (0)
[87144:775:1205/104748.172842:INFO:CONSOLE(0)] "Unchecked runtime.lastError: Cannot access contents of url "https://app.twitch.tv/download". Extension manifest must request permission to access this host.", source: chrome-extension://jidkidbbcafjabdphckchenhfomhnfma/_generated_background_page.html (0)
'<img class=\"tw-avatar__img tw-image\" alt=\"' | ||
let itr = 0 | ||
const limit = 20 | ||
let interval = setInterval(function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this effect responsiveness of twitch in anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
who clears interval is you close panel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interval is cleared at limit
still if panel is closed. Although it still clears it can be restarted by opening the panel again. I would think we could set the limit down to 4 or 5 (vice 20). wdyt?
Even under a development run I do not notice any considerable difference in performance when interacting with the site. This is a small line of eval code that returns the outerHtml that, when generated with the parts we need, equates to roughly 220Kb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we clear interval as soon as you close panel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There may be a way but it would involve setting a local storage flag whenever panel is opened and then resetting it when it closes.
example:
chrome.runtime.onConnect.addListener(function (externalPort) {
chrome.storage.local.set({
'rewards_panel_open': true
})
externalPort.onDisconnect.addListener(function () {
chrome.storage.local.set({
'rewards_panel_open': false <-- we would read from local storage in the interval function after this is set and clear it
})
})
})
I'm in the process of testing this now but do you see any immediate problems that could lead to inconsistencies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition, we seem to get the information we need right away, so I would also want to shorten the limit as a safeguard fallback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So using the above, we are able to clear the timeout when the panel is closed. Test is successful. Let me know if your tests are satisfactory and I'll remove it.
Fixed. Added a separate "getPublisherData" call that is specific to twitch pages. We hand off to |
I moved it below to prevent log spamming. (native-ledger) |
"I get this errors when I close browser" clearing the interval when closing the panel should minimize the first error. I've modified the scripting to only include 'www' twitch urls. We don't need info from other subdomains. |
...brave_rewards/resources/extension/brave_rewards/background/reducers/rewards_panel_reducer.ts
Outdated
Show resolved
Hide resolved
...brave_rewards/resources/extension/brave_rewards/background/reducers/rewards_panel_reducer.ts
Outdated
Show resolved
Hide resolved
...brave_rewards/resources/extension/brave_rewards/background/reducers/rewards_panel_reducer.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments above. also needs tests.
...brave_rewards/resources/extension/brave_rewards/background/reducers/rewards_panel_reducer.ts
Outdated
Show resolved
Hide resolved
...brave_rewards/resources/extension/brave_rewards/background/reducers/rewards_panel_reducer.ts
Outdated
Show resolved
Hide resolved
Still one small intermittent issue but I don't think we will see it on a release build. If panel is open when a new page is about to load or loading, It could populate the publisher and then switch back to twitch. Closing the panel and reopening will mitigate. |
Fixes brave/brave-browser#2089 Fixes brave/brave-browser#1521 Updates for twitch panel Add conditional for verified favicon Testing vod vs live favicon pull Adding conditional and fixing var name Cleaning up debug code Added pointer check and verified becoming non-verified check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two follow up's that we need to do, otherwise looks good
Fixes brave/brave-browser#1814
Fixes brave/brave-browser#2089
Fixes brave/brave-browser#1521
Rebased off of brave-intl/bat-native-ledger#177
Submitter Checklist:
npm test brave_unit_tests && npm test brave_browser_tests
) ongit rebase master
(if needed).git rebase -i
to squash commits (if needed).Test Plan:
EDIT: Favicon should only show for verified publishers
Reviewer Checklist: