Skip to content

Commit

Permalink
v8.8
Browse files Browse the repository at this point in the history
  • Loading branch information
erosman authored Dec 19, 2023
1 parent 70ef1bf commit 652707f
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 83 deletions.
1 change: 1 addition & 0 deletions src/content/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ <h1 id="changelog">Changelog</h1>
<dt>8.8</dt>
<dd>Added Show hidden feature</dd>
<dd>Updated code to process duplicate hostname:port (#33, #76)</dd>
<dd>Updated user interface to hide patterns on FoxyProxy Basic</dd>

<dt>8.7</dt>
<dd>Added Auto Backup feature</dd>
Expand Down
28 changes: 1 addition & 27 deletions src/content/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class App {
static firefox = navigator.userAgent.includes('Firefox');
static android = navigator.userAgent.includes('Android');
// static chrome = navigator.userAgent.includes('Chrome');
// static basic = browser.runtime.getManifest().name === browser.i18n.getMessage('extensionNameBasic');
static basic = browser.runtime.getManifest().name === browser.i18n.getMessage('extensionNameBasic');

// ---------- User Preferences ---------------------------
static defaultPref = JSON.stringify(pref);
Expand Down Expand Up @@ -84,30 +84,4 @@ export class App {

return url;
}

static findProxy({pref, value, pac = false}) {
const arr = pref.data.filter(i => value === i.pac || [i.hostname, i.port, i.username, i.password].join(':'));
// not found [] or found only one
if (!arr[1]) { return arr[0]; }

// found more than one

/*
// action
const item = pref.data.find(i => pref.mode === (i.type === 'pac' ? i.pac : `${i.hostname}:${i.port}`));
// commands
const proxy = pref.data.find(i => i.active && host === `${i.hostname}:${i.port}`);
// on-request
this.proxy = data.find(i => pref.mode === `${i.hostname}:${i.port}`)
data.find(i => val === `${i.hostname}:${i.port}`)
// proxy.js
pref.data.find(i =>
i.active && i.type !== 'pac' && i.hostname && mode === `${i.hostname}:${i.port}`);
const pxy = pref.data.find(i => host === `${i.hostname}:${i.port}`);
*/
}
}
39 changes: 22 additions & 17 deletions src/content/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,8 @@ <h2 class="experimental">Firefox on Android</h2>
<p>Support is experimental and based on user feedback.</p>

<h2>Show Hidden Elements</h2>
<p>Some elements on the Toolbar Popup and Options page are disabled or hidden in FoxyProxy Basic and/or on Chrome. You can toggle to view/enable them by clicking the FoxyProxy icon (on the top of the page).</p>
<p>Some elements on the Toolbar Popup and Options page are disabled or hidden in FoxyProxy Basic and/or on Chrome.<br>
You can toggle to view/enable them by clicking the FoxyProxy icon (on the top of the page).</p>

<h1 id="how-to-use">How to Use</h1>

Expand Down Expand Up @@ -482,19 +483,19 @@ <h4>Storage quotas for sync data</h4>
<p class="note">There is a discussion to increase the storage sync quota to 1MB.<br>
See also: <a href="https://github.com/w3c/webextensions/issues/351" target="_blank">Discuss limits applied to storage.local and storage.sync API</a></p>

<h2>Auto Backup</h2>
<h2 id="auto-backup">Auto Backup</h2>
<p>Automatically backup settings to the browser configured Downloads folder on save</p>


<h2>Limit WebRTC <span>(requires "privacy" permission)</span></h2>
<h2 id="limit-webrtc">Limit WebRTC <span>(requires "privacy" permission)</span></h2>
<p>Toggle <a href="https://developer.mozilla.org/docs/Web/API/WebRTC_API" target="_blank">WebRTC</a> browser settings as it has been known to leak real IP</p>
<p>Toggle changes the browser preferences and does not require SAVE.</p>


<h2>Show Pattern Proxy <span>(Firefox only)</span></h2>
<h2 id="show-pattern-proxy">Show Pattern Proxy <span>(Firefox only)</span></h2>
<p>Show per-tab proxies on the toolbar badge when in Proxy by Patterns mode</p>

<h2 class="experimental">Incognito/Container</h2>
<h2 id="container" class="experimental">Incognito/Container</h2>
<p>Set a proxy for Incognito (Private Mode) and/or Containers</p>
<p>Incognito proxy behaviour is slightly different in Chrome and Firefox.</p>

Expand All @@ -517,7 +518,7 @@ <h2 class="experimental">Incognito/Container</h2>
</dl>


<h2>Keyboard Shortcut <span>(not available on Android)</span></h2>
<h2 id="keyboard-shortcut">Keyboard Shortcut <span>(not available on Android)</span></h2>
<p>Preselect a proxy to associate with a keyboard shortcut action</p>
<ul>
<li>Only active proxies are listed</li>
Expand All @@ -532,7 +533,7 @@ <h2 id="global-exclude">Global Exclude</h2>
<p>A comma-separated list of hosts which should not be proxied.</p> -->

<ul>
<li>Connections to <code>localhost</code>, <code>127.0.0.1/8</code>, and <code>::1</code> are never proxied</li>
<li>Connections to <code>localhost</code>, <code>127.0.0.1/8</code>, and <code>::1</code> are never proxied (by the browser)</li>
<li>The passthrough implementation is slightly different in Chrome and Firefox</li>
<li>Entries can be separated by comma (as in Firefox), or space, or new line</li>
<li>The tables shows if the process is handled by the browser or FoxyProxy</li>
Expand All @@ -550,6 +551,7 @@ <h2 id="global-exclude">Global Exclude</h2>
</ul>

<table>
<caption>Who is controlling the passthrough?</caption>
<thead>
<tr>
<th></th>
Expand All @@ -560,23 +562,23 @@ <h2 id="global-exclude">Global Exclude</h2>
<tbody>
<tr>
<th></th>
<th>localhost</th>
<th>passthrough</th>
<th>localhost</th>
<th>passthrough</th>
<th>localhost & local network</th>
<th>passthrough (global exclude)</th>
<th>localhost & local network</th>
<th>passthrough (global exclude)</th>
</tr>
<tr>
<th>Proxy by Patterns</th>
<td>browser</td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
<td><mark><s>FoxyProxy</s></mark></td>
<td><s><mark>FoxyProxy</mark></s> (v8.4)</td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
</tr>
<tr>
<th>Single Proxy</th>
<td>browser</td>
<td>browser<br><i>scheme, host, wildcard, CIDR</i></td>
<td><mark><s>FoxyProxy</s></mark></td>
<td><s><mark>FoxyProxy</mark></s> (v8.4)</td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
</tr>
<tr>
Expand All @@ -590,21 +592,21 @@ <h2 id="global-exclude">Global Exclude</h2>
<th>Incognito</th>
<td>browser</td>
<td>browser<br><i>scheme, host, wildcard, CIDR</i></td>
<td><mark><s>FoxyProxy</s></mark></td>
<td><s><mark>FoxyProxy</mark></s> (v8.4)</td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
</tr>
<tr>
<th>Container</th>
<td>n/a</td>
<td>n/a</td>
<td><mark><s>FoxyProxy</s></mark></td>
<td><s><mark>FoxyProxy</mark></s> (v8.4)</td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
</tr>
<tr>
<th>Tab Proxy</th>
<td>n/a</td>
<td>n/a</td>
<td><mark><s>FoxyProxy</s></mark></td>
<td><s><mark>FoxyProxy</mark></s> (v8.4)</td>
<td><mark>FoxyProxy</mark><br><i>scheme, host, wildcard, CIDR (IPv4)</i></td>
</tr>
</tbody>
Expand Down Expand Up @@ -691,13 +693,16 @@ <h2 id="save">Save</h2>
<h1 id="proxies">Proxies</h1>
<div class="note">
<p>FoxyProxy identifies proxies by their "hostname:post" or PAC URL.</p>
<p>In case more than one proxy with the same "hostname:post" is needed, one or more letters can be added to the port to separate them, and FoxyProxy will remove the letters later.</p>
<p>In case more than one proxy with the same "hostname:post" is needed, one or more letters can be added to the port to separate them, and FoxyProxy will remove the letters later. <i>(v8.8)</i></p>
<pre>
127.0.0.1:9050
127.0.0.1:9050a
127.0.0.1:9050b
127.0.0.1:9050c
</pre>

<p>Another solution is to prepend hostnames where possible e.g. <code>&lt;sometext&gt;.localhost</code> since they all resolve to <code>127.0.0.1</code> internally.</p>

<p class="warning">For Unix Domain Sockets, where port is ignored, only numbers should be used.</p>
</div>

Expand Down
11 changes: 7 additions & 4 deletions src/content/on-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,24 @@ export class OnRequest {
const {type, hostname: host, port, username, password, proxyDNS} = proxy;
if (type === 'direct') { return {type: 'direct'}; }

const response = {type, host, port: parseInt(port)}; // port 'number', prepare for augmented port
// https://searchfox.org/mozilla-central/source/toolkit/components/extensions/ProxyChannelFilter.sys.mjs#102
// Although API converts to number -> let port = Number.parseInt(proxyData.port, 10);
// port 'number', prepare for augmented port
const response = {type, host, port: parseInt(port)};

// https://searchfox.org/mozilla-central/source/toolkit/components/extensions/ProxyChannelFilter.sys.mjs#49
// https://searchfox.org/mozilla-central/source/toolkit/components/extensions/ProxyChannelFilter.sys.mjs#43
// API uses socks for socks5
response.type === 'socks5' && (response.type = 'socks');

// https://searchfox.org/mozilla-central/source/toolkit/components/extensions/ProxyChannelFilter.sys.mjs#141
// https://searchfox.org/mozilla-central/source/toolkit/components/extensions/ProxyChannelFilter.sys.mjs#135
type.startsWith('socks') && (response.proxyDNS = !!proxyDNS);

if (username && password) {
response.username = username;
response.password = password;
// https://bugzilla.mozilla.org/show_bug.cgi?id=1794464
// Allow HTTP authentication in proxy.onRequest
// https://searchfox.org/mozilla-central/source/toolkit/components/extensions/ProxyChannelFilter.sys.mjs#173
// https://searchfox.org/mozilla-central/source/toolkit/components/extensions/ProxyChannelFilter.sys.mjs#167
// proxyAuthorizationHeader on Firefox only applies to HTTPS (not HTTP and it breaks the API and sends DIRECT)
// proxyAuthorizationHeader added to reduce the authentication request in webRequest.onAuthRequired
type === 'https' && (response.proxyAuthorizationHeader = 'Basic ' + btoa(proxy.username + ':' + proxy.password));
Expand Down
12 changes: 6 additions & 6 deletions src/content/options.css
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ details.proxy > summary span:nth-of-type(2):empty::before {
}
/* ----- /Pattern ----- */

/* ----- hide/show elements ----- */
/* ----- show/hide elements ----- */
details.proxy[data-type="direct"] :is(
[data-i18n="port"], [data-id="port"],
[data-i18n="username"], [data-id="username"],
Expand Down Expand Up @@ -575,15 +575,15 @@ details.proxy:not([data-type="socks5"]) :is([data-i18n="proxyDNS"], [data-id="pr
}

/* --- Chrome --- */
.chrome details.proxy[data-type="socks5"] :is(
[data-i18n="username"], [data-id="username"],
[data-i18n="password"], .password) {
.chrome .firefox {
opacity: 0.3;
pointer-events: none;
user-select: none;
}

.chrome :is([data-i18n="proxyDNS"], [data-id="proxyDNS"]) {
.chrome details.proxy[data-type="socks5"] :is(
[data-i18n="username"], [data-id="username"],
[data-i18n="password"], .password) {
opacity: 0.3;
pointer-events: none;
user-select: none;
Expand All @@ -594,7 +594,7 @@ details.proxy:not([data-type="socks5"]) :is([data-i18n="proxyDNS"], [data-id="pr
display: none;
}

/* ----- /hide/show elements ----- */
/* ----- /show/hide elements ----- */

/* ----- Popup ----- */
div.popup {
Expand Down
26 changes: 13 additions & 13 deletions src/content/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
<label data-i18n="limitWebRTC"><input type="checkbox" id="limitWebRTC"></label>
<p class="description" data-i18n="limitWebRTCDescription"></p>

<label data-i18n="showPatternProxy"><input type="checkbox" id="showPatternProxy"></label>
<p class="description" data-i18n="showPatternProxyDescription"></p>
<label class="firefox" data-i18n="showPatternProxy"><input type="checkbox" id="showPatternProxy"></label>
<p class="description firefox" data-i18n="showPatternProxyDescription"></p>

<label data-i18n="container"></label>
<p class="description" data-i18n="containerDescription"></p>
Expand All @@ -83,23 +83,23 @@
<option value="">&nbsp;</option>
</select>

<label><span data-i18n="container"></span> 1</label>
<select name="container-1">
<label class="firefox"><span data-i18n="container"></span> 1</label>
<select class="firefox" name="container-1">
<option value="">&nbsp;</option>
</select>

<label><span data-i18n="container"></span> 2</label>
<select name="container-2">
<label class="firefox"><span data-i18n="container"></span> 2</label>
<select class="firefox" name="container-2">
<option value="">&nbsp;</option>
</select>

<label><span data-i18n="container"></span> 3</label>
<select name="container-3">
<label class="firefox"><span data-i18n="container"></span> 3</label>
<select class="firefox" name="container-3">
<option value="">&nbsp;</option>
</select>

<label><span data-i18n="container"></span> 4</label>
<select name="container-4">
<label class="firefox"><span data-i18n="container"></span> 4</label>
<select class="firefox" name="container-4">
<option value="">&nbsp;</option>
</select>

Expand Down Expand Up @@ -142,7 +142,7 @@
<!-- /user options -->

<!-- proxy -->
<section class="proxySection show-js">
<section class="proxySection">

<fieldset class="proxySection">

Expand Down Expand Up @@ -478,8 +478,8 @@
<button type="button" class="flat" data-i18n="view"></button>
</span>

<label data-i18n="proxyDNS"></label>
<input type="checkbox" class="toggle" data-id="proxyDNS" checked>
<label class="firefox" data-i18n="proxyDNS"></label>
<input type="checkbox" class="toggle firefox" data-id="proxyDNS" checked>


</div>
Expand Down
4 changes: 2 additions & 2 deletions src/content/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ class Proxies {
const [pac, storeLocallyLabel, view] = pacSpan.children;

type.addEventListener('change', e => {
pxy.dataset.type = e.target.value; // hide/show elements
pxy.dataset.type = e.target.value; // show/hide elements

switch (e.target.options[e.target.selectedIndex].textContent) {
case 'TOR':
Expand Down Expand Up @@ -589,7 +589,7 @@ class Proxies {
return;
}

// hide/show elements
// show/hide elements
pxy.dataset.type = item.type;

const id = item.type === 'pac' ? item.pac : `${item.hostname}:${item.port}`;
Expand Down
10 changes: 5 additions & 5 deletions src/content/popup.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,25 +157,25 @@ div.host select {
grid-column: span 2;
}

/* ----- hide/show elements ----- */
/* ----- show/hide elements ----- */

/* --- Chrome --- */
section.chrome .firefox {
.chrome .firefox {
opacity: 0.3;
pointer-events: none;
user-select: none;
}

/* ---managed --- */
section.managed .local {
.managed .local {
opacity: 0.3;
pointer-events: none;
user-select: none;
}

/* --- Basic --- */
section.basic .pattern {
.basic .pattern {
display: none;
}

/* ----- /hide/show elements ----- */
/* ----- /show/hide elements ----- */
2 changes: 1 addition & 1 deletion src/content/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</head>
<body>
<article>
<section class="show-js">
<section>
<h1 data-i18n="extensionName"><img src="../image/icon.svg" alt=""> </h1>

<div class="list">
Expand Down
2 changes: 1 addition & 1 deletion src/content/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Popup {
// disable buttons on Chrome
// !App.firefox && this.showJS.classList.add('chrome');
// disable buttons on storage.managed
pref.managed && this.list.parentElement.classList.add('managed');
pref.managed && document.body.classList.add('managed');

// --- proxy filter
const filter = document.querySelector('#filter');
Expand Down
Loading

0 comments on commit 652707f

Please sign in to comment.