feat: Implemented Flattr API [#1370]
This MR contains the following changes:
- Added src/bypass/.
- Added content script for exposing public API via DOM events.
- Added background script to authenticate incoming requests.
- Updated build scripts accordingly.
- Added "premium.getAuthPayload" trusted message.
- Added
getAuthPayload()
function to src/premium/. - Added "bypass_authorizedKeys" preference to make the feature easier to test.
- Added browser.d.ts file to avoid having to declare the global in each file - similar to ext.d.ts.
- Adjusted js/api/ modules accordingly.
Additionally, it includes a Firefox-specific fix.
It implements the following flow based on Adblock Plus 3.16.3rc:
- (website)
"flattr-request-payload" event - content: bypass
"premium.getAuthPayload" message - background: bypass
- background: premium
"premium_license_check_url" HTTP request - (server)
Note that these changes are based on 3.16.x, so the content script is generated using npm-dollar and rollup. This means that we'll need to change that to be done using webpack when we rebase those changes onto next.