From 7eda6a08e80685eecc0fb6b2de50c5a31ef0455d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Poizat?= Date: Thu, 28 Nov 2024 11:44:53 +0100 Subject: [PATCH] fix: Do not show inline menu in Cozy Drive and Photos It was displayed for example in sharing modals and album creation modal where it has no interest at all. --- .../autofill-overlay-content.service.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts index 69ee6db2d27..3c9c6697f75 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts @@ -66,6 +66,8 @@ function getAppURLCozy(cozyUrl: string, appName: string, hash: string, nested: b let cozyPasswordsHostnames: string[] = []; let cozyContactsHostnames: string[] = []; let cozyMespapiersHostnames: string[] = []; +let cozyDriveHostnames: string[] = []; +let cozyPhotosHostnames: string[] = []; chrome.storage.local.get("global_environment_environment", (response) => { const storedValue = response?.global_environment_environment?.value; @@ -85,6 +87,14 @@ chrome.storage.local.get("global_environment_environment", (response) => { new URL(getAppURLCozy(parsedValue.urls.base, "mespapiers", "", true)).hostname, new URL(getAppURLCozy(parsedValue.urls.base, "mespapiers", "", false)).hostname, ]; + cozyDriveHostnames = [ + new URL(getAppURLCozy(parsedValue.urls.base, "drive", "", true)).hostname, + new URL(getAppURLCozy(parsedValue.urls.base, "drive", "", false)).hostname, + ]; + cozyPhotosHostnames = [ + new URL(getAppURLCozy(parsedValue.urls.base, "photos", "", true)).hostname, + new URL(getAppURLCozy(parsedValue.urls.base, "photos", "", false)).hostname, + ]; } }); // Cozy customization end @@ -1221,6 +1231,14 @@ export class AutofillOverlayContentService implements AutofillOverlayContentServ return true; } + if (cozyDriveHostnames.find((hostname) => hostname === url.hostname)) { + return true; + } + + if (cozyPhotosHostnames.find((hostname) => hostname === url.hostname)) { + return true; + } + return false; } catch { // do nothing is new URL is invalid