-
Notifications
You must be signed in to change notification settings - Fork 895
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
[WIP] Publisher access pass #3565
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Run some code when the page is loaded (now or future) - Run some code when the URL changes via history.pushState / replaceState - Run some code only when the page first becomes visible (in case the tab is loaded in the background) - Generate random / semi-unique ID for inter-script communication - Inject some code from content script to a document - Wait for and get some global variable from the document to the content script
…ript, including article count tracking
…ll, only use publisher-site-specific on-paywall-shown 'event'
…ss status between content-script and background script For some reason I'm still keeping around content-script-paywall-bypass possibility, maybe we will have to do that in the future. Otherwise the reload could be done in background script immediately after doing the background-script-paywall-bypass.
petemill
force-pushed
the
publisher-access-pass
branch
from
September 30, 2019 20:29
ffda0bb
to
bf94520
Compare
petemill
added
CI/skip-android
Do not run CI builds for Android
CI/skip-ios
Do not run CI builds for iOS
CI/skip-linux
labels
Sep 30, 2019
32 tasks
petemill
added a commit
that referenced
this pull request
Oct 10, 2019
Introduces `chrome.{ braveRewards, braveShields }.openBrowserActionUI(optional tabId, optional relativePath)`. Several upcoming features require being able to summon a dialog attached to Shields or Rewards icons from some other user action that is not clicking on the icon buttons (the only current way to open the dialogs). These features include: • Offering to bypass paywalls (Publisher Access Pass) • Offering to turn shields off (Webcompat detection) • Offering to opt-in to Rewards or complete a Rewards captcha The API allows a custom path to be sent to open a specific HTML page other than the one configured for the active tab, e.g. offer-paywall.html, solve-captcha.html etc The API will default to the current tab, which only works when called from a WebUI page. When called from a background script, a tabId will need to be provided so that the popup is shown on a compatible active or recently-active window (and not, e.g., a devtools window). This was prototyped for the Publisher Access Pass concept at #3565 and modified for this PR. If there is a webui page which has access to chrome.braveShields or chrome.braveRewards API, then simply call `chrome.brave{Shields | Rewards}.openBrowserActionUI()` and `chrome.brave{Shields | Rewards}.openBrowserActionUI('fake-page.html)` to test. A popup should open on the current window Open chrome://inspect, switch to the Extensions tab, and inspect either the Rewards or Brave extension. Then use the following API calls: ``` const tabId = (await chrome.tabs.queryAsync({ active: true }))[0].id chrome.braveShields.openBrowserActionUI(tabId) ``` ``` const tabId = (await chrome.tabs.queryAsync({ active: true }))[0].id chrome.braveShields.openBrowserActionUI(tabId, 'fake-page.html') ```
petemill
added a commit
to petemill/brave-core
that referenced
this pull request
Oct 24, 2019
Introduces `chrome.{ braveRewards, braveShields }.openBrowserActionUI(optional windowId, optional relativePath)`. Several upcoming features require being able to summon a dialog attached to Shields or Rewards icons from some other user action that is not clicking on the icon buttons (the only current way to open the dialogs). These features include: • Offering to bypass paywalls (Publisher Access Pass) • Offering to turn shields off (Webcompat detection) • Offering to opt-in to Rewards or complete a Rewards captcha The API allows a custom path to be sent to open a specific HTML page other than the one configured for the active tab, e.g. offer-paywall.html, solve-captcha.html etc The API will default to the current window for the profile, which only works when called from a WebUI page. When called from a background script, a windowId will need to be provided so that the popup is shown on a compatible active or recently-active window (and not, e.g., a devtools window). This was prototyped for the Publisher Access Pass concept at brave#3565 and modified for this PR to use the Observer pattern. If there is a webui page which has access to chrome.braveShields or chrome.braveRewards API, then simply call `chrome.brave{Shields | Rewards}.openBrowserActionUI()` and `chrome.brave{Shields | Rewards}.openBrowserActionUI('fake-page.html)` to test. A popup should open on the current window Test Plan: Open chrome://inspect, switch to the Extensions tab, and inspect either the Rewards or Brave extension. Then use the following API calls, one at a time (uncomment the line you wish to run): ``` chrome.windows.getAll(wins => { // test that we can open in a specified window // chrome.braveShields.openBrowserActionUI(wins[0].id) // test that we can specify a page (should be 404 though!) // chrome.braveShields.openBrowserActionUI(wins[0].id, 'another.html) }) // Test that we can call in the 'active' window (e.g. if the call is made from NTP, which is the intention for rewards). Run this command then switch focus to an actual browser window for the profile. // setTimeout(() => chrome.braveShields.openBrowserActionUI('popup.html?grant-id=42'), 2000) // And with the default popup html // setTimeout(() => chrome.braveShields.openBrowserActionUI(), 2000) ``` Then create or open another profile at the same time, and verify that calling the API from one profile cannot open a popup in a window id from another profile. Also check that the API works for the other profile.
petemill
added a commit
that referenced
this pull request
Oct 24, 2019
Introduces `chrome.{ braveRewards, braveShields }.openBrowserActionUI(optional windowId, optional relativePath)`. Several upcoming features require being able to summon a dialog attached to Shields or Rewards icons from some other user action that is not clicking on the icon buttons (the only current way to open the dialogs). These features include: • Offering to bypass paywalls (Publisher Access Pass) • Offering to turn shields off (Webcompat detection) • Offering to opt-in to Rewards or complete a Rewards captcha The API allows a custom path to be sent to open a specific HTML page other than the one configured for the active tab, e.g. offer-paywall.html, solve-captcha.html etc The API will default to the current window for the profile, which only works when called from a WebUI page. When called from a background script, a windowId will need to be provided so that the popup is shown on a compatible active or recently-active window (and not, e.g., a devtools window). This was prototyped for the Publisher Access Pass concept at #3565 and modified for this PR to use the Observer pattern. If there is a webui page which has access to chrome.braveShields or chrome.braveRewards API, then simply call `chrome.brave{Shields | Rewards}.openBrowserActionUI()` and `chrome.brave{Shields | Rewards}.openBrowserActionUI('fake-page.html)` to test. A popup should open on the current window Test Plan: Open chrome://inspect, switch to the Extensions tab, and inspect either the Rewards or Brave extension. Then use the following API calls, one at a time (uncomment the line you wish to run): ``` chrome.windows.getAll(wins => { // test that we can open in a specified window // chrome.braveShields.openBrowserActionUI(wins[0].id) // test that we can specify a page (should be 404 though!) // chrome.braveShields.openBrowserActionUI(wins[0].id, 'another.html) }) // Test that we can call in the 'active' window (e.g. if the call is made from NTP, which is the intention for rewards). Run this command then switch focus to an actual browser window for the profile. // setTimeout(() => chrome.braveShields.openBrowserActionUI('popup.html?grant-id=42'), 2000) // And with the default popup html // setTimeout(() => chrome.braveShields.openBrowserActionUI(), 2000) ``` Then create or open another profile at the same time, and verify that calling the API from one profile cannot open a popup in a window id from another profile. Also check that the API works for the other profile.
@petemill do we still need this one can we close it and reopen it later if needed? |
@NejcZdovc I think it's safe to close 😄 I'll leave the branch as-is, just in case! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Demo purposes. Not marked as draft in order to get CI builds.