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

Update TwitchAdSolutions scripts #204

Closed
wants to merge 5 commits into from
Closed

Update TwitchAdSolutions scripts #204

wants to merge 5 commits into from

Conversation

ryanbr
Copy link
Collaborator

@ryanbr ryanbr commented Aug 21, 2024

Re-sync with changes pixeltris/TwitchAdSolutions@144bc99

pixeltris/TwitchAdSolutions#276 (comment)

Adds the Worker check from AdGuard Extra which fixes the black screen / infinite loading wheel

@diracdeltas for a JS review

@ryanbr ryanbr self-assigned this Aug 21, 2024
hookWindowWorker();
hookFetch();
// This stops Twitch from pausing the player when in another tab and an ad shows.
// Taken from https://github.com/saucettv/VideoAdBlockForTwitch/blob/cefce9d2b565769c77e3666ac8234c3acfe20d83/chrome/content.js#L30

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pixeltris
Copy link

pixeltris commented Aug 21, 2024

Unfortunately I had to modify the worker check pixeltris/TwitchAdSolutions@0863c6d due to pixeltris/TwitchAdSolutions#277

I can't think of a way to avoid the loading wheel with the current version of TTV LOL PRO

hookFetch();
function onContentLoaded() {
// This stops Twitch from pausing the player when in another tab and an ad shows.
// Taken from https://github.com/saucettv/VideoAdBlockForTwitch/blob/cefce9d2b565769c77e3666ac8234c3acfe20d83/chrome/content.js#L30

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

[puLL-Merge] - brave/adblock-resources@204

Description

This pull request makes significant changes to the project structure and workflow, primarily focusing on updating the CI process, modernizing JavaScript code, and enhancing ad-blocking scripts for Twitch. The changes aim to improve code quality, maintainability, and the overall functionality of the ad-blocking resources.

Changes

Changes

  1. .github/workflows/ci.yml:

    • Added a new comprehensive CI workflow that replaces the previous json_verify.yml and verify_metadata.yml.
    • The new workflow includes steps for verifying JSON files, confirming built resources, and checking formatting.
  2. build.js, generateMetadataJsonFromScriptResources.js, index.js:

    • Updated to use ES module syntax instead of CommonJS.
    • Replaced require statements with import statements.
    • Updated file path references to use import.meta.dirname.
  3. package.json:

    • Added "type": "module" to enable ES module syntax by default.
  4. resources/vaft-ublock-origin.js and resources/video-swap-new-ublock-origin.js:

    • Significant updates to the ad-blocking scripts for Twitch.
    • Refactored code to improve organization and readability.
    • Added new functionality to handle Twitch's ad-serving mechanisms more effectively.
    • Introduced a hookWindowWorker function to intercept and modify Twitch's web worker behavior.
  5. verify.js:

    • Updated to use ES module syntax.
    • Added a new function getIDFromBase64PublicKey for generating component IDs.
    • Enhanced tests to verify component IDs against public keys.

Possible Issues

  1. The transition to ES modules might cause compatibility issues with environments or tools that expect CommonJS modules.
  2. The changes to the Twitch ad-blocking scripts are extensive and may introduce unexpected behavior or break existing functionality if not thoroughly tested.

Security Hotspots

  1. The ad-blocking scripts modify browser behavior and interact with Twitch's content. While no immediate vulnerabilities are apparent, these scripts should be carefully reviewed to ensure they don't introduce security risks or violate Twitch's terms of service.

  2. The getIDFromBase64PublicKey function in verify.js performs cryptographic operations. While it appears to be used for testing purposes, ensure that it's not used in a security-critical context without proper review.

@ryanbr
Copy link
Collaborator Author

ryanbr commented Aug 21, 2024

Messed up PR. will do this again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants