Skip to content

Commit

Permalink
* When adding a new proxy, <strong>Add whitelist pattern to match all…
Browse files Browse the repository at this point in the history
… URLs</strong> is now on by default. Discussed <a href="#49" target="_blank">here</a>.

* On patterns window, added button for <strong>Add whitelist pattern to match all URLs</strong> similar to the existing button <strong>Add black patterns to prevent this proxy being used for localhost & intranet/private IP addresses</strong>.
* Patterns Cheat Sheet improvements &mdash; more examples and text explaining that blacklist patterns take precedence over whitelist patterns.
* Change an i18n key name so it works in chrome, too (chrome does not allow periods in key names).
* Remove unneeded console log messages.
* Faster deletion of patterns (faster animation)
  • Loading branch information
ericjung committed Nov 16, 2019
1 parent d94193b commit 73a17e5
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 60 deletions.
6 changes: 5 additions & 1 deletion src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,9 @@
"proxyTitle": { "message": "Proxy Title" },
"proxyAddress": { "message": "Proxy Address" },
"matchPattern": { "message": "Match Pattern" },
"timestamp": { "message": "Timestamp" }
"whiteBlack": { "message": "White/Black" },
"white": { "message": "White" },
"black": { "message": "Black" },
"timestamp": { "message": "Timestamp" },
"notApplicable": {"message": "n/a"}
}
46 changes: 9 additions & 37 deletions src/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ <h3>Support Me</h3>
<p>&mdash; <a href="mailto:[email protected]">Eric H. Jung</a><br>Denver, Colorado, USA</p>

<h3>Release Notes for Recent Releases</h3>
<h4>Version 7.4.2</h4>
<ul>
<li>When adding a new proxy, <strong>Add whitelist pattern to match all URLs</strong> is now on by default. Discussed <a href="https://github.com/foxyproxy/firefox-extension/issues/49" target="_blank">here</a>.</li>
<li>On patterns window, added button for <strong>Add whitelist pattern to match all URLs</strong> similar to the existing button <strong>Add black patterns to prevent this proxy being used for localhost & intranet/private IP addresses</strong>.</li>
<li>Patterns Cheat Sheet improvements &mdash; more examples and text explaining that blacklist patterns take precedence over whitelist patterns.</li>
<li>Change an i18n key name so it works in chrome, too (chrome does not allow periods in key names).</li>
<li>Remove unneeded console log messages.</li>
<li>Faster deletion of patterns (faster animation)</li>
</ul>
<h4>Version 7.4.1</h4>
<ul>
<li>Fixes so that FoxyProxy Basic can share the same codebase as FoxyProxy Standard again. Version number alignment: for the first time since FoxyProxy Basic
Expand All @@ -69,43 +78,6 @@ <h4>Version 7.4.1</h4>
<li>Import optimizations and increase on import file size from 5 MB to 10 MB</li>
<li>Show help text if no proxy settings are defined; hide all proxy selectors too including 'turn off'.</li>
</ul>

