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

fix: youtube & iframe util from packages/ui to main source #1884

Merged
merged 7 commits into from
Sep 19, 2024

Conversation

smalluban
Copy link
Collaborator

@smalluban smalluban commented Sep 16, 2024

  • Moves out youtube from packages/ui to the main source
  • Moves and cleans up the iframe feature
  • The notification flows go through the background process and single content script (avoids duplication of the mounting mechanism in Youtube content script)
  • Adds pages/notifications to group all notifications in one path
  • Cleans up the opera-serp util
  • Adds debugMode for easier testing and stagingMode for allowing engines to update from staging CDN

I tested the Youtube Wall notification (Chrome, Firefox, Safari) and Opera Serp (Opera).

@smalluban smalluban force-pushed the fix-youtube-and-iframe-util branch 3 times, most recently from af6e22e to 7e22997 Compare September 16, 2024 14:08
@smalluban smalluban force-pushed the fix-youtube-and-iframe-util branch from 7e22997 to 23ad974 Compare September 16, 2024 14:25
@smalluban smalluban force-pushed the fix-youtube-and-iframe-util branch from 96c9467 to 7eafd79 Compare September 17, 2024 09:11
@smalluban smalluban marked this pull request as ready for review September 17, 2024 13:36
const TEST_COOKIE_NAME = `ghostery:opera:cookie:test:${Date.now()}`;

let isSupported = undefined;
export async function isSerpSupported() {
Copy link
Member

Choose a reason for hiding this comment

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

From what I see, this function may be called concurrently. If so, could setting the cookies then conflict?

Copy link
Collaborator Author

@smalluban smalluban Sep 18, 2024

Choose a reason for hiding this comment

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

I think setting the cookie just overwrites the values when called multiple times. I carefully tested the feature on Opera, and I haven't found issues.

Copy link
Member

@chrmod chrmod left a comment

Choose a reason for hiding this comment

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

The cleanup looks good. Only few nits to cleanup.

@@ -57,13 +57,14 @@ if (argv.target.startsWith('safari')) {
argv.target = 'safari';
}

// Add flags to manifest
if (argv.debug) manifest.debug = true;
if (argv.staging) manifest.staging = true;
Copy link
Member

Choose a reason for hiding this comment

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

was wondering why you "invent" the stating mode, but from the other changes it looks like it was implicitly there for some subsystems.

We have to decide how those modes should work.

Historically:

  • debug - was setting all backends to staging and was enabling some additional logging
  • staging - was recently introduced to download adblocker engines from the staging environment

It looks like we have 3 separate aspects to deal with:

  • debugging of the addon (logs, some settings like opera serp, scritplets debugging)
  • adblocker engines environment
  • backends (staging vs production)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The staging mode usually does not work. They it yourself. The engines are not updated there (I suppose we have to trigger it manually).

Firstly, there was only a debug mode, but with that issue I had to add separate flag for loading engines from staging.

Copy link
Member

Choose a reason for hiding this comment

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

ah, so you mean even if we downloaded staging engine pre-build, they would update to production engine in the runtime anyways?

I'm fine to keep the staging mode. Shall we then update all endpoints configuration to use stagingMode instead of debugMode?

Copy link
Collaborator Author

@smalluban smalluban Sep 18, 2024

Choose a reason for hiding this comment

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

npm start -- --staging fails... as the staging CDN does not have the proper version of the engines..

For me --staging should only set the engines' endpoints - as this must be used only when we know that we pushed something to the staging CDN for engines and only engines.

Error: Engine "dnr-ads" for "669" engine version not found
    at file:///Users/dominik/Workspace/ghostery-extension/extension-manifest-v3/scripts/download-engines.js:89:11
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Copy link
Member

Choose a reason for hiding this comment

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

the problem occurs as we don't create staging engines on every adblocker release - perhaps we should. When this happen please reach out so we can schedule a CI build.

@smalluban smalluban merged commit 8dd540e into main Sep 19, 2024
2 checks passed
@smalluban smalluban deleted the fix-youtube-and-iframe-util branch September 19, 2024 07:37
@smalluban smalluban mentioned this pull request Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants