diff --git a/README.MD b/README.MD index 5026e7d..28ae230 100644 --- a/README.MD +++ b/README.MD @@ -25,6 +25,7 @@ Your language is not listed? Submit an issue to let me know. 1. `git clone --depth 1 https://github.com/NanoAdblocker/NanoCore2.git` 2. `git clone --depth 1 https://github.com/NanoAdblocker/NanoFilters.git` 3. `git clone --depth 1 https://github.com/jspenguin2017/Edgyfy.git` + 4. `git clone --depth 1 https://github.com/jspenguin2017/uBlockProtector` 3. Run `git clone --depth 1 https://github.com/gorhill/uBlock.git` in an appropriate directory to get upstream. Check out a tag or commit as appropriate. diff --git a/config.nano.js b/config.nano.js index 291ca72..8d136a5 100644 --- a/config.nano.js +++ b/config.nano.js @@ -52,6 +52,7 @@ "./patches/integration/20_0_popup_tweaks.patch", "./patches/integration/20_1_force_scroll.patch", + "./patches/integration/20_2_bug_reporter.patch", "./patches/integration/30_0_settings_tweaks.patch", "./patches/integration/30_1_editor_settings.patch", diff --git a/patches/integration/20_2_bug_reporter.patch b/patches/integration/20_2_bug_reporter.patch new file mode 100644 index 0000000..dadb437 --- /dev/null +++ b/patches/integration/20_2_bug_reporter.patch @@ -0,0 +1,69 @@ +diff --git a/platform/chromium/vapi-common.js b/platform/chromium/vapi-common.js +index 9396b47a..ac486d41 100644 +--- a/platform/chromium/vapi-common.js ++++ b/platform/chromium/vapi-common.js +@@ -138,6 +138,23 @@ vAPI.download = function(details) { + + vAPI.getURL = chrome.runtime.getURL; + ++vAPI.nanoOpenBugReporter = function() { ++ const reporter = vAPI.getURL('/reporter/index.html'); ++ ++ chrome.tabs.query({ ++ active: true, ++ currentWindow: true, ++ }, (tabs) => { ++ if (chrome.runtime.lastError || tabs.length === 0) { ++ return; ++ } ++ ++ chrome.tabs.create({ ++ url: reporter + '?' + tabs[0].id ++ }); ++ }); ++}; ++ + /******************************************************************************/ + + vAPI.i18n = chrome.i18n.getMessage; +diff --git a/src/js/popup.js b/src/js/popup.js +index 79def108..1c41379f 100644 +--- a/src/js/popup.js ++++ b/src/js/popup.js +@@ -450,6 +450,7 @@ const renderPopup = function() { + uDom.nodeFromId('gotoPick').classList.toggle('enabled', canElementPicker); + uDom.nodeFromId('gotoZap').classList.toggle('enabled', canElementPicker); + uDom.nodeFromId('nanoForceEnableScroll').classList.toggle('enabled', canElementPicker); ++ uDom.nodeFromId('nanoOpenBugReporter').classList.toggle('enabled', canElementPicker); + + let blocked = popupData.pageBlockedRequestCount, + total = popupData.pageAllowedRequestCount + blocked, +@@ -759,6 +760,8 @@ const nanoForceEnableScroll = function() { + vAPI.closePopup(); + }; + ++const nanoOpenBugReporter = vAPI.nanoOpenBugReporter; ++ + /******************************************************************************/ + + const gotoURL = function(ev) { +@@ -1153,6 +1156,7 @@ uDom('#switch .fa-icon').on('click', toggleNetFilteringSwitch); + uDom('#gotoZap').on('click', gotoZap); + uDom('#gotoPick').on('click', gotoPick); + uDom('#nanoForceEnableScroll').on('click', nanoForceEnableScroll); ++uDom('#nanoOpenBugReporter').on('click', nanoOpenBugReporter); + uDom('#nanoFirewallPaneToggle').on('click', toggleFirewallPane); + uDom('#refresh').on('click', reloadTab); + uDom('.hnSwitch').on('click', toggleHostnameSwitch); +diff --git a/src/popup.html b/src/popup.html +index 48f78ec3..7f5cd9d4 100644 +--- a/src/popup.html ++++ b/src/popup.html +@@ -25,6 +25,7 @@ +
+ ++ +
+ +diff --git a/patches/integration/README.MD b/patches/integration/README.MD index 4421055..e09dd85 100644 --- a/patches/integration/README.MD +++ b/patches/integration/README.MD @@ -40,6 +40,8 @@ settings page. `20_1_force_scroll.patch`: Enable force scroll mode button in popup panel. +`20_2_bug_reporter.patch`: Open bug reporter button in popup panel. + ## Group `30`: Dashboard Changes `30_0_settings_tweaks.patch`: Cosmetic tweaks to dashboard settings tab. diff --git a/term/build.js b/term/build.js index dfc67f6..a582d04 100644 --- a/term/build.js +++ b/term/build.js @@ -146,6 +146,7 @@ const f = (root, ext, match = true) => { */ exports.src_repo = null; exports.assets_repo = "../NanoFilters"; +exports.defender_repo = "../uBlockProtector"; exports.edge_shim = "../Edgyfy/edgyfy.js"; /*****************************************************************************/ @@ -186,6 +187,13 @@ exports.build_core = async (browser) => { await fs.copy(r("./src/js"), r(output, "js")); await fs.copy(r("./LICENSE"), r(output, "LICENSE")); + await fs.copy( + r(exports.defender_repo, "src/reporter"), r(output, "reporter"), + ); + await fs.copy( + r(exports.defender_repo, "src/libdom.js"), r(output, "libdom.js"), + ); + // This must be after copying platform files await fs.writeFile( r(output, "manifest.json"), data.manifest(browser), "utf8",