<h4>Version 7.4</h4>
<ul>
<li>Uses new proxy API now and works with Firefox Nighly; discussed <a target="_blank" href="https://github.com/foxyproxy/firefox-extension/issues/39">here</a>. Minimum Firefox version is now 60.0.</li>
<li>Toolbar icon now changes with proxy use, just like version 6.x and earlier (patterns mode only). If there are no matches, a gray icon is displayed; discussed <a target="_blank" href="https://github.com/foxyproxy/firefox-extension/issues/38">here</a>.</li>
<li>Logging improvements; log now displays unmatched URLs just like version 6.x and earlier. This makes it obvious which URLs you may want to write patterns for.</li>
<li>UI Improvements</li>
<li>Performance improvements for authentication</li>
<li>Add browser and extension version numbers to export for debugging of exported settings submitted by users. It will be useful also in the future as the fileformat matures and changes, as it has many times over the years.</li>
<li>Ensure new proxies are added to the top of the list when created</li>
<li>Remove migration code which seems to cause errors for some people; migration from very old versions now gone.</li>
<li>Do not display pattern shortcuts (match all URLs, don't match localhost & intranet IPs) when editing a proxy setting, just like 6.x and earlier. Showing these created a lot of confusion for some users. Sorry!</li>
<li>

<div class="tooltip"><span class="orangehover">Pattern Cheat Sheet</span> <i class="fa fa-info-circle"></i>
<span class="tooltiptext center">
<span class="monospace">bbc.co.uk</span> &mdash; exact domain only<br>
<span class="monospace">*.bbc.co.uk</span> &mdash; exact domain and all subdomains<br>
<span class="monospace">**.bbc.co.uk</span> &mdash; subdomains only, not bbc.co.uk
</span>
on pattern-related pages</div>
</li>
<li>Bug fixes when importing legacy foxyproxy.xml settings (FoxyProxy 4.x and earlier)</li>
<li>Show patterns buttons when adding Direct (no proxy) setting. Fixed some minor UI bugs when using Direct (no proxy).</li>
</ul>
<h4>Version 7.3</h4>
<ul>
<li><a href="https://github.com/foxyproxy/firefox-extension/issues/33">Another</a> pattern bugfix.</li>
<li>Fix for inability to turn off <i>Send DNS through SOCKS5 proxy</i>; discussed <a href="https://github.com/foxyproxy/firefox-extension/issues/35">here</a>.</li>
</ul>

<h4>Version 7.2</h4>
<ul>
<li>HTTP Basic Auth bugfix introduced in 7.0; discussed <a href="https://github.com/foxyproxy/firefox-extension/issues/30">here</a>.</li>
<li>Fix minor import bug when importing FoxyProxy settings for paid accounts.</li>
</ul>

<div style="text-align: right;">
<button type="button" class="button" data-i18n="back">&#x25c1; </button>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/log.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
<thead>
<tr>
<th data-i18n="url"></th><th data-i18n="proxyTitle"></th><th data-i18n="color"></th>
<th data-i18n="proxyAddress"></th><th data-i18n="matchPattern"></th><th data-i18n="timestamp"></th>
<th data-i18n="proxyAddress"></th><th data-i18n="matchPattern"></th><th data-i18n="whiteBlack"></th>
<th data-i18n="timestamp"></th>
</tr>
<!-- template -->
<tr class="template">
Expand All @@ -85,6 +86,7 @@
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</thead>

Expand Down
3 changes: 2 additions & 1 deletion src/pattern-help.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
<div style="text-align: right;">

<div class="tooltip"><span data-i18n="patternCheatSheet" class="orangehover"></span> <i class="fa fa-info-circle"></i>
<span class="tooltiptext center">
<span class="tooltiptext center bottom">
<span class="monospace">*</span> &mdash; all domains<br>
<span class="monospace">bbc.co.uk</span> &mdash; exact domain only<br>
<span class="monospace">*.bbc.co.uk</span> &mdash; exact domain and all subdomains<br>
<span class="monospace">**.bbc.co.uk</span> &mdash; subdomains only, not bbc.co.uk
Expand Down
3 changes: 2 additions & 1 deletion src/pattern-tester.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
<div style="text-align: right;">

<div class="tooltip"><span data-i18n="patternCheatSheet" class="orangehover"></span> <i class="fa fa-info-circle"></i>
<span class="tooltiptext center">
<span class="tooltiptext center bottom">
<span class="monospace">*</span> &mdash; all domains<br>
<span class="monospace">bbc.co.uk</span> &mdash; exact domain only<br>
<span class="monospace">*.bbc.co.uk</span> &mdash; exact domain and all subdomains<br>
<span class="monospace">**.bbc.co.uk</span> &mdash; subdomains only, not bbc.co.uk
Expand Down
17 changes: 12 additions & 5 deletions src/patterns.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ <h3 data-i18n="errorWas"></h3>
</div>
<div style="text-align: right;">
<div class="tooltip"><span data-i18n="patternCheatSheet" class="orangehover"></span> <i class="fa fa-info-circle"></i>
<span class="tooltiptext center">
<span class="monospace">bbc.co.uk</span> &mdash; exact domain only<br>
<span class="monospace">*.bbc.co.uk</span> &mdash; exact domain and all subdomains<br>
<span class="monospace">**.bbc.co.uk</span> &mdash; subdomains only, not bbc.co.uk
<span class="tooltiptext bottom monospace" style="text-align: left; padding-left: 1rem">
<p><span>*</span> &mdash; all domains<br>
<span>bbc.co.uk</span> &mdash; exact domain only<br>
<span>*.bbc.co.uk</span> &mdash; exact domain and all subdomains<br>
<span>**.bbc.co.uk</span> &mdash; subdomains only, not bbc.co.uk</p>
<p><span>Black patterns take precedence over white patterns. For example, a black pattern of * means nothing will match, regardless of any white patterns.</span></p>
</span>
</div>
|
Expand Down Expand Up @@ -125,6 +127,11 @@ <h3 data-i18n="whitePatterns"></h3>
</table>
</div>

<div style="margin: 1em 0 2em; text-align: center; font-size: 0.9em;">
<span data-i18n="addWhitelist"></span>
<div class="tooltip"><i class="fa fa-info-circle"></i><span class="tooltiptext center" data-i18n="addWhitelistTip"></span></div>
<button type="button" class="small" style="margin-left: 1em; vertical-align: initial;" data-i18n="add" data-white></button>
</div>

<h3 data-i18n="blackPatterns"></h3>
<div class="scroll">
Expand All @@ -145,7 +152,7 @@ <h3 data-i18n="blackPatterns"></h3>
<div style="margin: 1em 0 2em; text-align: center; font-size: 0.9em;">
<span data-i18n="addBlacklist"></span>
<div class="tooltip"><i class="fa fa-info-circle"></i><span class="tooltiptext center" data-i18n="addBlacklistTip"></span></div>
<button type="button" class="small" style="margin-left: 1em; vertical-align: initial;" data-i18n="add"></button>
<button type="button" class="small" style="margin-left: 1em; vertical-align: initial;" data-i18n="add" data-black></button>
</div>

<div class="flex">
Expand Down
2 changes: 1 addition & 1 deletion src/proxy.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
<label><span data-i18n="addWhitelist"></span>
<div class="tooltip"><i class="fa fa-info-circle"></i><span class="tooltiptext" data-i18n="addWhitelistTip"></span></div></label>
<div>
<input type="checkbox" class="switch" id="whiteAll"><label for="whiteAll"></label>
<input type="checkbox" class="switch" id="whiteAll" checked><label for="whiteAll"></label>
</div>
</div>

Expand Down
14 changes: 8 additions & 6 deletions src/scripts/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,15 @@ function renderLog() {
const tbody = tr.parentNode.nextElementSibling;
tbody.textContent = ''; // clearing the content

const forAll = chrome.i18n.getMessage('forAll');;

const forAll = chrome.i18n.getMessage('forAll');
const NA = chrome.i18n.getMessage('notApplicable');

logger.list.forEach(item => {

const pattern = item.matchedPattern ?
(item.matchedPattern === 'all' ? forAll : item.matchedPattern) : 'No matches';

// Build a row for this log entry by cloning the tr containing 6 td
// Build a row for this log entry by cloning the tr containing 7 td
const row = tr.cloneNode(true);
row.className = item.matchedPattern ? 'success' : 'secondary'; // this will rest class .tamplate as well
const td = row.children;
Expand All @@ -98,11 +99,12 @@ function renderLog() {
a.href = item.url;
a.textContent = item.url;

td[1].textContent = item.title || 'n/a';
td[1].textContent = item.title || NA;
td[2].style.backgroundColor = item.color || 'blue';
td[3].textContent = item.address || 'n/a';
td[3].textContent = item.address || NA;
td[4].textContent = pattern;
td[5].textContent = formatInt(item.timestamp);
td[5].textContent = item.whiteBlack || NA;
td[6].textContent = formatInt(item.timestamp);

docfrag.appendChild(row);
});
Expand Down
14 changes: 10 additions & 4 deletions src/scripts/matcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const FOR_ALL = {originalPattern: chrome.i18n.getMessage('forAll')}
const NOMATCH_TEXT = chrome.i18n.getMessage('noMatch');
const NONE_TEXT = chrome.i18n.getMessage('none');
const NOMATCH_COLOR = '#D3D3D3';
const WHITE = chrome.i18n.getMessage('white');
const BLACK = chrome.i18n.getMessage('black');

function findProxyMatch(url, activeSettings) {
// note: we've already thrown out inactive settings and inactive patterns in background.js.
Expand All @@ -32,7 +34,10 @@ function findProxyMatch(url, activeSettings) {
(item.protocols === schemeSet.all || item.protocols === schemeSet[scheme]) &&
item.pattern.test(hostPort));

if (blackMatch) { continue; } // if blacklist matched, move to the next proxy
if (blackMatch) {
sendToLog(url, proxy, Utils.getProxyTitle(proxy), blackMatch, BLACK);
continue; // if blacklist matched, continue to the next proxy
}

const whiteMatch = proxy.whitePatterns.find(item =>
(item.protocols === schemeSet.all || item.protocols === schemeSet[scheme]) &&
Expand All @@ -43,7 +48,7 @@ function findProxyMatch(url, activeSettings) {
const title = Utils.getProxyTitle(proxy);
Utils.updateIcon('images/icon.svg', proxy.color, title, false, title, false);
// TODO: use a Promise for sendToLogAndHandleToolbarIcon()
sendToLog(url, proxy, title, whiteMatch);
sendToLog(url, proxy, title, whiteMatch, WHITE);
return prepareSetting(proxy);
}
}
Expand Down Expand Up @@ -93,15 +98,16 @@ function prepareSetting(proxy) {
return ret;
}

function sendToLog(url, proxy, title, matchedPattern) {
function sendToLog(url, proxy, title, matchedPattern, whiteBlack) {
// log only the data that is needed for display
logger && logger.active && logger.add({
url,
title,
color: proxy.color,
address: proxy.address,
// Log should display whatever user typed, not our processed version.
// Log should display whatever user typed, not our processed version of the pattern
matchedPattern: matchedPattern.originalPattern,
whiteBlack,
timestamp: Date.now()
});
}
12 changes: 9 additions & 3 deletions src/scripts/patterns.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,14 @@ function process() {
break;

case 'add':
proxy.blackPatterns.push(...blacklistSet);
processOptions();
if (typeof(this.dataset.black) !== 'undefined') {
proxy.blackPatterns.push(...blacklistSet);
processOptions();
}
else {
proxy.whitePatterns.push(PATTERN_ALL_WHITE);
processOptions();
}
break;
}
}
Expand Down Expand Up @@ -194,7 +200,7 @@ function processEdit() {

case 'delete|title':
parent.style.opacity = 0;
setTimeout(() => { parent.remove(); }, 600); // remove row
setTimeout(() => { parent.remove(); }, 300); // remove row
break;
}
}
Expand Down
12 changes: 12 additions & 0 deletions src/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,18 @@ input[type="text"] + button i.fa.fa-eye {
left: 50%;
}

.tooltiptext.bottom {
top: 125%;
bottom: auto;
}

.tooltiptext.bottom::after {
bottom: 100%;
top: auto;
left: 75%;
border-color: transparent transparent #555 transparent;
}

.tooltip i.fa {
font-size: 1.2em;
color: black;
Expand Down

0 comments on commit 73a17e5

Please sign in to comment.