From 5bfc0f52e102701448c3787e5e562c068d28ac5d Mon Sep 17 00:00:00 2001 From: erosman Date: Sun, 17 Dec 2023 21:52:08 +0330 Subject: [PATCH] v8.8 --- src/content/about.html | 6 +++++- src/content/app.js | 8 +++++++- src/content/help.html | 13 +++++++++++++ src/content/on-request.js | 2 +- src/content/options.css | 12 ++++++++---- src/content/options.html | 4 ++-- src/content/options.js | 6 ++++-- src/content/popup.css | 25 ++++++++++++++++++++++++- src/content/popup.html | 4 ++-- src/content/popup.js | 10 ++++++---- src/content/proxy.js | 12 ++++++------ src/content/show.js | 26 ++++++++++++++++++++++++++ 12 files changed, 104 insertions(+), 24 deletions(-) create mode 100644 src/content/show.js diff --git a/src/content/about.html b/src/content/about.html index 9f3a346..ba611ee 100644 --- a/src/content/about.html +++ b/src/content/about.html @@ -16,6 +16,10 @@

Changelog

+
8.8
+
Added Show hidden feature
+
Updated code to process duplicate hostname:port (#33, #76)
+
8.7
Added Auto Backup feature
Added FoxyProxy Basic detection (disabled for now)
@@ -53,7 +57,7 @@

Changelog

Added PAC view feature
Fixed an issue with empty Global Exclude
Fixed an issue with upgrade sync data on Firefox (#53)
-
Updated hostname check to allow "file:" for Unix domain socket (#47)
+
Updated hostname check to allow "file:" for Unix Domain Socket (#47)
Updated PAC check to allow "file:" (#49)
Updated user interface to disable inapplicable options in proxies
diff --git a/src/content/app.js b/src/content/app.js index b0e395a..15365ff 100644 --- a/src/content/app.js +++ b/src/content/app.js @@ -85,7 +85,13 @@ export class App { return url; } - static findProxy() { + 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}`)); diff --git a/src/content/help.html b/src/content/help.html index bd77bec..78fd710 100644 --- a/src/content/help.html +++ b/src/content/help.html @@ -371,6 +371,8 @@

Light/Dark Theme

Firefox on Android

Support is experimental and based on user feedback.

+

Show Hidden Elements

+

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).

How to Use

@@ -687,6 +689,17 @@

Save

Proxies

+
+

FoxyProxy identifies proxies by their "hostname:post" or PAC URL.

+

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.

+
+127.0.0.1:9050
+127.0.0.1:9050a
+127.0.0.1:9050b
+127.0.0.1:9050c
+
+

For Unix Domain Sockets, where port is ignored, only numbers should be used.

+

Proxy

diff --git a/src/content/on-request.js b/src/content/on-request.js index c157830..0aea41b 100644 --- a/src/content/on-request.js +++ b/src/content/on-request.js @@ -140,7 +140,7 @@ export class OnRequest { const {type, hostname: host, port, username, password, proxyDNS} = proxy; if (type === 'direct') { return {type: 'direct'}; } - const response = {type, host, port}; + 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#49 // API uses socks for socks5 diff --git a/src/content/options.css b/src/content/options.css index 2e12b4d..f7b0e21 100644 --- a/src/content/options.css +++ b/src/content/options.css @@ -400,6 +400,10 @@ details div.content { padding-left: 2em; } +details.proxy .content * { + transition: opacity 0.5s; +} + details.proxy.off { display: none; } @@ -571,7 +575,7 @@ details.proxy:not([data-type="socks5"]) :is([data-i18n="proxyDNS"], [data-id="pr } /* --- Chrome --- */ -details.proxy[data-type="socks5"][data-chrome] :is( +.chrome details.proxy[data-type="socks5"] :is( [data-i18n="username"], [data-id="username"], [data-i18n="password"], .password) { opacity: 0.3; @@ -579,18 +583,18 @@ details.proxy[data-type="socks5"][data-chrome] :is( user-select: none; } -details.proxy[data-chrome] :is([data-i18n="proxyDNS"], [data-id="proxyDNS"]) { +.chrome :is([data-i18n="proxyDNS"], [data-id="proxyDNS"]) { opacity: 0.3; pointer-events: none; user-select: none; } /* --- Basic --- */ -div.proxy-div.basic :is(.pattern-head, .pattern-box) { +.basic :is(.pattern-head, .pattern-box) { display: none; } -/* ----- hide/show elements ----- */ +/* ----- /hide/show elements ----- */ /* ----- Popup ----- */ div.popup { diff --git a/src/content/options.html b/src/content/options.html index 63eb522..689be85 100644 --- a/src/content/options.html +++ b/src/content/options.html @@ -142,7 +142,7 @@ -
+
@@ -619,7 +619,7 @@ - + diff --git a/src/content/options.js b/src/content/options.js index 1de64e1..11dc599 100644 --- a/src/content/options.js +++ b/src/content/options.js @@ -7,6 +7,7 @@ import {Color} from './color.js'; import {Nav} from './nav.js'; import {Spinner} from './spinner.js'; import {Log} from './log.js'; +import './show.js'; import './i18n.js'; // ---------- Popup -------------------------------------- @@ -465,7 +466,9 @@ class Proxies { Log.mode = pref.mode; // --- hide elements for Basic - App.basic && this.proxyDiv.classList.add('basic'); + // const showJS = document.querySelector('.show-js'); + // App.basic && showJS.classList.add('basic'); + // !App.firefox && showJS.classList.add('chrome'); this.process(); } @@ -588,7 +591,6 @@ class Proxies { // hide/show elements pxy.dataset.type = item.type; - App.firefox || (pxy.dataset.chrome = true); const id = item.type === 'pac' ? item.pac : `${item.hostname}:${item.port}`; this.proxyCache[id] = item; // cache to find later diff --git a/src/content/popup.css b/src/content/popup.css index efe43f5..5f976ba 100644 --- a/src/content/popup.css +++ b/src/content/popup.css @@ -155,4 +155,27 @@ div.host button:hover { div.host select { grid-column: span 2; -} \ No newline at end of file +} + +/* ----- hide/show elements ----- */ + +/* --- Chrome --- */ +section.chrome .firefox { + opacity: 0.3; + pointer-events: none; + user-select: none; +} + +/* ---managed --- */ +section.managed .local { + opacity: 0.3; + pointer-events: none; + user-select: none; +} + +/* --- Basic --- */ +section.basic .pattern { + display: none; +} + +/* ----- /hide/show elements ----- */ \ No newline at end of file diff --git a/src/content/popup.html b/src/content/popup.html index 087d853..2c61d8b 100644 --- a/src/content/popup.html +++ b/src/content/popup.html @@ -9,11 +9,11 @@
-
+

-