diff --git a/src/drivers/webextension/_locales/ca/messages.json b/src/drivers/webextension/_locales/ca/messages.json index 03409d3ec..e08acdc04 100644 --- a/src/drivers/webextension/_locales/ca/messages.json +++ b/src/drivers/webextension/_locales/ca/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Enviar les tecnologies identificades de forma anònima a wappalyzer.com" }, "optionThemeMode": { "message": "Habilitar la compatibilitat de la manera fosc." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Res a fer aquí." }, "noAppsDetected": { "message": "No s'ha detectat cap tecnologia." }, "categoryPin": { "message": "Mostrar sempre la icona" }, diff --git a/src/drivers/webextension/_locales/de/messages.json b/src/drivers/webextension/_locales/de/messages.json index 4d4ac58b9..380eeeb36 100644 --- a/src/drivers/webextension/_locales/de/messages.json +++ b/src/drivers/webextension/_locales/de/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Anonyme Statistiken an wappalyzer.com übermitteln" }, "optionThemeMode": { "message": "Aktivieren dunklen Modus Kompatibilität." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Nichts zu tun." }, "noAppsDetected": { "message": "Keine Applikation entdeckt." }, "categoryPin": { "message": "Immer Icon anzeigen" }, diff --git a/src/drivers/webextension/_locales/el/messages.json b/src/drivers/webextension/_locales/el/messages.json index fc87b0f73..97b47231b 100644 --- a/src/drivers/webextension/_locales/el/messages.json +++ b/src/drivers/webextension/_locales/el/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Ανώνυμη αποστολή αναφορών για εντοπισμένες εφαρμογές στο wappalyzer.com για έρευνα" }, "optionThemeMode": { "message": "Ενεργοποίηση συμβατότητας σκοτεινό τρόπο." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Καμία ενέργεια." }, "noAppsDetected": { "message": "Δεν ανιχνεύθηκαν εφαρμογές." }, "categoryPin": { "message": "Always show icon" }, diff --git a/src/drivers/webextension/_locales/en/messages.json b/src/drivers/webextension/_locales/en/messages.json index 3e9dc4eb5..c96ec36ec 100644 --- a/src/drivers/webextension/_locales/en/messages.json +++ b/src/drivers/webextension/_locales/en/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Anonymously send identified technologies to wappalyzer.com" }, "optionThemeMode": { "message": "Enable dark mode compatibility" }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Nothing to do here." }, "noAppsDetected": { "message": "No technologies detected." }, "categoryPin": { "message": "Always show icon" }, diff --git a/src/drivers/webextension/_locales/es/messages.json b/src/drivers/webextension/_locales/es/messages.json index 6f7493571..8027b9a5e 100644 --- a/src/drivers/webextension/_locales/es/messages.json +++ b/src/drivers/webextension/_locales/es/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Enviar informes anónimos sobre las aplicaciones detectadas a wappalyzer.com para análisis" }, "optionThemeMode": { "message": "Habilitar la compatibilidad del modo oscuro." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Nada que hacer aquí." }, "noAppsDetected": { "message": "Aplicaciones no detectadas." }, "categoryPin": { "message": "Always show icon" }, diff --git a/src/drivers/webextension/_locales/fa/messages.json b/src/drivers/webextension/_locales/fa/messages.json index 3590d4152..3965349ed 100644 --- a/src/drivers/webextension/_locales/fa/messages.json +++ b/src/drivers/webextension/_locales/fa/messages.json @@ -11,6 +11,8 @@ "optionThemeMode": { "message": "فعال کردن حالت سازگاری تاریک." }, "nothingToDo": { "message": "هیچ چیز برای انجام اینجا نیست." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "noAppsDetected": { "message": "هیچ فن‌آوری شناسایی نشده است." }, "categoryPin": { "message": "همیشه نماد را نشان بده" }, "termsAccept": { "message": "قبول" }, diff --git a/src/drivers/webextension/_locales/fr/messages.json b/src/drivers/webextension/_locales/fr/messages.json index 97771540e..3126df07d 100644 --- a/src/drivers/webextension/_locales/fr/messages.json +++ b/src/drivers/webextension/_locales/fr/messages.json @@ -10,6 +10,8 @@ "optionsSave": { "message": "Sauvegarder les options" }, "optionsSaved": { "message": "Sauvegardé" }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "twitter": { "message": "Suivre Wappalyzer sur Twitter" }, "website": { "message": "Aller sur wappalyzer.com" }, "categoryPin": { "message": " Toujours afficher l'icône" }, diff --git a/src/drivers/webextension/_locales/gl_ES/messages.json b/src/drivers/webextension/_locales/gl_ES/messages.json index 1e3771094..db0aa24bf 100644 --- a/src/drivers/webextension/_locales/gl_ES/messages.json +++ b/src/drivers/webextension/_locales/gl_ES/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Envía anonimamente aplicativos identificados a wappalyzer.com" }, "optionThemeMode": { "message": "Permitir a compatibilidade modo escuro." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Nada que facer por aquí." }, "noAppsDetected": { "message": "Non se identificaron aplicativos." }, "categoryPin": { "message": "Amosar sempre icono" }, diff --git a/src/drivers/webextension/_locales/gr/messages.json b/src/drivers/webextension/_locales/gr/messages.json index 15f320401..615275d5f 100644 --- a/src/drivers/webextension/_locales/gr/messages.json +++ b/src/drivers/webextension/_locales/gr/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Ανώνυμη αποστολή αναφορών για εντοπισμένες εφαρμογές στο wappalyzer.com για έρευνα" }, "optionThemeMode": { "message": "Ενεργοποίηση συμβατότητας σκοτεινό τρόπο." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Καμία ενέργεια." }, "noAppsDetected": { "message": "Δεν ανιχνεύθηκαν εφαρμογές." }, "categoryPin": { "message": "Always show icon" }, diff --git a/src/drivers/webextension/_locales/id/messages.json b/src/drivers/webextension/_locales/id/messages.json index 300a4e639..0fab2d472 100644 --- a/src/drivers/webextension/_locales/id/messages.json +++ b/src/drivers/webextension/_locales/id/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Secara anonim kirimkan laporan tentang aplikasi yang terdeteksi ke wappalyzer.com untuk penelitian" }, "optionThemeMode": { "message": "Aktifkan kompatibilitas modus gelap." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Tak ada yang dilakukan disini." }, "noAppsDetected": { "message": "Tidak ada aplikasi yang terdeteksi." }, "categoryPin": { "message": "Always show icon" }, diff --git a/src/drivers/webextension/_locales/it/messages.json b/src/drivers/webextension/_locales/it/messages.json index 4c1e3b89b..e4d107851 100644 --- a/src/drivers/webextension/_locales/it/messages.json +++ b/src/drivers/webextension/_locales/it/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Inviare anonimamente un report sulle applicazioni rilevate a wappalyzer.com per l'analisi" }, "optionThemeMode": { "message": "Abilita compatibilità con la modalità scura." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Niente da fare qui." }, "noAppsDetected": { "message": "Nessuna applicazione rilevata." }, "categoryPin": { "message": "Always show icon" }, diff --git a/src/drivers/webextension/_locales/ja/messages.json b/src/drivers/webextension/_locales/ja/messages.json index a98fd900c..3b3d095a8 100644 --- a/src/drivers/webextension/_locales/ja/messages.json +++ b/src/drivers/webextension/_locales/ja/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "特定した技術を匿名でwappalyzer.comに送信する" }, "optionThemeMode": { "message": "Enable dark mode compatibility." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "ここでは特定出来ません。" }, "noAppsDetected": { "message": "技術は検出されませんでした。" }, "categoryPin": { "message": "常にアイコンを表示" }, diff --git a/src/drivers/webextension/_locales/pl/messages.json b/src/drivers/webextension/_locales/pl/messages.json index 1fca29a4c..f72e45917 100644 --- a/src/drivers/webextension/_locales/pl/messages.json +++ b/src/drivers/webextension/_locales/pl/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Przesyłaj anonimowe statystyki aplikacji wykrytych przez Wappalyzer do twórców" }, "optionThemeMode": { "message": "Włącz kompatybilność z ciemnym motywem." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Nic tu nie ma." }, "noAppsDetected": { "message": "Nie wykryto żadnych aplikacji." }, "categoryPin": { "message": "Zawsze pokazuj tą ikonę" }, diff --git a/src/drivers/webextension/_locales/pt/messages.json b/src/drivers/webextension/_locales/pt/messages.json index ad23baa74..664ec823a 100644 --- a/src/drivers/webextension/_locales/pt/messages.json +++ b/src/drivers/webextension/_locales/pt/messages.json @@ -10,6 +10,8 @@ "optionsSave": { "message": "Opções de Guardar" }, "optionsSaved": { "message": "Guardado" }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "twitter": { "message": "Seguir Wappalyzer no Twitter" }, "website": { "message": "Ir para wappalyzer.com" }, "categoryPin": { "message": "Mostrar sempre ícone" }, diff --git a/src/drivers/webextension/_locales/pt_BR/messages.json b/src/drivers/webextension/_locales/pt_BR/messages.json index 39d40c504..e26c19526 100644 --- a/src/drivers/webextension/_locales/pt_BR/messages.json +++ b/src/drivers/webextension/_locales/pt_BR/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Enviar relatórios anônimos para wappalyzer.com sobre tecnologias identificadas" }, "optionThemeMode": { "message": "Permitir a compatibilidade modo escuro." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Nada a fazer aqui." }, "noAppsDetected": { "message": "Nenhuma tecnologia identificada." }, "categoryPin": { "message": "Sempre mostrar ícone" }, diff --git a/src/drivers/webextension/_locales/ro/messages.json b/src/drivers/webextension/_locales/ro/messages.json index a521406e2..235b78c37 100644 --- a/src/drivers/webextension/_locales/ro/messages.json +++ b/src/drivers/webextension/_locales/ro/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Trimite rapoarte anonime despre aplicațiile detectate către wappalyzer.com pentru cercetare" }, "optionThemeMode": { "message": "Activează modul de compatibilitate întuneric." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Nimic de făcut pe pagina curentă." }, "noAppsDetected": { "message": "Nici o aplicație detectată." }, "categoryPin": { "message": "Afișează icon tot timpul" }, diff --git a/src/drivers/webextension/_locales/ru/messages.json b/src/drivers/webextension/_locales/ru/messages.json index bb16fcb1a..4ed742348 100644 --- a/src/drivers/webextension/_locales/ru/messages.json +++ b/src/drivers/webextension/_locales/ru/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Анонимно отправлять статистику распознанных данных на wappalyzer.com" }, "optionThemeMode": { "message": "Темная тема" }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Здесь нечего делать" }, "noAppsDetected": { "message": "Не удалось определить ни одну технологию" }, "categoryPin": { "message": "Всегда отображать эту категорию иконкой"}, diff --git a/src/drivers/webextension/_locales/sk/messages.json b/src/drivers/webextension/_locales/sk/messages.json index 23ea5a96f..ae0347742 100644 --- a/src/drivers/webextension/_locales/sk/messages.json +++ b/src/drivers/webextension/_locales/sk/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Anonymne posielať správy o zistených aplikáciách na wappalyzer.com pre výskum" }, "optionThemeMode": { "message": "Povoliť kompatibilitu tmavú režim." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Nie je tu čo robiť." }, "noAppsDetected": { "message": "Žiadne aplikácie neboli zistené." }, "categoryPin": { "message": "Always show icon" }, diff --git a/src/drivers/webextension/_locales/tr/messages.json b/src/drivers/webextension/_locales/tr/messages.json index 8b090d420..b355b011d 100644 --- a/src/drivers/webextension/_locales/tr/messages.json +++ b/src/drivers/webextension/_locales/tr/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Anonim olarak tespit edilen uygulamalar hakkında wappalyzer.com'a araştırma raporları gönderin" }, "optionThemeMode": { "message": "Karanlık modu uyumluluğu etkinleştirin." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Burada yapacak birşey yok." }, "noAppsDetected": { "message": "Uygulamalar tespit edilemedi." }, "categoryPin": { "message": "Her zaman bu kategorinin ikonunu kullan" }, diff --git a/src/drivers/webextension/_locales/uk/messages.json b/src/drivers/webextension/_locales/uk/messages.json index 416902756..0100a626f 100644 --- a/src/drivers/webextension/_locales/uk/messages.json +++ b/src/drivers/webextension/_locales/uk/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Анонімно надсилати статистику розпізнавань на сервер для досліджень" }, "optionThemeMode": { "message": "Включити сумісність темного режиму." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Тут нічого робити." }, "noAppsDetected": { "message": "Нічого не знайдено." }, "categoryPin": { "message": "Завжди показувати іконку Wappalyzer" }, diff --git a/src/drivers/webextension/_locales/uz/messages.json b/src/drivers/webextension/_locales/uz/messages.json index 7ccf0106a..3b3925df1 100644 --- a/src/drivers/webextension/_locales/uz/messages.json +++ b/src/drivers/webextension/_locales/uz/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "Wappalyzer takomillashtirish uchun hisobotlarni maxfiy ravishda serverga jo'natish" }, "optionThemeMode": { "message": "qorong'i rejimi mosligini yoqish." }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "Bu yerda tekshirib bolmaydi." }, "noAppsDetected": { "message": "Hech qanday dastur aniqlanmadi." }, "categoryPin": { "message": "Always show icon" }, diff --git a/src/drivers/webextension/_locales/zh_CN/messages.json b/src/drivers/webextension/_locales/zh_CN/messages.json index 6c4126adf..fa732aebb 100644 --- a/src/drivers/webextension/_locales/zh_CN/messages.json +++ b/src/drivers/webextension/_locales/zh_CN/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "匿名发送检测到的技术至 wappalyzer.com" }, "optionThemeMode": { "message": "启用深色模式的兼容。" }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "这儿啥也没有。" }, "noAppsDetected": { "message": "未检测到任何技术。" }, "categoryPin": { "message": "总是显示图标" }, diff --git a/src/drivers/webextension/_locales/zh_TW/messages.json b/src/drivers/webextension/_locales/zh_TW/messages.json index d2401e4e3..cee7a4463 100644 --- a/src/drivers/webextension/_locales/zh_TW/messages.json +++ b/src/drivers/webextension/_locales/zh_TW/messages.json @@ -10,6 +10,8 @@ "optionTracking": { "message": "匿名傳送已識別的技術至 wappalyzer.com" }, "optionThemeMode": { "message": "啟用暗模式的兼容性。" }, "optionBadge": { "message": "Show the number of identified technologies on the icon" }, + "disableOnDomain": { "message": "Disable on this website" }, + "clearCache": { "message": "Clear cached detections" }, "nothingToDo": { "message": "這裡什麼也沒有。" }, "noAppsDetected": { "message": "未識別到技術。" }, "categoryPin": { "message": "永遠顯示圖示" }, diff --git a/src/drivers/webextension/css/styles.css b/src/drivers/webextension/css/styles.css index 700dc92fb..1651547e7 100644 --- a/src/drivers/webextension/css/styles.css +++ b/src/drivers/webextension/css/styles.css @@ -20,7 +20,7 @@ body { font-size: .9rem; line-height: 1.5rem; margin: 0; - min-width: 35rem; + min-width: 24rem; overflow-x: hidden; padding-bottom: 3rem; } @@ -59,7 +59,6 @@ a:hover { align-items: center; background: #fff; bottom: 0; - justify-content: space-between; border-top: 1px solid var(--color-secondary); height: 3rem; display: flex; @@ -68,6 +67,10 @@ a:hover { width: 100%; } +.alerts { + white-space: nowrap; +} + .alerts--hidden { visibility: hidden; } @@ -80,17 +83,35 @@ a:hover { width: 1.1rem; } -.footer__settings { +.spacer { + flex-grow:1; +} + +.footer__icon { color: var(--color-primary); cursor: pointer; height: 1.1rem; + margin-left: 1rem; vertical-align: middle; width: 1.1rem; } +.footer__switch { + height: 1.5rem; + width: 1.5rem; +} + +.footer__switch--hidden { + display: none; +} + +.footer__switch--disabled { + color: var(--color-text); +} + .detections { columns: 2; - column-gap: 1.5rem; + column-gap: 3rem; padding: 1.5rem 1.5rem .5rem 1.5rem; } @@ -100,7 +121,7 @@ a:hover { .empty { opacity: .3; - padding: 3rem 1.5rem .5rem 1.5rem; + padding: 3rem 1.5rem 2.5rem 1.5rem; text-align: center; } @@ -114,6 +135,10 @@ a:hover { padding-bottom: 1rem; } +.category__heading { + white-space: nowrap; +} + .category__link { font-weight: bold; line-height: 2rem; @@ -159,6 +184,7 @@ a:hover { display: flex; align-items: center; margin-bottom: .2rem; + white-space: nowrap; } .technology__icon { @@ -246,6 +272,10 @@ a:hover { margin-bottom: .5rem; } +.options__cache { + margin-top: 1rem; +} + @media (prefers-color-scheme: dark) { body.theme-mode { background: var(--color-primary-darken); diff --git a/src/drivers/webextension/html/options.html b/src/drivers/webextension/html/options.html index 7f25de49c..3dfc531d4 100644 --- a/src/drivers/webextension/html/options.html +++ b/src/drivers/webextension/html/options.html @@ -42,6 +42,8 @@   + + diff --git a/src/drivers/webextension/html/popup.html b/src/drivers/webextension/html/popup.html index 79b8322fc..911a46d4f 100644 --- a/src/drivers/webextension/html/popup.html +++ b/src/drivers/webextension/html/popup.html @@ -72,7 +72,20 @@ - +
+ + + + + + + + + + + + + diff --git a/src/drivers/webextension/js/content.js b/src/drivers/webextension/js/content.js index 3b031d84b..bc969c166 100644 --- a/src/drivers/webextension/js/content.js +++ b/src/drivers/webextension/js/content.js @@ -7,6 +7,10 @@ const Content = { * Initialise content script */ async init() { + if (await Content.driver('isDisabledDomain', [location])) { + return + } + await new Promise((resolve) => setTimeout(resolve, 1000)) try { diff --git a/src/drivers/webextension/js/driver.js b/src/drivers/webextension/js/driver.js index fce4b587c..a5cd1b4eb 100644 --- a/src/drivers/webextension/js/driver.js +++ b/src/drivers/webextension/js/driver.js @@ -185,6 +185,10 @@ const Driver = { * @param {Object} request */ async onWebRequestComplete(request) { + if (await Driver.isDisabledDomain(request.url)) { + return + } + if (request.responseHeaders) { const headers = {} @@ -252,6 +256,19 @@ const Driver = { return Wappalyzer.technologies }, + /** + * Check if Wappalyzer has been disabled for the domain + */ + async isDisabledDomain(url) { + try { + const { hostname } = new URL(url) + + return (await getOption('disabledDomains', [])).includes(hostname) + } catch (error) { + return false + } + }, + /** * Callback for detections * @param {String} url @@ -363,7 +380,7 @@ const Driver = { * @param {String} url * @param {Object} technologies */ - async setIcon(url, technologies) { + async setIcon(url, technologies = []) { const dynamicIcon = await getOption('dynamicIcon', false) const badge = await getOption('badge', true) @@ -384,7 +401,8 @@ const Driver = { chrome.browserAction.setBadgeText( { tabId, - text: badge ? technologies.length.toString() : '' + text: + badge && technologies.length ? technologies.length.toString() : '' }, () => {} ) @@ -410,12 +428,22 @@ const Driver = { * Get the detected technologies for the current tab */ async getDetections() { - const [{ id }] = await promisify(chrome.tabs, 'query', { + const [{ id, url }] = await promisify(chrome.tabs, 'query', { active: true, currentWindow: true }) - return Driver.cache.tabs[id] + if (await Driver.isDisabledDomain(url)) { + await Driver.setIcon(url, []) + + return + } + + const resolved = Driver.cache.tabs[id] + + await Driver.setIcon(url, resolved) + + return resolved }, /** @@ -511,6 +539,16 @@ const Driver = { } }, + /** + * Clear caches + */ + async clearCache() { + Driver.cache.hostnames = {} + Driver.cache.tabs = {} + + await setOption('hostnames', {}) + }, + /** * Anonymously send identified technologies to wappalyzer.com * This function can be disabled in the extension settings diff --git a/src/drivers/webextension/js/options.js b/src/drivers/webextension/js/options.js index 358053ee9..dc2db78b2 100644 --- a/src/drivers/webextension/js/options.js +++ b/src/drivers/webextension/js/options.js @@ -1,6 +1,6 @@ 'use strict' /* eslint-env browser */ -/* globals Utils */ +/* globals Utils, chrome */ const { i18n, getOption, setOption } = Utils @@ -37,7 +37,28 @@ const Options = { }) }) + document + .querySelector('.options__cache') + .addEventListener('click', () => Options.driver('clearCache')) + i18n() + }, + + driver(func, args, callback) { + return new Promise((resolve, reject) => { + chrome.runtime.sendMessage( + { + source: 'content.js', + func, + args: args ? (Array.isArray(args) ? args : [args]) : [] + }, + (response) => { + chrome.runtime.lastError + ? reject(new Error(chrome.runtime.lastError.message)) + : resolve(response) + } + ) + }) } } diff --git a/src/drivers/webextension/js/popup.js b/src/drivers/webextension/js/popup.js index 380435d03..e7e20bc5c 100644 --- a/src/drivers/webextension/js/popup.js +++ b/src/drivers/webextension/js/popup.js @@ -12,6 +12,24 @@ const { sendMessage } = Utils +function setDisabledDomain(enabled) { + if (enabled) { + document + .querySelector('.footer__switch--enabled') + .classList.add('footer__switch--hidden') + document + .querySelector('.footer__switch--disabled') + .classList.remove('footer__switch--hidden') + } else { + document + .querySelector('.footer__switch--enabled') + .classList.remove('footer__switch--hidden') + document + .querySelector('.footer__switch--disabled') + .classList.add('footer__switch--hidden') + } +} + const Popup = { /** * Initialise popup @@ -28,6 +46,9 @@ const Popup = { return templates }, {}) + // Disabled domains + let disabledDomains = await getOption('disabledDomains', []) + // Theme mode const themeMode = await getOption('themeMode', false) @@ -55,7 +76,7 @@ const Popup = { document.querySelector('.terms').classList.add('terms--hidden') document.querySelector('.empty').classList.remove('empty--hidden') - chrome.runtime.sendMessage('getDetections', Popup.onGetDetections) + Popup.onGetDetections(await Popup.driver('getDetections')) }) } @@ -76,7 +97,40 @@ const Popup = { ).href = `https://www.wappalyzer.com/alerts?url=${encodeURIComponent( `${url}` )}` + + const { hostname } = new URL(url) + + setDisabledDomain(disabledDomains.includes(hostname)) + + document + .querySelector('.footer__switch--disabled') + .addEventListener('click', async () => { + disabledDomains = disabledDomains.filter( + (_hostname) => _hostname !== hostname + ) + + await setOption('disabledDomains', disabledDomains) + + setDisabledDomain(false) + + Popup.onGetDetections(await Popup.driver('getDetections')) + }) + + document + .querySelector('.footer__switch--enabled') + .addEventListener('click', async () => { + disabledDomains.push(hostname) + + await setOption('disabledDomains', disabledDomains) + + setDisabledDomain(true) + + Popup.onGetDetections(await Popup.driver('getDetections')) + }) } else { + for (const el of document.querySelectorAll('.footer__switch')) { + el.classList.add('footer__switch--hidden') + } document.querySelector('.alerts').classList.add('alerts--hidden') } } @@ -128,11 +182,14 @@ const Popup = { */ async onGetDetections(detections = []) { if (!detections || !detections.length) { + document.querySelector('.empty').classList.remove('empty--hidden') + document.querySelector('.detections').classList.add('detections--hidden') + return } document.querySelector('.empty').classList.add('empty--hidden') - document.querySelector('.detections').classList.remove('empty--hidden') + document.querySelector('.detections').classList.remove('detections--hidden') const pinnedCategory = await getOption('pinnedCategory')