From 23231b655477360ae10b4a334a6386b1710bd079 Mon Sep 17 00:00:00 2001 From: Dax Mobile <44842493+daxmobile@users.noreply.github.com> Date: Thu, 19 Dec 2024 23:06:52 +1100 Subject: [PATCH] Update content scope scripts to version 6.43.0 (#5403) - Automated content scope scripts dependency update This PR updates the content scope scripts dependency to the latest available version and copies the necessary files. If tests have failed, see https://app.asana.com/0/1202561462274611/1203986899650836/f for further information on what to do next. - [ ] All tests must pass Co-authored-by: daxmobile --- .../pages/duckplayer/{js => dist}/index.css | 0 .../pages/duckplayer/{js => dist}/index.js | 22 +++++----- .../pages/duckplayer/{js => dist}/inline.js | 2 +- .../{js => dist}/mobile-bg-GCRU67TC.jpg | Bin .../{js => dist}/player-bg-F7QLKTXS.jpg | Bin .../build/android/pages/duckplayer/index.html | 6 +-- .../android/pages/duckplayer/js/storage.js | 32 -------------- .../android/pages/duckplayer/js/utils.js | 40 ------------------ package-lock.json | 4 +- package.json | 2 +- 10 files changed, 18 insertions(+), 90 deletions(-) rename node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/{js => dist}/index.css (100%) rename node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/{js => dist}/index.js (99%) rename node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/{js => dist}/inline.js (90%) rename node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/{js => dist}/mobile-bg-GCRU67TC.jpg (100%) rename node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/{js => dist}/player-bg-F7QLKTXS.jpg (100%) delete mode 100644 node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/storage.js delete mode 100644 node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/utils.js diff --git a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/index.css b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/index.css similarity index 100% rename from node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/index.css rename to node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/index.css diff --git a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/index.js b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/index.js similarity index 99% rename from node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/index.js rename to node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/index.js index 4999e435b990..8119bf66cd0a 100644 --- a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/index.js +++ b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/index.js @@ -1942,7 +1942,7 @@ return null; } - // pages/duckplayer/src/locales/en/duckplayer.json + // pages/duckplayer/public/locales/en/duckplayer.json var duckplayer_default = { smartling: { string_format: "icu", @@ -2004,7 +2004,7 @@ this.focusMode = focusMode; } /** - * @param {keyof import("../../../types/duckplayer").DuckPlayerPageSettings} named + * @param {keyof import("../types/duckplayer.js").DuckPlayerPageSettings} named * @param {{state: 'enabled' | 'disabled'} | null | undefined} settings * @return {Settings} */ @@ -2092,12 +2092,12 @@ }; } var MessagingContext2 = G( - /** @type {import("../src/js/index.js").DuckplayerPage} */ + /** @type {import("../src/index.js").DuckplayerPage} */ {} ); var useMessaging = () => x2(MessagingContext2); var TelemetryContext = G( - /** @type {import("../src/js/index.js").Telemetry} */ + /** @type {import("../src/index.js").Telemetry} */ {} ); var useTelemetry = () => x2(TelemetryContext); @@ -2858,7 +2858,7 @@ } }; - // pages/duckplayer/src/js/utils.js + // pages/duckplayer/src/utils.js function createYoutubeURLForError(href, urlBase) { const valid = VideoParams.forWatchPage(href); if (!valid) return null; @@ -3360,7 +3360,7 @@ } } - // pages/duckplayer/src/js/storage.js + // pages/duckplayer/src/storage.js function deleteStorage(subject) { Object.keys(subject).forEach((key) => { if (key.indexOf("yt-player") === 0) { @@ -3391,7 +3391,7 @@ }); } - // pages/duckplayer/src/js/index.js + // pages/duckplayer/src/index.js var DuckplayerPage = class { /** * @param {import("@duckduckgo/messaging").Messaging} messaging @@ -3403,7 +3403,7 @@ /** * This will be sent if the application has loaded, but a client-side error * has occurred that cannot be recovered from - * @returns {Promise} + * @returns {Promise} */ initialSetup() { if (this.injectName === "integration") { @@ -3427,7 +3427,7 @@ /** * This is sent when the user wants to set Duck Player as the default. * - * @param {import("../../../../types/duckplayer").UserValues} userValues + * @param {import("../types/duckplayer.ts").UserValues} userValues */ setUserValues(userValues) { return this.messaging.request("setUserValues", userValues); @@ -3467,7 +3467,7 @@ * } * ``` * - * @param {(value: import("../../../../types/duckplayer").UserValues) => void} cb + * @param {(value: import("../types/duckplayer.ts").UserValues) => void} cb */ onUserValuesChanged(cb) { return this.messaging.subscribe("onUserValuesChanged", cb); @@ -3501,7 +3501,7 @@ this.messaging = messaging2; } /** - * @param {import('../../../../types/duckplayer').TelemetryEvent} event + * @param {import('../types/duckplayer.ts').TelemetryEvent} event * @internal */ _event(event) { diff --git a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/inline.js b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/inline.js similarity index 90% rename from node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/inline.js rename to node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/inline.js index 6f18bb2bfd2e..41908278e673 100644 --- a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/inline.js +++ b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/inline.js @@ -1,6 +1,6 @@ "use strict"; (() => { - // pages/duckplayer/src/js/inline.js + // pages/duckplayer/src/inline.js var param = new URLSearchParams(window.location.search).get("platform"); if (isAllowed(param)) { document.documentElement.dataset.platform = String(param); diff --git a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/mobile-bg-GCRU67TC.jpg b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/mobile-bg-GCRU67TC.jpg similarity index 100% rename from node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/mobile-bg-GCRU67TC.jpg rename to node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/mobile-bg-GCRU67TC.jpg diff --git a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/player-bg-F7QLKTXS.jpg b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/player-bg-F7QLKTXS.jpg similarity index 100% rename from node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/player-bg-F7QLKTXS.jpg rename to node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/dist/player-bg-F7QLKTXS.jpg diff --git a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/index.html b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/index.html index f48bb6eef269..0c4099075b32 100644 --- a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/index.html +++ b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/index.html @@ -4,11 +4,11 @@ Duck Player - - + +
- + diff --git a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/storage.js b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/storage.js deleted file mode 100644 index be18978d7789..000000000000 --- a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/storage.js +++ /dev/null @@ -1,32 +0,0 @@ -function deleteStorage(subject) { - Object.keys(subject).forEach((key) => { - if (key.indexOf('yt-player') === 0) { - return; - } - subject.removeItem(key); - }); -} - -function deleteAllCookies() { - const cookies = document.cookie.split(';'); - for (let i = 0; i < cookies.length; i++) { - const cookie = cookies[i]; - const eqPos = cookie.indexOf('='); - const name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie; - document.cookie = name + '=;expires=Thu, 01 Jan 1970 00:00:00 GMT;domain=youtube-nocookie.com;path=/;'; - } -} - -export function initStorage() { - window.addEventListener('unload', () => { - deleteStorage(localStorage); - deleteStorage(sessionStorage); - deleteAllCookies(); - }); - - window.addEventListener('load', () => { - deleteStorage(localStorage); - deleteStorage(sessionStorage); - deleteAllCookies(); - }); -} diff --git a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/utils.js b/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/utils.js deleted file mode 100644 index 19781547aeab..000000000000 --- a/node_modules/@duckduckgo/content-scope-scripts/build/android/pages/duckplayer/js/utils.js +++ /dev/null @@ -1,40 +0,0 @@ -import { VideoParams } from 'injected/src/features/duckplayer/util.js'; - -/** - * @param {string} href - * @param {string} urlBase - * @return {null | string} - */ -export function createYoutubeURLForError(href, urlBase) { - const valid = VideoParams.forWatchPage(href); - if (!valid) return null; - - // this will not throw, since it was guarded above - const original = new URL(href); - - // for now, we're only intercepting clicks when `emb_err_woyt` is present - // this may not be enough to cover all situations, but it solves our immediate - // problems whilst keeping the blast radius low - if (original.searchParams.get('feature') !== 'emb_err_woyt') return null; - - // if we get this far, we think a click is occurring that would cause a navigation loop - // construct the 'next' url - const url = new URL(urlBase); - url.searchParams.set('v', valid.id); - - if (typeof valid.time === 'string') { - url.searchParams.set('t', valid.time); - } - - return url.toString(); -} - -/** - * @param {string|null|undefined} iframeTitle - * @return {string | null} - */ -export function getValidVideoTitle(iframeTitle) { - if (typeof iframeTitle !== 'string') return null; - if (iframeTitle === 'YouTube') return null; - return iframeTitle.replace(/ - YouTube$/g, ''); -} diff --git a/package-lock.json b/package-lock.json index 5273b8f69aca..3dbb4812b8bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "dependencies": { "@duckduckgo/autoconsent": "^12.3.0", "@duckduckgo/autofill": "github:duckduckgo/duckduckgo-autofill#16.1.0", - "@duckduckgo/content-scope-scripts": "github:duckduckgo/content-scope-scripts#6.41.0", + "@duckduckgo/content-scope-scripts": "github:duckduckgo/content-scope-scripts#6.43.0", "@duckduckgo/privacy-dashboard": "github:duckduckgo/privacy-dashboard#7.3.0", "@duckduckgo/privacy-reference-tests": "github:duckduckgo/privacy-reference-tests#1734514764" }, @@ -63,7 +63,7 @@ "license": "Apache-2.0" }, "node_modules/@duckduckgo/content-scope-scripts": { - "resolved": "git+ssh://git@github.com/duckduckgo/content-scope-scripts.git#c4bb146afdf0c7a93fb9a7d95b1cb255708a470d", + "resolved": "git+ssh://git@github.com/duckduckgo/content-scope-scripts.git#bc808eb735d9eb72d5c54cf2452b104b6a370e25", "license": "Apache-2.0", "workspaces": [ "injected", diff --git a/package.json b/package.json index fec54817138f..82ee56ef9cc0 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "dependencies": { "@duckduckgo/autoconsent": "^12.3.0", "@duckduckgo/autofill": "github:duckduckgo/duckduckgo-autofill#16.1.0", - "@duckduckgo/content-scope-scripts": "github:duckduckgo/content-scope-scripts#6.41.0", + "@duckduckgo/content-scope-scripts": "github:duckduckgo/content-scope-scripts#6.43.0", "@duckduckgo/privacy-dashboard": "github:duckduckgo/privacy-dashboard#7.3.0", "@duckduckgo/privacy-reference-tests": "github:duckduckgo/privacy-reference-tests#1734514764" }