1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-03 09:39:38 +02:00

Make the creation of _allow_ rules in panel an opt-in feature

There have been too many examples out there of users
opting-in to "I am an advanced user" and yet still misusing
dynamic filtering by creating _allow_ rules where _noop_
rules should be used.

Creating _allow_ rules has serious consequences as these
override blocking static filters and can potentially
disable other advanced filtering ability such as
HTML filtering and scriptlet injection -- often used
to deal with anti-blocker mechanisms.

The ability to point-and-click to create _allow_ rules
from the popup panel is no longer allowed by default.

An new advanced setting has been added to enable
the ability to create _allow_ rules from the popup
panel, `popupPanelGodMode`, which default to `false`.
Set to `true` to restore ability to set _allow_ rules
from popup panel.

Since the creation of _allow_ rules is especially useful
to filter list authors, to diagnose and narrow down site
breakage as a result of problematic blocking filter,
the creation of _allow_ rules will still be available
when the advanced setting `filterAuthorMode` is `true`.

This change is probably going to be problematic to all
those users who were misusing dynamic filtering by
creating _allow_ rules instead of _noop_ rules -- but
the breakage is going to bring their misusing to their
attention, a positive outcome.
This commit is contained in:
Raymond Hill 2020-05-22 11:35:44 -04:00
parent 7b140a139e
commit 162e537270
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
4 changed files with 23 additions and 10 deletions

View File

@ -478,7 +478,9 @@ body.advancedUser #firewall > div > span.noopRule.ownRule,
#actionSelector {
box-sizing: border-box;
display: flex;
height: 100%;
justify-items: stretch;
left: 0;
overflow: hidden;
position: absolute;
@ -488,16 +490,17 @@ body.advancedUser #firewall > div > span.noopRule.ownRule,
}
#actionSelector > span {
display: inline-block;
height: 100%;
flex-grow: 1;
}
#actionSelector > #dynaAllow {
width: 33%;
display: none;
}
body.godMode #actionSelector > #dynaAllow {
display: inline-block;
}
#actionSelector > #dynaNoop {
width: 33.5%;
}
#actionSelector > #dynaBlock {
width: 33.5%;
}
#actionSelector > #dynaCounts {
background-color: transparent;

View File

@ -68,6 +68,7 @@ const µBlock = (( ) => { // jshint ignore:line
popupFontSize: 'unset',
popupPanelDisabledSections: 0,
popupPanelLockedSections: 0,
popupPanelGodMode: false,
popupPanelHeightMode: 0,
requestJournalProcessPeriod: 1000,
selfieAfter: 3,

View File

@ -269,6 +269,7 @@ const popupDataFromTabId = function(tabId, tabTitle) {
const tabContext = µb.tabContextManager.mustLookup(tabId);
const rootHostname = tabContext.rootHostname;
const µbus = µb.userSettings;
const µbhs = µb.hiddenSettings;
const r = {
advancedUserEnabled: µbus.advancedUserEnabled,
appName: vAPI.app.name,
@ -278,7 +279,8 @@ const popupDataFromTabId = function(tabId, tabTitle) {
firewallPaneMinimized: µbus.firewallPaneMinimized,
globalAllowedRequestCount: µb.localSettings.allowedRequestCount,
globalBlockedRequestCount: µb.localSettings.blockedRequestCount,
fontSize: µb.hiddenSettings.popupFontSize,
fontSize: µbhs.popupFontSize,
godMode: µbhs.filterAuthorMode || µbhs.popupPanelGodMode,
netFilteringSwitch: false,
rawURL: tabContext.rawURL,
pageURL: tabContext.normalURL,
@ -288,16 +290,16 @@ const popupDataFromTabId = function(tabId, tabTitle) {
pageBlockedRequestCount: 0,
popupBlockedCount: 0,
popupPanelSections: µbus.popupPanelSections,
popupPanelDisabledSections: µb.hiddenSettings.popupPanelDisabledSections,
popupPanelLockedSections: µb.hiddenSettings.popupPanelLockedSections,
popupPanelHeightMode: µb.hiddenSettings.popupPanelHeightMode,
popupPanelDisabledSections: µbhs.popupPanelDisabledSections,
popupPanelLockedSections: µbhs.popupPanelLockedSections,
popupPanelHeightMode: µbhs.popupPanelHeightMode,
tabId: tabId,
tabTitle: tabTitle,
tooltipsDisabled: µbus.tooltipsDisabled
};
if ( µb.hiddenSettings.uiPopupConfig !== 'undocumented' ) {
r.uiPopupConfig = µb.hiddenSettings.uiPopupConfig;
if ( µbhs.uiPopupConfig !== 'undocumented' ) {
r.uiPopupConfig = µbhs.uiPopupConfig;
}
const pageStore = µb.pageStoreFromTabId(tabId);

View File

@ -644,6 +644,13 @@ let renderOnce = function() {
if ( popupData.popupPanelHeightMode === 1 ) {
body.classList.add('vMin');
}
// Prevent non-advanced user opting into advanced user mode from harming
// themselves by disabling by default features generally suitable to
// filter list maintainers and actual advanced users.
if ( popupData.godMode ) {
body.classList.add('godMode');
}
};
/******************************************************************************/