Commit graph

6 commits

Author SHA1 Message Date
Kevin Raoofi
94af57b809 Fix CORS errors in content script
Move fetch requests to background page. Include a dirty cache so that
same requests don't get made over and over again as settings change.
2021-04-20 23:22:19 -04:00
Kevin Raoofi
7954c29482 Watch-on-Lbry button
* Created a content script for YouTube that injects a styled button
* Automatically pause the video when redirecting to the app

The button location is rather finicky as certain polymer components
seem to move around, causing random DOM elements to appear all over the
place if it's not a "singleton" component.

squash
2020-10-28 05:21:49 -04:00
Kevin Raoofi
deac83e656 Bug fixes
Subscription converter didn't handle error responses very well.
Also, the chunk size was lowered to 300 as this seems to make requests
failing.

Additionally, fix bug where redirect was trying to go to the app and a frontend at the same time, only to confuse lbry.tv
2020-10-13 06:45:51 -04:00
Kevin Raoofi
9f8e521fa6 URL parsing for app redirects
URL parsing logic is basically a straight port of how lbryio/lbry-sdk
parses lbry URLs. While there's a lot more going on, it should be
easier to follow what they're doing this way.

Also, added some light unit tests for the URL parsing using jest.
Which, of course, needed a babel config.

With this, tabOnUpdated was able to be rewritten more elegantly to
handle redirects as it delegates a lot of the work to utilities now.
2020-10-13 05:39:47 -04:00
Kevin Raoofi
da5cc12a7b ytService and rewrite of YTtoLBRY
YTtoLBRY:

* Use DOMParser for reading OPML
  * OPML parsing was quite brittle as it relied on string parsing
* Removed dead script inclusion in the HTML page
* Removed global state variables
* Use fetch to clean up the query logic
* Promisified file, API calls, and settings querying to simplify logic

Many of the utilities involving APIs were isolated to a common module.
Particularly, ytService contains all methods for extracting IDs,
querying for the lbry URLs, parsing OPML, and more.

This functionally is heavily used in YTtoLBRY and lightly used by
tabsOnUpdated.
2020-10-13 05:17:44 -04:00
Kevin Raoofi
48f88da6aa Common settings module
* settings module as single source of truth and provides utilities,
  defaults, constants, and typing
* runtimeOnStartup and storageOnChanged were merged into storageSetup
* storageSetup reworked to use settings for seamless additions
* tabOnUpdated and YTtoLBRY updated to use settings for URL prefixes
2020-10-13 05:17:44 -04:00