@browserless.io/browserless 2.0.0-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +674 -0
- package/LICENSE +6 -0
- package/README.md +132 -0
- package/assets/logo.png +0 -0
- package/bin/browserless.js +227 -0
- package/browser.json +7 -0
- package/build/browserless.d.ts +33 -0
- package/build/browserless.js +146 -0
- package/build/browsers/cdp-chromium.d.ts +41 -0
- package/build/browsers/cdp-chromium.js +287 -0
- package/build/browsers/index.d.ts +26 -0
- package/build/browsers/index.js +183 -0
- package/build/browsers/playwright-chromium.d.ts +34 -0
- package/build/browsers/playwright-chromium.js +106 -0
- package/build/browsers/playwright-firefox.d.ts +34 -0
- package/build/browsers/playwright-firefox.js +101 -0
- package/build/browsers/playwright-webkit.d.ts +34 -0
- package/build/browsers/playwright-webkit.js +101 -0
- package/build/config.d.ts +138 -0
- package/build/config.js +349 -0
- package/build/constants.d.ts +4 -0
- package/build/constants.js +4 -0
- package/build/data/classes.json +1 -0
- package/build/data/selectors.json +1 -0
- package/build/exports.d.ts +20 -0
- package/build/exports.js +22 -0
- package/build/file-system.d.ts +24 -0
- package/build/file-system.js +46 -0
- package/build/hooks.d.ts +5 -0
- package/build/hooks.js +20 -0
- package/build/http.d.ts +175 -0
- package/build/http.js +104 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +39 -0
- package/build/limiter.d.ts +24 -0
- package/build/limiter.js +147 -0
- package/build/limiter.spec.d.ts +1 -0
- package/build/limiter.spec.js +241 -0
- package/build/metrics.d.ts +24 -0
- package/build/metrics.js +86 -0
- package/build/metrics.spec.d.ts +1 -0
- package/build/metrics.spec.js +35 -0
- package/build/mime-types.d.ts +1 -0
- package/build/mime-types.js +328 -0
- package/build/monitoring.d.ts +13 -0
- package/build/monitoring.js +38 -0
- package/build/routes/chromium/http/content-post.body.json +514 -0
- package/build/routes/chromium/http/content-post.d.ts +34 -0
- package/build/routes/chromium/http/content-post.js +109 -0
- package/build/routes/chromium/http/content-post.query.json +183 -0
- package/build/routes/chromium/http/content-post.response.json +5 -0
- package/build/routes/chromium/http/download-post.body.json +32 -0
- package/build/routes/chromium/http/download-post.d.ts +16 -0
- package/build/routes/chromium/http/download-post.js +92 -0
- package/build/routes/chromium/http/download-post.query.json +120 -0
- package/build/routes/chromium/http/download-post.response.json +4 -0
- package/build/routes/chromium/http/function-post.body.json +32 -0
- package/build/routes/chromium/http/function-post.d.ts +18 -0
- package/build/routes/chromium/http/function-post.js +53 -0
- package/build/routes/chromium/http/function-post.query.json +120 -0
- package/build/routes/chromium/http/function-post.response.json +4 -0
- package/build/routes/chromium/http/pdf-post.body.json +654 -0
- package/build/routes/chromium/http/pdf-post.d.ts +35 -0
- package/build/routes/chromium/http/pdf-post.js +107 -0
- package/build/routes/chromium/http/pdf-post.query.json +120 -0
- package/build/routes/chromium/http/pdf-post.response.json +5 -0
- package/build/routes/chromium/http/performance.body.json +26 -0
- package/build/routes/chromium/http/performance.d.ts +17 -0
- package/build/routes/chromium/http/performance.js +30 -0
- package/build/routes/chromium/http/performance.query.json +120 -0
- package/build/routes/chromium/http/performance.response.json +7 -0
- package/build/routes/chromium/http/scrape-post.body.json +561 -0
- package/build/routes/chromium/http/scrape-post.d.ts +106 -0
- package/build/routes/chromium/http/scrape-post.js +205 -0
- package/build/routes/chromium/http/scrape-post.query.json +183 -0
- package/build/routes/chromium/http/scrape-post.response.json +325 -0
- package/build/routes/chromium/http/screenshot-post.body.json +604 -0
- package/build/routes/chromium/http/screenshot-post.d.ts +37 -0
- package/build/routes/chromium/http/screenshot-post.js +124 -0
- package/build/routes/chromium/http/screenshot-post.query.json +120 -0
- package/build/routes/chromium/http/screenshot-post.response.json +5 -0
- package/build/routes/chromium/tests/content.spec.d.ts +1 -0
- package/build/routes/chromium/tests/content.spec.js +285 -0
- package/build/routes/chromium/tests/download.spec.d.ts +1 -0
- package/build/routes/chromium/tests/download.spec.js +67 -0
- package/build/routes/chromium/tests/function.spec.d.ts +1 -0
- package/build/routes/chromium/tests/function.spec.js +245 -0
- package/build/routes/chromium/tests/pdf.spec.d.ts +1 -0
- package/build/routes/chromium/tests/pdf.spec.js +333 -0
- package/build/routes/chromium/tests/performance.spec.d.ts +1 -0
- package/build/routes/chromium/tests/performance.spec.js +124 -0
- package/build/routes/chromium/tests/scrape.spec.d.ts +1 -0
- package/build/routes/chromium/tests/scrape.spec.js +354 -0
- package/build/routes/chromium/tests/screenshot.spec.d.ts +1 -0
- package/build/routes/chromium/tests/screenshot.spec.js +339 -0
- package/build/routes/chromium/tests/websocket.spec.d.ts +1 -0
- package/build/routes/chromium/tests/websocket.spec.js +309 -0
- package/build/routes/chromium/utils/function/client.d.ts +26 -0
- package/build/routes/chromium/utils/function/client.js +66 -0
- package/build/routes/chromium/utils/function/handler.d.ts +18 -0
- package/build/routes/chromium/utils/function/handler.js +95 -0
- package/build/routes/chromium/utils/performance/child.d.ts +1 -0
- package/build/routes/chromium/utils/performance/child.js +29 -0
- package/build/routes/chromium/utils/performance/main.d.ts +3 -0
- package/build/routes/chromium/utils/performance/main.js +65 -0
- package/build/routes/chromium/utils/performance/types.d.ts +21 -0
- package/build/routes/chromium/utils/performance/types.js +1 -0
- package/build/routes/chromium/ws/browser.d.ts +6 -0
- package/build/routes/chromium/ws/browser.js +11 -0
- package/build/routes/chromium/ws/browser.query.json +120 -0
- package/build/routes/chromium/ws/cdp-chromium.d.ts +6 -0
- package/build/routes/chromium/ws/cdp-chromium.js +11 -0
- package/build/routes/chromium/ws/cdp-chromium.query.json +120 -0
- package/build/routes/chromium/ws/page.d.ts +6 -0
- package/build/routes/chromium/ws/page.js +11 -0
- package/build/routes/chromium/ws/page.query.json +120 -0
- package/build/routes/chromium/ws/playwright-chromium.d.ts +6 -0
- package/build/routes/chromium/ws/playwright-chromium.js +19 -0
- package/build/routes/chromium/ws/playwright-chromium.query.json +100 -0
- package/build/routes/firefox/tests/websocket.spec.d.ts +1 -0
- package/build/routes/firefox/tests/websocket.spec.js +104 -0
- package/build/routes/firefox/ws/playwright-firefox.d.ts +6 -0
- package/build/routes/firefox/ws/playwright-firefox.js +19 -0
- package/build/routes/firefox/ws/playwright-firefox.query.json +100 -0
- package/build/routes/management/http/config-get.d.ts +25 -0
- package/build/routes/management/http/config-get.js +43 -0
- package/build/routes/management/http/config-get.response.json +107 -0
- package/build/routes/management/http/metrics-get.d.ts +4 -0
- package/build/routes/management/http/metrics-get.js +24 -0
- package/build/routes/management/http/metrics-get.response.json +94 -0
- package/build/routes/management/http/metrics-total-get.d.ts +4 -0
- package/build/routes/management/http/metrics-total-get.js +60 -0
- package/build/routes/management/http/metrics-total-get.response.json +72 -0
- package/build/routes/management/http/sessions-get.d.ts +4 -0
- package/build/routes/management/http/sessions-get.js +21 -0
- package/build/routes/management/http/sessions-get.response.json +221 -0
- package/build/routes/management/http/static-get.d.ts +3 -0
- package/build/routes/management/http/static-get.js +67 -0
- package/build/routes/management/tests/management.spec.d.ts +1 -0
- package/build/routes/management/tests/management.spec.js +41 -0
- package/build/routes/webkit/tests/websocket.spec.d.ts +1 -0
- package/build/routes/webkit/tests/websocket.spec.js +104 -0
- package/build/routes/webkit/ws/playwright-webkit.d.ts +6 -0
- package/build/routes/webkit/ws/playwright-webkit.js +19 -0
- package/build/routes/webkit/ws/playwright-webkit.query.json +100 -0
- package/build/server.d.ts +38 -0
- package/build/server.js +365 -0
- package/build/shim.d.ts +9 -0
- package/build/shim.js +54 -0
- package/build/shim.spec.d.ts +1 -0
- package/build/shim.spec.js +114 -0
- package/build/types.d.ts +360 -0
- package/build/types.js +6 -0
- package/build/utils.d.ts +111 -0
- package/build/utils.js +570 -0
- package/build/webhooks.d.ts +11 -0
- package/build/webhooks.js +43 -0
- package/docker/base/.dockerignore +16 -0
- package/docker/base/Dockerfile +70 -0
- package/docker/chrome/.dockerignore +16 -0
- package/docker/chrome/Dockerfile +40 -0
- package/docker/firefox/.dockerignore +16 -0
- package/docker/firefox/Dockerfile +39 -0
- package/docker/multi/.dockerignore +16 -0
- package/docker/multi/Dockerfile +37 -0
- package/docker/sdk/.dockerignore +16 -0
- package/docker/sdk/Dockerfile +34 -0
- package/docker/webkit/.dockerignore +16 -0
- package/docker/webkit/Dockerfile +40 -0
- package/extensions/screencast/background.js +143 -0
- package/extensions/screencast/content_script.js +18 -0
- package/extensions/screencast/manifest.json +19 -0
- package/extensions/ublock/1p-filters.html +69 -0
- package/extensions/ublock/3p-filters.html +119 -0
- package/extensions/ublock/LICENSE.txt +674 -0
- package/extensions/ublock/_locales/ar/messages.json +1290 -0
- package/extensions/ublock/_locales/az/messages.json +1290 -0
- package/extensions/ublock/_locales/be/messages.json +1290 -0
- package/extensions/ublock/_locales/bg/messages.json +1290 -0
- package/extensions/ublock/_locales/bn/messages.json +1290 -0
- package/extensions/ublock/_locales/br_FR/messages.json +1290 -0
- package/extensions/ublock/_locales/bs/messages.json +1290 -0
- package/extensions/ublock/_locales/ca/messages.json +1290 -0
- package/extensions/ublock/_locales/cs/messages.json +1290 -0
- package/extensions/ublock/_locales/cv/messages.json +1290 -0
- package/extensions/ublock/_locales/da/messages.json +1290 -0
- package/extensions/ublock/_locales/de/messages.json +1290 -0
- package/extensions/ublock/_locales/el/messages.json +1290 -0
- package/extensions/ublock/_locales/en/messages.json +1292 -0
- package/extensions/ublock/_locales/en_GB/messages.json +1290 -0
- package/extensions/ublock/_locales/eo/messages.json +1290 -0
- package/extensions/ublock/_locales/es/messages.json +1290 -0
- package/extensions/ublock/_locales/et/messages.json +1290 -0
- package/extensions/ublock/_locales/eu/messages.json +1290 -0
- package/extensions/ublock/_locales/fa/messages.json +1290 -0
- package/extensions/ublock/_locales/fi/messages.json +1290 -0
- package/extensions/ublock/_locales/fil/messages.json +1290 -0
- package/extensions/ublock/_locales/fr/messages.json +1290 -0
- package/extensions/ublock/_locales/fy/messages.json +1290 -0
- package/extensions/ublock/_locales/gl/messages.json +1290 -0
- package/extensions/ublock/_locales/gu/messages.json +1290 -0
- package/extensions/ublock/_locales/he/messages.json +1290 -0
- package/extensions/ublock/_locales/hi/messages.json +1290 -0
- package/extensions/ublock/_locales/hr/messages.json +1290 -0
- package/extensions/ublock/_locales/hu/messages.json +1290 -0
- package/extensions/ublock/_locales/hy/messages.json +1290 -0
- package/extensions/ublock/_locales/id/messages.json +1290 -0
- package/extensions/ublock/_locales/it/messages.json +1290 -0
- package/extensions/ublock/_locales/ja/messages.json +1290 -0
- package/extensions/ublock/_locales/ka/messages.json +1290 -0
- package/extensions/ublock/_locales/kk/messages.json +1290 -0
- package/extensions/ublock/_locales/kn/messages.json +1290 -0
- package/extensions/ublock/_locales/ko/messages.json +1290 -0
- package/extensions/ublock/_locales/ku/messages.json +1290 -0
- package/extensions/ublock/_locales/lt/messages.json +1290 -0
- package/extensions/ublock/_locales/lv/messages.json +1290 -0
- package/extensions/ublock/_locales/mk/messages.json +1290 -0
- package/extensions/ublock/_locales/ml/messages.json +1290 -0
- package/extensions/ublock/_locales/mr/messages.json +1290 -0
- package/extensions/ublock/_locales/ms/messages.json +1290 -0
- package/extensions/ublock/_locales/nb/messages.json +1290 -0
- package/extensions/ublock/_locales/nl/messages.json +1290 -0
- package/extensions/ublock/_locales/no/messages.json +1290 -0
- package/extensions/ublock/_locales/oc/messages.json +1290 -0
- package/extensions/ublock/_locales/pa/messages.json +1290 -0
- package/extensions/ublock/_locales/pl/messages.json +1290 -0
- package/extensions/ublock/_locales/pt_BR/messages.json +1290 -0
- package/extensions/ublock/_locales/pt_PT/messages.json +1290 -0
- package/extensions/ublock/_locales/ro/messages.json +1290 -0
- package/extensions/ublock/_locales/ru/messages.json +1290 -0
- package/extensions/ublock/_locales/si/messages.json +1290 -0
- package/extensions/ublock/_locales/sk/messages.json +1290 -0
- package/extensions/ublock/_locales/sl/messages.json +1290 -0
- package/extensions/ublock/_locales/so/messages.json +1290 -0
- package/extensions/ublock/_locales/sq/messages.json +1290 -0
- package/extensions/ublock/_locales/sr/messages.json +1290 -0
- package/extensions/ublock/_locales/sv/messages.json +1290 -0
- package/extensions/ublock/_locales/sw/messages.json +1290 -0
- package/extensions/ublock/_locales/ta/messages.json +1290 -0
- package/extensions/ublock/_locales/te/messages.json +1290 -0
- package/extensions/ublock/_locales/th/messages.json +1290 -0
- package/extensions/ublock/_locales/tr/messages.json +1290 -0
- package/extensions/ublock/_locales/uk/messages.json +1290 -0
- package/extensions/ublock/_locales/ur/messages.json +1290 -0
- package/extensions/ublock/_locales/vi/messages.json +1290 -0
- package/extensions/ublock/_locales/zh_CN/messages.json +1290 -0
- package/extensions/ublock/_locales/zh_TW/messages.json +1290 -0
- package/extensions/ublock/about.html +63 -0
- package/extensions/ublock/advanced-settings.html +42 -0
- package/extensions/ublock/asset-viewer.html +50 -0
- package/extensions/ublock/assets/assets.json +903 -0
- package/extensions/ublock/assets/resources/scriptlets.js +4255 -0
- package/extensions/ublock/assets/thirdparties/easylist/easylist.txt +65576 -0
- package/extensions/ublock/assets/thirdparties/easylist/easyprivacy.txt +33219 -0
- package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/README.md +29 -0
- package/extensions/ublock/assets/thirdparties/pgl.yoyo.org/as/serverlist +3732 -0
- package/extensions/ublock/assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat +15431 -0
- package/extensions/ublock/assets/thirdparties/urlhaus-filter/LICENSE.md +42 -0
- package/extensions/ublock/assets/thirdparties/urlhaus-filter/urlhaus-filter-online.txt +1970 -0
- package/extensions/ublock/assets/ublock/badlists.txt +77 -0
- package/extensions/ublock/assets/ublock/badware.min.txt +3033 -0
- package/extensions/ublock/assets/ublock/filters.min.txt +23419 -0
- package/extensions/ublock/assets/ublock/privacy.min.txt +575 -0
- package/extensions/ublock/assets/ublock/quick-fixes.min.txt +99 -0
- package/extensions/ublock/assets/ublock/unbreak.min.txt +2448 -0
- package/extensions/ublock/background.html +12 -0
- package/extensions/ublock/cloud-ui.html +23 -0
- package/extensions/ublock/code-viewer.html +53 -0
- package/extensions/ublock/css/1p-filters.css +26 -0
- package/extensions/ublock/css/3p-filters.css +250 -0
- package/extensions/ublock/css/about.css +3 -0
- package/extensions/ublock/css/advanced-settings.css +26 -0
- package/extensions/ublock/css/asset-viewer.css +79 -0
- package/extensions/ublock/css/click2load.css +53 -0
- package/extensions/ublock/css/cloud-ui.css +104 -0
- package/extensions/ublock/css/code-viewer.css +67 -0
- package/extensions/ublock/css/codemirror.css +326 -0
- package/extensions/ublock/css/common.css +347 -0
- package/extensions/ublock/css/dashboard-common.css +55 -0
- package/extensions/ublock/css/dashboard.css +115 -0
- package/extensions/ublock/css/devtools.css +22 -0
- package/extensions/ublock/css/document-blocked.css +146 -0
- package/extensions/ublock/css/dyna-rules.css +79 -0
- package/extensions/ublock/css/epicker-ui.css +270 -0
- package/extensions/ublock/css/fa-icons.css +149 -0
- package/extensions/ublock/css/fonts/Inter/Inter-Regular.woff2 +0 -0
- package/extensions/ublock/css/fonts/Inter/Inter-SemiBold.woff2 +0 -0
- package/extensions/ublock/css/fonts/Inter/LICENSE.txt +93 -0
- package/extensions/ublock/css/fonts/Metropolis/Metropolis-Regular.woff2 +0 -0
- package/extensions/ublock/css/fonts/Metropolis/Metropolis-SemiBold.woff2 +0 -0
- package/extensions/ublock/css/fonts/Metropolis/README.md +25 -0
- package/extensions/ublock/css/fonts/Metropolis/UNLICENSE +24 -0
- package/extensions/ublock/css/logger-ui-inspector.css +116 -0
- package/extensions/ublock/css/logger-ui.css +978 -0
- package/extensions/ublock/css/popup-fenix.css +778 -0
- package/extensions/ublock/css/settings.css +74 -0
- package/extensions/ublock/css/support.css +110 -0
- package/extensions/ublock/css/themes/default.css +526 -0
- package/extensions/ublock/css/whitelist.css +22 -0
- package/extensions/ublock/dashboard.html +47 -0
- package/extensions/ublock/devtools.html +58 -0
- package/extensions/ublock/document-blocked.html +64 -0
- package/extensions/ublock/dyna-rules.html +67 -0
- package/extensions/ublock/img/cloud.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/README +9 -0
- package/extensions/ublock/img/flags-of-the-world/ad.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ae.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/af.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ag.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ai.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/al.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/am.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ao.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/aq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ar.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/as.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/at.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/au.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/aw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ax.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/az.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ba.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/be.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/br.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bs.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/by.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/bz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ca.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ch.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ci.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ck.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/co.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cx.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/cz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/de.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/do.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/dz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ec.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ee.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/eg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/eh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/er.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/es.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/et.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/fr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ga.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-eng.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-nir.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-sct.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb-wls.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ge.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gs.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/gy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ht.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/hu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/id.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ie.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/il.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/im.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/in.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/io.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/iq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ir.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/is.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/it.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/je.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/jm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/jo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/jp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ke.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ki.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/km.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ky.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/kz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/la.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/li.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ls.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/lv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ly.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ma.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/md.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/me.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ml.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mo.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mp.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mq.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ms.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mx.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/my.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/mz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/na.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ne.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ng.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ni.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/no.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/np.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/nz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/om.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pa.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pe.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ph.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ps.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/pw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/py.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/qa.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/re.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ro.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/rs.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ru.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/rw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sa.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sb.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sd.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/se.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sh.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/si.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/so.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ss.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/st.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sx.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/sz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/td.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/th.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tj.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tl.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/to.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tr.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tv.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tw.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/tz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ua.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ug.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/um.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/us.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/uy.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/uz.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/va.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vc.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ve.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vg.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vi.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vn.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/vu.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/wf.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ws.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/xk.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/ye.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/yt.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/za.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/zm.png +0 -0
- package/extensions/ublock/img/flags-of-the-world/zw.png +0 -0
- package/extensions/ublock/img/fontawesome/LICENSE.txt +25 -0
- package/extensions/ublock/img/fontawesome/fontawesome-defs.svg +79 -0
- package/extensions/ublock/img/help16.png +0 -0
- package/extensions/ublock/img/icon_128.png +0 -0
- package/extensions/ublock/img/icon_16-loading.png +0 -0
- package/extensions/ublock/img/icon_16-off.png +0 -0
- package/extensions/ublock/img/icon_16.png +0 -0
- package/extensions/ublock/img/icon_32-loading.png +0 -0
- package/extensions/ublock/img/icon_32-off.png +0 -0
- package/extensions/ublock/img/icon_32.png +0 -0
- package/extensions/ublock/img/icon_64-loading.png +0 -0
- package/extensions/ublock/img/icon_64-off.png +0 -0
- package/extensions/ublock/img/icon_64.png +0 -0
- package/extensions/ublock/img/material-design.svg +16 -0
- package/extensions/ublock/img/photon.svg +16 -0
- package/extensions/ublock/img/ublock-defs.svg +27 -0
- package/extensions/ublock/img/ublock.svg +44 -0
- package/extensions/ublock/is-webrtc-supported.html +9 -0
- package/extensions/ublock/js/1p-filters.js +336 -0
- package/extensions/ublock/js/3p-filters.js +867 -0
- package/extensions/ublock/js/about.js +34 -0
- package/extensions/ublock/js/advanced-settings.js +194 -0
- package/extensions/ublock/js/asset-viewer.js +112 -0
- package/extensions/ublock/js/assets.js +1448 -0
- package/extensions/ublock/js/background.js +404 -0
- package/extensions/ublock/js/base64-custom.js +246 -0
- package/extensions/ublock/js/benchmarks.js +421 -0
- package/extensions/ublock/js/biditrie.js +947 -0
- package/extensions/ublock/js/cachestorage.js +510 -0
- package/extensions/ublock/js/click2load.js +60 -0
- package/extensions/ublock/js/cloud-ui.js +238 -0
- package/extensions/ublock/js/code-viewer.js +311 -0
- package/extensions/ublock/js/codemirror/search-thread.js +199 -0
- package/extensions/ublock/js/codemirror/search.js +504 -0
- package/extensions/ublock/js/codemirror/ubo-dynamic-filtering.js +239 -0
- package/extensions/ublock/js/codemirror/ubo-static-filtering.js +1126 -0
- package/extensions/ublock/js/commands.js +181 -0
- package/extensions/ublock/js/console.js +59 -0
- package/extensions/ublock/js/contentscript-extra.js +662 -0
- package/extensions/ublock/js/contentscript.js +1366 -0
- package/extensions/ublock/js/contextmenu.js +270 -0
- package/extensions/ublock/js/cosmetic-filtering.js +983 -0
- package/extensions/ublock/js/dashboard-common.js +215 -0
- package/extensions/ublock/js/dashboard.js +166 -0
- package/extensions/ublock/js/devtools.js +184 -0
- package/extensions/ublock/js/diff-updater.js +288 -0
- package/extensions/ublock/js/document-blocked.js +230 -0
- package/extensions/ublock/js/dom.js +213 -0
- package/extensions/ublock/js/dyna-rules.js +678 -0
- package/extensions/ublock/js/dynamic-net-filtering.js +488 -0
- package/extensions/ublock/js/epicker-ui.js +924 -0
- package/extensions/ublock/js/fa-icons.js +129 -0
- package/extensions/ublock/js/filtering-context.js +461 -0
- package/extensions/ublock/js/filtering-engines.js +50 -0
- package/extensions/ublock/js/hnswitches.js +289 -0
- package/extensions/ublock/js/hntrie.js +780 -0
- package/extensions/ublock/js/html-filtering.js +465 -0
- package/extensions/ublock/js/httpheader-filtering.js +213 -0
- package/extensions/ublock/js/i18n.js +346 -0
- package/extensions/ublock/js/is-webrtc-supported.js +52 -0
- package/extensions/ublock/js/logger-ui-inspector.js +652 -0
- package/extensions/ublock/js/logger-ui.js +3028 -0
- package/extensions/ublock/js/logger.js +84 -0
- package/extensions/ublock/js/lz4.js +190 -0
- package/extensions/ublock/js/messaging.js +2095 -0
- package/extensions/ublock/js/pagestore.js +1140 -0
- package/extensions/ublock/js/popup-fenix.js +1529 -0
- package/extensions/ublock/js/redirect-engine.js +494 -0
- package/extensions/ublock/js/redirect-resources.js +193 -0
- package/extensions/ublock/js/reverselookup-worker.js +287 -0
- package/extensions/ublock/js/reverselookup.js +223 -0
- package/extensions/ublock/js/scriptlet-filtering.js +556 -0
- package/extensions/ublock/js/scriptlets/cosmetic-logger.js +376 -0
- package/extensions/ublock/js/scriptlets/cosmetic-off.js +48 -0
- package/extensions/ublock/js/scriptlets/cosmetic-on.js +48 -0
- package/extensions/ublock/js/scriptlets/cosmetic-report.js +142 -0
- package/extensions/ublock/js/scriptlets/dom-inspector.js +906 -0
- package/extensions/ublock/js/scriptlets/dom-survey-elements.js +72 -0
- package/extensions/ublock/js/scriptlets/dom-survey-scripts.js +126 -0
- package/extensions/ublock/js/scriptlets/epicker.js +1365 -0
- package/extensions/ublock/js/scriptlets/load-3p-css.js +67 -0
- package/extensions/ublock/js/scriptlets/load-large-media-all.js +62 -0
- package/extensions/ublock/js/scriptlets/load-large-media-interactive.js +299 -0
- package/extensions/ublock/js/scriptlets/noscript-spoof.js +89 -0
- package/extensions/ublock/js/scriptlets/should-inject-contentscript.js +40 -0
- package/extensions/ublock/js/scriptlets/subscriber.js +113 -0
- package/extensions/ublock/js/scriptlets/updater.js +101 -0
- package/extensions/ublock/js/settings.js +317 -0
- package/extensions/ublock/js/start.js +509 -0
- package/extensions/ublock/js/static-dnr-filtering.js +497 -0
- package/extensions/ublock/js/static-ext-filtering-db.js +171 -0
- package/extensions/ublock/js/static-ext-filtering.js +184 -0
- package/extensions/ublock/js/static-filtering-io.js +144 -0
- package/extensions/ublock/js/static-filtering-parser.js +4459 -0
- package/extensions/ublock/js/static-net-filtering.js +5631 -0
- package/extensions/ublock/js/storage.js +1683 -0
- package/extensions/ublock/js/support.js +335 -0
- package/extensions/ublock/js/tab.js +1178 -0
- package/extensions/ublock/js/tasks.js +42 -0
- package/extensions/ublock/js/text-encode.js +275 -0
- package/extensions/ublock/js/text-utils.js +107 -0
- package/extensions/ublock/js/theme.js +151 -0
- package/extensions/ublock/js/traffic.js +1260 -0
- package/extensions/ublock/js/ublock.js +696 -0
- package/extensions/ublock/js/uri-utils.js +175 -0
- package/extensions/ublock/js/url-net-filtering.js +336 -0
- package/extensions/ublock/js/utils.js +208 -0
- package/extensions/ublock/js/vapi-background-ext.js +254 -0
- package/extensions/ublock/js/vapi-background.js +1802 -0
- package/extensions/ublock/js/vapi-client-extra.js +312 -0
- package/extensions/ublock/js/vapi-client.js +280 -0
- package/extensions/ublock/js/vapi-common.js +308 -0
- package/extensions/ublock/js/vapi.js +89 -0
- package/extensions/ublock/js/wasm/README.md +24 -0
- package/extensions/ublock/js/wasm/biditrie.wasm +0 -0
- package/extensions/ublock/js/wasm/biditrie.wat +728 -0
- package/extensions/ublock/js/wasm/hntrie.wasm +0 -0
- package/extensions/ublock/js/wasm/hntrie.wat +724 -0
- package/extensions/ublock/js/webext.js +164 -0
- package/extensions/ublock/js/whitelist.js +258 -0
- package/extensions/ublock/lib/codemirror/LICENSE +21 -0
- package/extensions/ublock/lib/codemirror/README.md +47 -0
- package/extensions/ublock/lib/codemirror/addon/comment/comment.js +211 -0
- package/extensions/ublock/lib/codemirror/addon/display/panel.js +133 -0
- package/extensions/ublock/lib/codemirror/addon/edit/closebrackets.js +201 -0
- package/extensions/ublock/lib/codemirror/addon/edit/matchbrackets.js +160 -0
- package/extensions/ublock/lib/codemirror/addon/fold/foldcode.js +157 -0
- package/extensions/ublock/lib/codemirror/addon/fold/foldgutter.css +20 -0
- package/extensions/ublock/lib/codemirror/addon/fold/foldgutter.js +163 -0
- package/extensions/ublock/lib/codemirror/addon/hint/show-hint.css +36 -0
- package/extensions/ublock/lib/codemirror/addon/hint/show-hint.js +509 -0
- package/extensions/ublock/lib/codemirror/addon/merge/merge.css +119 -0
- package/extensions/ublock/lib/codemirror/addon/merge/merge.js +1006 -0
- package/extensions/ublock/lib/codemirror/addon/scroll/annotatescrollbar.js +128 -0
- package/extensions/ublock/lib/codemirror/addon/search/matchesonscrollbar.css +8 -0
- package/extensions/ublock/lib/codemirror/addon/search/searchcursor.js +296 -0
- package/extensions/ublock/lib/codemirror/addon/selection/active-line.js +72 -0
- package/extensions/ublock/lib/codemirror/lib/codemirror.css +350 -0
- package/extensions/ublock/lib/codemirror/lib/codemirror.js +9800 -0
- package/extensions/ublock/lib/codemirror/mode/css/css.js +864 -0
- package/extensions/ublock/lib/codemirror/mode/htmlmixed/htmlmixed.js +153 -0
- package/extensions/ublock/lib/codemirror/mode/javascript/javascript.js +942 -0
- package/extensions/ublock/lib/codemirror/mode/xml/xml.js +413 -0
- package/extensions/ublock/lib/codemirror/theme/night.css +27 -0
- package/extensions/ublock/lib/csstree/LICENSE +19 -0
- package/extensions/ublock/lib/csstree/css-tree.js +17 -0
- package/extensions/ublock/lib/diff/README.md +34 -0
- package/extensions/ublock/lib/diff/swatinem_diff.js +272 -0
- package/extensions/ublock/lib/hsluv/LICENSE +20 -0
- package/extensions/ublock/lib/hsluv/README +3 -0
- package/extensions/ublock/lib/hsluv/hsluv-0.1.0.min.js +8 -0
- package/extensions/ublock/lib/js-beautify/LICENSE +9 -0
- package/extensions/ublock/lib/js-beautify/README +5 -0
- package/extensions/ublock/lib/js-beautify/beautifier.min.js +2 -0
- package/extensions/ublock/lib/lz4/README.md +52 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec-any.js +151 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec-js.js +297 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec-wasm.js +195 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec.wasm +0 -0
- package/extensions/ublock/lib/lz4/lz4-block-codec.wat +745 -0
- package/extensions/ublock/lib/publicsuffixlist/publicsuffixlist.js +641 -0
- package/extensions/ublock/lib/publicsuffixlist/wasm/README.md +29 -0
- package/extensions/ublock/lib/publicsuffixlist/wasm/publicsuffixlist.wasm +0 -0
- package/extensions/ublock/lib/publicsuffixlist/wasm/publicsuffixlist.wat +322 -0
- package/extensions/ublock/lib/punycode.js +493 -0
- package/extensions/ublock/lib/regexanalyzer/CHANGES.md +15 -0
- package/extensions/ublock/lib/regexanalyzer/README.md +14 -0
- package/extensions/ublock/lib/regexanalyzer/regex.js +2276 -0
- package/extensions/ublock/logger-ui.html +232 -0
- package/extensions/ublock/managed_storage.json +73 -0
- package/extensions/ublock/manifest.json +115 -0
- package/extensions/ublock/no-dashboard.html +27 -0
- package/extensions/ublock/popup-fenix.html +114 -0
- package/extensions/ublock/settings.html +98 -0
- package/extensions/ublock/support.html +131 -0
- package/extensions/ublock/web_accessible_resources/1x1.gif +0 -0
- package/extensions/ublock/web_accessible_resources/2x2.png +0 -0
- package/extensions/ublock/web_accessible_resources/32x32.png +0 -0
- package/extensions/ublock/web_accessible_resources/3x2.png +0 -0
- package/extensions/ublock/web_accessible_resources/README.txt +11 -0
- package/extensions/ublock/web_accessible_resources/addthis_widget.js +39 -0
- package/extensions/ublock/web_accessible_resources/amazon_ads.js +70 -0
- package/extensions/ublock/web_accessible_resources/amazon_apstag.js +62 -0
- package/extensions/ublock/web_accessible_resources/ampproject_v0.js +34 -0
- package/extensions/ublock/web_accessible_resources/chartbeat.js +30 -0
- package/extensions/ublock/web_accessible_resources/click2load.html +28 -0
- package/extensions/ublock/web_accessible_resources/doubleclick_instream_ad_status.js +1 -0
- package/extensions/ublock/web_accessible_resources/empty +0 -0
- package/extensions/ublock/web_accessible_resources/epicker-ui.html +76 -0
- package/extensions/ublock/web_accessible_resources/fingerprint2.js +55 -0
- package/extensions/ublock/web_accessible_resources/fingerprint3.js +45 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_analytics.js +110 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_cx_api.js +36 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_ga.js +130 -0
- package/extensions/ublock/web_accessible_resources/google-analytics_inpage_linkid.js +28 -0
- package/extensions/ublock/web_accessible_resources/google-ima.js +855 -0
- package/extensions/ublock/web_accessible_resources/googlesyndication_adsbygoogle.js +56 -0
- package/extensions/ublock/web_accessible_resources/googletagmanager_gtm.js +43 -0
- package/extensions/ublock/web_accessible_resources/googletagservices_gpt.js +153 -0
- package/extensions/ublock/web_accessible_resources/hd-main.js +46 -0
- package/extensions/ublock/web_accessible_resources/ligatus_angular-tag.js +29 -0
- package/extensions/ublock/web_accessible_resources/monkeybroker.js +43 -0
- package/extensions/ublock/web_accessible_resources/mxpnl_mixpanel.js +51 -0
- package/extensions/ublock/web_accessible_resources/nobab.js +87 -0
- package/extensions/ublock/web_accessible_resources/nobab2.js +42 -0
- package/extensions/ublock/web_accessible_resources/noeval-silent.js +28 -0
- package/extensions/ublock/web_accessible_resources/noeval.js +30 -0
- package/extensions/ublock/web_accessible_resources/nofab.js +67 -0
- package/extensions/ublock/web_accessible_resources/noop-0.1s.mp3 +0 -0
- package/extensions/ublock/web_accessible_resources/noop-0.5s.mp3 +0 -0
- package/extensions/ublock/web_accessible_resources/noop-1s.mp4 +0 -0
- package/extensions/ublock/web_accessible_resources/noop-vmap1.0.xml +1 -0
- package/extensions/ublock/web_accessible_resources/noop.css +1 -0
- package/extensions/ublock/web_accessible_resources/noop.html +5 -0
- package/extensions/ublock/web_accessible_resources/noop.js +3 -0
- package/extensions/ublock/web_accessible_resources/noop.json +1 -0
- package/extensions/ublock/web_accessible_resources/noop.txt +1 -0
- package/extensions/ublock/web_accessible_resources/outbrain-widget.js +72 -0
- package/extensions/ublock/web_accessible_resources/popads-dummy.js +30 -0
- package/extensions/ublock/web_accessible_resources/popads.js +40 -0
- package/extensions/ublock/web_accessible_resources/prebid-ads.js +26 -0
- package/extensions/ublock/web_accessible_resources/scorecardresearch_beacon.js +31 -0
- package/extensions/ublock/whitelist.html +63 -0
- package/external/.gitkeep +0 -0
- package/fonts/Calibri Bold Italic.ttf +0 -0
- package/fonts/Calibri Bold.TTF +0 -0
- package/fonts/Calibri Italic.ttf +0 -0
- package/fonts/Calibri Light Italic.ttf +0 -0
- package/fonts/Calibri Light.ttf +0 -0
- package/fonts/Calibri Regular.ttf +0 -0
- package/fonts/Emoji.ttf +0 -0
- package/fonts/SegoeUI-Bold.ttf +0 -0
- package/fonts/SegoeUI-Light.ttf +0 -0
- package/fonts/SegoeUI-Regular.ttf +0 -0
- package/fonts/SegoeUI-Semibold.ttf +0 -0
- package/fonts/SegoeUI-Semilight.ttf +0 -0
- package/fonts/Tahoma Bold.ttf +0 -0
- package/fonts/Tahoma.ttf +0 -0
- package/fonts/fonts.conf +21 -0
- package/package.json +177 -0
- package/scripts/build-function.js +18 -0
- package/scripts/build-open-api.js +274 -0
- package/scripts/build-schemas.js +86 -0
- package/scripts/build-selectors.js +36 -0
- package/scripts/clean.js +7 -0
- package/scripts/install-adblock.js +45 -0
- package/scripts/install-cdp-json.js +37 -0
- package/scripts/start.sh +30 -0
- package/scripts/test.sh +17 -0
- package/src/browserless.ts +253 -0
- package/src/browsers/cdp-chromium.ts +422 -0
- package/src/browsers/index.ts +296 -0
- package/src/browsers/playwright-chromium.ts +168 -0
- package/src/browsers/playwright-firefox.ts +161 -0
- package/src/browsers/playwright-webkit.ts +161 -0
- package/src/config.ts +426 -0
- package/src/constants.ts +4 -0
- package/src/exports.ts +23 -0
- package/src/file-system.ts +54 -0
- package/src/hooks.ts +37 -0
- package/src/http.ts +157 -0
- package/src/index.ts +41 -0
- package/src/limiter.spec.ts +365 -0
- package/src/limiter.ts +225 -0
- package/src/metrics.spec.ts +49 -0
- package/src/metrics.ts +108 -0
- package/src/mime-types.ts +332 -0
- package/src/monitoring.ts +53 -0
- package/src/routes/chromium/http/content-post.ts +238 -0
- package/src/routes/chromium/http/download-post.ts +162 -0
- package/src/routes/chromium/http/function-post.ts +98 -0
- package/src/routes/chromium/http/pdf-post.ts +234 -0
- package/src/routes/chromium/http/performance.ts +71 -0
- package/src/routes/chromium/http/scrape-post.ts +439 -0
- package/src/routes/chromium/http/screenshot-post.ts +262 -0
- package/src/routes/chromium/tests/content.spec.ts +340 -0
- package/src/routes/chromium/tests/download.spec.ts +77 -0
- package/src/routes/chromium/tests/function.spec.ts +279 -0
- package/src/routes/chromium/tests/pdf.spec.ts +375 -0
- package/src/routes/chromium/tests/performance.spec.ts +155 -0
- package/src/routes/chromium/tests/scrape.spec.ts +414 -0
- package/src/routes/chromium/tests/screenshot.spec.ts +387 -0
- package/src/routes/chromium/tests/websocket.spec.ts +407 -0
- package/src/routes/chromium/utils/function/client.ts +99 -0
- package/src/routes/chromium/utils/function/handler.ts +172 -0
- package/src/routes/chromium/utils/performance/child.ts +38 -0
- package/src/routes/chromium/utils/performance/main.ts +90 -0
- package/src/routes/chromium/utils/performance/types.ts +24 -0
- package/src/routes/chromium/ws/browser.ts +31 -0
- package/src/routes/chromium/ws/cdp-chromium.ts +31 -0
- package/src/routes/chromium/ws/page.ts +31 -0
- package/src/routes/chromium/ws/playwright-chromium.ts +44 -0
- package/src/routes/firefox/tests/websocket.spec.ts +146 -0
- package/src/routes/firefox/ws/playwright-firefox.ts +44 -0
- package/src/routes/management/http/config-get.ts +82 -0
- package/src/routes/management/http/metrics-get.ts +43 -0
- package/src/routes/management/http/metrics-total-get.ts +89 -0
- package/src/routes/management/http/sessions-get.ts +39 -0
- package/src/routes/management/http/static-get.ts +109 -0
- package/src/routes/management/tests/management.spec.ts +71 -0
- package/src/routes/webkit/tests/websocket.spec.ts +146 -0
- package/src/routes/webkit/ws/playwright-webkit.ts +44 -0
- package/src/server.ts +609 -0
- package/src/shim.spec.ts +154 -0
- package/src/shim.ts +78 -0
- package/src/types.ts +470 -0
- package/src/utils.ts +787 -0
- package/src/webhooks.ts +50 -0
- package/static/docs/browserless-logo.png +0 -0
- package/static/docs/docs.js +2 -0
- package/static/docs/index.html +71 -0
- package/static/docs/swagger.json +4232 -0
- package/static/favicon-32x32.png +0 -0
- package/static/function/client.js +31623 -0
- package/static/function/index.html +12 -0
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,1529 @@
|
|
|
1
|
+
/*******************************************************************************
|
|
2
|
+
|
|
3
|
+
uBlock Origin - a browser extension to block requests.
|
|
4
|
+
Copyright (C) 2014-present Raymond Hill
|
|
5
|
+
|
|
6
|
+
This program is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
This program is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU General Public License
|
|
17
|
+
along with this program. If not, see {http://www.gnu.org/licenses/}.
|
|
18
|
+
|
|
19
|
+
Home: https://github.com/gorhill/uBlock
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
'use strict';
|
|
23
|
+
|
|
24
|
+
import punycode from '../lib/punycode.js';
|
|
25
|
+
import { i18n$ } from './i18n.js';
|
|
26
|
+
import { dom, qs$, qsa$ } from './dom.js';
|
|
27
|
+
|
|
28
|
+
/******************************************************************************/
|
|
29
|
+
|
|
30
|
+
let popupFontSize = 'unset';
|
|
31
|
+
vAPI.localStorage.getItemAsync('popupFontSize').then(value => {
|
|
32
|
+
if ( typeof value !== 'string' || value === 'unset' ) { return; }
|
|
33
|
+
document.body.style.setProperty('--font-size', value);
|
|
34
|
+
popupFontSize = value;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// https://github.com/chrisaljoudi/uBlock/issues/996
|
|
38
|
+
// Experimental: mitigate glitchy popup UI: immediately set the firewall
|
|
39
|
+
// pane visibility to its last known state. By default the pane is hidden.
|
|
40
|
+
vAPI.localStorage.getItemAsync('popupPanelSections').then(bits => {
|
|
41
|
+
if ( typeof bits !== 'number' ) { return; }
|
|
42
|
+
setSections(bits);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
/******************************************************************************/
|
|
46
|
+
|
|
47
|
+
const messaging = vAPI.messaging;
|
|
48
|
+
const scopeToSrcHostnameMap = {
|
|
49
|
+
'/': '*',
|
|
50
|
+
'.': ''
|
|
51
|
+
};
|
|
52
|
+
const hostnameToSortableTokenMap = new Map();
|
|
53
|
+
const statsStr = i18n$('popupBlockedStats');
|
|
54
|
+
const domainsHitStr = i18n$('popupHitDomainCount');
|
|
55
|
+
|
|
56
|
+
let popupData = {};
|
|
57
|
+
let dfPaneBuilt = false;
|
|
58
|
+
let dfHotspots = null;
|
|
59
|
+
const allHostnameRows = [];
|
|
60
|
+
let cachedPopupHash = '';
|
|
61
|
+
|
|
62
|
+
// https://github.com/gorhill/uBlock/issues/2550
|
|
63
|
+
// Solution inspired from
|
|
64
|
+
// - https://bugs.chromium.org/p/chromium/issues/detail?id=683314
|
|
65
|
+
// - https://bugzilla.mozilla.org/show_bug.cgi?id=1332714#c17
|
|
66
|
+
// Confusable character set from:
|
|
67
|
+
// - http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%D0%B0%D1%81%D4%81%D0%B5%D2%BB%D1%96%D1%98%D3%8F%D0%BE%D1%80%D4%9B%D1%95%D4%9D%D1%85%D1%83%D1%8A%D0%AC%D2%BD%D0%BF%D0%B3%D1%B5%D1%A1%5D&g=gc&i=
|
|
68
|
+
// Linked from:
|
|
69
|
+
// - https://www.chromium.org/developers/design-documents/idn-in-google-chrome
|
|
70
|
+
const reCyrillicNonAmbiguous = /[\u0400-\u042b\u042d-\u042f\u0431\u0432\u0434\u0436-\u043d\u0442\u0444\u0446-\u0449\u044b-\u0454\u0457\u0459-\u0460\u0462-\u0474\u0476-\u04ba\u04bc\u04be-\u04ce\u04d0-\u0500\u0502-\u051a\u051c\u051e-\u052f]/;
|
|
71
|
+
const reCyrillicAmbiguous = /[\u042c\u0430\u0433\u0435\u043e\u043f\u0440\u0441\u0443\u0445\u044a\u0455\u0456\u0458\u0461\u0475\u04bb\u04bd\u04cf\u0501\u051b\u051d]/;
|
|
72
|
+
|
|
73
|
+
/******************************************************************************/
|
|
74
|
+
|
|
75
|
+
const cachePopupData = function(data) {
|
|
76
|
+
popupData = {};
|
|
77
|
+
scopeToSrcHostnameMap['.'] = '';
|
|
78
|
+
hostnameToSortableTokenMap.clear();
|
|
79
|
+
|
|
80
|
+
if ( typeof data !== 'object' ) {
|
|
81
|
+
return popupData;
|
|
82
|
+
}
|
|
83
|
+
popupData = data;
|
|
84
|
+
popupData.cnameMap = new Map(popupData.cnameMap);
|
|
85
|
+
scopeToSrcHostnameMap['.'] = popupData.pageHostname || '';
|
|
86
|
+
const hostnameDict = popupData.hostnameDict;
|
|
87
|
+
if ( typeof hostnameDict !== 'object' ) {
|
|
88
|
+
return popupData;
|
|
89
|
+
}
|
|
90
|
+
for ( const hostname in hostnameDict ) {
|
|
91
|
+
if ( hostnameDict.hasOwnProperty(hostname) === false ) { continue; }
|
|
92
|
+
let domain = hostnameDict[hostname].domain;
|
|
93
|
+
let prefix = hostname.slice(0, 0 - domain.length - 1);
|
|
94
|
+
// Prefix with space char for 1st-party hostnames: this ensure these
|
|
95
|
+
// will come first in list.
|
|
96
|
+
if ( domain === popupData.pageDomain ) {
|
|
97
|
+
domain = '\u0020';
|
|
98
|
+
}
|
|
99
|
+
hostnameToSortableTokenMap.set(
|
|
100
|
+
hostname,
|
|
101
|
+
domain + ' ' + prefix.split('.').reverse().join('.')
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
return popupData;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/******************************************************************************/
|
|
108
|
+
|
|
109
|
+
const hashFromPopupData = function(reset = false) {
|
|
110
|
+
// It makes no sense to offer to refresh the behind-the-scene scope
|
|
111
|
+
if ( popupData.pageHostname === 'behind-the-scene' ) {
|
|
112
|
+
dom.cl.remove(dom.body, 'needReload');
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const hasher = [];
|
|
117
|
+
const rules = popupData.firewallRules;
|
|
118
|
+
for ( const key in rules ) {
|
|
119
|
+
const rule = rules[key];
|
|
120
|
+
if ( rule === undefined ) { continue; }
|
|
121
|
+
hasher.push(rule);
|
|
122
|
+
}
|
|
123
|
+
hasher.sort();
|
|
124
|
+
hasher.push(
|
|
125
|
+
dom.cl.has('body', 'off'),
|
|
126
|
+
dom.cl.has('#no-large-media', 'on'),
|
|
127
|
+
dom.cl.has('#no-cosmetic-filtering', 'on'),
|
|
128
|
+
dom.cl.has('#no-remote-fonts', 'on'),
|
|
129
|
+
dom.cl.has('#no-scripting', 'on')
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const hash = hasher.join('');
|
|
133
|
+
if ( reset ) {
|
|
134
|
+
cachedPopupHash = hash;
|
|
135
|
+
}
|
|
136
|
+
dom.cl.toggle(dom.body, 'needReload',
|
|
137
|
+
hash !== cachedPopupHash || popupData.hasUnprocessedRequest === true
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
/******************************************************************************/
|
|
142
|
+
|
|
143
|
+
// greater-than-zero test
|
|
144
|
+
|
|
145
|
+
const gtz = n => typeof n === 'number' && n > 0;
|
|
146
|
+
|
|
147
|
+
/******************************************************************************/
|
|
148
|
+
|
|
149
|
+
const formatNumber = function(count) {
|
|
150
|
+
if ( typeof count !== 'number' ) { return ''; }
|
|
151
|
+
if ( count < 1e6 ) { return count.toLocaleString(); }
|
|
152
|
+
|
|
153
|
+
if (
|
|
154
|
+
intlNumberFormat === undefined &&
|
|
155
|
+
Intl.NumberFormat instanceof Function
|
|
156
|
+
) {
|
|
157
|
+
const intl = new Intl.NumberFormat(undefined, {
|
|
158
|
+
notation: 'compact',
|
|
159
|
+
maximumSignificantDigits: 4
|
|
160
|
+
});
|
|
161
|
+
if (
|
|
162
|
+
intl.resolvedOptions instanceof Function &&
|
|
163
|
+
intl.resolvedOptions().hasOwnProperty('notation')
|
|
164
|
+
) {
|
|
165
|
+
intlNumberFormat = intl;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if ( intlNumberFormat ) {
|
|
170
|
+
return intlNumberFormat.format(count);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// https://github.com/uBlockOrigin/uBlock-issues/issues/1027#issuecomment-629696676
|
|
174
|
+
// For platforms which do not support proper number formatting, use
|
|
175
|
+
// a poor's man compact form, which unfortunately is not i18n-friendly.
|
|
176
|
+
count /= 1000000;
|
|
177
|
+
if ( count >= 100 ) {
|
|
178
|
+
count = Math.floor(count * 10) / 10;
|
|
179
|
+
} else if ( count > 10 ) {
|
|
180
|
+
count = Math.floor(count * 100) / 100;
|
|
181
|
+
} else {
|
|
182
|
+
count = Math.floor(count * 1000) / 1000;
|
|
183
|
+
}
|
|
184
|
+
return (count).toLocaleString(undefined) + '\u2009M';
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
let intlNumberFormat;
|
|
188
|
+
|
|
189
|
+
/******************************************************************************/
|
|
190
|
+
|
|
191
|
+
const safePunycodeToUnicode = function(hn) {
|
|
192
|
+
const pretty = punycode.toUnicode(hn);
|
|
193
|
+
return pretty === hn ||
|
|
194
|
+
reCyrillicAmbiguous.test(pretty) === false ||
|
|
195
|
+
reCyrillicNonAmbiguous.test(pretty)
|
|
196
|
+
? pretty
|
|
197
|
+
: hn;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/******************************************************************************/
|
|
201
|
+
|
|
202
|
+
const updateFirewallCellCount = function(cells, allowed, blocked) {
|
|
203
|
+
for ( const cell of cells ) {
|
|
204
|
+
if ( gtz(allowed) ) {
|
|
205
|
+
dom.attr(cell, 'data-acount',
|
|
206
|
+
Math.min(Math.ceil(Math.log(allowed + 1) / Math.LN10), 3)
|
|
207
|
+
);
|
|
208
|
+
} else {
|
|
209
|
+
dom.attr(cell, 'data-acount', '0');
|
|
210
|
+
}
|
|
211
|
+
if ( gtz(blocked) ) {
|
|
212
|
+
dom.attr(cell, 'data-bcount',
|
|
213
|
+
Math.min(Math.ceil(Math.log(blocked + 1) / Math.LN10), 3)
|
|
214
|
+
);
|
|
215
|
+
} else {
|
|
216
|
+
dom.attr(cell, 'data-bcount', '0');
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/******************************************************************************/
|
|
222
|
+
|
|
223
|
+
const updateFirewallCellRule = function(cells, scope, des, type, rule) {
|
|
224
|
+
const ruleParts = rule !== undefined ? rule.split(' ') : undefined;
|
|
225
|
+
|
|
226
|
+
for ( const cell of cells ) {
|
|
227
|
+
if ( ruleParts === undefined ) {
|
|
228
|
+
dom.attr(cell, 'class', null);
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
const action = updateFirewallCellRule.actionNames[ruleParts[3]];
|
|
233
|
+
dom.attr(cell, 'class', `${action}Rule`);
|
|
234
|
+
|
|
235
|
+
// Use dark shade visual cue if the rule is specific to the cell.
|
|
236
|
+
if (
|
|
237
|
+
(ruleParts[1] !== '*' || ruleParts[2] === type) &&
|
|
238
|
+
(ruleParts[1] === des) &&
|
|
239
|
+
(ruleParts[0] === scopeToSrcHostnameMap[scope])
|
|
240
|
+
|
|
241
|
+
) {
|
|
242
|
+
dom.cl.add(cell, 'ownRule');
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
updateFirewallCellRule.actionNames = { '1': 'block', '2': 'allow', '3': 'noop' };
|
|
248
|
+
|
|
249
|
+
/******************************************************************************/
|
|
250
|
+
|
|
251
|
+
const updateAllFirewallCells = function(doRules = true, doCounts = true) {
|
|
252
|
+
const { pageDomain } = popupData;
|
|
253
|
+
const rowContainer = qs$('#firewall');
|
|
254
|
+
const rows = qsa$(rowContainer, '#firewall > [data-des][data-type]');
|
|
255
|
+
|
|
256
|
+
let a1pScript = 0, b1pScript = 0;
|
|
257
|
+
let a3pScript = 0, b3pScript = 0;
|
|
258
|
+
let a3pFrame = 0, b3pFrame = 0;
|
|
259
|
+
|
|
260
|
+
for ( const row of rows ) {
|
|
261
|
+
const des = dom.attr(row, 'data-des');
|
|
262
|
+
const type = dom.attr(row, 'data-type');
|
|
263
|
+
if ( doRules ) {
|
|
264
|
+
updateFirewallCellRule(
|
|
265
|
+
qsa$(row, ':scope > span[data-src="/"]'),
|
|
266
|
+
'/',
|
|
267
|
+
des,
|
|
268
|
+
type,
|
|
269
|
+
popupData.firewallRules[`/ ${des} ${type}`]
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
const cells = qsa$(row, ':scope > span[data-src="."]');
|
|
273
|
+
if ( doRules ) {
|
|
274
|
+
updateFirewallCellRule(
|
|
275
|
+
cells,
|
|
276
|
+
'.',
|
|
277
|
+
des,
|
|
278
|
+
type,
|
|
279
|
+
popupData.firewallRules[`. ${des} ${type}`]
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
if ( des === '*' || type !== '*' ) { continue; }
|
|
283
|
+
if ( doCounts === false ) { continue; }
|
|
284
|
+
const hnDetails = popupData.hostnameDict[des];
|
|
285
|
+
if ( hnDetails === undefined ) {
|
|
286
|
+
updateFirewallCellCount(cells);
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
const { allowed, blocked } = hnDetails.counts;
|
|
290
|
+
updateFirewallCellCount([ cells[0] ], allowed.any, blocked.any);
|
|
291
|
+
const { totals } = hnDetails;
|
|
292
|
+
if ( totals !== undefined ) {
|
|
293
|
+
updateFirewallCellCount([ cells[1] ], totals.allowed.any, totals.blocked.any);
|
|
294
|
+
}
|
|
295
|
+
if ( hnDetails.domain === pageDomain ) {
|
|
296
|
+
a1pScript += allowed.script; b1pScript += blocked.script;
|
|
297
|
+
} else {
|
|
298
|
+
a3pScript += allowed.script; b3pScript += blocked.script;
|
|
299
|
+
a3pFrame += allowed.frame; b3pFrame += blocked.frame;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
if ( doCounts ) {
|
|
304
|
+
const fromType = type =>
|
|
305
|
+
qsa$(`#firewall > [data-des="*"][data-type="${type}"] > [data-src="."]`);
|
|
306
|
+
updateFirewallCellCount(fromType('1p-script'), a1pScript, b1pScript);
|
|
307
|
+
updateFirewallCellCount(fromType('3p-script'), a3pScript, b3pScript);
|
|
308
|
+
dom.cl.toggle(rowContainer, 'has3pScript', a3pScript !== 0 || b3pScript !== 0);
|
|
309
|
+
updateFirewallCellCount(fromType('3p-frame'), a3pFrame, b3pFrame);
|
|
310
|
+
dom.cl.toggle(rowContainer, 'has3pFrame', a3pFrame !== 0 || b3pFrame !== 0);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
dom.cl.toggle(dom.body, 'needSave', popupData.matrixIsDirty === true);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/******************************************************************************/
|
|
317
|
+
|
|
318
|
+
// Compute statistics useful only to firewall entries -- we need to call
|
|
319
|
+
// this only when overview pane needs to be rendered.
|
|
320
|
+
|
|
321
|
+
const expandHostnameStats = ( ) => {
|
|
322
|
+
let dnDetails;
|
|
323
|
+
for ( const des of allHostnameRows ) {
|
|
324
|
+
const hnDetails = popupData.hostnameDict[des];
|
|
325
|
+
const { domain, counts } = hnDetails;
|
|
326
|
+
const isDomain = des === domain;
|
|
327
|
+
const { allowed: hnAllowed, blocked: hnBlocked } = counts;
|
|
328
|
+
if ( isDomain ) {
|
|
329
|
+
dnDetails = hnDetails;
|
|
330
|
+
dnDetails.totals = JSON.parse(JSON.stringify(dnDetails.counts));
|
|
331
|
+
} else {
|
|
332
|
+
const { allowed: dnAllowed, blocked: dnBlocked } = dnDetails.totals;
|
|
333
|
+
dnAllowed.any += hnAllowed.any;
|
|
334
|
+
dnBlocked.any += hnBlocked.any;
|
|
335
|
+
}
|
|
336
|
+
hnDetails.hasScript = hnAllowed.script !== 0 || hnBlocked.script !== 0;
|
|
337
|
+
dnDetails.hasScript = dnDetails.hasScript || hnDetails.hasScript;
|
|
338
|
+
hnDetails.hasFrame = hnAllowed.frame !== 0 || hnBlocked.frame !== 0;
|
|
339
|
+
dnDetails.hasFrame = dnDetails.hasFrame || hnDetails.hasFrame;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
/******************************************************************************/
|
|
344
|
+
|
|
345
|
+
const buildAllFirewallRows = function() {
|
|
346
|
+
// Do this before removing the rows
|
|
347
|
+
if ( dfHotspots === null ) {
|
|
348
|
+
dfHotspots = qs$('#actionSelector');
|
|
349
|
+
dom.on(dfHotspots, 'click', setFirewallRuleHandler);
|
|
350
|
+
}
|
|
351
|
+
dfHotspots.remove();
|
|
352
|
+
|
|
353
|
+
// This must be called before we create the rows.
|
|
354
|
+
expandHostnameStats();
|
|
355
|
+
|
|
356
|
+
// Update incrementally: reuse existing rows if possible.
|
|
357
|
+
const rowContainer = qs$('#firewall');
|
|
358
|
+
const toAppend = document.createDocumentFragment();
|
|
359
|
+
const rowTemplate = qs$('#templates > div[data-des=""][data-type="*"]');
|
|
360
|
+
const { cnameMap, hostnameDict, pageDomain, pageHostname } = popupData;
|
|
361
|
+
|
|
362
|
+
let row = qs$(rowContainer, 'div[data-des="*"][data-type="3p-frame"] + div');
|
|
363
|
+
|
|
364
|
+
for ( const des of allHostnameRows ) {
|
|
365
|
+
if ( row === null ) {
|
|
366
|
+
row = dom.clone(rowTemplate);
|
|
367
|
+
toAppend.appendChild(row);
|
|
368
|
+
}
|
|
369
|
+
dom.attr(row, 'data-des', des);
|
|
370
|
+
|
|
371
|
+
const hnDetails = hostnameDict[des] || {};
|
|
372
|
+
const isDomain = des === hnDetails.domain;
|
|
373
|
+
const prettyDomainName = des.includes('xn--')
|
|
374
|
+
? punycode.toUnicode(des)
|
|
375
|
+
: des;
|
|
376
|
+
const isPunycoded = prettyDomainName !== des;
|
|
377
|
+
|
|
378
|
+
if ( isDomain && row.childElementCount < 4 ) {
|
|
379
|
+
row.append(dom.clone(row.children[2]));
|
|
380
|
+
} else if ( isDomain === false && row.childElementCount === 4 ) {
|
|
381
|
+
row.children[3].remove();
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
const span = qs$(row, 'span:first-of-type');
|
|
385
|
+
dom.text(qs$(span, ':scope > span > span'), prettyDomainName);
|
|
386
|
+
|
|
387
|
+
const classList = row.classList;
|
|
388
|
+
|
|
389
|
+
let desExtra = '';
|
|
390
|
+
if ( classList.toggle('isCname', cnameMap.has(des)) ) {
|
|
391
|
+
desExtra = punycode.toUnicode(cnameMap.get(des));
|
|
392
|
+
} else if (
|
|
393
|
+
isDomain && isPunycoded &&
|
|
394
|
+
reCyrillicAmbiguous.test(prettyDomainName) &&
|
|
395
|
+
reCyrillicNonAmbiguous.test(prettyDomainName) === false
|
|
396
|
+
) {
|
|
397
|
+
desExtra = des;
|
|
398
|
+
}
|
|
399
|
+
dom.text(qs$(span, 'sub'), desExtra);
|
|
400
|
+
|
|
401
|
+
classList.toggle('isRootContext', des === pageHostname);
|
|
402
|
+
classList.toggle('is3p', hnDetails.domain !== pageDomain);
|
|
403
|
+
classList.toggle('isDomain', isDomain);
|
|
404
|
+
classList.toggle('hasSubdomains', isDomain && hnDetails.hasSubdomains);
|
|
405
|
+
classList.toggle('isSubdomain', !isDomain);
|
|
406
|
+
const { counts } = hnDetails;
|
|
407
|
+
classList.toggle('allowed', gtz(counts.allowed.any));
|
|
408
|
+
classList.toggle('blocked', gtz(counts.blocked.any));
|
|
409
|
+
const { totals } = hnDetails;
|
|
410
|
+
classList.toggle('totalAllowed', gtz(totals && totals.allowed.any));
|
|
411
|
+
classList.toggle('totalBlocked', gtz(totals && totals.blocked.any));
|
|
412
|
+
classList.toggle('hasScript', hnDetails.hasScript === true);
|
|
413
|
+
classList.toggle('hasFrame', hnDetails.hasFrame === true);
|
|
414
|
+
classList.toggle('expandException', expandExceptions.has(hnDetails.domain));
|
|
415
|
+
|
|
416
|
+
row = row.nextElementSibling;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Remove unused trailing rows
|
|
420
|
+
if ( row !== null ) {
|
|
421
|
+
while ( row.nextElementSibling !== null ) {
|
|
422
|
+
row.nextElementSibling.remove();
|
|
423
|
+
}
|
|
424
|
+
row.remove();
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
// Add new rows all at once
|
|
428
|
+
if ( toAppend.childElementCount !== 0 ) {
|
|
429
|
+
rowContainer.append(toAppend);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
if ( dfPaneBuilt !== true && popupData.advancedUserEnabled ) {
|
|
433
|
+
dom.on('#firewall', 'click', 'span[data-src]', unsetFirewallRuleHandler);
|
|
434
|
+
dom.on('#firewall', 'mouseenter', 'span[data-src]', mouseenterCellHandler);
|
|
435
|
+
dom.on('#firewall', 'mouseleave', 'span[data-src]', mouseleaveCellHandler);
|
|
436
|
+
dfPaneBuilt = true;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
updateAllFirewallCells();
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
/******************************************************************************/
|
|
443
|
+
|
|
444
|
+
const hostnameCompare = function(a, b) {
|
|
445
|
+
let ha = a;
|
|
446
|
+
if ( !reIP.test(ha) ) {
|
|
447
|
+
ha = hostnameToSortableTokenMap.get(ha) || ' ';
|
|
448
|
+
}
|
|
449
|
+
let hb = b;
|
|
450
|
+
if ( !reIP.test(hb) ) {
|
|
451
|
+
hb = hostnameToSortableTokenMap.get(hb) || ' ';
|
|
452
|
+
}
|
|
453
|
+
const ca = ha.charCodeAt(0);
|
|
454
|
+
const cb = hb.charCodeAt(0);
|
|
455
|
+
return ca !== cb ? ca - cb : ha.localeCompare(hb);
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
const reIP = /(\d|\])$/;
|
|
459
|
+
|
|
460
|
+
/******************************************************************************/
|
|
461
|
+
|
|
462
|
+
function filterFirewallRows() {
|
|
463
|
+
const firewallElem = qs$('#firewall');
|
|
464
|
+
const elems = qsa$('#firewall .filterExpressions span[data-expr]');
|
|
465
|
+
let not = false;
|
|
466
|
+
for ( const elem of elems ) {
|
|
467
|
+
const on = dom.cl.has(elem, 'on');
|
|
468
|
+
switch ( elem.dataset.expr ) {
|
|
469
|
+
case 'not':
|
|
470
|
+
not = on;
|
|
471
|
+
break;
|
|
472
|
+
case 'blocked':
|
|
473
|
+
dom.cl.toggle(firewallElem, 'showBlocked', !not && on);
|
|
474
|
+
dom.cl.toggle(firewallElem, 'hideBlocked', not && on);
|
|
475
|
+
break;
|
|
476
|
+
case 'allowed':
|
|
477
|
+
dom.cl.toggle(firewallElem, 'showAllowed', !not && on);
|
|
478
|
+
dom.cl.toggle(firewallElem, 'hideAllowed', not && on);
|
|
479
|
+
break;
|
|
480
|
+
case 'script':
|
|
481
|
+
dom.cl.toggle(firewallElem, 'show3pScript', !not && on);
|
|
482
|
+
dom.cl.toggle(firewallElem, 'hide3pScript', not && on);
|
|
483
|
+
break;
|
|
484
|
+
case 'frame':
|
|
485
|
+
dom.cl.toggle(firewallElem, 'show3pFrame', !not && on);
|
|
486
|
+
dom.cl.toggle(firewallElem, 'hide3pFrame', not && on);
|
|
487
|
+
break;
|
|
488
|
+
default:
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
dom.on('#firewall .filterExpressions', 'click', 'span[data-expr]', ev => {
|
|
495
|
+
const target = ev.target;
|
|
496
|
+
dom.cl.toggle(target, 'on');
|
|
497
|
+
switch ( target.dataset.expr ) {
|
|
498
|
+
case 'blocked':
|
|
499
|
+
if ( dom.cl.has(target, 'on') === false ) { break; }
|
|
500
|
+
dom.cl.remove('#firewall .filterExpressions span[data-expr="allowed"]', 'on');
|
|
501
|
+
break;
|
|
502
|
+
case 'allowed':
|
|
503
|
+
if ( dom.cl.has(target, 'on') === false ) { break; }
|
|
504
|
+
dom.cl.remove('#firewall .filterExpressions span[data-expr="blocked"]', 'on');
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
507
|
+
filterFirewallRows();
|
|
508
|
+
const elems = qsa$('#firewall .filterExpressions span[data-expr]');
|
|
509
|
+
const filters = Array.from(elems) .map(el => dom.cl.has(el, 'on') ? '1' : '0');
|
|
510
|
+
filters.unshift('00');
|
|
511
|
+
vAPI.localStorage.setItem('firewallFilters', filters.join(' '));
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
{
|
|
515
|
+
vAPI.localStorage.getItemAsync('firewallFilters').then(v => {
|
|
516
|
+
if ( v === null ) { return; }
|
|
517
|
+
const filters = v.split(' ');
|
|
518
|
+
if ( filters.shift() !== '00' ) { return; }
|
|
519
|
+
if ( filters.every(v => v === '0') ) { return; }
|
|
520
|
+
const elems = qsa$('#firewall .filterExpressions span[data-expr]');
|
|
521
|
+
for ( let i = 0; i < elems.length; i++ ) {
|
|
522
|
+
if ( filters[i] === '0' ) { continue; }
|
|
523
|
+
dom.cl.add(elems[i], 'on');
|
|
524
|
+
}
|
|
525
|
+
filterFirewallRows();
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/******************************************************************************/
|
|
530
|
+
|
|
531
|
+
const renderPrivacyExposure = function() {
|
|
532
|
+
const allDomains = {};
|
|
533
|
+
let allDomainCount = 0;
|
|
534
|
+
let touchedDomainCount = 0;
|
|
535
|
+
|
|
536
|
+
allHostnameRows.length = 0;
|
|
537
|
+
|
|
538
|
+
// Sort hostnames. First-party hostnames must always appear at the top
|
|
539
|
+
// of the list.
|
|
540
|
+
const { hostnameDict } = popupData;
|
|
541
|
+
const desHostnameDone = new Set();
|
|
542
|
+
const keys = Object.keys(hostnameDict).sort(hostnameCompare);
|
|
543
|
+
for ( const des of keys ) {
|
|
544
|
+
// Specific-type rules -- these are built-in
|
|
545
|
+
if ( des === '*' || desHostnameDone.has(des) ) { continue; }
|
|
546
|
+
const hnDetails = hostnameDict[des];
|
|
547
|
+
const { domain, counts } = hnDetails;
|
|
548
|
+
if ( allDomains.hasOwnProperty(domain) === false ) {
|
|
549
|
+
allDomains[domain] = false;
|
|
550
|
+
allDomainCount += 1;
|
|
551
|
+
}
|
|
552
|
+
if ( gtz(counts.allowed.any) ) {
|
|
553
|
+
if ( allDomains[domain] === false ) {
|
|
554
|
+
allDomains[domain] = true;
|
|
555
|
+
touchedDomainCount += 1;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
const dnDetails = hostnameDict[domain];
|
|
559
|
+
if ( dnDetails !== undefined ) {
|
|
560
|
+
if ( des !== domain ) {
|
|
561
|
+
dnDetails.hasSubdomains = true;
|
|
562
|
+
} else if ( dnDetails.hasSubdomains === undefined ) {
|
|
563
|
+
dnDetails.hasSubdomains = false;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
allHostnameRows.push(des);
|
|
567
|
+
desHostnameDone.add(des);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
const summary = domainsHitStr
|
|
571
|
+
.replace('{{count}}', touchedDomainCount.toLocaleString())
|
|
572
|
+
.replace('{{total}}', allDomainCount.toLocaleString());
|
|
573
|
+
dom.text('[data-i18n^="popupDomainsConnected"] + span', summary);
|
|
574
|
+
};
|
|
575
|
+
|
|
576
|
+
/******************************************************************************/
|
|
577
|
+
|
|
578
|
+
const updateHnSwitches = function() {
|
|
579
|
+
dom.cl.toggle('#no-popups', 'on', popupData.noPopups === true);
|
|
580
|
+
dom.cl.toggle('#no-large-media', 'on', popupData.noLargeMedia === true);
|
|
581
|
+
dom.cl.toggle('#no-cosmetic-filtering', 'on',popupData.noCosmeticFiltering === true);
|
|
582
|
+
dom.cl.toggle('#no-remote-fonts', 'on', popupData.noRemoteFonts === true);
|
|
583
|
+
dom.cl.toggle('#no-scripting', 'on', popupData.noScripting === true);
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
/******************************************************************************/
|
|
587
|
+
|
|
588
|
+
// Assume everything has to be done incrementally.
|
|
589
|
+
|
|
590
|
+
const renderPopup = function() {
|
|
591
|
+
if ( popupData.tabTitle ) {
|
|
592
|
+
document.title = popupData.appName + ' - ' + popupData.tabTitle;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const isFiltering = popupData.netFilteringSwitch;
|
|
596
|
+
|
|
597
|
+
dom.cl.toggle(dom.body, 'advancedUser', popupData.advancedUserEnabled === true);
|
|
598
|
+
dom.cl.toggle(dom.body, 'off', popupData.pageURL === '' || isFiltering !== true);
|
|
599
|
+
dom.cl.toggle(dom.body, 'needSave', popupData.matrixIsDirty === true);
|
|
600
|
+
|
|
601
|
+
// The hostname information below the power switch
|
|
602
|
+
{
|
|
603
|
+
const [ elemHn, elemDn ] = qs$('#hostname').children;
|
|
604
|
+
const { pageDomain, pageHostname } = popupData;
|
|
605
|
+
if ( pageDomain !== '' ) {
|
|
606
|
+
dom.text(elemDn, safePunycodeToUnicode(pageDomain));
|
|
607
|
+
dom.text(elemHn, pageHostname !== pageDomain
|
|
608
|
+
? safePunycodeToUnicode(pageHostname.slice(0, -pageDomain.length - 1)) + '.'
|
|
609
|
+
: ''
|
|
610
|
+
);
|
|
611
|
+
} else {
|
|
612
|
+
dom.text(elemDn, '');
|
|
613
|
+
dom.text(elemHn, '');
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
dom.cl.toggle(
|
|
618
|
+
'#basicTools',
|
|
619
|
+
'canPick',
|
|
620
|
+
popupData.canElementPicker === true && isFiltering
|
|
621
|
+
);
|
|
622
|
+
|
|
623
|
+
let blocked, total;
|
|
624
|
+
if ( popupData.pageCounts !== undefined ) {
|
|
625
|
+
const counts = popupData.pageCounts;
|
|
626
|
+
blocked = counts.blocked.any;
|
|
627
|
+
total = blocked + counts.allowed.any;
|
|
628
|
+
} else {
|
|
629
|
+
blocked = 0;
|
|
630
|
+
total = 0;
|
|
631
|
+
}
|
|
632
|
+
let text;
|
|
633
|
+
if ( total === 0 ) {
|
|
634
|
+
text = formatNumber(0);
|
|
635
|
+
} else {
|
|
636
|
+
text = statsStr.replace('{{count}}', formatNumber(blocked))
|
|
637
|
+
.replace('{{percent}}', formatNumber(Math.floor(blocked * 100 / total)));
|
|
638
|
+
}
|
|
639
|
+
dom.text('[data-i18n^="popupBlockedOnThisPage"] + span', text);
|
|
640
|
+
|
|
641
|
+
blocked = popupData.globalBlockedRequestCount;
|
|
642
|
+
total = popupData.globalAllowedRequestCount + blocked;
|
|
643
|
+
if ( total === 0 ) {
|
|
644
|
+
text = formatNumber(0);
|
|
645
|
+
} else {
|
|
646
|
+
text = statsStr.replace('{{count}}', formatNumber(blocked))
|
|
647
|
+
.replace('{{percent}}', formatNumber(Math.floor(blocked * 100 / total)));
|
|
648
|
+
}
|
|
649
|
+
dom.text('[data-i18n^="popupBlockedSinceInstall"] + span', text);
|
|
650
|
+
|
|
651
|
+
// This will collate all domains, touched or not
|
|
652
|
+
renderPrivacyExposure();
|
|
653
|
+
|
|
654
|
+
// Extra tools
|
|
655
|
+
updateHnSwitches();
|
|
656
|
+
|
|
657
|
+
// Report popup count on badge
|
|
658
|
+
total = popupData.popupBlockedCount;
|
|
659
|
+
dom.text(
|
|
660
|
+
'#no-popups .fa-icon-badge',
|
|
661
|
+
total ? Math.min(total, 99).toLocaleString() : ''
|
|
662
|
+
);
|
|
663
|
+
|
|
664
|
+
// Report large media count on badge
|
|
665
|
+
total = popupData.largeMediaCount;
|
|
666
|
+
dom.text(
|
|
667
|
+
'#no-large-media .fa-icon-badge',
|
|
668
|
+
total ? Math.min(total, 99).toLocaleString() : ''
|
|
669
|
+
);
|
|
670
|
+
|
|
671
|
+
// Report remote font count on badge
|
|
672
|
+
total = popupData.remoteFontCount;
|
|
673
|
+
dom.text(
|
|
674
|
+
'#no-remote-fonts .fa-icon-badge',
|
|
675
|
+
total ? Math.min(total, 99).toLocaleString() : ''
|
|
676
|
+
);
|
|
677
|
+
|
|
678
|
+
// Unprocesseed request(s) warning
|
|
679
|
+
dom.cl.toggle(dom.root, 'warn', popupData.hasUnprocessedRequest === true);
|
|
680
|
+
|
|
681
|
+
dom.cl.toggle(dom.html, 'colorBlind', popupData.colorBlindFriendly === true);
|
|
682
|
+
|
|
683
|
+
setGlobalExpand(popupData.firewallPaneMinimized === false, true);
|
|
684
|
+
|
|
685
|
+
// Build dynamic filtering pane only if in use
|
|
686
|
+
if ( (computedSections() & sectionFirewallBit) !== 0 ) {
|
|
687
|
+
buildAllFirewallRows();
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
renderTooltips();
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
/******************************************************************************/
|
|
694
|
+
|
|
695
|
+
dom.on('.dismiss', 'click', ( ) => {
|
|
696
|
+
messaging.send('popupPanel', {
|
|
697
|
+
what: 'dismissUnprocessedRequest',
|
|
698
|
+
tabId: popupData.tabId,
|
|
699
|
+
}).then(( ) => {
|
|
700
|
+
popupData.hasUnprocessedRequest = false;
|
|
701
|
+
dom.cl.remove(dom.root, 'warn');
|
|
702
|
+
});
|
|
703
|
+
});
|
|
704
|
+
|
|
705
|
+
/******************************************************************************/
|
|
706
|
+
|
|
707
|
+
// https://github.com/gorhill/uBlock/issues/2889
|
|
708
|
+
// Use tooltip for ARIA purpose.
|
|
709
|
+
|
|
710
|
+
const renderTooltips = function(selector) {
|
|
711
|
+
for ( const [ key, details ] of tooltipTargetSelectors ) {
|
|
712
|
+
if ( selector !== undefined && key !== selector ) { continue; }
|
|
713
|
+
const elem = qs$(key);
|
|
714
|
+
if ( elem.hasAttribute('title') === false ) { continue; }
|
|
715
|
+
const text = i18n$(
|
|
716
|
+
details.i18n +
|
|
717
|
+
(qs$(details.state) === null ? '1' : '2')
|
|
718
|
+
);
|
|
719
|
+
dom.attr(elem, 'aria-label', text);
|
|
720
|
+
dom.attr(elem, 'title', text);
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
|
|
724
|
+
const tooltipTargetSelectors = new Map([
|
|
725
|
+
[
|
|
726
|
+
'#switch',
|
|
727
|
+
{
|
|
728
|
+
state: 'body.off',
|
|
729
|
+
i18n: 'popupPowerSwitchInfo',
|
|
730
|
+
}
|
|
731
|
+
],
|
|
732
|
+
[
|
|
733
|
+
'#no-popups',
|
|
734
|
+
{
|
|
735
|
+
state: '#no-popups.on',
|
|
736
|
+
i18n: 'popupTipNoPopups'
|
|
737
|
+
}
|
|
738
|
+
],
|
|
739
|
+
[
|
|
740
|
+
'#no-large-media',
|
|
741
|
+
{
|
|
742
|
+
state: '#no-large-media.on',
|
|
743
|
+
i18n: 'popupTipNoLargeMedia'
|
|
744
|
+
}
|
|
745
|
+
],
|
|
746
|
+
[
|
|
747
|
+
'#no-cosmetic-filtering',
|
|
748
|
+
{
|
|
749
|
+
state: '#no-cosmetic-filtering.on',
|
|
750
|
+
i18n: 'popupTipNoCosmeticFiltering'
|
|
751
|
+
}
|
|
752
|
+
],
|
|
753
|
+
[
|
|
754
|
+
'#no-remote-fonts',
|
|
755
|
+
{
|
|
756
|
+
state: '#no-remote-fonts.on',
|
|
757
|
+
i18n: 'popupTipNoRemoteFonts'
|
|
758
|
+
}
|
|
759
|
+
],
|
|
760
|
+
[
|
|
761
|
+
'#no-scripting',
|
|
762
|
+
{
|
|
763
|
+
state: '#no-scripting.on',
|
|
764
|
+
i18n: 'popupTipNoScripting'
|
|
765
|
+
}
|
|
766
|
+
],
|
|
767
|
+
]);
|
|
768
|
+
|
|
769
|
+
/******************************************************************************/
|
|
770
|
+
|
|
771
|
+
// All rendering code which need to be executed only once.
|
|
772
|
+
|
|
773
|
+
let renderOnce = function() {
|
|
774
|
+
renderOnce = function(){};
|
|
775
|
+
|
|
776
|
+
if ( popupData.fontSize !== popupFontSize ) {
|
|
777
|
+
popupFontSize = popupData.fontSize;
|
|
778
|
+
if ( popupFontSize !== 'unset' ) {
|
|
779
|
+
dom.body.style.setProperty('--font-size', popupFontSize);
|
|
780
|
+
vAPI.localStorage.setItem('popupFontSize', popupFontSize);
|
|
781
|
+
} else {
|
|
782
|
+
dom.body.style.removeProperty('--font-size');
|
|
783
|
+
vAPI.localStorage.removeItem('popupFontSize');
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
dom.text('#version', popupData.appVersion);
|
|
788
|
+
|
|
789
|
+
setSections(computedSections());
|
|
790
|
+
|
|
791
|
+
if ( popupData.uiPopupConfig !== undefined ) {
|
|
792
|
+
dom.attr(dom.body, 'data-ui', popupData.uiPopupConfig);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
dom.cl.toggle(dom.body, 'no-tooltips', popupData.tooltipsDisabled === true);
|
|
796
|
+
if ( popupData.tooltipsDisabled === true ) {
|
|
797
|
+
dom.attr('[title]', 'title', null);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
// https://github.com/uBlockOrigin/uBlock-issues/issues/22
|
|
801
|
+
if ( popupData.advancedUserEnabled !== true ) {
|
|
802
|
+
dom.attr('#firewall [title][data-src]', 'title', null);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// This must be done the firewall is populated
|
|
806
|
+
if ( popupData.popupPanelHeightMode === 1 ) {
|
|
807
|
+
dom.cl.add(dom.body, 'vMin');
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
// Prevent non-advanced user opting into advanced user mode from harming
|
|
811
|
+
// themselves by disabling by default features generally suitable to
|
|
812
|
+
// filter list maintainers and actual advanced users.
|
|
813
|
+
if ( popupData.godMode ) {
|
|
814
|
+
dom.cl.add(dom.body, 'godMode');
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
|
|
818
|
+
/******************************************************************************/
|
|
819
|
+
|
|
820
|
+
const renderPopupLazy = (( ) => {
|
|
821
|
+
let mustRenderCosmeticFilteringBadge = true;
|
|
822
|
+
|
|
823
|
+
// https://github.com/uBlockOrigin/uBlock-issues/issues/756
|
|
824
|
+
// Launch potentially expensive hidden elements-counting scriptlet on
|
|
825
|
+
// demand only.
|
|
826
|
+
{
|
|
827
|
+
const sw = qs$('#no-cosmetic-filtering');
|
|
828
|
+
const badge = qs$(sw, ':scope .fa-icon-badge');
|
|
829
|
+
dom.text(badge, '\u22EF');
|
|
830
|
+
|
|
831
|
+
const render = ( ) => {
|
|
832
|
+
if ( mustRenderCosmeticFilteringBadge === false ) { return; }
|
|
833
|
+
mustRenderCosmeticFilteringBadge = false;
|
|
834
|
+
if ( dom.cl.has(sw, 'hnSwitchBusy') ) { return; }
|
|
835
|
+
dom.cl.add(sw, 'hnSwitchBusy');
|
|
836
|
+
messaging.send('popupPanel', {
|
|
837
|
+
what: 'getHiddenElementCount',
|
|
838
|
+
tabId: popupData.tabId,
|
|
839
|
+
}).then(count => {
|
|
840
|
+
let text;
|
|
841
|
+
if ( (count || 0) === 0 ) {
|
|
842
|
+
text = '';
|
|
843
|
+
} else if ( count === -1 ) {
|
|
844
|
+
text = '?';
|
|
845
|
+
} else {
|
|
846
|
+
text = Math.min(count, 99).toLocaleString();
|
|
847
|
+
}
|
|
848
|
+
dom.text(badge, text);
|
|
849
|
+
dom.cl.remove(sw, 'hnSwitchBusy');
|
|
850
|
+
});
|
|
851
|
+
};
|
|
852
|
+
|
|
853
|
+
dom.on(sw, 'mouseenter', render, { passive: true });
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
return async function() {
|
|
857
|
+
const count = await messaging.send('popupPanel', {
|
|
858
|
+
what: 'getScriptCount',
|
|
859
|
+
tabId: popupData.tabId,
|
|
860
|
+
});
|
|
861
|
+
dom.text(
|
|
862
|
+
'#no-scripting .fa-icon-badge',
|
|
863
|
+
(count || 0) !== 0 ? Math.min(count, 99).toLocaleString() : ''
|
|
864
|
+
);
|
|
865
|
+
mustRenderCosmeticFilteringBadge = true;
|
|
866
|
+
};
|
|
867
|
+
})();
|
|
868
|
+
|
|
869
|
+
/******************************************************************************/
|
|
870
|
+
|
|
871
|
+
const toggleNetFilteringSwitch = function(ev) {
|
|
872
|
+
if ( !popupData || !popupData.pageURL ) { return; }
|
|
873
|
+
messaging.send('popupPanel', {
|
|
874
|
+
what: 'toggleNetFiltering',
|
|
875
|
+
url: popupData.pageURL,
|
|
876
|
+
scope: ev.ctrlKey || ev.metaKey ? 'page' : '',
|
|
877
|
+
state: dom.cl.toggle(dom.body, 'off') === false,
|
|
878
|
+
tabId: popupData.tabId,
|
|
879
|
+
});
|
|
880
|
+
renderTooltips('#switch');
|
|
881
|
+
hashFromPopupData();
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
/******************************************************************************/
|
|
885
|
+
|
|
886
|
+
const gotoZap = function() {
|
|
887
|
+
messaging.send('popupPanel', {
|
|
888
|
+
what: 'launchElementPicker',
|
|
889
|
+
tabId: popupData.tabId,
|
|
890
|
+
zap: true,
|
|
891
|
+
});
|
|
892
|
+
|
|
893
|
+
vAPI.closePopup();
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
/******************************************************************************/
|
|
897
|
+
|
|
898
|
+
const gotoPick = function() {
|
|
899
|
+
messaging.send('popupPanel', {
|
|
900
|
+
what: 'launchElementPicker',
|
|
901
|
+
tabId: popupData.tabId,
|
|
902
|
+
});
|
|
903
|
+
|
|
904
|
+
vAPI.closePopup();
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
/******************************************************************************/
|
|
908
|
+
|
|
909
|
+
const gotoReport = function() {
|
|
910
|
+
const popupPanel = {
|
|
911
|
+
blocked: popupData.pageCounts.blocked.any,
|
|
912
|
+
};
|
|
913
|
+
const reportedStates = [
|
|
914
|
+
{ name: 'enabled', prop: 'netFilteringSwitch', expected: true },
|
|
915
|
+
{ name: 'no-cosmetic-filtering', prop: 'noCosmeticFiltering', expected: false },
|
|
916
|
+
{ name: 'no-large-media', prop: 'noLargeMedia', expected: false },
|
|
917
|
+
{ name: 'no-popups', prop: 'noPopups', expected: false },
|
|
918
|
+
{ name: 'no-remote-fonts', prop: 'noRemoteFonts', expected: false },
|
|
919
|
+
{ name: 'no-scripting', prop: 'noScripting', expected: false },
|
|
920
|
+
{ name: 'can-element-picker', prop: 'canElementPicker', expected: true },
|
|
921
|
+
];
|
|
922
|
+
for ( const { name, prop, expected } of reportedStates ) {
|
|
923
|
+
if ( popupData[prop] === expected ) { continue; }
|
|
924
|
+
popupPanel[name] = !expected;
|
|
925
|
+
}
|
|
926
|
+
if ( hostnameToSortableTokenMap.size !== 0 ) {
|
|
927
|
+
const network = {};
|
|
928
|
+
const hostnames =
|
|
929
|
+
Array.from(hostnameToSortableTokenMap.keys()).sort(hostnameCompare);
|
|
930
|
+
for ( const hostname of hostnames ) {
|
|
931
|
+
const entry = popupData.hostnameDict[hostname];
|
|
932
|
+
const count = entry.counts.blocked.any;
|
|
933
|
+
if ( count === 0 ) { continue; }
|
|
934
|
+
const domain = entry.domain;
|
|
935
|
+
if ( network[domain] === undefined ) {
|
|
936
|
+
network[domain] = 0;
|
|
937
|
+
}
|
|
938
|
+
network[domain] += count;
|
|
939
|
+
}
|
|
940
|
+
if ( Object.keys(network).length !== 0 ) {
|
|
941
|
+
popupPanel.network = network;
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
messaging.send('popupPanel', {
|
|
945
|
+
what: 'launchReporter',
|
|
946
|
+
tabId: popupData.tabId,
|
|
947
|
+
pageURL: popupData.rawURL,
|
|
948
|
+
popupPanel,
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
vAPI.closePopup();
|
|
952
|
+
};
|
|
953
|
+
|
|
954
|
+
/******************************************************************************/
|
|
955
|
+
|
|
956
|
+
const gotoURL = function(ev) {
|
|
957
|
+
if ( this.hasAttribute('href') === false ) { return; }
|
|
958
|
+
|
|
959
|
+
ev.preventDefault();
|
|
960
|
+
|
|
961
|
+
let url = dom.attr(ev.target, 'href');
|
|
962
|
+
if (
|
|
963
|
+
url === 'logger-ui.html#_' &&
|
|
964
|
+
typeof popupData.tabId === 'number'
|
|
965
|
+
) {
|
|
966
|
+
url += '+' + popupData.tabId;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
messaging.send('popupPanel', {
|
|
970
|
+
what: 'gotoURL',
|
|
971
|
+
details: {
|
|
972
|
+
url: url,
|
|
973
|
+
select: true,
|
|
974
|
+
index: -1,
|
|
975
|
+
shiftKey: ev.shiftKey
|
|
976
|
+
},
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
vAPI.closePopup();
|
|
980
|
+
};
|
|
981
|
+
|
|
982
|
+
/******************************************************************************/
|
|
983
|
+
|
|
984
|
+
// The popup panel is made of sections. Visibility of sections can
|
|
985
|
+
// be toggled on/off.
|
|
986
|
+
|
|
987
|
+
const maxNumberOfSections = 6;
|
|
988
|
+
const sectionFirewallBit = 0b10000;
|
|
989
|
+
|
|
990
|
+
const computedSections = ( ) =>
|
|
991
|
+
popupData.popupPanelSections &
|
|
992
|
+
~popupData.popupPanelDisabledSections |
|
|
993
|
+
popupData.popupPanelLockedSections;
|
|
994
|
+
|
|
995
|
+
const sectionBitsFromAttribute = function() {
|
|
996
|
+
const attr = document.body.dataset.more;
|
|
997
|
+
if ( attr === '' ) { return 0; }
|
|
998
|
+
let bits = 0;
|
|
999
|
+
for ( const c of attr ) {
|
|
1000
|
+
bits |= 1 << (c.charCodeAt(0) - 97);
|
|
1001
|
+
}
|
|
1002
|
+
return bits;
|
|
1003
|
+
};
|
|
1004
|
+
|
|
1005
|
+
const sectionBitsToAttribute = function(bits) {
|
|
1006
|
+
const attr = [];
|
|
1007
|
+
for ( let i = 0; i < maxNumberOfSections; i++ ) {
|
|
1008
|
+
const bit = 1 << i;
|
|
1009
|
+
if ( (bits & bit) === 0 ) { continue; }
|
|
1010
|
+
attr.push(String.fromCharCode(97 + i));
|
|
1011
|
+
}
|
|
1012
|
+
return attr.join('');
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
const setSections = function(bits) {
|
|
1016
|
+
const value = sectionBitsToAttribute(bits);
|
|
1017
|
+
const min = sectionBitsToAttribute(popupData.popupPanelLockedSections);
|
|
1018
|
+
const max = sectionBitsToAttribute(
|
|
1019
|
+
(1 << maxNumberOfSections) - 1 & ~popupData.popupPanelDisabledSections
|
|
1020
|
+
);
|
|
1021
|
+
document.body.dataset.more = value;
|
|
1022
|
+
dom.cl.toggle('#lessButton', 'disabled', value === min);
|
|
1023
|
+
dom.cl.toggle('#moreButton', 'disabled', value === max);
|
|
1024
|
+
};
|
|
1025
|
+
|
|
1026
|
+
const toggleSections = function(more) {
|
|
1027
|
+
const offbits = ~popupData.popupPanelDisabledSections;
|
|
1028
|
+
const onbits = popupData.popupPanelLockedSections;
|
|
1029
|
+
let currentBits = sectionBitsFromAttribute();
|
|
1030
|
+
let newBits = currentBits;
|
|
1031
|
+
for ( let i = 0; i < maxNumberOfSections; i++ ) {
|
|
1032
|
+
const bit = 1 << (more ? i : maxNumberOfSections - i - 1);
|
|
1033
|
+
if ( more ) {
|
|
1034
|
+
newBits |= bit;
|
|
1035
|
+
} else {
|
|
1036
|
+
newBits &= ~bit;
|
|
1037
|
+
}
|
|
1038
|
+
newBits = newBits & offbits | onbits;
|
|
1039
|
+
if ( newBits !== currentBits ) { break; }
|
|
1040
|
+
}
|
|
1041
|
+
if ( newBits === currentBits ) { return; }
|
|
1042
|
+
|
|
1043
|
+
setSections(newBits);
|
|
1044
|
+
|
|
1045
|
+
popupData.popupPanelSections = newBits;
|
|
1046
|
+
messaging.send('popupPanel', {
|
|
1047
|
+
what: 'userSettings',
|
|
1048
|
+
name: 'popupPanelSections',
|
|
1049
|
+
value: newBits,
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
// https://github.com/chrisaljoudi/uBlock/issues/996
|
|
1053
|
+
// Remember the last state of the firewall pane. This allows to
|
|
1054
|
+
// configure the popup size early next time it is opened, which means a
|
|
1055
|
+
// less glitchy popup at open time.
|
|
1056
|
+
vAPI.localStorage.setItem('popupPanelSections', newBits);
|
|
1057
|
+
|
|
1058
|
+
// Dynamic filtering pane may not have been built yet
|
|
1059
|
+
if ( (newBits & sectionFirewallBit) !== 0 && dfPaneBuilt === false ) {
|
|
1060
|
+
buildAllFirewallRows();
|
|
1061
|
+
}
|
|
1062
|
+
};
|
|
1063
|
+
|
|
1064
|
+
dom.on('#moreButton', 'click', ( ) => { toggleSections(true); });
|
|
1065
|
+
dom.on('#lessButton', 'click', ( ) => { toggleSections(false); });
|
|
1066
|
+
|
|
1067
|
+
/******************************************************************************/
|
|
1068
|
+
|
|
1069
|
+
const mouseenterCellHandler = function(ev) {
|
|
1070
|
+
const target = ev.target;
|
|
1071
|
+
if ( dom.cl.has(target, 'ownRule') ) { return; }
|
|
1072
|
+
target.appendChild(dfHotspots);
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
const mouseleaveCellHandler = function() {
|
|
1076
|
+
dfHotspots.remove();
|
|
1077
|
+
};
|
|
1078
|
+
|
|
1079
|
+
/******************************************************************************/
|
|
1080
|
+
|
|
1081
|
+
const setFirewallRule = async function(src, des, type, action, persist) {
|
|
1082
|
+
// This can happen on pages where uBlock does not work
|
|
1083
|
+
if (
|
|
1084
|
+
typeof popupData.pageHostname !== 'string' ||
|
|
1085
|
+
popupData.pageHostname === ''
|
|
1086
|
+
) {
|
|
1087
|
+
return;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
const response = await messaging.send('popupPanel', {
|
|
1091
|
+
what: 'toggleFirewallRule',
|
|
1092
|
+
tabId: popupData.tabId,
|
|
1093
|
+
pageHostname: popupData.pageHostname,
|
|
1094
|
+
srcHostname: src,
|
|
1095
|
+
desHostname: des,
|
|
1096
|
+
requestType: type,
|
|
1097
|
+
action: action,
|
|
1098
|
+
persist: persist,
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
// Remove action widget if an own rule has been set, this allows to click
|
|
1102
|
+
// again immediately to remove the rule.
|
|
1103
|
+
if ( action !== 0 ) {
|
|
1104
|
+
dfHotspots.remove();
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
cachePopupData(response);
|
|
1108
|
+
updateAllFirewallCells(true, false);
|
|
1109
|
+
hashFromPopupData();
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1112
|
+
/******************************************************************************/
|
|
1113
|
+
|
|
1114
|
+
const unsetFirewallRuleHandler = function(ev) {
|
|
1115
|
+
const cell = ev.target;
|
|
1116
|
+
const row = cell.closest('[data-des]');
|
|
1117
|
+
setFirewallRule(
|
|
1118
|
+
dom.attr(cell, 'data-src') === '/' ? '*' : popupData.pageHostname,
|
|
1119
|
+
dom.attr(row, 'data-des'),
|
|
1120
|
+
dom.attr(row, 'data-type'),
|
|
1121
|
+
0,
|
|
1122
|
+
ev.ctrlKey || ev.metaKey
|
|
1123
|
+
);
|
|
1124
|
+
cell.appendChild(dfHotspots);
|
|
1125
|
+
};
|
|
1126
|
+
|
|
1127
|
+
/******************************************************************************/
|
|
1128
|
+
|
|
1129
|
+
const setFirewallRuleHandler = function(ev) {
|
|
1130
|
+
const hotspot = ev.target;
|
|
1131
|
+
const cell = hotspot.closest('[data-src]');
|
|
1132
|
+
if ( cell === null ) { return; }
|
|
1133
|
+
const row = cell.closest('[data-des]');
|
|
1134
|
+
let action = 0;
|
|
1135
|
+
if ( hotspot.id === 'dynaAllow' ) {
|
|
1136
|
+
action = 2;
|
|
1137
|
+
} else if ( hotspot.id === 'dynaNoop' ) {
|
|
1138
|
+
action = 3;
|
|
1139
|
+
} else {
|
|
1140
|
+
action = 1;
|
|
1141
|
+
}
|
|
1142
|
+
setFirewallRule(
|
|
1143
|
+
dom.attr(cell, 'data-src') === '/' ? '*' : popupData.pageHostname,
|
|
1144
|
+
dom.attr(row, 'data-des'),
|
|
1145
|
+
dom.attr(row, 'data-type'),
|
|
1146
|
+
action,
|
|
1147
|
+
ev.ctrlKey || ev.metaKey
|
|
1148
|
+
);
|
|
1149
|
+
dfHotspots.remove();
|
|
1150
|
+
};
|
|
1151
|
+
|
|
1152
|
+
/******************************************************************************/
|
|
1153
|
+
|
|
1154
|
+
const reloadTab = function(bypassCache = false) {
|
|
1155
|
+
// Preemptively clear the unprocessed-requests status since we know for sure
|
|
1156
|
+
// the page is being reloaded in this code path.
|
|
1157
|
+
if ( popupData.hasUnprocessedRequest === true ) {
|
|
1158
|
+
messaging.send('popupPanel', {
|
|
1159
|
+
what: 'dismissUnprocessedRequest',
|
|
1160
|
+
tabId: popupData.tabId,
|
|
1161
|
+
}).then(( ) => {
|
|
1162
|
+
popupData.hasUnprocessedRequest = false;
|
|
1163
|
+
dom.cl.remove(dom.root, 'warn');
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
messaging.send('popupPanel', {
|
|
1168
|
+
what: 'reloadTab',
|
|
1169
|
+
tabId: popupData.tabId,
|
|
1170
|
+
url: popupData.rawURL,
|
|
1171
|
+
select: vAPI.webextFlavor.soup.has('mobile'),
|
|
1172
|
+
bypassCache,
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
// Polling will take care of refreshing the popup content
|
|
1176
|
+
// https://github.com/chrisaljoudi/uBlock/issues/748
|
|
1177
|
+
// User forces a reload, assume the popup has to be updated regardless
|
|
1178
|
+
// if there were changes or not.
|
|
1179
|
+
popupData.contentLastModified = -1;
|
|
1180
|
+
|
|
1181
|
+
// Reset popup state hash to current state.
|
|
1182
|
+
hashFromPopupData(true);
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
dom.on('#refresh', 'click', ev => {
|
|
1186
|
+
reloadTab(ev.ctrlKey || ev.metaKey || ev.shiftKey);
|
|
1187
|
+
});
|
|
1188
|
+
|
|
1189
|
+
// https://github.com/uBlockOrigin/uBlock-issues/issues/672
|
|
1190
|
+
dom.on(document, 'keydown', ev => {
|
|
1191
|
+
if ( ev.isComposing ) { return; }
|
|
1192
|
+
let bypassCache = false;
|
|
1193
|
+
switch ( ev.key ) {
|
|
1194
|
+
case 'F5':
|
|
1195
|
+
bypassCache = ev.ctrlKey || ev.metaKey || ev.shiftKey;
|
|
1196
|
+
break;
|
|
1197
|
+
case 'r':
|
|
1198
|
+
if ( (ev.ctrlKey || ev.metaKey) !== true ) { return; }
|
|
1199
|
+
break;
|
|
1200
|
+
case 'R':
|
|
1201
|
+
if ( (ev.ctrlKey || ev.metaKey) !== true ) { return; }
|
|
1202
|
+
bypassCache = true;
|
|
1203
|
+
break;
|
|
1204
|
+
default:
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
reloadTab(bypassCache);
|
|
1208
|
+
ev.preventDefault();
|
|
1209
|
+
ev.stopPropagation();
|
|
1210
|
+
}, { capture: true });
|
|
1211
|
+
|
|
1212
|
+
/******************************************************************************/
|
|
1213
|
+
|
|
1214
|
+
const expandExceptions = new Set();
|
|
1215
|
+
|
|
1216
|
+
vAPI.localStorage.getItemAsync('popupExpandExceptions').then(exceptions => {
|
|
1217
|
+
try {
|
|
1218
|
+
if ( Array.isArray(exceptions) === false ) { return; }
|
|
1219
|
+
for ( const exception of exceptions ) {
|
|
1220
|
+
expandExceptions.add(exception);
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
catch(ex) {
|
|
1224
|
+
}
|
|
1225
|
+
});
|
|
1226
|
+
|
|
1227
|
+
const saveExpandExceptions = function() {
|
|
1228
|
+
vAPI.localStorage.setItem(
|
|
1229
|
+
'popupExpandExceptions',
|
|
1230
|
+
Array.from(expandExceptions)
|
|
1231
|
+
);
|
|
1232
|
+
};
|
|
1233
|
+
|
|
1234
|
+
const setGlobalExpand = function(state, internal = false) {
|
|
1235
|
+
dom.cl.remove('.expandException', 'expandException');
|
|
1236
|
+
if ( state ) {
|
|
1237
|
+
dom.cl.add('#firewall', 'expanded');
|
|
1238
|
+
} else {
|
|
1239
|
+
dom.cl.remove('#firewall', 'expanded');
|
|
1240
|
+
}
|
|
1241
|
+
if ( internal ) { return; }
|
|
1242
|
+
popupData.firewallPaneMinimized = !state;
|
|
1243
|
+
expandExceptions.clear();
|
|
1244
|
+
saveExpandExceptions();
|
|
1245
|
+
messaging.send('popupPanel', {
|
|
1246
|
+
what: 'userSettings',
|
|
1247
|
+
name: 'firewallPaneMinimized',
|
|
1248
|
+
value: popupData.firewallPaneMinimized,
|
|
1249
|
+
});
|
|
1250
|
+
};
|
|
1251
|
+
|
|
1252
|
+
const setSpecificExpand = function(domain, state, internal = false) {
|
|
1253
|
+
const elems = qsa$(`[data-des="${domain}"],[data-des$=".${domain}"]`);
|
|
1254
|
+
if ( state ) {
|
|
1255
|
+
dom.cl.add(elems, 'expandException');
|
|
1256
|
+
} else {
|
|
1257
|
+
dom.cl.remove(elems, 'expandException');
|
|
1258
|
+
}
|
|
1259
|
+
if ( internal ) { return; }
|
|
1260
|
+
if ( state ) {
|
|
1261
|
+
expandExceptions.add(domain);
|
|
1262
|
+
} else {
|
|
1263
|
+
expandExceptions.delete(domain);
|
|
1264
|
+
}
|
|
1265
|
+
saveExpandExceptions();
|
|
1266
|
+
};
|
|
1267
|
+
|
|
1268
|
+
dom.on('[data-i18n="popupAnyRulePrompt"]', 'click', ev => {
|
|
1269
|
+
// Special display mode: in its own tab/window, with no vertical restraint.
|
|
1270
|
+
// Useful to take snapshots of the whole list of domains -- example:
|
|
1271
|
+
// https://github.com/gorhill/uBlock/issues/736#issuecomment-178879944
|
|
1272
|
+
if ( ev.shiftKey && ev.ctrlKey ) {
|
|
1273
|
+
messaging.send('popupPanel', {
|
|
1274
|
+
what: 'gotoURL',
|
|
1275
|
+
details: {
|
|
1276
|
+
url: `popup-fenix.html?tabId=${popupData.tabId}&intab=1`,
|
|
1277
|
+
select: true,
|
|
1278
|
+
index: -1,
|
|
1279
|
+
},
|
|
1280
|
+
});
|
|
1281
|
+
vAPI.closePopup();
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
setGlobalExpand(dom.cl.has('#firewall', 'expanded') === false);
|
|
1286
|
+
});
|
|
1287
|
+
|
|
1288
|
+
dom.on('#firewall', 'click', '.isDomain[data-type="*"] > span:first-of-type', ev => {
|
|
1289
|
+
const div = ev.target.closest('[data-des]');
|
|
1290
|
+
if ( div === null ) { return; }
|
|
1291
|
+
setSpecificExpand(
|
|
1292
|
+
dom.attr(div, 'data-des'),
|
|
1293
|
+
dom.cl.has(div, 'expandException') === false
|
|
1294
|
+
);
|
|
1295
|
+
});
|
|
1296
|
+
|
|
1297
|
+
/******************************************************************************/
|
|
1298
|
+
|
|
1299
|
+
const saveFirewallRules = function() {
|
|
1300
|
+
messaging.send('popupPanel', {
|
|
1301
|
+
what: 'saveFirewallRules',
|
|
1302
|
+
srcHostname: popupData.pageHostname,
|
|
1303
|
+
desHostnames: popupData.hostnameDict,
|
|
1304
|
+
});
|
|
1305
|
+
dom.cl.remove(dom.body, 'needSave');
|
|
1306
|
+
};
|
|
1307
|
+
|
|
1308
|
+
/******************************************************************************/
|
|
1309
|
+
|
|
1310
|
+
const revertFirewallRules = async function() {
|
|
1311
|
+
dom.cl.remove(dom.body, 'needSave');
|
|
1312
|
+
const response = await messaging.send('popupPanel', {
|
|
1313
|
+
what: 'revertFirewallRules',
|
|
1314
|
+
srcHostname: popupData.pageHostname,
|
|
1315
|
+
desHostnames: popupData.hostnameDict,
|
|
1316
|
+
tabId: popupData.tabId,
|
|
1317
|
+
});
|
|
1318
|
+
cachePopupData(response);
|
|
1319
|
+
updateAllFirewallCells(true, false);
|
|
1320
|
+
updateHnSwitches();
|
|
1321
|
+
hashFromPopupData();
|
|
1322
|
+
};
|
|
1323
|
+
|
|
1324
|
+
/******************************************************************************/
|
|
1325
|
+
|
|
1326
|
+
const toggleHostnameSwitch = async function(ev) {
|
|
1327
|
+
const target = ev.currentTarget;
|
|
1328
|
+
const switchName = dom.attr(target, 'id');
|
|
1329
|
+
if ( !switchName ) { return; }
|
|
1330
|
+
// For touch displays, process click only if the switch is not "busy".
|
|
1331
|
+
if (
|
|
1332
|
+
vAPI.webextFlavor.soup.has('mobile') &&
|
|
1333
|
+
dom.cl.has(target, 'hnSwitchBusy')
|
|
1334
|
+
) {
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
dom.cl.toggle(target, 'on');
|
|
1338
|
+
renderTooltips(`#${switchName}`);
|
|
1339
|
+
|
|
1340
|
+
const response = await messaging.send('popupPanel', {
|
|
1341
|
+
what: 'toggleHostnameSwitch',
|
|
1342
|
+
name: switchName,
|
|
1343
|
+
hostname: popupData.pageHostname,
|
|
1344
|
+
state: dom.cl.has(target, 'on'),
|
|
1345
|
+
tabId: popupData.tabId,
|
|
1346
|
+
persist: ev.ctrlKey || ev.metaKey,
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
cachePopupData(response);
|
|
1350
|
+
hashFromPopupData();
|
|
1351
|
+
|
|
1352
|
+
dom.cl.toggle(dom.body, 'needSave', popupData.matrixIsDirty === true);
|
|
1353
|
+
};
|
|
1354
|
+
|
|
1355
|
+
/*******************************************************************************
|
|
1356
|
+
|
|
1357
|
+
Double tap ctrl key: toggle god mode
|
|
1358
|
+
|
|
1359
|
+
*/
|
|
1360
|
+
|
|
1361
|
+
// https://github.com/uBlockOrigin/uBlock-issues/issues/2145
|
|
1362
|
+
// Ignore events from auto-repeating keys
|
|
1363
|
+
|
|
1364
|
+
{
|
|
1365
|
+
let eventCount = 0;
|
|
1366
|
+
let eventTime = 0;
|
|
1367
|
+
|
|
1368
|
+
dom.on(document, 'keydown', ev => {
|
|
1369
|
+
if ( ev.key !== 'Control' ) {
|
|
1370
|
+
eventCount = 0;
|
|
1371
|
+
return;
|
|
1372
|
+
}
|
|
1373
|
+
if ( ev.repeat ) { return; }
|
|
1374
|
+
const now = Date.now();
|
|
1375
|
+
if ( (now - eventTime) >= 500 ) {
|
|
1376
|
+
eventCount = 0;
|
|
1377
|
+
}
|
|
1378
|
+
eventCount += 1;
|
|
1379
|
+
eventTime = now;
|
|
1380
|
+
if ( eventCount < 2 ) { return; }
|
|
1381
|
+
eventCount = 0;
|
|
1382
|
+
dom.cl.toggle(dom.body, 'godMode');
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
/******************************************************************************/
|
|
1388
|
+
|
|
1389
|
+
// Poll for changes.
|
|
1390
|
+
//
|
|
1391
|
+
// I couldn't find a better way to be notified of changes which can affect
|
|
1392
|
+
// popup content, as the messaging API doesn't support firing events accurately
|
|
1393
|
+
// from the main extension process to a specific auxiliary extension process:
|
|
1394
|
+
//
|
|
1395
|
+
// - broadcasting() is not an option given there could be a lot of tabs opened,
|
|
1396
|
+
// and maybe even many frames within these tabs, i.e. unacceptable overhead
|
|
1397
|
+
// regardless of whether the popup is opened or not.
|
|
1398
|
+
//
|
|
1399
|
+
// - Modifying the messaging API is not an option, as this would require
|
|
1400
|
+
// revisiting all platform-specific code to support targeted broadcasting,
|
|
1401
|
+
// which who knows could be not so trivial for some platforms.
|
|
1402
|
+
//
|
|
1403
|
+
// A well done polling is a better anyways IMO, I prefer that data is pulled
|
|
1404
|
+
// on demand rather than forcing the main process to assume a client may need
|
|
1405
|
+
// it and thus having to push it all the time unconditionally.
|
|
1406
|
+
|
|
1407
|
+
const pollForContentChange = (( ) => {
|
|
1408
|
+
const pollCallback = async function() {
|
|
1409
|
+
const response = await messaging.send('popupPanel', {
|
|
1410
|
+
what: 'hasPopupContentChanged',
|
|
1411
|
+
tabId: popupData.tabId,
|
|
1412
|
+
contentLastModified: popupData.contentLastModified,
|
|
1413
|
+
});
|
|
1414
|
+
if ( response ) {
|
|
1415
|
+
await getPopupData(popupData.tabId);
|
|
1416
|
+
return;
|
|
1417
|
+
}
|
|
1418
|
+
poll();
|
|
1419
|
+
};
|
|
1420
|
+
|
|
1421
|
+
const pollTimer = vAPI.defer.create(pollCallback);
|
|
1422
|
+
|
|
1423
|
+
const poll = function() {
|
|
1424
|
+
pollTimer.on(1500);
|
|
1425
|
+
};
|
|
1426
|
+
|
|
1427
|
+
return poll;
|
|
1428
|
+
})();
|
|
1429
|
+
|
|
1430
|
+
/******************************************************************************/
|
|
1431
|
+
|
|
1432
|
+
const getPopupData = async function(tabId, first = false) {
|
|
1433
|
+
const response = await messaging.send('popupPanel', {
|
|
1434
|
+
what: 'getPopupData',
|
|
1435
|
+
tabId,
|
|
1436
|
+
});
|
|
1437
|
+
|
|
1438
|
+
cachePopupData(response);
|
|
1439
|
+
renderOnce();
|
|
1440
|
+
renderPopup();
|
|
1441
|
+
renderPopupLazy(); // low priority rendering
|
|
1442
|
+
hashFromPopupData(first);
|
|
1443
|
+
pollForContentChange();
|
|
1444
|
+
};
|
|
1445
|
+
|
|
1446
|
+
/******************************************************************************/
|
|
1447
|
+
|
|
1448
|
+
// Popup DOM is assumed to be loaded at this point -- because this script
|
|
1449
|
+
// is loaded after everything else.
|
|
1450
|
+
|
|
1451
|
+
{
|
|
1452
|
+
// Extract the tab id of the page for this popup. If there's no tab id
|
|
1453
|
+
// specified in the query string, it will default to current tab.
|
|
1454
|
+
const selfURL = new URL(self.location.href);
|
|
1455
|
+
const tabId = parseInt(selfURL.searchParams.get('tabId'), 10) || null;
|
|
1456
|
+
|
|
1457
|
+
const nextFrames = async n => {
|
|
1458
|
+
for ( let i = 0; i < n; i++ ) {
|
|
1459
|
+
await new Promise(resolve => {
|
|
1460
|
+
self.requestAnimationFrame(( ) => { resolve(); });
|
|
1461
|
+
});
|
|
1462
|
+
}
|
|
1463
|
+
};
|
|
1464
|
+
|
|
1465
|
+
// The purpose of the following code is to reset to a vertical layout
|
|
1466
|
+
// should the viewport not be enough wide to accommodate the horizontal
|
|
1467
|
+
// layout.
|
|
1468
|
+
// To avoid querying a spurious viewport width -- it happens sometimes,
|
|
1469
|
+
// somehow -- we delay layout-changing operations to the next paint
|
|
1470
|
+
// frames.
|
|
1471
|
+
// Force a layout recalculation by querying the body width. To be
|
|
1472
|
+
// honest, I have no clue if this makes a difference in the end.
|
|
1473
|
+
// https://gist.github.com/paulirish/5d52fb081b3570c81e3a
|
|
1474
|
+
// Use a tolerance proportional to the sum of the width of the panes
|
|
1475
|
+
// when testing against viewport width.
|
|
1476
|
+
const checkViewport = async function() {
|
|
1477
|
+
if (
|
|
1478
|
+
dom.cl.has(dom.root, 'mobile') ||
|
|
1479
|
+
selfURL.searchParams.get('portrait')
|
|
1480
|
+
) {
|
|
1481
|
+
dom.cl.add(dom.root, 'portrait');
|
|
1482
|
+
} else if ( dom.cl.has(dom.root, 'desktop') ) {
|
|
1483
|
+
await nextFrames(8);
|
|
1484
|
+
const main = qs$('#main');
|
|
1485
|
+
const firewall = qs$('#firewall');
|
|
1486
|
+
const minWidth = (main.offsetWidth + firewall.offsetWidth) / 1.1;
|
|
1487
|
+
if (
|
|
1488
|
+
selfURL.searchParams.get('portrait') ||
|
|
1489
|
+
window.innerWidth < minWidth
|
|
1490
|
+
) {
|
|
1491
|
+
dom.cl.add(dom.root, 'portrait');
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
if ( dom.cl.has(dom.root, 'portrait') ) {
|
|
1495
|
+
const panes = qs$('#panes');
|
|
1496
|
+
const sticky = qs$('#sticky');
|
|
1497
|
+
const stickyParent = sticky.parentElement;
|
|
1498
|
+
if ( stickyParent !== panes ) {
|
|
1499
|
+
panes.prepend(sticky);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
if ( selfURL.searchParams.get('intab') !== null ) {
|
|
1503
|
+
dom.cl.add(dom.root, 'intab');
|
|
1504
|
+
}
|
|
1505
|
+
await nextFrames(1);
|
|
1506
|
+
dom.cl.remove(dom.body, 'loading');
|
|
1507
|
+
};
|
|
1508
|
+
|
|
1509
|
+
getPopupData(tabId, true).then(( ) => {
|
|
1510
|
+
if ( document.readyState !== 'complete' ) {
|
|
1511
|
+
dom.on(self, 'load', ( ) => { checkViewport(); }, { once: true });
|
|
1512
|
+
} else {
|
|
1513
|
+
checkViewport();
|
|
1514
|
+
}
|
|
1515
|
+
});
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
/******************************************************************************/
|
|
1519
|
+
|
|
1520
|
+
dom.on('#switch', 'click', toggleNetFilteringSwitch);
|
|
1521
|
+
dom.on('#gotoZap', 'click', gotoZap);
|
|
1522
|
+
dom.on('#gotoPick', 'click', gotoPick);
|
|
1523
|
+
dom.on('#gotoReport', 'click', gotoReport);
|
|
1524
|
+
dom.on('.hnSwitch', 'click', ev => { toggleHostnameSwitch(ev); });
|
|
1525
|
+
dom.on('#saveRules', 'click', saveFirewallRules);
|
|
1526
|
+
dom.on('#revertRules', 'click', ( ) => { revertFirewallRules(); });
|
|
1527
|
+
dom.on('a[href]', 'click', gotoURL);
|
|
1528
|
+
|
|
1529
|
+
/******************************************************************************/
|